Place Hammy anywhere he cannot see his cage - another room? Go through the cage like you are searching for diamonds - go over every inch of the cage, his bed, the bedding -everything, and remove every single food item you find. You need to do this daily. If he has a single nut hidden someplace, he will defend it with a thermonuclear weapon if he can lay his hands on one (remove all weapons along with the food)
. Do not do it while he is present unless y'all just want a butt-kicking! The nuts are what triggers the aggressiveness, but you want to clear out ALL food once a day - it can go bad and make them quite ill.
My second suggestion is to stop giving nuts that are still in the shell. Wild squirrels will bury nuts in the shell - they are protected by the shell and won't get soggy and moldy when buried. That instinct is very strong and is why your pet squirrel will bury them in their bedding. Nuts NOT in the shell will be consumed immediately.
I try to restrict nut consumption because they cause dietary issues, but my boy wants LOTS of nuts so I solve this by shelling the nut, then using a sharp knife to cut them into little fragments no larger than 5mm square. They don't seem to register that one is big and one is small - he got a NUT and he is happy, as am I, because he won't stash it, and I know he isn't risking MBD from too many. I provide lots of wood for him to chew, and the Teklad blocks are so rock hard that they do a dandy job of keeping the teeth worn down properly. They don't need nutshells.
In addition to the nut crazies, he is in a magical time called puberty. He will be all over the place behaviorally because of the tons of hormones dumping into his system right now. It takes several months for the boys to put this behind them, but they do. Zeke, my now 7 year old boy was nicknamed "Krakken" during puberty, and he is now the sweetest little cuddle bug I have ever experienced. To accomplish that, you need to do whatever you have to to keep yourself safe and continue to interact hands on with him ALL THE TIME. You cannot just leave him in his cage until this passes because your relationship will be broken. I built myself a "head cage" which was a cylinder of wire mesh with one closed end large enough to drop over my head and rest on my shoulders, combined with gloves, and heavy clothing from head to foot. It was very attractive, but allowed me to keep being his buddy even when he was in a mood, and what came out the other side was a munchkin who loves his mommy and doesn't try to hurt her anymore AT ALL. The switch just flips and the crazy goes away and you can discard your head cage. Or hang onto it for special occasions, if that is the way you roll...