public class HashCreatorImplCombined extends AbstractSecurityAlgorithm implements HashCreator
HashCreator that only wraps MessageDigest.| Modifier and Type | Field and Description |
|---|---|
private HashCreator[] |
generators |
| Constructor and Description |
|---|
HashCreatorImplCombined(HashCreator[] generators)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAlgorithm() |
byte[] |
hash(boolean reset) |
void |
reset()
Will reset the internal state of this object.
|
void |
update(byte[] input,
int offset,
int length) |
OutputStream |
wrapStream(OutputStream out)
Creates a new
OutputStream wraps the given OutputStream. |
creationFailedException, creationFailedException, creationFailedException, creationFailedException, getAlgorithm, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waithash, hash, hash, hash, process, wrapStreamupdate, updateprocess, process, processprivate final HashCreator[] generators
public HashCreatorImplCombined(HashCreator[] generators)
generators - the HashCreators to combine sequentially.public String getAlgorithm()
getAlgorithm in interface CryptoAlgorithmKey.getAlgorithm(),
Signature.getAlgorithm(),
MessageDigest.getAlgorithm(),
SecureRandom.getAlgorithm(),
Cipher.getAlgorithm()public OutputStream wrapStream(OutputStream out)
HashCreatorOutputStream wraps the given OutputStream. It will automatically
update all written data. After data has been written,
you may call HashCreator.hash(boolean) to get the hash of the data. This method will not reset this
hasher. Therefore any previous updated data will also influence the hash. The typical usage
is to call this method once on a fresh instance of HashCreator, then write data to that stream and
finally get the hash.wrapStream in interface HashCreatorout - the OutputStream to wrap.OutputStream.HashCreator.wrapStream(),
DigestOutputStreampublic void update(byte[] input,
int offset,
int length)
update in interface CryptoChunkerinput - the next chunk of data.offset - the index where to start reading data from input.length - the number of bytes to read from input.MessageDigest.update(byte[], int, int),
Signature.update(byte[], int, int)public byte[] hash(boolean reset)
hash in interface HashCreatorreset - - true if this HashCreator shall be reset after the hash
calculation, false otherwise. A design problem of MessageDigest is that it
automatically resets itself on
hashing what prevents calculating intermediate hashes but also
continue the hash calculation. This API allows to workaround this limitation.MessageDigest.digest()public void reset()
CryptoProcessorCryptor may not reusable. It is therefore preferable to always create a
fresh instance for each cryptographic task.reset in interface CryptoProcessorMessageDigest.reset()Copyright © 2001–2019 mmm-Team. All rights reserved.