updated hash method and added test for it