Package org.bouncycastle.crypto.digests
Class SHAKEDigest
java.lang.Object
org.bouncycastle.crypto.digests.KeccakDigest
org.bouncycastle.crypto.digests.SHAKEDigest
- All Implemented Interfaces:
Digest,EncodableDigest,EncodableService,ExtendedDigest,SavableDigestXof,Xof,Memoable
- Direct Known Subclasses:
CSHAKEDigest
implementation of SHAKE 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
ConstructorsConstructorDescriptionSHAKEDigest(byte[] encodedState) SHAKEDigest(byte[] encoded, CryptoServicePurpose purpose) SHAKEDigest(int bitStrength) Base constructor.SHAKEDigest(int bitStrength, CryptoServicePurpose purpose) Base constructor.SHAKEDigest(CryptoServicePurpose purpose) SHAKEDigest(SHAKEDigest source) Clone constructor -
Method Summary
Modifier and TypeMethodDescriptioncopy()Produce a copy of this object with its configuration and in its current state.protected CryptoServicePropertiesintdoFinal(byte[] out, int outOff) close the digest, producing the final digest value.protected intdoFinal(byte[] out, int outOff, byte partialByte, int partialBits) intdoFinal(byte[] out, int outOff, int outLen) Output the results of the final calculation for this digest to outLen number of bytes.protected intdoFinal(byte[] out, int outOff, int outLen, byte partialByte, int partialBits) intdoOutput(byte[] out, int outOff, int outLen) Start outputting the results of the final calculation for this digest.return the algorithm nameintreturn the size, in bytes, of the digest produced by this message digest.byte[]Return an encoded byte array for the digest's internal statestatic SavableDigestXofstatic SavableDigestXofnewInstance(byte[] encoded, CryptoServicePurpose purpose) static SavableDigestXofnewInstance(int bitStrength) static SavableDigestXofnewInstance(int bitStrength, CryptoServicePurpose purpose) static SavableDigestXofnewInstance(CryptoServicePurpose purpose) static SavableDigestXofnewInstance(Digest digest) voidRestore a copied object state into this object.toString()Methods inherited from class org.bouncycastle.crypto.digests.KeccakDigest
absorb, absorb, absorbBits, copyIn, getByteLength, getEncodedState, reset, squeeze, update, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bouncycastle.crypto.ExtendedDigest
getByteLength
-
Constructor Details
-
SHAKEDigest
public SHAKEDigest() -
SHAKEDigest
-
SHAKEDigest
public SHAKEDigest(int bitStrength) Base constructor.- Parameters:
bitStrength- the security strength in bits of the XOF.
-
SHAKEDigest
Base constructor.- Parameters:
bitStrength- the security strength in bits of the XOF.purpose- the purpose of the digest will be used for.
-
SHAKEDigest
-
SHAKEDigest
Clone constructor- Parameters:
source- the other digest to be copied.
-
SHAKEDigest
public SHAKEDigest(byte[] encodedState)
-
-
Method Details
-
newInstance
-
newInstance
-
newInstance
-
newInstance
-
newInstance
-
newInstance
-
getAlgorithmName
Description copied from interface:Digestreturn the algorithm name- Specified by:
getAlgorithmNamein interfaceDigest- Overrides:
getAlgorithmNamein classKeccakDigest- Returns:
- the algorithm name
-
getDigestSize
public int getDigestSize()Description copied from interface:Digestreturn the size, in bytes, of the digest produced by this message digest.- Specified by:
getDigestSizein interfaceDigest- Overrides:
getDigestSizein classKeccakDigest- Returns:
- the size, in bytes, of the digest produced by this message digest.
-
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
public int doFinal(byte[] out, int outOff, int outLen) Description copied from interface:XofOutput the results of the final calculation for this digest to outLen number of bytes. -
doOutput
public int doOutput(byte[] out, int outOff, int outLen) Description copied from interface:XofStart outputting the results of the final calculation for this digest. Unlike doFinal, this method will continue producing output until the Xof is explicitly reset, or signals otherwise. -
doFinal
protected int doFinal(byte[] out, int outOff, byte partialByte, int partialBits) - Overrides:
doFinalin classKeccakDigest
-
doFinal
protected int doFinal(byte[] out, int outOff, int outLen, byte partialByte, int partialBits) -
cryptoServiceProperties
- Overrides:
cryptoServicePropertiesin classKeccakDigest
-
toString
-
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
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.
-
reset
Description copied from interface:MemoableRestore a copied object state into this object.Implementations of this method should try to avoid or minimise memory allocation to perform the reset.
-