Don't know if I'm going to be able to reassure you, as my dd is now 9, and still has 'episodes' like this - and has done since she was about 4.
I can't say I can see a time when I will be able to 'cure' this, but I have learnt some coping strategies over the years.
Firstly, DON'T engage with her on the same level ie don't scream and shout, ignore as much as you can, if it means locking yourself away, so be it (remove any other children from danger). I realise it is so easy to say this, and almost impossible to do (especially for me as my temperament is so similar to hers), but we find that screaming and shouting back at her just escalates the situation.
Which brings me to my second point - if she is being violent, try not to get physical with her at all. Even trying to remove my dd to her room physically makes her almost literally boil over with temper. Again, it just escalates the situation.
When she is calm (perhaps even a couple of days later) try talking to her and asking her why she thinks she gets so mad. I once saw a method to expel anger on one of the parenting programmes on TV - it involves pretending to blow up a balloon, so almost blowing the anger out. They also suggested doing star jumps, again, using the energy in a different way.
Bear in mind this is all advice from someone who still has the problem, so I see it more as coping strategies than actually solutions, but I hope it gives you something to think about.