SHA2()

Overview

Returns an SHA-2 checksum hash as a hexadecimal string.

USAGE

SHA2(string, hash_length)

Argument Name

Description

expr

The string to be hashed

hash_length

The bit length of the result (224, 256, 384, or 512)

DETAILS

SHA2() is an encryption function that returns an SHA-2 checksum hash value for the string argument.

The hash_length number picks which hashing algorithm to use from the supported choices of 224, 256, 384, and 512 for the algorithms SHA-224, SHA-256, SHA-384, and SHA-512.

A hash_length of 0 is also accepted and treated the same as a length argument of 256.

A NULL is returned if the either argument is NULL or the hash_length is not one of the accepted values.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT SHA2('abc', 224);
+----------------------------------------------------------+
| SHA2('abc', 224)                                         |
+----------------------------------------------------------+
| 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 |
+----------------------------------------------------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES