Better and smaller hash generation