|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.vt.middleware.crypt.AbstractAlgorithm
edu.vt.middleware.crypt.AbstractRandomizableAlgorithm
edu.vt.middleware.crypt.digest.DigestAlgorithm
public class DigestAlgorithm
DigestAlgorithm provides message digest operations.
| Field Summary | |
|---|---|
static int |
CHUNK_SIZE
Chunk size used in stream-based digestion. |
protected org.bouncycastle.crypto.Digest |
digest
Digest instance used for digest computation. |
protected byte[] |
salt
Random data used to initialize digest. |
| Fields inherited from class edu.vt.middleware.crypt.AbstractRandomizableAlgorithm |
|---|
randomByteSize |
| Fields inherited from class edu.vt.middleware.crypt.AbstractAlgorithm |
|---|
algorithm, logger, randomProvider |
| Constructor Summary | |
|---|---|
protected |
DigestAlgorithm(org.bouncycastle.crypto.Digest d)
Creates a new digest algorithm that uses the given Digest for
digest computation. |
| Method Summary | |
|---|---|
byte[] |
digest(byte[] input)
Computes the digest for the given data in a single operation. |
String |
digest(byte[] input,
Converter converter)
Computes the digest for the given data in a single operation and passes the resulting digest bytes through the given converter to produce text output. |
byte[] |
digest(InputStream in)
Computes the digest for all the data in the stream by reading data and hashing it in chunks. |
String |
digest(InputStream in,
Converter converter)
Computes the digest for all the data in the stream by reading data and hashing it in chunks. |
org.bouncycastle.crypto.Digest |
getDigest()
Gets the underlying object that performs digest computation. |
byte[] |
getRandomSalt()
Gets a random salt in the amount specified by AbstractRandomizableAlgorithm.getRandomByteSize(). |
static DigestAlgorithm |
newInstance(String algorithm)
Creates a new digest algorithm instance from its name, e.g. |
protected void |
setDigest(org.bouncycastle.crypto.Digest d)
Sets the internal object responsible for digest computation. |
void |
setSalt(byte[] randomBytes)
Sets the salt used to randomize the digest prior to digestion. |
| Methods inherited from class edu.vt.middleware.crypt.AbstractRandomizableAlgorithm |
|---|
getRandomByteSize, setRandomByteSize |
| Methods inherited from class edu.vt.middleware.crypt.AbstractAlgorithm |
|---|
getAlgorithm, getRandomData, setRandomProvider, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int CHUNK_SIZE
protected org.bouncycastle.crypto.Digest digest
protected byte[] salt
| Constructor Detail |
|---|
protected DigestAlgorithm(org.bouncycastle.crypto.Digest d)
Digest for
digest computation.
d - Used for digest computation.| Method Detail |
|---|
public static DigestAlgorithm newInstance(String algorithm)
algorithm - Name of a message digest algorithm.
protected void setDigest(org.bouncycastle.crypto.Digest d)
d - Used for digest computation.public void setSalt(byte[] randomBytes)
randomBytes - Random data to initialize digest.public byte[] getRandomSalt()
AbstractRandomizableAlgorithm.getRandomByteSize().
public org.bouncycastle.crypto.Digest getDigest()
public byte[] digest(byte[] input)
input - Data to be digested.
public String digest(byte[] input,
Converter converter)
input - Data to be digested.converter - Converts digest bytes to some string representation, e.g
Base-64 encoded text.
public byte[] digest(InputStream in)
throws IOException
in - Input stream containing data to be digested.
IOException - On input stream read errors.
public String digest(InputStream in,
Converter converter)
throws IOException
in - Input stream containing data to be digested.converter - Converts digest bytes to some string representation, e.g
Base-64 encoded text.
IOException - On input stream read errors.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||