generates hash before commiting