Ive never personaly given my hamsters hay so i cant comment if it is safe for them or not however i did read somewhere that you should not feed your hamster hay or straw as it can damage their cheek pouches. But if their are people on this forum who're sayin it is safe for them and they have tried and tested hay id imagine that'd it be fine for them then. But i definitely wouldnt feed your hamster straw as that is VERY sharp!
Hope this helps