Skip to content

Commit 0229119

Browse files
authored
Update README to say CircleHash64f is stable
CircleHash64f is currently the default 64-bit hash for CircleHash64. Given the same input data and seed, CircleHash64f will produce the same digest in future versions.
1 parent 812959d commit 0229119

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

README.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,19 @@ CircleHash is a family of modern non-cryptographic hash functions.
2323

2424
CircleHash64 is a 64-bit hash with a 64-bit seed. It's fast, simple, and easy to audit. It uses fractional digits of **π** as default constants ([nothing up my sleeve](https://en.wikipedia.org/wiki/Nothing-up-my-sleeve_number)). It balances speed, digest quality, and maintainability.
2525

26-
CircleHash64 is based on [Google's Abseil C++ library](https://abseil.io/about/) internal hash. It passes every test in SMHasher (demerphq/smhasher, rurban/smhasher, and my stricter test suite). Tests passed include [Strict Avalanche Criterion](https://en.wikipedia.org/wiki/Avalanche_effect#Strict_avalanche_criterion), Bit Independence Criterion, and many others.
26+
CircleHash64 is based on [Google's Abseil C++ library](https://abseil.io/about/) internal hash. It passes 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.
27+
28+
Three CircleHash64 functions are currently used in production (on linux_amd64):
29+
30+
```Go
31+
func Hash64(b []byte, seed uint64) uint64
32+
func Hash64String(s string, seed uint64) uint64
33+
func Hash64Uint64x2(a uint64, b uint64, seed uint64) uint64
34+
```
35+
36+
ℹ️ 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).
37+
38+
## Comparisons
2739

2840
### Strict Avalanche Criterion (SAC)
2941

@@ -33,7 +45,7 @@ CircleHash64 is based on [Google's Abseil C++ library](https://abseil.io/about/)
3345

3446
☝️ Using demerphq/smhasher updated to test all input sizes 0-128 bytes (SAC test will take hours longer to run).
3547

36-
### Speed Comparison - Short Inputs and 64-bit Seed
48+
### Speed: Hash Short Inputs with 64-bit Seed
3749
| | CircleHash64 | XXH3 | XXH64 <br/>(w/o seed) | SipHash |
3850
|:-------------|:---:|:---:|:---:|:---:|
3951
| 4 bytes | 1.34 GB/s | 1.21 GB/s| 0.877 GB/s | 0.361 GB/s |
@@ -45,11 +57,9 @@ CircleHash64 is based on [Google's Abseil C++ library](https://abseil.io/about/)
4557
| 192 bytes | 14.2 GB/s | 9.86 GB/s | 9.71 GB/s | 2.17 GB/s |
4658
| 256 bytes | 15.0 GB/s | 8.19 GB/s | 10.2 GB/s | 2.22 GB/s |
4759

48-
- Using Go 1.17.7, darwin_amd64, i7-1068N7 CPU
60+
- Go 1.17.7, darwin_amd64, i7-1068N7 CPU.
4961
- Fastest XXH64 (written in Go+Assembly) doesn't support seed.
5062

51-
ℹ️ 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).
52-
5363
## Why CircleHash?
5464

5565
I 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 a 64-bit seed.
@@ -78,37 +88,33 @@ CircleHash64 is ideal for input sizes <= 512 bytes. Larger inputs can be hashed
7888

7989
For best results, it's better to run your own benchmarks on your own hardware with your most common data sizes.
8090

81-
Coming soon...
91+
Until detailed benchmarks are published, please view [Comparisons](README.md#Comparisons) for some preliminary results.
8292

8393
## Status
8494

8595
CircleHash64 is currently used in production on linux_amd64. Other platforms may work but they are not officially supported yet.
8696

87-
Idiomatic API is planned. There are 3 functions exported by the stop-gap API:
88-
89-
```Go
90-
func Hash64(b []byte, seed uint64) uint64
91-
func Hash64String(s string, seed uint64) uint64
92-
func Hash64Uint64x2(a uint64, b uint64, seed uint64) uint64
93-
```
94-
95-
Rather than port SMHasher and other test suites to Go, the C++ implementation is used for those tests.
96-
97+
The most important files are:
9798

9899
- circlehash64_ref.go -- reference implementation used by Go 1.16 and older versions.
99100
- circlehash64.go -- faster implementation used by Go 1.17 and newer versions.
100-
- circlehash64_test.go -- tests that verify digests with expected results for various input sizes using different seeds.
101+
- 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.
101102

103+
A more extensive and idiomatic API is being considered. However, currently exported CircleHash64 functions are unlikely to be affected.
104+
105+
CircleHash64fx has not yet been published because CircleHash64f (aka CircleHash64) is faster and there hasn't been a need.
102106

103107
## Release Policy
104108

105109
This project uses Semantic Versioning 2.0.
106110

107111
As 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.
108112

113+
CircleHash64f is stable. Given the same input data and seed, it will always produce the same digest in future versions.
114+
109115
## Contributing
110116

111-
If you would like to contribute to CircleHash, have a look at the [contributing guide](CONTRIBUTING.md).
117+
Please read [contributing guide](CONTRIBUTING.md) if you would like to contribute to CircleHash.
112118

113119
## Special Thanks and Credits
114120
- Go Team for making programming more fun and productive.

0 commit comments

Comments
 (0)