Class PasswordDigest

java.lang.Object
net.freehaven.tor.control.PasswordDigest

public class PasswordDigest extends 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 Details

    • 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 Details

    • 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 String getHashedPassword()
      Return the hashed password in the format used by Tor.
    • secretToKey

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