{"id":33930815,"url":"https://github.com/phayes/fdh-rs","last_synced_at":"2026-03-17T20:04:15.413Z","repository":{"id":52417837,"uuid":"175273175","full_name":"phayes/fdh-rs","owner":"phayes","description":"Full Domain Hash library for rust","archived":false,"fork":false,"pushed_at":"2021-09-13T14:16:46.000Z","size":553,"stargazers_count":3,"open_issues_count":4,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-02T10:52:56.250Z","etag":null,"topics":["blind-signatures","cryptography","full-domain-hash","hash"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phayes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"phayes","custom":"flattr.com/@phayes"}},"created_at":"2019-03-12T18:25:31.000Z","updated_at":"2021-11-07T18:51:04.000Z","dependencies_parsed_at":"2022-09-13T08:51:58.338Z","dependency_job_id":null,"html_url":"https://github.com/phayes/fdh-rs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/phayes/fdh-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phayes%2Ffdh-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phayes%2Ffdh-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phayes%2Ffdh-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phayes%2Ffdh-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phayes","download_url":"https://codeload.github.com/phayes/fdh-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phayes%2Ffdh-rs/sbom","scorecard":{"id":730748,"data":{"date":"2025-08-11","repo":{"name":"github.com/phayes/fdh-rs","commit":"6cefea3f4e2927bb063b393bd54c856793425f24"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/audit.yml:1","Warn: no topLevel permission defined: .github/workflows/cd.yml:1","Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/audit.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/audit.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/audit.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/audit.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cd.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/cd.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cd.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/cd.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cd.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/cd.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:64: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:75: update your workflow using https://app.stepsecurity.io/secureworkflow/phayes/fdh-rs/ci.yml/master?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of  12 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T14:20:36.527Z","repository_id":52417837,"created_at":"2025-08-22T14:20:36.532Z","updated_at":"2025-08-22T14:20:36.532Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30630037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["blind-signatures","cryptography","full-domain-hash","hash"],"created_at":"2025-12-12T12:12:34.344Z","updated_at":"2026-03-17T20:04:15.408Z","avatar_url":"https://github.com/phayes.png","language":"Rust","funding_links":["https://patreon.com/phayes","flattr.com/@phayes"],"categories":[],"sub_categories":[],"readme":"## Full Domain Hash\n\n[![checks](https://github.com/phayes/fdh-rs/workflows/checks/badge.svg)](https://github.com/phayes/fdh-rs/actions)\n[![codecov](https://codecov.io/gh/phayes/fdh-rs/branch/master/graph/badge.svg)](https://codecov.io/gh/phayes/fdh-rs)\n[![docs](https://docs.rs/fdh/badge.svg)](https://docs.rs/fdh)\n[![crates.io](https://meritbadge.herokuapp.com/fdh)](https://crates.io/crates/fdh)\n[![patreon](https://img.shields.io/badge/patreon-donate-green.svg)](https://patreon.com/phayes)\n[![flattr](https://img.shields.io/badge/flattr-donate-green.svg)](https://flattr.com/@phayes)\n\n\nA Full Domain Hash (FDH) is a useful cryptographic construction that limits the domain of the digest of a hash function (for example ensuring the digest is less than modulus `n` in RSA). Secondarily, it can also be used to extend the size of a hash digest to an arbitrary length, turning a regular hash function into an XOF hash function.\n\nWe construct an FDH by computing a number of cycles where:\n\n`cycles=(target length)/(digest length) + 1`\n\nWe then compute:\n\n`FDH(M) = HASH(M||0) || HASH(M||1) || ... || HASH(M||cycles−1)`\n\nWhere `HASH` is any hash function, `M` is the message, `||` denotes concatenation, and numerical values are single-byte `u8`.\n\nFDHs are usually used with an RSA signature scheme where the target length is the size of the key, and the domain is less than modulus `n`. See https://en.wikipedia.org/wiki/Full_Domain_Hash\n\nThis crate makes extensive use of the [`digest`](/digest) crate's cryptograhic hash traits, so most useful methods are implemented as part of `digest` traits. These traits are re-exported for convenience. See [https://github.com/RustCrypto/hashes](https://github.com/RustCrypto/hashes) for a list of compatible hashes.\n\nIt should be noted that FDH is not constant-time in relation to the message. While the variable-time natue of a FDH cannot be used to recover the message (except in pathological cases), it can be used to eliminate certain values from the set of all possible values for the message.\n\n## Example\n\n```rust\n  use sha2::Sha256;\n  use fdh::{FullDomainHash, VariableOutput, Input};\n\n  // Expand SHA256 from 256 bits to 1024 bits.\n  let output_bits = 1024;\n  let output_bytes = 1024 / 8;\n  let mut hasher = FullDomainHash::\u003cSha256\u003e::new(output_bytes)?;\n  hasher.input(b\"ATTACK AT DAWN\");\n  let result = hasher.vec_result();\n```\n\n## `no_std`\n\nThis crate also supports `no_std`, so it can be used in embedded or other settings with no allocation.\n\n```rust\n#![no_std]\nuse sha2::Sha256;\nuse fdh::{FullDomainHash, Input, ExtendableOutput, XofReader};\n\n// Expand SHA256 from 256 bits to 512 bits (and beyond!), reading it in 16 byte chunks.\nlet mut hasher = FullDomainHash::\u003cSha256\u003e::default();\nhasher.input(b\"ATTACK AT DAWN\");\nlet mut reader = hasher.xof_result();\nlet mut read_buf = \u003c[u8; 16]\u003e::default();\n\n// Read the first 16 bytes into read_buf\nreader.read(\u0026mut read_buf);\n\n// Read the second 16 bytes into read_buf\nreader.read(\u0026mut read_buf);\n\n// If we want, we can just keep going, reading as many bits as we want indefinitely.\nreader.read(\u0026mut read_buf);\nreader.read(\u0026mut read_buf);\n```\n\n## Restricted Domain\n\nThis crate also supports getting a digest that is within a specific domain. It follows an algorithim like so:\n\n```\nfn digest_in_domain(message, iv):\n    digest = fdh(message, iv)\n    while not in_domain(digest):\n        iv++\n        digest = fdh(message, iv)\n    return digest, iv\n```\n\nThe method `results_in_domain()` is provided to accomplish this. The helper methods `results_between()`, `results_lt()`, `results_gt()` are provided for the common case where the digest must be in a certain range.\n\nAn example that produces a digest that is odd:\n\n```rust\nuse sha2::Sha512;\nuse fdh::{FullDomainHash, Input, VariableOutput};\nuse num_bigint::BigUint;\nuse num_integer::Integer;\n\n// Get a full domain hash that is odd\nlet mut hasher = FullDomainHash::\u003cSha512\u003e::new(64).unwrap();\nhasher.input(b\"ATTACKATDAWN\");\n\nfn digest_is_odd(digest: \u0026[u8]) -\u003e bool {\n    BigUint::from_bytes_be(digest).is_odd()\n}\nlet iv = 0;\n\nlet (digest, iv) = hasher.results_in_domain(iv, digest_is_odd).unwrap();\n```\n\n ## Contributors\n \n 1. Patrick Hayes ([linkedin](https://www.linkedin.com/in/patrickdhayes/)) ([github](https://github.com/phayes)) - Available for hire.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphayes%2Ffdh-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphayes%2Ffdh-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphayes%2Ffdh-rs/lists"}