refactor hash_pw