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
digestSkeinDigest
SkeinDigest(int, int)
Constructs a Skein digest with an internal state size and output size.
public SkeinDigest(int stateSizeBits, int digestSizeBits)
Parameters
stateSizeBitsintthe internal state size in bits - one of SKEIN_256 SKEIN_512 or SKEIN_1024.
digestSizeBitsintthe 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
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 message digest with a block of bytes.
public void BlockUpdate(byte[] inBytes, int inOff, int len)
Parameters
BlockUpdate(ReadOnlySpan<byte>)
Update the message digest with a span of bytes.
public void BlockUpdate(ReadOnlySpan<byte> input)
Parameters
inputReadOnlySpan<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
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
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
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
parametersSkeinParametersthe parameters to apply to this engine, or
to use no parameters.null
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
otherIMemoablean 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
inBytebyte