Boy do I feel your pain!! DD has gotten into this slapping thing, and it hurts!! I know she's not being mean, it's just a new sensory experience for her, she does it to everything around the house.
Before this though, when she was learning to sit unassisted (at 5 months old, same as your daughter) she would try SO HARD to sit up, roll over, crawl, climb up my chest, stick her fingers in my nose, etc. It's just an age/developmental thing and is totally normal, however infuriating it is!
She's so busy during the day doing her new skills (like crawling, and sitting up, etc) that bed time is a mommy-daughter play time that she normally wouldn't do during the day. I've found the best way to combat this is to have several quiet times with little distraction, especially during feeding time (although I think you formula feed, right? you may not need to do this, I have no idea how that works).
And the single bestest (I know, its not a word) thing I do now is swaddle her. Yes, my almost 8 month old is still swaddled. I don't care. She went unswaddled from about a month and a half to 5 months old, however, just like you, it took me HOURS to get her to settle down otherwise because she just.. would.. not.. stay.. still!!
Everyone kept suggesting it and I blew it off because we hadn't done it so long, she hated it when I did do it, yadda yadda yadda. Finally in the middle of the night after about the 67th time she stuck her finger up my nose I found the biggest, stretchiest receiving blanket I had and I wrapped her as tight as I could. She was out in about 5 minutes!!
Now it's part of every bedtime and naptime "routine". When she's asleep I unwrap the top of it so she can move her arms and roll over, and that way she ends up laying on top of her blanket. She's fine once she's already asleep, it's getting her to settle down long enough to actually fall asleep.
I'll swaddle her 'till she's 10 if it will stop her from scratching the inside of my nose with her finger nails! LOL.
Even if your daughter hasn't been swaddled in a while, and even if she didn't like it, I would really suggest you try it. Even if she sort of puts up a fuss getting it on, give it a try. As soon as I get the blanket wrapped up and pick her up, I can see her eyelids getting heavy. She just needs the help calming down enough from being so stimulated with all her new skills.