Class Sha256PasswordHasher

java.lang.Object
integration.security.Sha256PasswordHasher
All Implemented Interfaces:
PasswordHasher

public class Sha256PasswordHasher extends Object implements PasswordHasher
Class that takes in the chosen password of a user, and hashes it.
  • Constructor Details

    • Sha256PasswordHasher

      public Sha256PasswordHasher()
  • Method Details

    • hash

      public String hash(String password)
      Method for hashing an inputted password. Uses the SHA-256 algorithm. Transforms the password to a UTF-8 byte-array, then digests it using SHA-256. The bytes are then formatted as a 64-character string.
      Specified by:
      hash in interface PasswordHasher
      Parameters:
      password - the password to hash
      Returns:
      a 64-character hash of the password.
      Throws:
      RuntimeException - if the hashing fails.