Package net.freehaven.tor.control
Class PasswordDigest
- java.lang.Object
-
- net.freehaven.tor.control.PasswordDigest
-
public class PasswordDigest extends java.lang.ObjectA 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 saltPasswordDigest(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 PasswordDigestgenerateDigest()Return a new password digest with a random secret and salt.java.lang.StringgetHashedPassword()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
-
-
-
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
-
-