ddn.crypto.hash.sha
SHA-1 and SHA-2 hash implementations.
This module provides SHA-1 (legacy) and SHA-2 (SHA-256, SHA-384, SHA-512) hash implementations. SHA-1 is deprecated and should not be used for security-critical purposes; SHA-256 and SHA-512 are recommended for all new code.
Types 9
SHA-1 secure hash algorithm (RFC 3174).
DEPRECATED — Do not use for security-critical purposes.SHA-1 is no longer considered collision-resistant. NIST deprecated it in 2011, and practical collision attacks have been demonstrated since 2017 (SHAttered). SHA-1 must not be used for digital signatures, certificate generation, or any application that relies on collision resistance.
Acceptable legacy uses include HMAC construction (where collision resistance of the underlying hash is not required), non-security checksums, and compatibility with existing protocols that mandate SHA-1. Even in those cases, consider migrating to SHA-256 at the earliest opportunity.
See Also
private uint[5] _stateprivate ulong _countprivate ubyte[64] _bufferthis()SHA-512 implementation (FIPS 180-4).
private ulong[8] _stateprivate ulong[2] _countprivate ubyte[128] _bufferprivate ulong[80] Kvoid reset()ubyte[] finish()void transform(const(ubyte)[] block)ulong rotateRight(ulong x, uint n)this()SHA-384 implementation (FIPS 180-4).
SHA-384 uses the same algorithm as SHA-512 but with different initial values and the output is truncated to 48 bytes.
private ulong[8] _stateprivate ulong[2] _countprivate ubyte[128] _bufferprivate ulong[80] Kvoid reset()ubyte[] finish()void transform(const(ubyte)[] block)ulong rotateRight(ulong x, uint n)this()SHA-3 (Keccak) Digest Implementation.
private ulong[25] _stateprivate ubyte[] _bufferprivate size_t _rateBytesprivate size_t _outputBytesprivate size_t _byteIndexprivate ulong[24] RCprivate int[5][5] RHO_OFFSETSthis()SHA3-224
SHA3-256
SHA3-384
SHA3-512