Compute the SHA-384 hash of a string and return it as a 96-character lowercase hexadecimal string.
SHA384(str)
## Overview Computes the SHA-384 cryptographic hash of the UTF-8-encoded input string and returns the digest as a lowercase hexadecimal string. SHA-384 is a truncated variant of SHA-512 that produces a 384-bit (48-byte) digest. Use it when you want a longer digest than SHA-256 but shorter than SHA-512, typically for compliance-driven fingerprinting. ## Algorithm and output - Returns a 96-character lowercase hexadecimal string (`[0-9a-f]`). - The digest is 384 bits (48 bytes) long. - Provides higher collision resistance than SHA-256 at a larger storage cost. - Compare digests hex-for-hex; direct equality with `=` is collation-safe because the output is ASCII. ## 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. ## Compatibility - PG-compat alias for the standard SHA-384 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 SHA384('hello');
-- Build a large fingerprint for high-collision-resistance scenarios
SELECT document_id, SHA384(content) AS digest FROM cms.catalog.documents;
-- Same input yields the same digest
SELECT SHA384('abc') = SHA384('abc') AS same; -- true
-- NULL propagation
SELECT SHA384(NULL); -- NULL