Table of Contents

Class ShakeDigest

Namespace
Org.BouncyCastle.Crypto.Digests
Assembly
BouncyCastle.Cryptography.dll

Implementation of SHAKE based on following KeccakNISTInterface.c from http://keccak.noekeon.org/

public class ShakeDigest : KeccakDigest, IMemoable, IXof, IDigest
Inheritance
ShakeDigest
Implements
Derived
Inherited Members

Remarks

Following the naming conventions used in the C source code to enable easy review of the implementation.

Constructors

ShakeDigest()

public ShakeDigest()

ShakeDigest(ShakeDigest)

public ShakeDigest(ShakeDigest source)

Parameters

source ShakeDigest

ShakeDigest(int)

public ShakeDigest(int bitLength)

Parameters

bitLength int

Properties

AlgorithmName

The algorithm name.

public override string AlgorithmName { get; }

Property Value

string

Methods

Copy()

Produce a copy of this object with its configuration and in its current state.

public override IMemoable Copy()

Returns

IMemoable

Remarks

The returned object may be used simply to store the state, or may be used as a similar object starting from the copied state.

DoFinal(byte[], int)

Close the digest, producing the final digest value.

public override int DoFinal(byte[] output, int outOff)

Parameters

output byte[]

The byte array the digest is to be copied into.

outOff int

The offset into the byte array the digest is to start at.

Returns

int

The number of bytes written.

Remarks

This call leaves the digest reset.

DoFinal(byte[], int, byte, int)

protected override int DoFinal(byte[] output, int outOff, byte partialByte, int partialBits)

Parameters

output byte[]
outOff int
partialByte byte
partialBits int

Returns

int

DoFinal(Span<byte>)

Close the digest, producing the final digest value.

public override int DoFinal(Span<byte> output)

Parameters

output Span<byte>

The span the digest is to be copied into.

Returns

int

The number of bytes written.

Remarks

This call leaves the digest reset.

GetDigestSize()

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

public override int GetDigestSize()

Returns

int

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

Output(byte[], int, int)

Start outputting the results of the final calculation for this XOF. Unlike DoFinal, this method will continue producing output until the XOF is explicitly reset, or signals otherwise.

public virtual int Output(byte[] output, int outOff, int outLen)

Parameters

output 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

Output(Span<byte>)

Start outputting the results of the final calculation for this XOF. Unlike OutputFinal, this method will continue producing output until the XOF is explicitly reset, or signals otherwise.

public virtual int Output(Span<byte> output)

Parameters

output Span<byte>

span to fill with the output bytes.

Returns

int

the number of bytes written

OutputFinal(byte[], int, int)

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

public virtual int OutputFinal(byte[] output, int outOff, int outLen)

Parameters

output 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

OutputFinal(byte[], int, int, byte, int)

protected virtual int OutputFinal(byte[] output, int outOff, int outLen, byte partialByte, int partialBits)

Parameters

output byte[]
outOff int
outLen int
partialByte byte
partialBits int

Returns

int

OutputFinal(Span<byte>)

Output the results of the final calculation for this XOF to fill the output span.

public virtual int OutputFinal(Span<byte> output)

Parameters

output Span<byte>

span to fill with the output bytes.

Returns

int

the number of bytes written