Sha0

Constructors

this
this()

Construct an Sha0

Members

Functions

transform
void transform(ubyte[] input)

Static functions

expand
void expand(uint[] W, uint s)

Inherited Members

From Sha01

context
uint[5] context;
Undocumented in source.
mask
uint mask;
Undocumented in source.
digestSize
uint digestSize()

The digest size of Sha-0 and Sha-1 is 20 bytes

reset
void reset()

Initialize the cipher

createDigest
void createDigest(ubyte[] buf)

Obtain the digest

transform
void transform(ubyte[] data)

To be implemented

blockSize
uint blockSize()

block size

addSize
uint addSize()

Length padding size

padMessage
void padMessage(ubyte[] data)

Pads the cipher data

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

Performs the length padding

f
uint f(uint t, uint B, uint C, uint D)
K
const(uint[]) K;

Examples

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

static istring[] results = [
    "f96cea198ad1dd5617ac084a3d92c6107708c0ef",
    "0164b8a914cd2a5e74c4f7ff082c4d97f1edf880",
    "c1b0f222d150ebb9aa36a40cafdc8bcbed830b14",
    "b40ce07a430cfd3c033039b9fe9afec95dc1bdcd",
    "79e966f7a3a990df33e40e3d7f8f18d2caebadfa",
    "4aa29d14d171522ece47bee8957e35a41f3e9cff",
];

Sha0 h = new Sha0();

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

Meta