Top Description Fields Constructors Methods
org.bouncycastle.crypto.digests

public Class SHAKEDigest

extends KeccakDigest
implements Xof
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.Xof, org.bouncycastle.crypto.ExtendedDigest, org.bouncycastle.crypto.Digest
Known Direct Subclasses
org.bouncycastle.crypto.digests.CSHAKEDigest
Imports
org.bouncycastle.crypto.CryptoServiceProperties, .CryptoServicePurpose, .Xof

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

Inherited from org.bouncycastle.crypto.digests.KeccakDigest:
bitsInQueuedataQueuefixedOutputLengthpurposeratesqueezingstate

Constructor Summary

AccessConstructor and Description
public
public
public
SHAKEDigest(int
the security strength in bits of the XOF.
bitStrength
)

Base constructor.

public
SHAKEDigest(int
the security strength in bits of the XOF.
bitStrength
,
CryptoServicePurpose
the purpose of the digest will be used for.
purpose
)

Base constructor.

public
SHAKEDigest(SHAKEDigest
the other digest to be copied.
source
)

Clone constructor

Method Summary

Modifier and TypeMethod and Description
private static int
checkBitLength(int bitStrength)

protected CryptoServiceProperties
public int
doFinal(byte[]
the array the digest is to be copied into.
out
,
int
the offset into the out array the digest is to start at.
outOff
)

Overrides org.bouncycastle.crypto.digests.KeccakDigest.doFinal.

Implements org.bouncycastle.crypto.Digest.doFinal.

close the digest, producing the final digest value.

public int
doFinal(byte[]
output array to write the output bytes to.
out
,
int
offset to start writing the bytes at.
outOff
,
int
the number of output bytes requested.
outLen
)

Implements org.bouncycastle.crypto.Xof.doFinal.

Output the results of the final calculation for this digest to outLen number of bytes.

protected int
doFinal(byte[] out, int outOff, byte partialByte, int partialBits)

Overrides org.bouncycastle.crypto.digests.KeccakDigest.doFinal.

protected int
doFinal(byte[] out, int outOff, int outLen, byte partialByte, int partialBits)

public int
doOutput(byte[]
output array to write the output bytes to.
out
,
int
offset to start writing the bytes at.
outOff
,
int
the number of output bytes requested.
outLen
)

Implements org.bouncycastle.crypto.Xof.doOutput.

Start outputting the results of the final calculation for this digest.

public String
public int
getDigestSize()

Overrides org.bouncycastle.crypto.digests.KeccakDigest.getDigestSize.

Implements org.bouncycastle.crypto.Digest.getDigestSize.

return the size, in bytes, of the digest produced by this message digest.

Inherited from org.bouncycastle.crypto.digests.KeccakDigest:
absorbabsorbabsorbBitsgetByteLengthresetsqueezeupdateupdate

Constructor Detail

SHAKEDigestback to summary
public SHAKEDigest()
SHAKEDigestback to summary
public SHAKEDigest(CryptoServicePurpose purpose)
SHAKEDigestback to summary
public SHAKEDigest(int bitStrength)

Base constructor.

Parameters
bitStrength:int

the security strength in bits of the XOF.

SHAKEDigestback to summary
public SHAKEDigest(int bitStrength, CryptoServicePurpose purpose)

Base constructor.

Parameters
bitStrength:int

the security strength in bits of the XOF.

purpose:CryptoServicePurpose

the purpose of the digest will be used for.

SHAKEDigestback to summary
public SHAKEDigest(SHAKEDigest source)

Clone constructor

Parameters
source:SHAKEDigest

the other digest to be copied.

Method Detail

checkBitLengthback to summary
private static int checkBitLength(int bitStrength)
cryptoServicePropertiesback to summary
protected CryptoServiceProperties cryptoServiceProperties()

Overrides org.bouncycastle.crypto.digests.KeccakDigest.cryptoServiceProperties.

doFinalback to summary
public int doFinal(byte[] out, int outOff)

Overrides org.bouncycastle.crypto.digests.KeccakDigest.doFinal.

Implements org.bouncycastle.crypto.Digest.doFinal.

Doc from org.bouncycastle.crypto.Digest.doFinal.

close the digest, producing the final digest value. The doFinal call leaves the digest reset.

Parameters
out:byte[]

the array the digest is to be copied into.

outOff:int

the offset into the out array the digest is to start at.

doFinalback to summary
public int doFinal(byte[] out, int outOff, int outLen)

Implements org.bouncycastle.crypto.Xof.doFinal.

Doc from org.bouncycastle.crypto.Xof.doFinal.

Output the results of the final calculation for this digest to outLen number of bytes.

Parameters
out:byte[]

output array to write the output bytes to.

outOff:int

offset to start writing the bytes at.

outLen:int

the number of output bytes requested.

Returns:int

the number of bytes written

doFinalback to summary
protected int doFinal(byte[] out, int outOff, byte partialByte, int partialBits)

Overrides org.bouncycastle.crypto.digests.KeccakDigest.doFinal.

doFinalback to summary
protected int doFinal(byte[] out, int outOff, int outLen, byte partialByte, int partialBits)
doOutputback to summary
public int doOutput(byte[] out, int outOff, int outLen)

Implements org.bouncycastle.crypto.Xof.doOutput.

Doc from org.bouncycastle.crypto.Xof.doOutput.

Start 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.

Parameters
out:byte[]

output array to write the output bytes to.

outOff:int

offset to start writing the bytes at.

outLen:int

the number of output bytes requested.

Returns:int

the number of bytes written

getAlgorithmNameback to summary
public String getAlgorithmName()

Overrides org.bouncycastle.crypto.digests.KeccakDigest.getAlgorithmName.

Implements org.bouncycastle.crypto.Digest.getAlgorithmName.

Doc from org.bouncycastle.crypto.Digest.getAlgorithmName.

return the algorithm name

Returns:String

the algorithm name

getDigestSizeback to summary
public int getDigestSize()

Overrides org.bouncycastle.crypto.digests.KeccakDigest.getDigestSize.

Implements org.bouncycastle.crypto.Digest.getDigestSize.

Doc from org.bouncycastle.crypto.Digest.getDigestSize.

return the size, in bytes, of the digest produced by this message digest.

Returns:int

the size, in bytes, of the digest produced by this message digest.