public class SimpleHash extends AbstractHash
ByteSource.Util| 构造器和说明 |
|---|
SimpleHash(String algorithmName) |
SimpleHash(String algorithmName,
Object source) |
SimpleHash(String algorithmName,
Object source,
Object salt) |
SimpleHash(String algorithmName,
Object source,
Object salt,
int hashIterations) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(Object o)
Returns
true if the specified object is a Hash and its byte array is identical to
this Hash's byte array, false otherwise. |
String |
getAlgorithmName()
Returns the
MessageDigest algorithm name to use when performing the hash. |
byte[] |
getBytes() |
int |
getIterations()
Returns the number of hash iterations used to compute the hash.
|
ByteSource |
getSalt()
Returns a salt used to compute the hash or
null if no salt was used. |
int |
hashCode()
Simply returns toHex().hashCode();
|
boolean |
isEmpty() |
void |
setBytes(byte[] alreadyHashedBytes) |
void |
setIterations(int iterations) |
void |
setSalt(ByteSource salt) |
String |
toBase64() |
String |
toHex() |
String |
toString()
Simple implementation that merely returns
toHex(). |
public SimpleHash(String algorithmName)
algorithmName - the MessageDigest algorithm name to use when
performing the hash.UnknownAlgorithmExceptionpublic SimpleHash(String algorithmName, Object source) throws org.apache.shiro.codec.CodecException, org.apache.shiro.crypto.UnknownAlgorithmException
algorithmName - the MessageDigest algorithm name to use when
performing the hash.source - the object to be hashed.org.apache.shiro.codec.CodecException - if the specified source cannot be converted into a byte array (byte[]).org.apache.shiro.crypto.UnknownAlgorithmException - if the algorithmName is not available.public SimpleHash(String algorithmName, Object source, Object salt) throws org.apache.shiro.codec.CodecException, org.apache.shiro.crypto.UnknownAlgorithmException
algorithmName - the MessageDigest algorithm name to use when
performing the hash.source - the source object to be hashed.salt - the salt to use for the hashorg.apache.shiro.codec.CodecException - if either constructor argument cannot be converted into a byte array.org.apache.shiro.crypto.UnknownAlgorithmException - if the algorithmName is not available.public SimpleHash(String algorithmName, Object source, Object salt, int hashIterations) throws org.apache.shiro.codec.CodecException, org.apache.shiro.crypto.UnknownAlgorithmException
algorithmName - the MessageDigest algorithm name to use when
performing the hash.source - the source object to be hashed.salt - the salt to use for the hashhashIterations - the number of times the source argument hashed for attack resiliency.org.apache.shiro.codec.CodecException - if either Object constructor argument cannot be converted into a byte array.org.apache.shiro.crypto.UnknownAlgorithmException - if the algorithmName is not available.public String getAlgorithmName()
MessageDigest algorithm name to use when performing the hash.getAlgorithmName 在接口中 HashgetAlgorithmName 在类中 AbstractHashMessageDigest algorithm name to use when performing the hash.public ByteSource getSalt()
Hashnull if no salt was used.null if no salt was used.public int getIterations()
Hashpublic byte[] getBytes()
getBytes 在接口中 ByteSourcegetBytes 在类中 AbstractHashpublic void setBytes(byte[] alreadyHashedBytes)
setBytes 在类中 AbstractHashalreadyHashedBytes - the raw already-hashed bytes to store in this instance.public void setIterations(int iterations)
iterations - the number of hash iterations used to previously create the hash/digest.public void setSalt(ByteSource salt)
salt - the salt used to previously create the hash/digest.public boolean isEmpty()
public String toHex()
toHex 在接口中 ByteSourcetoHex 在类中 AbstractHashbyte array.public String toBase64()
toBase64 在接口中 ByteSourcetoBase64 在类中 AbstractHashbyte array.public String toString()
toHex().toString 在类中 AbstractHashtoHex() value.public boolean equals(Object o)
true if the specified object is a Hash and its byte array is identical to
this Hash's byte array, false otherwise.equals 在类中 AbstractHasho - the object (Hash) to check for equality.true if the specified object is a Hash and its byte array is identical to
this Hash's byte array, false otherwise.public int hashCode()
hashCode 在类中 AbstractHashCopyright © 2015-2017. All Rights Reserved.