public class MessageDigestHasher extends Object
| 构造器和说明 |
|---|
MessageDigestHasher(String algorithmName) |
MessageDigestHasher(String algorithmName,
byte[] salt) |
MessageDigestHasher(String algorithmName,
byte[] salt,
int hashIterations)
Creates an
algorithmName-specific hash of the specified source using the given
salt a total of hashIterations times. |
| 限定符和类型 | 方法和说明 |
|---|---|
protected byte[] |
doHash(byte[] data,
byte[] salt,
int iterations)
Hashes the specified byte array using the given
salt for the specified number of iterations. |
String |
getAlgorithmName() |
int |
getIterations() |
byte[] |
getSalt() |
byte[] |
hash(byte[] source) |
String |
hashToBase64String(byte[] source) |
String |
hashToHexString(byte[] source,
boolean lowerCase) |
void |
setAlgorithmName(String algorithmName) |
void |
setIterations(int iterations) |
void |
setSalt(byte[] salt) |
public MessageDigestHasher(@NonNull String algorithmName, @Nullable byte[] salt, int hashIterations)
algorithmName-specific hash of the specified source using the given
salt a total of hashIterations times.
algorithmName - the MessageDigest algorithm name to use when
performing the hash.salt - the salt to use for the hashhashIterations - the number of times the source argument hashed for attack resiliency.public byte[] getSalt()
public void setSalt(byte[] salt)
public int getIterations()
public void setIterations(int iterations)
public String getAlgorithmName()
public void setAlgorithmName(String algorithmName)
public byte[] hash(byte[] source)
public String hashToHexString(byte[] source, boolean lowerCase)
public String hashToBase64String(byte[] source)
protected byte[] doHash(byte[] data,
byte[] salt,
int iterations)
salt for the specified number of iterations.data - the bytes to hashsalt - the salt to use for the initial hashiterations - the number of times the the bytes will be hashed (for attack resiliency).Copyright © 2022. All rights reserved.