implement GenerateHash