Interface UnixSHACryptPassword

    • Field Detail

      • ALGORITHM_CRYPT_SHA_256

        static final String ALGORITHM_CRYPT_SHA_256
        The algorithm name "crypt-sha-256".
        See Also:
        Constant Field Values
      • ALGORITHM_CRYPT_SHA_512

        static final String ALGORITHM_CRYPT_SHA_512
        The algorithm name "crypt-sha-512".
        See Also:
        Constant Field Values
      • SALT_SIZE

        static final int SALT_SIZE
        The maximum salt size of this algorithm.
        See Also:
        Constant Field Values
      • DEFAULT_ITERATION_COUNT

        static final int DEFAULT_ITERATION_COUNT
        The default iteration count of this algorithm.
        See Also:
        Constant Field Values
    • Method Detail

      • getSalt

        byte[] getSalt()
        The salt used during the hashing of this password. Should have at most 16 bytes.
        Returns:
        the salt
      • getHash

        byte[] getHash()
        The final hash, based on the password, salt and iteration count
        Returns:
        the hash
      • getIterationCount

        int getIterationCount()
        The number of iterations to perform when hashing the password. Should be bigger than 1,000 and lower than 999,999,999. The default value is 5,000
        Returns:
        the number of iterations to perform
      • getParameterSpec

        default IteratedSaltedPasswordAlgorithmSpec getParameterSpec()
        Description copied from interface: Password
        Get the applicable algorithm parameter specification for this password type.
        Specified by:
        getParameterSpec in interface Password
        Returns:
        the algorithm parameter specification, or null if this password type does not support algorithms
      • impliesParameters

        default boolean impliesParameters​(AlgorithmParameterSpec parameterSpec)
        Description copied from interface: Password
        Determine if this password is matched by the given parameter specification.
        Specified by:
        impliesParameters in interface Password
        Parameters:
        parameterSpec - the parameter specification (must not be null)
        Returns:
        true if the password is matched by the parameters, false otherwise
      • createRaw

        static UnixSHACryptPassword createRaw​(String algorithm,
                                              byte[] salt,
                                              byte[] hash,
                                              int iterationCount)
        Create a raw implementation of this password type. No validation of the content is performed, and the password must be "adopted" in to a PasswordFactory (via the PasswordFactory.translate(Password) method) before it can be validated and used to verify guesses.
        Parameters:
        algorithm - the algorithm name
        salt - the salt
        hash - the hash
        iterationCount - the iteration count
        Returns:
        the raw password implementation