corrected hash generation