CTFE: Digests do not work in CTFE
std.digest.sha
Computes SHA1 and SHA2 hashes of arbitrary data. SHA hashes are 20 to 64 byte quantities (depending on the SHA algorithm) that are like a checksum or CRC, but are more robust.
SHA2 comes in several different versions, all supported by this module: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256.
This module conforms to the APIs defined in std.digest. To understand the differences between the template and the OOP API, see std.digest.
This module publicly imports std.digest and can be used as a stand-alone module.
License
Types 15
Template API SHA1/SHA2 implementation. Supports: SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256.
The hashBlockSize 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 for differences between template and OOP API.
hashBlockSize blockSizeulong[blockSize / 512] countubyte[blockSize / 8] bufferubyte[128] paddingT Ch(T)(T x, T y, T z)T Maj(T)(T x, T y, T z)uint Parity(uint x, uint y, uint z)uint BigSigma0(uint x)uint BigSigma1(uint x)uint SmSigma0(uint x)uint SmSigma1(uint x)ulong BigSigma0(ulong x)ulong BigSigma1(ulong x)ulong SmSigma0(ulong x)ulong SmSigma1(ulong x)void T_0_15(int i, const(ubyte[64]) * input, ref uint[16] W, uint A, ref uint B, uint C, uint D,
uint E, ref uint T) pure nothrow @nogcvoid T_16_19(int i, ref uint[16] W, uint A, ref uint B, uint C, uint D, uint E, ref uint T) pure nothrow @nogcvoid T_20_39(int i, ref uint[16] W, uint A, ref uint B, uint C, uint D, uint E,
ref uint T) pure nothrow @nogcvoid T_40_59(int i, ref uint[16] W, uint A, ref uint B, uint C, uint D, uint E,
ref uint T) pure nothrow @nogcvoid T_60_79(int i, ref uint[16] W, uint A, ref uint B, uint C, uint D, uint E,
ref uint T) pure nothrow @nogcvoid T_SHA2_0_15(Word)(int i, const(ubyte[blockSize / 8]) * input, ref Word[16] W,
Word A, Word B, Word C, ref Word D, Word E, Word F, Word G, ref Word H, Word K) pure nothrow @nogcvoid T_SHA2_16_79(Word)(int i, ref Word[16] W,
Word A, Word B, Word C, ref Word D, Word E, Word F, Word G, ref Word H, Word K) pure nothrow @nogcvoid transformSHA2(Word)(Word[8] * state, const(ubyte[blockSize / 8]) * block) pure nothrow @nogcvoid put(scope const(ubyte)[] input...) @trusted pure nothrow @nogcUse this to feed the digest with data. Also implements the isOutputRange interface for `ubyte` and `const(ubyte)[]`.ubyte[digestSize / 8] finish() @trusted pure nothrow @nogcReturns the finished SHA hash. This also calls start to reset the internal state.SHA alias for SHA-512/224, hash is ubyte[28]
SHA alias for SHA-512/256, hash is ubyte[32]
OOP API SHA1 and SHA2 implementations. See std.digest for differences between template and OOP API.
This is an alias for , see there for more information.WrapperDigest!SHA1
ditto
ditto
ditto
ditto
ditto
ditto