Struct SHA

Template API SHA1/SHA2 implementation. Supports: SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256.

The blockSize and digestSize are in bits. However, it's likely easier to simply use the convenience aliases: SHA1, SHA224, SHA256, SHA384, SHA512, SHA512_224 and SHA512_256.

See std.digest.digest for differences between template and OOP API.

Fields

Name Type Description
buffer ubyte[blockSize/8]
count ulong[blockSize/512]
padding ubyte[128]

Methods

Name Description
BigSigma0
BigSigma0
BigSigma1
BigSigma1
Ch
finish Returns the finished SHA hash. This also calls start to reset the internal state.
Maj
Parity
put Use this to feed the digest with data. Also implements the range, OutputRange interface for ubyte and const(ubyte)[].
SmSigma0
SmSigma0
SmSigma1
SmSigma1
start SHA initialization. Begins an SHA1/SHA2 operation.
transformSHA2
transformX86
T_0_15
T_16_19
T_20_39
T_40_59
T_60_79
T_SHA2_0_15
T_SHA2_16_79

Authors

The routines and algorithms are derived from the Secure Hash Signature Standard (SHS) (FIPS PUB 180-2). Kai Nacke, Johannes Pfau, Nick Sabalausky

Copyright

License

Boost License 1.0