Class PasswordDigest


  • public class PasswordDigest
    extends java.lang.Object
    A hashed digest of a secret password (used to set control connection security.)

    For the actual hashing algorithm, see RFC2440's secret-to-key conversion.

    • Constructor Summary

      Constructors 
      Constructor Description
      PasswordDigest​(byte[] secret)
      Construct a new password digest with a given secret and random salt
      PasswordDigest​(byte[] secret, byte[] specifier)
      Construct a new password digest with a given secret and random salt.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static PasswordDigest generateDigest()
      Return a new password digest with a random secret and salt.
      java.lang.String getHashedPassword()
      Return the hashed password in the format used by Tor.
      byte[] getSecret()
      Return the secret used to generate this password hash.
      static byte[] secretToKey​(byte[] secret, byte[] specifier)
      Implement rfc2440 s2k
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PasswordDigest

        public PasswordDigest​(byte[] secret)
        Construct a new password digest with a given secret and random salt
      • PasswordDigest

        public PasswordDigest​(byte[] secret,
                              byte[] specifier)
        Construct a new password digest with a given secret and random salt. Note that the 9th byte of the specifier determines the number of hash iterations as in RFC2440.
    • Method Detail

      • generateDigest

        public static PasswordDigest generateDigest()
        Return a new password digest with a random secret and salt.
      • getSecret

        public byte[] getSecret()
        Return the secret used to generate this password hash.
      • getHashedPassword

        public java.lang.String getHashedPassword()
        Return the hashed password in the format used by Tor.
      • secretToKey

        public static byte[] secretToKey​(byte[] secret,
                                         byte[] specifier)
        Implement rfc2440 s2k