crypto_postgresql_password_generator
Hash a plaintext password into PostgreSQL credential format for roles. Supports md5, scram_sha256, plain, and crypt to build CREATE/ALTER ROLE statements.
Instructions
PostgreSQL Password Hash Generator. Hash a plaintext password into the credential format a PostgreSQL server stores for a role, across PostgreSQL versions. Use it to build CREATE ROLE / ALTER ROLE statements, populate pg_hba.conf or test fixtures; use crypto_mysql_password_generator for MySQL hashes instead, and crypto_password_generator to invent a new random plaintext rather than hash one. Runs locally on the input you provide: read-only, non-destructive, contacts no database or external service, and is rate-limited (30 requests/min anonymous). The md5 format is deterministic; scram_sha256 and crypt use a fresh random salt, so their hash differs on every call. Returns the hash plus its version label, algorithm, format, and (where applicable) salt, iterations, and a plaintext-insecurity warning.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| password | Yes | Plaintext password to hash. Required and non-empty. | |
| username | No | Role name mixed into the md5 hash (md5 is MD5 of password plus username). Defaults to postgres. | postgres |
| version | No | Target format. md5 produces the legacy md5-prefixed hash (PostgreSQL under 10); scram_sha256 produces a salted SCRAM-SHA-256 verifier (PostgreSQL 10 and later); plain returns the unencrypted password (HIGHLY INSECURE); crypt produces a Unix MD5 modular-crypt hash. | md5 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| original | No | The plaintext password, echoed back. | |
| username | No | The role name used (relevant for the md5 format). | |
| hash | No | The PostgreSQL-format password hash or verifier. | |
| version | No | Human-readable label of the format used. | |
| algorithm | No | Hash algorithm used, for example MD5 of password plus username, or SCRAM-SHA-256. | |
| format | No | Description of the output encoding format. | |
| iterations | No | PBKDF2 iteration count (scram_sha256 only). | |
| salt | No | Salt used (scram_sha256 base64 salt, or crypt modular-crypt salt). | |
| warning | No | Present only for the plain format, warning the password is unencrypted. |