Botan

Block Cipher Base Class

License
Botan is released under the Simplified BSD License (see LICENSE.md)

interface  BlockCipher: botan.algo_base.sym_algo.SymmetricAlgorithm;

This class represents a block cipher object.


abstract const size_t  blockSize();

Returns
block size of this algorithm

abstract const @property size_t  parallelism();

Returns
native  parallelism of this cipher in blocks

final const size_t  parallelBytes();

Returns
prefererred parallelism of this cipher in bytes

final void  encrypt(const(ubyte)* input, ubyte* output);

Encrypt a block.

Parameters
const(ubyte)* input The plaintext block to be encrypted as a ubyte array.
ubyte* output The ubyte array designated to hold the encrypted block.
Notes:
Both arguments must be of length blockSize().

final void  decrypt(const(ubyte)* input, ubyte* output);

Decrypt a block.

Parameters
const(ubyte)* input The ciphertext block to be decypted as a ubyte array.
ubyte* output The ubyte array designated to hold the decrypted block.
Notes:
Both parameters must be of length blockSize().

final void  encrypt(ubyte* block);

Encrypt a block.

Parameters
ubyte* block the plaintext block to be encrypted
Notes:
Must be of length blockSize(). Will hold the result when the function has finished.

final void  decrypt(ubyte* block);

Decrypt a block.

Parameters
ubyte* block the ciphertext block to be decrypted
Notes:
Must be of length blockSize(). Will hold the result when the function has finished.

final void  encrypt(ref ubyte[] block);

Encrypt a block.

Parameters
ubyte[] block the plaintext block to be encrypted
Notes:
Must be of length blockSize(). Will hold the result when the function has finished.

final void  decrypt(ref ubyte[] block);

Decrypt a block.

Parameters
ubyte[] block the ciphertext block to be decrypted
Notes:
Must be of length blockSize(). Will hold the result when the function has finished.

final void  encrypt(Alloc)(ref Vector!(ubyte, Alloc) block);

Encrypt one or more blocks

Parameters
Vector!(ubyte, Alloc) block the input/output buffer (multiple of blockSize())

final void  decrypt(Alloc)(ref Vector!(ubyte, Alloc) block);

Decrypt one or more blocks

Parameters
Vector!(ubyte, Alloc) block the input/output buffer (multiple of blockSize())

final void  encrypt(Alloc, Alloc2)(auto ref const Vector!(ubyte, Alloc) input, ref Vector!(ubyte, Alloc2) output);

Encrypt one or more blocks

Parameters
Vector!(ubyte, Alloc) input the input buffer (multiple of blockSize())
Vector!(ubyte, Alloc2) output the output buffer (same size as input)

final void  decrypt(Alloc, Alloc2)(auto ref const Vector!(ubyte, Alloc) input, ref Vector!(ubyte, Alloc2) output);

Decrypt one or more blocks

Parameters
Vector!(ubyte, Alloc) input the input buffer (multiple of blockSize())
Vector!(ubyte, Alloc2) output the output buffer (same size as input)

final void  encrypt(ubyte[] input, ref ubyte[] output);

Encrypt one or more blocks

Parameters
ubyte[] input the input buffer (multiple of blockSize())
ubyte[] output the output buffer (same size as input)

final void  decrypt(ubyte[] input, ref ubyte[] output);

Decrypt one or more blocks

Parameters
ubyte[] input the input buffer (multiple of blockSize())
ubyte[] output the output buffer (same size as input)

abstract void  encryptN(const(ubyte)* input, ubyte* output, size_t blocks);

Encrypt one or more blocks

Parameters
const(ubyte)* input the input buffer (multiple of blockSize())
ubyte* output the output buffer (same size as input)
size_t blocks the number of blocks to process

abstract void  decryptN(const(ubyte)* input, ubyte* output, size_t blocks);

Decrypt one or more blocks

Parameters
const(ubyte)* input the input buffer (multiple of blockSize())
ubyte* output the output buffer (same size as input)
size_t blocks the number of blocks to process

abstract const BlockCipher  clone();

Returns
new object representing the same algorithm as this

class  BlockCipherFixedParams(size_t BS, size_t KMIN, size_t KMAX = 0, size_t KMOD = 1): BlockCipher, SymmetricAlgorithm;

Represents a block cipher with a single fixed block size