WL#3986: Add SHA2 support
Affects: Server-6.0
—
Status: Complete
We already implement SHA1. This implements the remaining four fips-approved
Secure Hash Algorithms for computing a condensed digital representation,
SHA-224, SHA-256, SHA-384, and SHA-512, collectively known as "SHA-2". The
number "224" and such refers to the digest length.
Algorithm specification documents:
http://csrc.nist.gov/CryptoToolkit/tkhash.html
http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf
MySQL SQL function specification:
SHA2( string cleartext, integer hash_length )
-> string hash, or NULL
where hash_length is one of 224, 256, 384, or 512. If either is
NULL or a length is unsupported, then the result is NULL.
SHA2( string cleartext, integer hash_length )
-> string hash, or NULL
Return a string representation of the hash number in hexadecimal.
hash_length must be one of 224, 256, 384, or 512 (or zero, means => 512). If
it's none of those numbers, then it must return NULL and raise a warning.
See patch for BUG#13174 "Patch: SHA2 function".
Copyright (c) 2000, 2025, Oracle Corporation and/or its affiliates. All rights reserved.