{"id":39461589,"url":"https://github.com/tfpf/hash-drbg","last_synced_at":"2026-01-18T04:43:42.529Z","repository":{"id":176530543,"uuid":"658306579","full_name":"tfpf/hash-drbg","owner":"tfpf","description":"Cryptographically secure pseudorandom number generator for C, C++ and Python with global-state (thread-unsafe) and thread-safe variants, implementing NIST SP 800-90A. Provided as an installable package.","archived":false,"fork":false,"pushed_at":"2024-04-25T20:16:13.000Z","size":227,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-26T18:53:53.579Z","etag":null,"topics":["cryptographically-secure","cryptographically-secure-random","csprng","drbg","global-state","hash-drbg","nist800-90a","sha256","thread-safe"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tfpf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null}},"created_at":"2023-06-25T11:21:03.000Z","updated_at":"2024-04-25T20:16:13.000Z","dependencies_parsed_at":"2023-09-26T11:08:57.002Z","dependency_job_id":null,"html_url":"https://github.com/tfpf/hash-drbg","commit_stats":null,"previous_names":["tfpf/hash-drbg"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/tfpf/hash-drbg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfpf%2Fhash-drbg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfpf%2Fhash-drbg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfpf%2Fhash-drbg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfpf%2Fhash-drbg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tfpf","download_url":"https://codeload.github.com/tfpf/hash-drbg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfpf%2Fhash-drbg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28530068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"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":["cryptographically-secure","cryptographically-secure-random","csprng","drbg","global-state","hash-drbg","nist800-90a","sha256","thread-safe"],"created_at":"2026-01-18T04:43:41.903Z","updated_at":"2026-01-18T04:43:42.522Z","avatar_url":"https://github.com/tfpf.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"* Elaine Barker and John Kelsey (2015) \"Recommendation for Random Number Generation Using Deterministic Random Bit\n  Generators\". NIST SP 800-90A Rev. 1, doi:10.6028/NIST.SP.800-90Ar1.\n* Elaine Barker (2020) \"Recommendation for Key Management: Part 1 – General\". NIST SP 800-57 Part 1 Rev. 5,\n  doi:10.6028/NIST.SP.800-57pt1r5.\n* National Institute of Standards and Technology (2015) \"Secure Hash Standard\". FIPS PUB 180-4,\n  doi:10.6028/NIST.FIPS.180-4.\n\n# Hash Deterministic Random Bit Generator (HDRBG): Cryptographically Secure Pseudorandom Number Generator\nThis package provides a cryptographically secure pseudorandom number generator for C, C++ and Python. It is mostly\ncompliant with the specification given in NIST SP 800-90A.\n\nSee [`doc`](doc) for the documentation of this package. [`examples`](examples) contains usage examples. For performance\nanalysis, go to [`benchmarks`](benchmarks).\n\n## Installation Requirements\nThese are the versions I have tested the installation with. Older versions may also work. You may not need all of\nthese, depending on how and what you are installing\n* CMake ≥ 3.22\n* CPython ≥ 3.8 and its C headers and library\n* cURL ≥ 7.68.0\n* GCC ≥ 9.4.0 or Clang ≥ 12.0.0\n* Git ≥ 2.30.2\n* GNU Make ≥ 4.2.1\n* pip ≥ 23.0\n* pkg-config ≥ 0.29.2 or pkgconf ≥ 1.8.0\n\nOn Windows, these are available natively via [MSYS2](https://www.msys2.org) (not recommended) and\n[Cygwin](https://www.cygwin.com), and in a Linux environment via\n[WSL](https://learn.microsoft.com/en-us/windows/wsl/about). On macOS, they can be installed using\n[Homebrew](https://brew.sh); however, their Apple-specific variants provided by\n[Xcode](https://apps.apple.com/app/xcode/id497799835) should also be fine.\n\n## Troubleshooting Information\nInstalling directly on Windows is a massive headache. MSVC adds some unnecessary flags which are incompatible with\noptimisation flags, so the program does not compile. Its concurrency library doesn't properly implement atomic data\ntypes, and isn't standard-compliant. Further, Windows does not provide a random device. That is why I suggest MSYS2 and\nCygwin. If installation fails for you, check the [workflows](.github/workflows) to see how I got it working.\n\n![cygwin](https://github.com/tfpf/hash-drbg/actions/workflows/cygwin.yml/badge.svg)\n![unix](https://github.com/tfpf/hash-drbg/actions/workflows/unix.yml/badge.svg)\n\n## Install for C (and C++)\n```shell\ncurl https://raw.githubusercontent.com/tfpf/hash-drbg/main/run.sh | sh\n```\nor\n```shell\ngit clone https://github.com/tfpf/hash-drbg.git\ncd hash-drbg\n./run.sh\n```\n\nNext, set `LD_LIBRARY_PATH` and `PKG_CONFIG_PATH`.\n```shell\nexport LD_LIBRARY_PATH=/usr/local/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\nexport PKG_CONFIG_PATH=/usr/local/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}\n```\n\n### Quick Start\nPut the following code in a file `example.c`:\n```C\n#include \u003chdrbg.h\u003e\n#include \u003cstdio.h\u003e\n\nint\nmain(void)\n{\n    hdrbg_init(0);\n    for (int i = 0; i \u003c 10; ++i)\n    {\n        long long unsigned r = hdrbg_rand(NULL);\n        printf(\"%llu\\n\", r);\n    }\n}\n```\ncompile it with\n```\ngcc example.c -o example $(pkg-config --cflags --libs hdrbg)\n```\nand run it using\n```sh\n./example\n```\nto see some random numbers.\n\n## Install for Python\n```shell\npip install git+https://github.com/tfpf/hash-drbg.git\n```\nor\n```shell\ngit clone https://github.com/tfpf/hash-drbg.git\ncd hash-drbg\npip install .\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftfpf%2Fhash-drbg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftfpf%2Fhash-drbg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftfpf%2Fhash-drbg/lists"}