Sha0

Constructors

this
this()

Construct an Sha0

Members

Functions

transform
void transform(const(ubyte[]) input)

Static functions

expand
void expand(uint W, uint s)

Inherited Members

From Sha01

context
uint[5] context;
Undocumented in source.
mask
enum 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

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, ulong length)

Performs the length padding

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

Examples

__gshared immutable immutable(char)[][] strings = 
[
        "",
        "abc",
        "message digest",
        "abcdefghijklmnopqrstuvwxyz",
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
        "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
];

__gshared immutable immutable(char)[][] results = 
[
        "f96cea198ad1dd5617ac084a3d92c6107708c0ef",
        "0164b8a914cd2a5e74c4f7ff082c4d97f1edf880",
        "c1b0f222d150ebb9aa36a40cafdc8bcbed830b14",
        "b40ce07a430cfd3c033039b9fe9afec95dc1bdcd",
        "79e966f7a3a990df33e40e3d7f8f18d2caebadfa",
        "4aa29d14d171522ece47bee8957e35a41f3e9cff",
];

Sha0 h = new Sha0();

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

Meta