Package org.cryptacular.spec
Class DigestSpec
java.lang.Object
org.cryptacular.spec.DigestSpec
- All Implemented Interfaces:
Spec<org.bouncycastle.crypto.Digest>
Describes a message digest function by name and provides a means to create a new instance of the digest via the
newInstance()
method.- Author:
- Middleware Services
-
Constructor Summary
ConstructorsConstructorDescriptionDigestSpec
(String algName) Creates a new instance from the given algorithm name.DigestSpec
(String algName, int digestSize) Constructor for digests that have variable output size, e.g. -
Method Summary
-
Constructor Details
-
DigestSpec
Creates a new instance from the given algorithm name.- Parameters:
algName
- Digest algorithm name.
-
DigestSpec
Constructor for digests that have variable output size, e.g. SHA3.- Parameters:
algName
- Digest algorithm name.digestSize
- Size of resultant digest in bits.
-
-
Method Details
-
getAlgorithm
- Specified by:
getAlgorithm
in interfaceSpec<org.bouncycastle.crypto.Digest>
- Returns:
- Cryptographic algorithm name.
-
getSize
public int getSize()- Returns:
- Size of digest output in bytes, or -1 if the digest does not support variable size output.
-
newInstance
public org.bouncycastle.crypto.Digest newInstance()Creates a new digest instance.- Specified by:
newInstance
in interfaceSpec<org.bouncycastle.crypto.Digest>
- Returns:
- Digest instance.
-
toString
-