Package com.identity4j.util.crypt.impl
Class Drupal7Encoder
- java.lang.Object
-
- com.identity4j.util.crypt.impl.AbstractEncoder
-
- com.identity4j.util.crypt.impl.AbstractPHPHashEncoder
-
- com.identity4j.util.crypt.impl.Drupal7Encoder
-
- All Implemented Interfaces:
Encoder
public class Drupal7Encoder extends AbstractPHPHashEncoder
http://stackoverflow.com/questions/5031662/what-is-drupals-default-password- encryption-method
-
-
Field Summary
Fields Modifier and Type Field Description static intDRUPAL_HASH_COUNTstatic intDRUPAL_HASH_LENGTHstatic intDRUPAL_MAX_HASH_COUNTstatic intDRUPAL_MIN_HASH_COUNTstatic StringID
-
Constructor Summary
Constructors Constructor Description Drupal7Encoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]encode(byte[] toEncode, byte[] salt, byte[] passphrase, String charset)Encode a stringbooleanisOfType(byte[] encodedBytes, String charset)Determine if this encoder may have been used to create the provided encoded bytes.booleanmatch(byte[] encodedData, byte[] unencodedData, byte[] passphrase, String charset)Check if the provide un-encoded data would match the encoded data if it was encoded.-
Methods inherited from class com.identity4j.util.crypt.impl.AbstractPHPHashEncoder
algoToNative, hash, hash, hash, toHexits
-
Methods inherited from class com.identity4j.util.crypt.impl.AbstractEncoder
decode, getId, randomBytes
-
-
-
-
Field Detail
-
DRUPAL_MIN_HASH_COUNT
public static final int DRUPAL_MIN_HASH_COUNT
- See Also:
- Constant Field Values
-
DRUPAL_HASH_COUNT
public static final int DRUPAL_HASH_COUNT
- See Also:
- Constant Field Values
-
DRUPAL_MAX_HASH_COUNT
public static final int DRUPAL_MAX_HASH_COUNT
- See Also:
- Constant Field Values
-
DRUPAL_HASH_LENGTH
public static final int DRUPAL_HASH_LENGTH
- See Also:
- Constant Field Values
-
ID
public static final String ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
isOfType
public boolean isOfType(byte[] encodedBytes, String charset)Description copied from interface:EncoderDetermine if this encoder may have been used to create the provided encoded bytes. This method should only be used if it is very likely to be the right encoder.- Specified by:
isOfTypein interfaceEncoder- Overrides:
isOfTypein classAbstractEncoder- Parameters:
encodedBytes- encoded bytescharset- character set- Returns:
- this almost certainly was encoded with a similar encoder
-
match
public boolean match(byte[] encodedData, byte[] unencodedData, byte[] passphrase, String charset)Description copied from interface:EncoderCheck if the provide un-encoded data would match the encoded data if it was encoded.- Specified by:
matchin interfaceEncoder- Overrides:
matchin classAbstractEncoder- Parameters:
encodedData- encoded dataunencodedData- un-encoded datapassphrase- passphrase if supportedcharset- character set- Returns:
- matches
-
encode
public byte[] encode(byte[] toEncode, byte[] salt, byte[] passphrase, String charset) throws EncoderExceptionDescription copied from interface:EncoderEncode a string- Parameters:
toEncode- data to encodesalt- salt if supportedpassphrase- passphrase if supportedcharset- character set- Returns:
- encoded bytes
- Throws:
EncoderException- if encoding fails
-
-