Class ModularCrypt

    • Method Detail

      • identifyAlgorithm

        public static String identifyAlgorithm​(char[] chars)
        Attempt to identify the algorithm used by the given crypt string password.
        Parameters:
        chars - the password crypt string characters
        Returns:
        the algorithm name, or null if no algorithm could be guessed
      • encode

        public static char[] encode​(Password password)
                             throws InvalidKeySpecException
        Encode the given Password to a char array.
        Parameters:
        password - the password to encode
        Returns:
        a char array representing the encoded password
        Throws:
        InvalidKeySpecException - if the given password is not supported or could be encoded
      • decode

        public static Password decode​(String cryptString)
                               throws InvalidKeySpecException
        Decode the given string and creates a Password instance.
        Parameters:
        cryptString - the string representing the encoded format of the password
        Returns:
        a Password instance created from the given string
        Throws:
        InvalidKeySpecException - if the given password is not supported or could be decoded
      • decode

        public static Password decode​(char[] cryptString)
                               throws InvalidKeySpecException
        Decode the given char array and creates a Password instance.
        Parameters:
        cryptString - the char array representing the encoded format of the password
        Returns:
        a Password instance created from the given string
        Throws:
        InvalidKeySpecException - if the given password is not supported or could be decoded