tango.util.cipher.Cipher

License:
BSD style:

Authors:
Thomas Dixon

abstract class Cipher;
Base symmetric cipher class

abstract uint update(const(void[]) input_, void[] output_);
Process a block of plaintext data from the input array and place it in the output array.

Params:
const(void[]) input_ Array containing input data.
void[] output_ Array to hold the output data.

Returns:
The amount of encrypted data processed.

abstract @property const(char)[] name();
Returns:
The name of the algorithm of this cipher.

abstract void reset();
Reset cipher to its state immediately subsequent the last init.

static void invalid(const(char[]) msg);
throw an InvalidArgument exception

Params:
const(char[]) msg message to associate with the exception

final const bool initialized();
Returns:
Whether or not the cipher has been initialized.

abstract class BlockCipher: tango.util.cipher.Cipher.Cipher;
Interface for a standard block cipher.

abstract const @property uint blockSize();
Returns:
The block size in bytes that this cipher will operate on.

abstract class StreamCipher: tango.util.cipher.Cipher.Cipher;
Interface for a standard stream cipher.

abstract ubyte returnByte(ubyte input);
Process one byte of input.

Params:
ubyte input Byte to XOR with keystream.

Returns:
One byte of input XORed with the keystream.

abstract class BlockCipherPadding;
Base padding class for implementing block padding schemes.

abstract @property const(char)[] name();
Returns:
The name of the padding scheme implemented.

abstract ubyte[] pad(uint len);
Generate padding to a specific length.

Params:
uint len Length of padding to generate

Returns:
The padding bytes to be added.

abstract uint unpad(const(void[]) input_);
Return the number of pad bytes in the block.

Params:
const(void[]) input_ Padded block of which to count the pad bytes.

Returns:
The number of pad bytes in the block.

Throws:
dcrypt.crypto.errors.InvalidPaddingError if pad length cannot be discerned.

struct ByteConverter;
Converts between integral types and unsigned byte arrays

struct LittleEndian;
Conversions between little endian integrals and bytes

T to(T)(const(void[]) x_);
Converts the supplied array to integral type T

Params:
const(void[]) x_ The supplied array of bytes (ubytes, bytes, chars, whatever)

Returns:
A integral of type T created with the supplied bytes placed in the specified byte order.

void from(T)(T input, ubyte[] output);
Converts the supplied integral to an array of unsigned bytes.

Params:
T input Integral to convert to bytes

Returns:
Integral input of type T split into its respective bytes with the bytes placed in the specified byte order.

struct BigEndian;
Conversions between big endian integrals and bytes


Page generated by Ddoc. Copyright (C) Thomas Dixon 2008. All rights reserved.