Table of Contents

Class ParallelHash

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

ParallelHash - a hash designed to support the efficient hashing of very long strings, by taking advantage, of the parallelism available in modern processors with an optional XOF mode.

From NIST Special Publication 800-185 - SHA-3 Derived Functions:cSHAKE, KMAC, TupleHash and ParallelHash

public class ParallelHash : IXof, IDigest
Inheritance
ParallelHash
Implements
Inherited Members

Constructors

ParallelHash(ParallelHash)

public ParallelHash(ParallelHash source)

Parameters

source ParallelHash

ParallelHash(int, byte[], int)

public ParallelHash(int bitLength, byte[] S, int B)

Parameters

bitLength int
S byte[]
B int

ParallelHash(int, byte[], int, int)

public ParallelHash(int bitLength, byte[] S, int B, int outputSize)

Parameters

bitLength int
S byte[]
B int
outputSize int

Properties

AlgorithmName

The algorithm name.

public virtual string AlgorithmName { get; }

Property Value

string

Methods

BlockUpdate(byte[], int, int)

Update the message digest with a block of bytes.

public virtual void BlockUpdate(byte[] inBuf, int inOff, int len)

Parameters

inBuf byte[]
inOff int

The offset into the byte array where the data starts.

len int

BlockUpdate(ReadOnlySpan<byte>)

Update the message digest with a span of bytes.

public virtual void BlockUpdate(ReadOnlySpan<byte> input)

Parameters

input ReadOnlySpan<byte>

The span containing the data.

DoFinal(byte[], int)

Close the digest, producing the final digest value.

public virtual int DoFinal(byte[] outBuf, int outOff)

Parameters

outBuf byte[]
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(Span<byte>)

Close the digest, producing the final digest value.

public virtual 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.

GetByteLength()

Return the size, in bytes, of the internal buffer used by this digest.

public virtual int GetByteLength()

Returns

int

The size, in bytes, of the internal buffer used by this digest.

GetDigestSize()

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

public virtual 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[] outBuf, int outOff, int outLen)

Parameters

outBuf byte[]
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[] outBuf, int outOff, int outLen)

Parameters

outBuf byte[]
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(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

Reset()

Reset the digest back to its initial state.

public virtual void Reset()

Update(byte)

Update the message digest with a single byte.

public virtual void Update(byte b)

Parameters

b byte