{"id":19619690,"url":"https://github.com/fxamacker/circlehash","last_synced_at":"2025-09-03T05:37:03.226Z","repository":{"id":40307914,"uuid":"411522549","full_name":"fxamacker/circlehash","owner":"fxamacker","description":"CircleHash is a family of fast hashes -- CircleHash64f is ideal for short inputs, reaching 10GB/s starting at \u003c64 bytes and 15GB/s at 256 bytes (i7-1068NG7)","archived":false,"fork":false,"pushed_at":"2025-08-30T12:43:36.000Z","size":255,"stargazers_count":22,"open_issues_count":6,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-30T14:35:43.703Z","etag":null,"topics":["go","golang","hash","hash-table","map-hash","smhasher"],"latest_commit_sha":null,"homepage":"","language":"Go","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/fxamacker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-09-29T03:53:57.000Z","updated_at":"2025-08-24T14:32:18.000Z","dependencies_parsed_at":"2022-08-09T16:53:00.386Z","dependency_job_id":"9df208b9-a0b2-4974-9b1b-ac6ca7314f6d","html_url":"https://github.com/fxamacker/circlehash","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/fxamacker/circlehash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxamacker%2Fcirclehash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxamacker%2Fcirclehash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxamacker%2Fcirclehash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxamacker%2Fcirclehash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fxamacker","download_url":"https://codeload.github.com/fxamacker/circlehash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxamacker%2Fcirclehash/sbom","scorecard":{"id":167994,"data":{"date":"2025-08-11","repo":{"name":"github.com/fxamacker/circlehash","commit":"068356074900e76a65628a0f467151a306975173"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":8.8,"checks":[{"name":"Code-Review","score":-1,"reason":"Found no human activity in the last 16 changesets","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":"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":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"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":"Maintained","score":10,"reason":"12 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"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":"Pinned-Dependencies","score":10,"reason":"all dependencies are pinned","details":["Info:  12 out of  12 GitHub-owned GitHubAction dependencies pinned","Info:   3 out of   3 goCommand 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":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/ci-go-cover.yml:39","Info: jobLevel 'contents' permission set to 'read': .github/workflows/ci.yml:26","Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:23","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:24","Info: jobLevel 'contents' permission set to 'read': .github/workflows/govulncheck.yml:28","Info: jobLevel 'contents' permission set to 'read': .github/workflows/safer-golangci-lint.yml:36","Info: found token with 'none' permissions: .github/workflows/ci-go-cover.yml:1","Info: found token with 'none' permissions: .github/workflows/ci.yml:1","Info: found token with 'none' permissions: .github/workflows/codeql-analysis.yml:1","Info: found token with 'none' permissions: .github/workflows/govulncheck.yml:1","Info: found token with 'none' permissions: .github/workflows/safer-golangci-lint.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":"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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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"}},{"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":"SAST","score":10,"reason":"SAST tool is run on all commits","details":["Info: SAST configuration detected: CodeQL","Info: all commits (30) are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T15:28:13.916Z","repository_id":40307914,"created_at":"2025-08-16T15:28:13.916Z","updated_at":"2025-08-16T15:28:13.916Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272864534,"owners_count":25006033,"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-08-30T02:00:09.474Z","response_time":77,"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":["go","golang","hash","hash-table","map-hash","smhasher"],"created_at":"2024-11-11T11:14:41.386Z","updated_at":"2025-09-03T05:37:03.180Z","avatar_url":"https://github.com/fxamacker.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg height=\"120\" src=\"https://user-images.githubusercontent.com/33205765/158502446-f96d007e-2b58-46af-88a0-895a475af958.png\" /\u003e\n\u003cp/\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/fxamacker/circlehash/actions?query=workflow%3ACI\"\u003e\n    \u003cimg src=\"https://github.com/fxamacker/circlehash/workflows/CI/badge.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/fxamacker/circlehash/actions?query=workflow%3Alinters\"\u003e\n    \u003cimg src=\"https://github.com/fxamacker/circlehash/workflows/linters/badge.svg\" /\u003e\n  \u003c/a\u003e \n  \u003ca href=\"https://github.com/fxamacker/circlehash/actions/workflows/codeql-analysis.yml\"\u003e\n    \u003cimg src=\"https://github.com/fxamacker/circlehash/actions/workflows/codeql-analysis.yml/badge.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/fxamacker/circlehash/actions?query=workflow%3A%22cover+100%25%22\"\u003e\n    \u003cimg src=\"https://github.com/fxamacker/circlehash/workflows/cover%20100%25/badge.svg\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# CircleHash\n\nCircleHash is a family of modern non-cryptographic hash functions.\n\nCircleHash64fx is a 64-bit hash with a 128-bit seed.  It's fast, simple, and easy to audit.  By default, it uses fractional digits of **π** as constants ([nothing up my sleeve](https://en.wikipedia.org/wiki/Nothing-up-my-sleeve_number)).  It balances speed, digest quality, and maintainability.\n\nCircleHash64fx is inspired by [Google's Abseil C++ library](https://abseil.io/about/) internal hash.  They pass every test in SMHasher (demerphq/smhasher, rurban/smhasher, and my stricter test suite).  Tests passed include Bit Independence Criterion, [Strict Avalanche Criterion](https://en.wikipedia.org/wiki/Avalanche_effect#Strict_avalanche_criterion), etc.\n\nCircleHash64 comes in two flavors:\n\n- 🛡️ **CircleHash64fx** supports 128-bit seed and shields against losing accumulated state from potential multiplication by zero. It's a bit slower than CircleHash64f but remains among the fastest for short inputs.\n\n- 🚀 **CircleHash64f** supports 64-bit seed like Abseil LTS 20210324.2.  By default, CircleHash64f uses two different 64-bit constants rather than using the same 64-bit constant twice at finalization.\n\nCircleHash64fx will be replacing CircleHash64f as the default hash.\n\nThree CircleHash64f functions are currently used in production (on linux_amd64):\n\n```Go\nfunc Hash64(b []byte, seed uint64) uint64\nfunc Hash64String(s string, seed uint64) uint64\nfunc Hash64Uint64x2(a uint64, b uint64, seed uint64) uint64 \n```\n\nℹ️ Non-cryptographic hashes should only be used in software designed to properly handle hash collisions.  If you require a secure hash, please use a cryptographic hash (like the ones in SHA-3 standard).\n\n## Comparisons\n\n### Strict Avalanche Criterion (SAC)\n\n|                | CircleHash64f | Abseil C++ | SipHash-2-4 | xxh64 |\n| :---           | :---:         | :---:  | :---: | :---: |\n| SAC worst-bit \u003cbr/\u003e 0-128 byte inputs \u003cbr/\u003e (lower % is better) | 0.791% 🥇 \u003cbr/\u003e w/ 99 bytes | 0.862% \u003cbr/\u003e w/ 67 bytes | 0.802% \u003cbr/\u003e w/ 75 \u0026 117 bytes | 0.817% \u003cbr/\u003e w/ 84 bytes |\n\n☝️ Using demerphq/smhasher updated to test all input sizes 0-128 bytes (SAC test will take hours longer to run).\n\n### Speed: Hash Short Inputs with 64-bit Seed\n|              | CircleHash64f | XXH3 | XXH64 \u003cbr/\u003e(w/o seed) | SipHash |\n|:-------------|:---:|:---:|:---:|:---:|\n| 4 bytes | 1.34 GB/s | 1.21 GB/s| 0.877 GB/s | 0.361 GB/s |\n| 8 bytes | 2.70 GB/s | 2.41 GB/s | 1.68 GB/s | 0.642 GB/s |\n| 16 bytes | 5.48 GB/s | 5.21 GB/s | 2.94 GB/s | 1.03 GB/s |\n| 32 bytes | 8.01 GB/s | 7.08 GB/s | 3.33 GB/s | 1.46 GB/s |\n| 64 bytes | 10.3 GB/s | 9.33 GB/s | 5.47 GB/s | 1.83 GB/s |\n| 128 bytes | 12.8 GB/s | 11.6 GB/s | 8.22 GB/s | 2.09 GB/s |\n| 192 bytes | 14.2 GB/s | 9.86 GB/s | 9.71 GB/s | 2.17 GB/s |\n| 256 bytes | 15.0 GB/s | 8.19 GB/s | 10.2 GB/s | 2.22 GB/s |\n\n- Go 1.17.7, darwin_amd64, i7-1068N7 CPU.\n- Fastest XXH64 (written in Go+Assembly) doesn't support seed.\n\n## Why CircleHash?\n\nI wanted a fast, maintainable, and easy-to-audit 64-bit hash function that's free of backdoors and bugs.  It needed to be very fast at hashing short inputs with at least a 64-bit seed.\n\nIt also needed to pass all tests in demerphq/smhasher, rurban/smhasher, and my test suite.  It was important to have sufficiently explained choice of default constants and avoid over-optimizations that increased complexity to the point of harming maintainability.\n\n## CircleHash Design\n\nI didn't want to reinvent the wheel.  After testing and evaluating existing hashes, I chose a slightly more conservative design than Go 1.17 internal hash and wyhash_final3 variants.  CircleHash64f is based primarily on [Abseil's](https://abseil.io/about/) internal hash (which was based on an older wyhash). CircleHash64fx is a larger departure from the original design and has support for 128-bit seeds plus other improvements.\n\n\u003e Abseil is an open source collection of C++ libraries drawn from the most fundamental pieces of Google’s internal codebase. These libraries are the nuts-and-bolts that underpin almost everything Google runs. [...] Abseil encompasses the most basic building blocks of Google’s codebase: code that is production-tested and will be fully maintained for years to come.\n\nCircleHash64 currently uses CircleHash64f by default with 64-bit seeds.  Default hash will switch to CircleHash64fx which supports 128-bit seeds plus other improvements.\n\n## Benchmarks\n\nCircleHash64 is ideal for input sizes \u003c= 512 bytes.  Larger inputs can be hashed faster using other CircleHash designs (not yet published).\n\nFor best results, it's better to run your own benchmarks on your own hardware with your most common data sizes.\n\nUntil detailed benchmarks are published, please view [Comparisons](README.md#Comparisons) for some preliminary results.\n\n## Status\n\nCircleHash64 is currently used in production on linux_amd64.  Other platforms may work but they are not officially supported yet.\n\nThe most important files are:\n\n- circlehash64_ref.go -- reference implementation used by Go 1.16 and older versions.\n- circlehash64.go -- faster implementation used by Go 1.17 and newer versions.\n- circlehash64_test.go -- tests that verify digests with expected results for various input sizes using different seeds.  Rather than port SMHasher and other test suites to Go, the C++ implementation is used for those additional tests.\n\nCircleHash64fx will replace CircleHash64f as the default hash.  CircleHash64fx supports 128-bit seeds and will include other improvements such as idiomatic and full-featured API.\n\n## Release Policy\n\nThis project uses Semantic Versioning 2.0.  \n\nAs an exception, some variants of CircleHash may be declared stable before this repo reaches v1.0.  I.e. given the same input data, the hash function will always produce the same digest.  Such declarations will be noted in the README and applicable release notes.\n\nCircleHash64f will be replaced by CircleHash64fx as the default CircleHash64.\n\n## Contributing\n\nPlease read [contributing guide](CONTRIBUTING.md) if you would like to contribute to CircleHash.\n\n## Acknowledgments\n  - There are at least two people I would like to acknowledge (after I improve this repo).\n  - Go Team for making programming more fun and productive.\n  - Abseil team for producing some of the best and cleanest C++ code I've ever seen.\n  - Reini Urban and Yves Orton for publishing their SMHasher improvements in rurban/smhasher and demerphq/smhasher.\n  - Montgomery Edwards⁴⁴⁸ for proof-reading my draft README and offering helpful suggestions.\n\n## License\n\nThe CircleHash library is licensed under the terms of the Apache license. See [LICENSE](LICENSE) for more information.\n\nCopyright © 2021-2022 Faye Amacker.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffxamacker%2Fcirclehash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffxamacker%2Fcirclehash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffxamacker%2Fcirclehash/lists"}