added gen hash function