Md4

Constructors

this
this()

Construct an Md4

Members

Functions

addSize
uint addSize()

Length padding size

blockSize
uint blockSize()

block size

createDigest
void createDigest(ubyte[] buf)

Obtain the digest

digestSize
uint digestSize()

The MD 4 digest size is 16 bytes

padLength
void padLength(ubyte[] data, ulong length)

Performs the length padding

padMessage
void padMessage(ubyte[] data)

Pads the cipher data

reset
void reset()

Initialize the cipher

transform
void transform(ubyte[] input)

Performs the cipher on a block of data

Static functions

f
uint f(uint x, uint y, uint z)
h
uint h(uint x, uint y, uint z)

Variables

context
uint[4] context;
Undocumented in source.

Inherited Members

From MerkleDamgard

createDigest
void createDigest(ubyte[] buf)

Constructs the digest

blockSize
uint blockSize()

Digest block size

addSize
uint addSize()

Length padding size

padMessage
void padMessage(ubyte[] data)

Pads the digest data

padLength
void padLength(ubyte[] data, size_t length)

Performs the length padding

transform
void transform(ubyte[] data)

Performs the digest on a block of data

extend
void extend()

Final processing of digest.

reset
void reset()

Initialize the digest

update
MerkleDamgard update(const(void)[] input)

Digest additional data

binaryDigest
ubyte[] binaryDigest(ubyte[] buf)

Complete the digest

littleEndian32
void littleEndian32(ubyte[] input, uint[] output)

Converts 8 bit to 32 bit Little Endian

bigEndian32
void bigEndian32(ubyte[] input, uint[] output)

Converts 8 bit to 32 bit Big Endian

littleEndian64
void littleEndian64(ubyte[] input, ulong[] output)

Converts 8 bit to 64 bit Little Endian

bigEndian64
void bigEndian64(ubyte[] input, ulong[] output)

Converts 8 bit to 64 bit Big Endian

rotateLeft
uint rotateLeft(uint x, uint n)

Rotate left by n

Examples

static istring[] strings = [
    "",
    "a",
    "abc",
    "message digest",
    "abcdefghijklmnopqrstuvwxyz",
    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
    "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
];

static istring[] results = [
    "31d6cfe0d16ae931b73c59d7e0c089c0",
    "bde52cb31de33e46245e05fbdbd6fb24",
    "a448017aaf21d8525fc10ae87aa6729d",
    "d9130a8164549fe818874806e1c7014b",
    "d79e1c308aa5bbcdeea8ed63df412da9",
    "043f8582f241db351ce627e153e7f0e4",
    "e33b4ddc9c38f2199c3e7b164fcc0536"
];

Md4 h = new Md4();

foreach (i, s; strings)
{
    h.update(s);
    char[] d = h.hexDigest;
    test(d == results[i],":("~s~")("~d~")!=("~results[i]~")");
}

Meta