Class KeyExpansion
- Namespace
- Kdf108
- Assembly
- Kdf108.dll
Describes one SP 800-108 expansion: the iteration mode, the fixed input data, and the counter
layout. Use FixedInput(ReadOnlySpan<byte>, ReadOnlySpan<byte>, BitLength) for the conventional
Label || 0x00 || Context || [L] fixed input. Instances are immutable.
public sealed class KeyExpansion
- Inheritance
-
KeyExpansion
- Inherited Members
Properties
CounterBits
The counter width r in bits, or 0 when the mode runs without a counter.
public int CounterBits { get; }
Property Value
Mode
The iteration mode.
public KdfMode Mode { get; }
Property Value
Methods
Counter(ReadOnlySpan<byte>, int, CounterPosition)
Counter mode with the counter before or after the fixed input.
public static KeyExpansion Counter(ReadOnlySpan<byte> fixedInput, int counterBits = 32, CounterPosition position = CounterPosition.BeforeFixedInput)
Parameters
fixedInputReadOnlySpan<byte>The fixed input data, typically from FixedInput(ReadOnlySpan<byte>, ReadOnlySpan<byte>, BitLength).
counterBitsintThe counter width r: 8, 16, 24, or 32.
positionCounterPositionWhere the counter goes.
Returns
CounterInMiddle(ReadOnlySpan<byte>, ReadOnlySpan<byte>, int)
Counter mode with the counter in the middle of the fixed input: Before || [i] || After.
public static KeyExpansion CounterInMiddle(ReadOnlySpan<byte> beforeCounter, ReadOnlySpan<byte> afterCounter, int counterBits = 32)
Parameters
beforeCounterReadOnlySpan<byte>afterCounterReadOnlySpan<byte>counterBitsint
Returns
DoublePipeline(ReadOnlySpan<byte>, bool, int, IterationCounterPosition)
Double-pipeline iteration mode. A(0) is the fixed input.
public static KeyExpansion DoublePipeline(ReadOnlySpan<byte> fixedInput, bool useCounter = true, int counterBits = 32, IterationCounterPosition position = IterationCounterPosition.AfterIteration)
Parameters
fixedInputReadOnlySpan<byte>The fixed input data.
useCounterboolWhether each PRF input includes the counter [i].
counterBitsintThe counter width r: 8, 16, 24, or 32. Ignored without a counter.
positionIterationCounterPositionWhere the counter goes relative to A(i).
Returns
Feedback(ReadOnlySpan<byte>, ReadOnlySpan<byte>, bool, int, IterationCounterPosition)
Feedback mode. K(0) is iv, which may be empty.
public static KeyExpansion Feedback(ReadOnlySpan<byte> fixedInput, ReadOnlySpan<byte> iv, bool useCounter = true, int counterBits = 32, IterationCounterPosition position = IterationCounterPosition.AfterIteration)
Parameters
fixedInputReadOnlySpan<byte>The fixed input data.
ivReadOnlySpan<byte>The initial chaining value K(0).
useCounterboolWhether each PRF input includes the counter [i].
counterBitsintThe counter width r: 8, 16, 24, or 32. Ignored without a counter.
positionIterationCounterPositionWhere the counter goes relative to K(i-1).