Table of Contents

Class SkeinMac

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

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

public class SkeinMac : IMac
Inheritance
SkeinMac
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

SkeinMac(SkeinMac)

public SkeinMac(SkeinMac mac)

Parameters

mac SkeinMac

SkeinMac(int, int)

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

public SkeinMac(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/MAC 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 MAC with a block of bytes.

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

Parameters

input byte[]

the byte array containing the data.

inOff int

the offset into the byte array where the data starts.

len int

BlockUpdate(ReadOnlySpan<byte>)

Update the MAC with a span of bytes.

public void BlockUpdate(ReadOnlySpan<byte> input)

Parameters

input ReadOnlySpan<byte>

the span containing the data.

DoFinal(byte[], int)

Perform final calculations, producing the result MAC.

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

Parameters

output byte[]

the byte array the MAC is to be copied into.

outOff int

the offset into the byte array the MAC is to start at.

Returns

int

the number of bytes written

Remarks

This call leaves the MAC reset.

DoFinal(Span<byte>)

Perform final calculations, producing the result MAC.

public int DoFinal(Span<byte> output)

Parameters

output Span<byte>

the span the MAC is to be copied into.

Returns

int

the number of bytes written

Remarks

This call leaves the MAC reset.

GetMacSize()

Return the size, in bytes, of the MAC produced by this implementation.

public int GetMacSize()

Returns

int

the size, in bytes, of the MAC produced by this implementation.

Init(ICipherParameters)

Optionally initialises the Skein digest with the provided parameters.

public void Init(ICipherParameters parameters)

Parameters

parameters ICipherParameters

the parameters to apply to this engine, or

null
to use no parameters.

Reset()

Reset the MAC back to its initial state.

public void Reset()

Update(byte)

Update the MAC with a single byte.

public void Update(byte inByte)

Parameters

inByte byte

See Also