Digests are supported via the GordianDigestFactory interface.
GordianKnot supports most Digests available from BouncyCastle plus some additional algorithms.
JCA provides a subset of available algorithms as indicated
A digest is created by specifying a GordianDigestSpec which comprises the digestType/OutputLength plus StateLength if applicable. The digest can be used in much the same way as a JCA Digest, allowing reset, update and finalise methods.
/* Access factory */ final GordianFactory myBaseFactory = GordianGenerator.createFactory(); final GordianDigestFactory myDigestFactory = myBaseFactory.getDigestFactory(); /* Create digest */ final GordianDigestSpec mySpec = GordianDigestSpec.sha2(GordianLength.LEN_256); final GordianDigest myDigest = myDigestFactory.createDigest(mySpec); /* Calculate digest */ final byte[] myMessage = ... myDigest.update(myMessage); final byte[] myResult = myDigest.finish();
The following algorithms are supported.
Algorithm | StateLength | OutputLengths | JCA | Notes |
---|---|---|---|---|
SHA2 | 512 | 224,256,384,512 | Y | |
256 | 224,256 | Y | ||
Tiger | 192 | Y | ||
WHIRLPOOL | 512 | Y | ||
Streebog | 512 | 512 | Y | GOST3411-2012 |
256 | 256 | Y | ||
GOST | 256 | Y | GOST3411-94 | |
RipeMD | 128 | 128,160 | Y | |
256 | 256,320 | Y | ||
SHA3 | 224,256,384,512 | Y | ||
Skein | 256 | 128,160,224,256 | Y | |
512 | 128,160,224,256,384,512 | Y | ||
1024 | 384,512,1024 | Y | ||
SM3 | 256 | Y | ||
Blake2s | 256 | 128,160,224,256 | Y | |
Blake2b | 512 | 160,256,384,512 | Y | |
Blake3 | 512 | 256,512 | ||
SHA1 | 160 | Y | ||
MD2 | 128 | Y | ||
MD4 | 128 | Y | ||
MD5 | 128 | Y | ||
SHAKE | 128 | 128,160,224,256 | ||
256 | 256,384,512 | |||
Kupyna | 256,384,512 | Y | DSTU7564 | |
JH | 224,256,384,512 | |||
Groestl | 224,256,384,512 | |||
CubeHash | 224,256,384,512 | |||
Kangaroo | 128 | 128,160,224,256 | Kangaroo12 | |
256 | 256,384,512 | Marsupilami14 | ||
Haraka | 256, 512 | 256 | Y | Note that input must be same length as stateLength |