Compute the SHA-224 hash of a string and return it as a 56-character lowercase hexadecimal string.
SHA224(str)
## Overview Computes the SHA-224 cryptographic hash of the UTF-8-encoded input string and returns the digest as a lowercase hexadecimal string. SHA-224 is a truncated variant of SHA-256 that produces a 224-bit (28-byte) digest. Use SHA-224 when you want a SHA-2 family hash shorter than SHA-256, typically for compact fingerprints in catalog or lineage contexts. For new designs, prefer SHA-256 unless you have a specific reason to keep the digest shorter. ## Algorithm and output - Returns a 56-character lowercase hexadecimal string (`[0-9a-f]`). - The digest is 224 bits (28 bytes) long. - Compare values hex-for-hex; direct equality with `=` is collation-safe because output is ASCII. - The function does not emit the raw binary; use a separate encoding if you need bytes. ## Behavior - Returns NULL if the input is NULL. - Deterministic: equal inputs produce equal outputs. - Side effect free. - Hashes the UTF-8 encoding of the input string; different encodings produce different digests. ## Compatibility - PG-compat alias for the standard SHA-224 primitive.
| Name | Type | Description |
|---|---|---|
str | Specifies the input string to hash. The input is hashed as its UTF-8 byte representation. |
-- Hash a literal
SELECT SHA224('hello');
-- Hash an empty string (canonical SHA-224 of empty input)
SELECT SHA224('');
-- Same input produces the same digest
SELECT SHA224('abc') = SHA224('abc') AS same_hash; -- true
-- Build a fingerprint column for change detection
SELECT customer_id, SHA224(CONCAT_WS('|', first_name, last_name, email)) AS fp
FROM crm.catalog.customers;
-- NULL propagation
SELECT SHA224(NULL); -- NULL