Class Hash


  • public class Hash
    extends Object
    A Hash is the couple made of two byte arrays : the hashed string and the salt used to hash it. When comparing two hashes made with the same salt, it has to be also through the same algorithm with the same parameters.
    • Constructor Detail

      • Hash

        public Hash​(byte[] hash,
                    byte[] salt)
        Constructor with byte arrays.
        Parameters:
        hash - the hashed string.
        salt - the salt used.
      • Hash

        public Hash​(String hash,
                    String salt)
        Constructor with strings.
        Parameters:
        hash - the hashed string.
        salt - the used salt.
    • Method Detail

      • getHash

        public byte[] getHash()
        Returns the hash.
        Returns:
        a byte array being the hash.
      • getSalt

        public byte[] getSalt()
        Returns the salt.
        Returns:
        a byte array being the salt.
      • getHashAsString

        public String getHashAsString()
        Returns the hash as a string.
        Returns:
        the hash as a string.
      • getSaltAsString

        public String getSaltAsString()
        Returns the salt as a string.
        Returns:
        the salt as a string.
      • toString

        public String toString()
        Returns the Hash formatted as "hash:salt".
        Overrides:
        toString in class Object