tango.util.cipher.Cipher

License:

BSD style: see license.txt

Authors:

Thomas Dixon
class Cipher [abstract]
Base symmetric cipher class
uint update(const(void[]) input_, void[] output_) [abstract]
Process a block of plaintext data from the input array and place it in the output array.

Parameters:

input_Array containing input data.
output_Array to hold the output data.

Returns:

The amount of encrypted data processed.
const(char)[] name() [@property, abstract]

Returns:

The name of the algorithm of this cipher.
void reset() [abstract]
Reset cipher to its state immediately subsequent the last init.
void invalid(const(char[]) msg) [static]
throw an InvalidArgument exception

Parameters:

msgmessage to associate with the exception
bool initialized() [final, const]

Returns:

Whether or not the cipher has been initialized.
class BlockCipher : Cipher [abstract]
Interface for a standard block cipher.
uint blockSize() [@property, const, abstract]

Returns:

The block size in bytes that this cipher will operate on.
class StreamCipher : Cipher [abstract]
Interface for a standard stream cipher.
ubyte returnByte(ubyte input) [abstract]
Process one byte of input.

Parameters:

inputByte to XOR with keystream.

Returns:

One byte of input XORed with the keystream.
class BlockCipherPadding [abstract]
Base padding class for implementing block padding schemes.
const(char)[] name() [@property, abstract]

Returns:

The name of the padding scheme implemented.
ubyte[] pad(uint len) [abstract]
Generate padding to a specific length.

Parameters:

lenLength of padding to generate

Returns:

The padding bytes to be added.
uint unpad(const(void[]) input_) [abstract]
Return the number of pad bytes in the block.

Parameters:

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_) [static]
Converts the supplied array to integral type T

Parameters:

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) [static]
Converts the supplied integral to an array of unsigned bytes.

Parameters:

inputIntegral 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