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
macSkeinMac
SkeinMac(int, int)
Constructs a Skein MAC with an internal state size and output size.
public SkeinMac(int stateSizeBits, int digestSizeBits)
Parameters
stateSizeBitsintthe internal state size in bits - one of SKEIN_256 SKEIN_512 or SKEIN_1024.
digestSizeBitsintthe 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
SKEIN_256
256 bit block size - Skein-256
public const int SKEIN_256 = 256
Field Value
SKEIN_512
512 bit block size - Skein-512
public const int SKEIN_512 = 512
Field Value
Properties
AlgorithmName
The algorithm name.
public string AlgorithmName { get; }
Property Value
Methods
BlockUpdate(byte[], int, int)
Update the MAC with a block of bytes.
public void BlockUpdate(byte[] input, int inOff, int len)
Parameters
inputbyte[]the byte array containing the data.
inOffintthe offset into the byte array where the data starts.
lenint
BlockUpdate(ReadOnlySpan<byte>)
Update the MAC with a span of bytes.
public void BlockUpdate(ReadOnlySpan<byte> input)
Parameters
inputReadOnlySpan<byte>the span containing the data.
DoFinal(byte[], int)
Perform final calculations, producing the result MAC.
public int DoFinal(byte[] output, int outOff)
Parameters
outputbyte[]the byte array the MAC is to be copied into.
outOffintthe 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
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
parametersICipherParametersthe parameters to apply to this engine, or
to use no parameters.null
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
inBytebyte