impl and refactor GenerateHash

* impl: done
* refactor: done