pg_digest
pg_digest · Data type for efficient storage of hash digests in PostgreSQL.
Overview
Usage
Sources:
pg_digest defines the variable-length digest type for compact storage of hash digests, checksums, encryption keys, and other binary blobs. Its representation is binary-compatible with bytea, with implicit casts in both directions.
The extension stores bytes; it does not calculate, validate, size, or label a hash algorithm. Enforce the expected byte length separately, and use pgcrypto or application cryptography to compute the digest. Never treat a checksum or short/non-cryptographic digest as authentication.
Because casts with bytea are implicit, review overloaded expressions and indexes for unexpected coercion. Pin the binary/text representation across upgrades and test dump/restore and logical replication before using the type in durable schemas; bytea remains the more portable choice when the small storage distinction is not important.