shacrypt
shacrypt
shacrypt : Implements SHA256-CRYPT and SHA512-CRYPT password encryption schemes
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4440 | shacrypt | shacrypt | 1.1 | UTIL | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | hashlib xxhash cryptint pguecc pgcrypto gzip bzip zstd |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.1 | 18 17 16 15 14 | shacrypt | - |
| RPM | PIGSTY | 1.1 | 18 17 16 15 14 | shacrypt_$v | - |
| DEB | PIGSTY | 1.1 | 18 17 16 15 14 | postgresql-$v-shacrypt | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
el8.aarch64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
el9.x86_64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
el9.aarch64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
el10.x86_64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
el10.aarch64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
d12.x86_64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
d12.aarch64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
d13.x86_64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
d13.aarch64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
u22.x86_64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
u22.aarch64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
u24.x86_64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
u24.aarch64 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 | PIGSTY 1.1 |
Source
pig build pkg shacrypt; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install shacrypt; # install via package name, for the active PG version
pig install shacrypt -v 18; # install for PG 18
pig install shacrypt -v 17; # install for PG 17
pig install shacrypt -v 16; # install for PG 16
pig install shacrypt -v 15; # install for PG 15
pig install shacrypt -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION shacrypt;Usage
Generate SHA256-CRYPT and SHA512-CRYPT password hashes per the SHA-crypt specification.
Functions
sha256_crypt(key text, salt text) RETURNS text
SELECT sha256_crypt('clearpassword', 'somesalt');
-- $5$somesalt$l3SlbI688JBlRS9RWFC1EwZLNJqfQKcrF3yhcbc7ffAWith custom rounds:
SELECT sha256_crypt('clearpassword', '$5$rounds=10000$somesalt');
-- $5$rounds=10000$somesalt$OekH6Tu7EOJIAvxKJ4Ko4bG0DxgO83gZODJLTTjXJi5sha512_crypt(key text, salt text) RETURNS text
SELECT sha512_crypt('clearpassword', 'somesalt');
-- $6$somesalt$dDcgWMHOtvHI6qT/Khi3uaaxXN6v4N9bnOeWFl/Y6K3pzxi/...Salt Format
- Simple salt:
'somesalt' - With algorithm prefix:
'$5$somesalt'(SHA-256) or'$6$somesalt'(SHA-512) - With custom rounds:
'$5$rounds=10000$somesalt'
Last updated on