Separate the password hashing routine into its own method for better reusability