{"id":16270807,"url":"https://github.com/fboulnois/pg-scram","last_synced_at":"2026-05-20T14:10:26.019Z","repository":{"id":140693375,"uuid":"469205816","full_name":"fboulnois/pg-scram","owner":"fboulnois","description":"A tiny C program to create valid Postgres scram-sha-256 passwords","archived":false,"fork":false,"pushed_at":"2022-03-12T21:54:01.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T15:34:41.138Z","etag":null,"topics":["c","libpq","postgres","postgresql","scram-sha-256"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fboulnois.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-12T21:37:15.000Z","updated_at":"2025-02-23T05:10:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"83f656b6-3400-498c-a6dd-2d5fc4412f38","html_url":"https://github.com/fboulnois/pg-scram","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fboulnois/pg-scram","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fboulnois%2Fpg-scram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fboulnois%2Fpg-scram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fboulnois%2Fpg-scram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fboulnois%2Fpg-scram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fboulnois","download_url":"https://codeload.github.com/fboulnois/pg-scram/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fboulnois%2Fpg-scram/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266850491,"owners_count":23995082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","libpq","postgres","postgresql","scram-sha-256"],"created_at":"2024-10-10T18:11:40.398Z","updated_at":"2026-05-20T14:10:20.981Z","avatar_url":"https://github.com/fboulnois.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `pg-scram`: Postgres `scram-sha-256` passwords\n\nA tiny C program to create valid [Postgres `scram-sha-256`](https://www.postgresql.org/docs/14/auth-password.html)\npasswords.\n\nThese can be used to automatically set and update database passwords without\naccidentally logging the passwords in plaintext:\n\n```sh\necho \"my_super_secret_password\" \u003e secret.txt\necho \"CREATE USER joe WITH PASSWORD :'PGPW';\" | psql --set PGPW=$(cat secret.txt | pg-scram) -f -\n```\n\n`joe` now has the password `my_super_secret_password`, but the database logs\ninclude this statement instead:\n\n```sql\nCREATE USER joe WITH PASSWORD 'SCRAM-SHA-256$4096:Hamvc7BOELb9OnEgS1dL/g==$jjR4ODiN5vqzbNUas2xSG08+1iZLWnghzjfXDx9p6yg=:/sRVoDORHCaojcWGg5ifOFx3NN7bzT/xgamQ7CSDpiE='\n```\n\n## How to build:\n\n### Build locally\n\n`pg-scram` only requires the `libpq` headers to build the code. Depending on\nyour distribution, these headers are included in the `libpq-dev`, `libpq-devel`,\nor `postgresql-devel` packages.\n\nTo build the code run:\n\n```sh\ncc -I/usr/include/postgresql main.c -o pg-scram -lpq\n```\n\nThe include paths and library paths might need to be adjusted to match your\ndistribution.\n\n### Build using Docker\n\nTwo `Dockerfile`s are also available to build the code:\n\n* [Dockerfile-debian](Dockerfile-debian) builds a dynamically linked version of\n`pg-scram` for Debian 11.\n* [Dockerfile-alpine](Dockerfile-alpine) builds a fully statically linked and\nportable version of `pg-scram`.\n\n## How to use:\n\nAlthough `pg-scram` depends on `libpq`, it does not need a running Postgres\ninstance.\n\nThe password can be specified directly as a command line argument:\n\n```sh\n$ pg-scram \"hello\"\nSCRAM-SHA-256$4096:if2MpZnsBy6B/TbMKd+siw==$xXmOAWEPkeDuJqT+N3wVVVY/eJL0vkpGQStEpoIKRw4=:KxdUo1wXlH5O4MCKzTX5E7iZbLxY1p9RX4o7WWbg89I=\n```\n\nThe password can also be passed using a pipe:\n\n```sh\n$ echo \"hello\" | pg-scram\nSCRAM-SHA-256$4096:1FZKq8e9WsX+p6fFN4pVQg==$Tn9TsEDc4v7UVpb7rCgvPVi2lCOck4ip1rQwKEg3coI=:X3ugMHIx12rIxYg2/6n/iaICOLl9dL6n0iyKxaQlZno=\n```\n\nFor convenience with most shell utilities, the final newline is discarded by\ndefault when using pipes. However, this behavior may be undesirable when piping\nin files. To avoid this behavior, pass the `--no-trim` option:\n\n```sh\n$ cat secret.txt | pg-scram --no-trim\nSCRAM-SHA-256$4096:BBsdc8M0Ir9WsCXXMYW3iw==$5rdGQRbwufOlEsrz1dlU1WYA32t5mAMz1Vv57rEP6Ww=:abldSFOQtYuZv5bNfJywrp6V/UtKkptS+DJ0nzx1sq8=\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffboulnois%2Fpg-scram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffboulnois%2Fpg-scram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffboulnois%2Fpg-scram/lists"}