You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: README.md
+24-18Lines changed: 24 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,19 @@ CircleHash is a family of modern non-cryptographic hash functions.
23
23
24
24
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.
25
25
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
+
funcHash64(b []byte, seeduint64) 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
27
39
28
40
### Strict Avalanche Criterion (SAC)
29
41
@@ -33,7 +45,7 @@ CircleHash64 is based on [Google's Abseil C++ library](https://abseil.io/about/)
33
45
34
46
☝️ Using demerphq/smhasher updated to test all input sizes 0-128 bytes (SAC test will take hours longer to run).
35
47
36
-
### Speed Comparison - Short Inputs and 64-bit Seed
- Fastest XXH64 (written in Go+Assembly) doesn't support seed.
50
62
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
-
53
63
## Why CircleHash?
54
64
55
65
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
78
88
79
89
For best results, it's better to run your own benchmarks on your own hardware with your most common data sizes.
80
90
81
-
Coming soon...
91
+
Until detailed benchmarks are published, please view [Comparisons](README.md#Comparisons) for some preliminary results.
82
92
83
93
## Status
84
94
85
95
CircleHash64 is currently used in production on linux_amd64. Other platforms may work but they are not officially supported yet.
86
96
87
-
Idiomatic API is planned. There are 3 functions exported by the stop-gap API:
88
-
89
-
```Go
90
-
funcHash64(b []byte, seeduint64) 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:
97
98
98
99
- circlehash64_ref.go -- reference implementation used by Go 1.16 and older versions.
99
100
- 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.
101
102
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.
102
106
103
107
## Release Policy
104
108
105
109
This project uses Semantic Versioning 2.0.
106
110
107
111
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.
108
112
113
+
CircleHash64f is stable. Given the same input data and seed, it will always produce the same digest in future versions.
114
+
109
115
## Contributing
110
116
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.
112
118
113
119
## Special Thanks and Credits
114
120
- Go Team for making programming more fun and productive.
0 commit comments