Class KMac
- Namespace
- Org.BouncyCastle.Crypto.Macs
- Assembly
- BouncyCastle.Cryptography.dll
public class KMac : IMac, IXof, IDigest
- Inheritance
-
KMac
- Implements
- Inherited Members
Constructors
KMac(int, byte[])
public KMac(int bitLength, byte[] S)
Parameters
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.
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.
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)
Initialise the MAC.
public void Init(ICipherParameters parameters)
Parameters
parametersICipherParametersThe key or other data required by the MAC.
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 int Output(byte[] output, int outOff, int outLen)
Parameters
outputbyte[]output array to write the output bytes to.
outOffintoffset to start writing the bytes at.
outLenintthe 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 int Output(Span<byte> output)
Parameters
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 int OutputFinal(byte[] output, int outOff, int outLen)
Parameters
outputbyte[]output array to write the output bytes to.
outOffintoffset to start writing the bytes at.
outLenintthe 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 int OutputFinal(Span<byte> output)
Parameters
Returns
- int
the number of bytes written
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 input)
Parameters
inputbytethe input byte to be entered.