Refactored password hashing