Postgres cryptographic functions

Other topics

digest

DIGEST() functions generate a binary hash of the given data. This can be used to create a random hash.

Usage: digest(data text, type text) returns bytea

Or: digest(data bytea, type text) returns bytea

Examples:

  • SELECT DIGEST('1', 'sha1')

  • SELECT DIGEST(CONCAT(CAST(current_timestamp AS TEXT), RANDOM()::TEXT), 'sha1')

Contributors

Topic Id: 9230

Example Ids: 28641

This site is not affiliated with any of the contributors.