improve hash algorithm