Package org.bouncycastle.crypto.digests
Class SHA3Digest
- java.lang.Object
-
- org.bouncycastle.crypto.digests.KeccakDigest
-
- org.bouncycastle.crypto.digests.SHA3Digest
-
- All Implemented Interfaces:
Digest,EncodableDigest,EncodableService,ExtendedDigest,SavableDigest,Memoable
public class SHA3Digest extends KeccakDigest implements SavableDigest
implementation of SHA-3 based on following KeccakNISTInterface.c from https://keccak.noekeon.org/Following the naming conventions used in the C source code to enable easy review of the implementation.
-
-
Field Summary
-
Fields inherited from class org.bouncycastle.crypto.digests.KeccakDigest
bitsInQueue, dataQueue, fixedOutputLength, purpose, rate, squeezing, state
-
-
Constructor Summary
Constructors Constructor Description SHA3Digest()SHA3Digest(byte[] encodedState)SHA3Digest(int bitLength)SHA3Digest(int bitLength, CryptoServicePurpose purpose)SHA3Digest(CryptoServicePurpose purpose)SHA3Digest(SHA3Digest source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Memoablecopy()Produce a copy of this object with its configuration and in its current state.intdoFinal(byte[] out, int outOff)close the digest, producing the final digest value.protected intdoFinal(byte[] out, int outOff, byte partialByte, int partialBits)java.lang.StringgetAlgorithmName()return the algorithm namebyte[]getEncodedState()Return an encoded byte array for the digest's internal statevoidreset(Memoable other)Restore a copied object state into this object.-
Methods inherited from class org.bouncycastle.crypto.digests.KeccakDigest
absorb, absorb, absorbBits, copyIn, cryptoServiceProperties, getByteLength, getDigestSize, getEncodedState, reset, squeeze, update, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bouncycastle.crypto.Digest
getDigestSize, reset, update, update
-
Methods inherited from interface org.bouncycastle.crypto.ExtendedDigest
getByteLength
-
-
-
-
Constructor Detail
-
SHA3Digest
public SHA3Digest()
-
SHA3Digest
public SHA3Digest(CryptoServicePurpose purpose)
-
SHA3Digest
public SHA3Digest(int bitLength)
-
SHA3Digest
public SHA3Digest(int bitLength, CryptoServicePurpose purpose)
-
SHA3Digest
public SHA3Digest(byte[] encodedState)
-
SHA3Digest
public SHA3Digest(SHA3Digest source)
-
-
Method Detail
-
getAlgorithmName
public java.lang.String getAlgorithmName()
Description copied from interface:Digestreturn the algorithm name- Specified by:
getAlgorithmNamein interfaceDigest- Overrides:
getAlgorithmNamein classKeccakDigest- Returns:
- the algorithm name
-
doFinal
public int doFinal(byte[] out, int outOff)Description copied from interface:Digestclose the digest, producing the final digest value. The doFinal call leaves the digest reset.- Specified by:
doFinalin interfaceDigest- Overrides:
doFinalin classKeccakDigest- Parameters:
out- the array the digest is to be copied into.outOff- the offset into the out array the digest is to start at.
-
doFinal
protected int doFinal(byte[] out, int outOff, byte partialByte, int partialBits)- Overrides:
doFinalin classKeccakDigest
-
getEncodedState
public byte[] getEncodedState()
Description copied from interface:EncodableDigestReturn an encoded byte array for the digest's internal state- Specified by:
getEncodedStatein interfaceEncodableDigest- Specified by:
getEncodedStatein interfaceEncodableService- Returns:
- an encoding of the digests internal state.
-
copy
public Memoable copy()
Description copied from interface:MemoableProduce a copy of this object with its configuration and in its current state.The returned object may be used simply to store the state, or may be used as a similar object starting from the copied state.
-
-