Skip to main content
Version: V1.0.0

SHA2

Declaration

SHA2(str,len)

Description

The function calculates and returns the SHA-2 hash of the given string, which includes the SHA-224, SHA-256, SHA-384, and SHA-512 algorithms. str is the plaintext string to be hashed, and len specifies the desired bit length of the result. The value of len must be 224, 256, 384, 512, or 0 (equivalent to 256).

Example

SELECT SHA2('OB',224);
+----------------------------------------------------------+
| SHA2('OB',224) |
+----------------------------------------------------------+
| 00ac28313083c3a30fa0c671f01829ff0fd3253938d0c0225c4c670e |
+----------------------------------------------------------+
1 row in set (0.001 sec)