Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okanmenevseoglu/a8aa36289d149866500ea3a0d7804a2f to your computer and use it in GitHub Desktop.
Save okanmenevseoglu/a8aa36289d149866500ea3a0d7804a2f to your computer and use it in GitHub Desktop.
Enable cryptography functions (pgcrypto extension) in PostgreSQL.
CREATE EXTENSION pgcrypto;
-- Examples
SELECT ENCODE(DIGEST('password', 'md5'), 'hex');
SELECT ENCODE(DIGEST('password', 'sha1'), 'hex');
SELECT ENCODE(DIGEST('password', 'sha224'), 'hex');
SELECT ENCODE(DIGEST('password', 'sha256'), 'hex');
SELECT ENCODE(DIGEST('password', 'sha384'), 'hex');
SELECT ENCODE(DIGEST('password', 'sha512'), 'base64');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment