Table of Contents

Class KCtrBlockCipher

Namespace
Org.BouncyCastle.Crypto.Modes
Assembly
BouncyCastle.Cryptography.dll
public class KCtrBlockCipher : IStreamCipher, IBlockCipherMode, IBlockCipher
Inheritance
KCtrBlockCipher
Implements
Inherited Members

Constructors

KCtrBlockCipher(IBlockCipher)

public KCtrBlockCipher(IBlockCipher cipher)

Parameters

cipher IBlockCipher

Properties

AlgorithmName

public string AlgorithmName { get; }

Property Value

string

IsPartialBlockOkay

Indicates whether this cipher mode can handle partial blocks.

public bool IsPartialBlockOkay { get; }

Property Value

bool

UnderlyingCipher

public IBlockCipher UnderlyingCipher { get; }

Property Value

IBlockCipher

Methods

CalculateByte(byte)

protected byte CalculateByte(byte b)

Parameters

b byte

Returns

byte

GetBlockSize()

public int GetBlockSize()

Returns

int

Init(bool, ICipherParameters)

public void Init(bool forEncryption, ICipherParameters parameters)

Parameters

forEncryption bool
parameters ICipherParameters

ProcessBlock(byte[], int, byte[], int)

public int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)

Parameters

input byte[]
inOff int
output byte[]
outOff int

Returns

int

ProcessBlock(ReadOnlySpan<byte>, Span<byte>)

Process a block.

public int ProcessBlock(ReadOnlySpan<byte> input, Span<byte> output)

Parameters

input ReadOnlySpan<byte>

The input block as a span.

output Span<byte>

The output span.

Returns

int

The number of bytes processed and produced.

Exceptions

DataLengthException

If input block is wrong size, or output span too small.

ProcessBytes(byte[], int, int, byte[], int)

Process a block of bytes from input, putting the result into output.

public void ProcessBytes(byte[] input, int inOff, int len, byte[] output, int outOff)

Parameters

input byte[]

The input byte array.

inOff int

The offset into input where the data to be processed starts.

len int
output byte[]

The output buffer the processed bytes go into.

outOff int

The offset into output the processed data starts at.

Exceptions

DataLengthException

If the input buffer is too small.

OutputLengthException

If the output buffer is too small.

ProcessBytes(ReadOnlySpan<byte>, Span<byte>)

Process a block of bytes from input, putting the result into output.

public void ProcessBytes(ReadOnlySpan<byte> input, Span<byte> output)

Parameters

input ReadOnlySpan<byte>

The input span.

output Span<byte>

The output span.

Exceptions

OutputLengthException

If the output span is too small.

Reset()

public void Reset()

ReturnByte(byte)

encrypt/decrypt a single byte returning the result.

public byte ReturnByte(byte input)

Parameters

input byte

the byte to be processed.

Returns

byte

the result of processing the input byte.