Function generateHash