public abstract class ERSCachingData extends java.lang.Object implements ERSData
ERSData implementation that caches calculated hashes, keyed by
digest algorithm and previous-chain hash, so the (potentially expensive) hash
of a data object is computed only once per combination. Subclasses supply the
actual hash in calculateHash(DigestCalculator, byte[]).| Constructor and Description |
|---|
ERSCachingData() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract byte[] |
calculateHash(DigestCalculator digestCalculator,
byte[] previousChainHash)
Compute the hash for this data object.
|
byte[] |
getHash(DigestCalculator digestCalculator,
byte[] previousChainHash)
Return the hash for this data object, computing it (via the subclass)
on first request and returning the cached value thereafter.
|
public byte[] getHash(DigestCalculator digestCalculator, byte[] previousChainHash)
getHash in interface ERSDatadigestCalculator - the DigestCalculator to use for computing the hash.previousChainHash - hash from an earlier chain to fold in, or null.protected abstract byte[] calculateHash(DigestCalculator digestCalculator, byte[] previousChainHash)
getHash(DigestCalculator, byte[]).digestCalculator - the digest calculator to use.previousChainHash - hash from an earlier chain to fold in, or null.