Table of Contents

Class SkeinDigest

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

Implementation of the Skein parameterised hash function in 256, 512 and 1024 bit block sizes, based on the Threefish tweakable block cipher.

public class SkeinDigest : IDigest, IMemoable
Inheritance
SkeinDigest
Implements
Inherited Members

Remarks

This is the 1.3 version of Skein defined in the Skein hash function submission to the NIST SHA-3 competition in October 2010.

Skein was designed by Niels Ferguson - Stefan Lucks - Bruce Schneier - Doug Whiting - Mihir Bellare - Tadayoshi Kohno - Jon Callas - Jesse Walker.

Constructors

SkeinDigest(SkeinDigest)

public SkeinDigest(SkeinDigest digest)

Parameters

digest SkeinDigest

SkeinDigest(int, int)

Constructs a Skein digest with an internal state size and output size.

public SkeinDigest(int stateSizeBits, int digestSizeBits)

Parameters

stateSizeBits int

the internal state size in bits - one of SKEIN_256 SKEIN_512 or SKEIN_1024.

digestSizeBits int

the output/digest size to produce in bits, which must be an integral number of bytes.

Fields

SKEIN_1024

1024 bit block size - Skein-1024

public const int SKEIN_1024 = 1024

Field Value

int

SKEIN_256

256 bit block size - Skein-256

public const int SKEIN_256 = 256

Field Value

int

SKEIN_512

512 bit block size - Skein-512

public const int SKEIN_512 = 512

Field Value

int

Properties

AlgorithmName

The algorithm name.

public string AlgorithmName { get; }

Property Value

string

Methods

BlockUpdate(byte[], int, int)

Update the message digest with a block of bytes.

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

Parameters

inBytes 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 void BlockUpdate(ReadOnlySpan<byte> input)

Parameters

input ReadOnlySpan<byte>

The span containing the data.

Copy()

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

public 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 int DoFinal(byte[] outBytes, int outOff)

Parameters

outBytes 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 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 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 int GetDigestSize()

Returns

int

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

Init(SkeinParameters)

Optionally initialises the Skein digest with the provided parameters.

public void Init(SkeinParameters parameters)

Parameters

parameters SkeinParameters

the parameters to apply to this engine, or

null
to use no parameters.

Reset()

Reset the digest back to its initial state.

public void Reset()

Reset(IMemoable)

Restore a copied object state into this object.

public void Reset(IMemoable other)

Parameters

other IMemoable

an object originally {@link #copy() copied} from an object of the same type as this instance.

Remarks

Implementations of this method should try to avoid or minimise memory allocation to perform the reset.

Exceptions

InvalidCastException

if the provided object is not of the correct type.

MemoableResetException

if the other parameter is in some other way invalid.

Update(byte)

Update the message digest with a single byte.

public void Update(byte inByte)

Parameters

inByte byte

See Also