pub enum HashAlg {
Sha1,
Sha256,
Sha384,
Sha512,
Sha3_256,
Sha3_384,
Sha3_512,
Ripemd160,
}Expand description
Hash algorithm identifiers for PKCS#1 v1.5 signatures.
Each variant carries the DER-encoded DigestInfo prefix that
gets prepended to the hash output H to form T = prefix || H.
Per RFC 8017 §9.2 Note 1 the prefix encodes
DigestInfo ::= SEQUENCE {
digestAlgorithm SEQUENCE { OID, NULL },
digest OCTET STRING
}SHA-3 prefixes use the OIDs assigned by NIST CSOR
(2.16.840.1.101.3.4.2.{8,9,10}) which were standardised after
RFC 8017 was published, but follow the same template as the
SHA-2 prefixes.
Note on RIPEMD-160: included for backwards compatibility with legacy systems (Bitcoin signatures, some X.509 CAs from the 2000s). Not recommended for new designs.
Variants§
Sha1
SHA-1 (FIPS 180-4). 20-byte output. Legacy / collision-broken; included only for compatibility with old certificates and HMAC-SHA-1.
Sha256
SHA-256 (FIPS 180-4). 32-byte output.
Sha384
SHA-384 (FIPS 180-4). 48-byte output.
Sha512
SHA-512 (FIPS 180-4). 64-byte output.
Sha3_256
SHA3-256 (FIPS 202). 32-byte output.
Sha3_384
SHA3-384 (FIPS 202). 48-byte output.
Sha3_512
SHA3-512 (FIPS 202). 64-byte output.
Ripemd160
RIPEMD-160 (ISO/IEC 10118-3). 20-byte output. Legacy; included for Bitcoin and 2000s European X.509 CAs.