54 lines
1.4 KiB
Markdown

# hash
This is a non-cryptographic hash (aka checksum) to verify data integrity.
## Installation
```shell
go get git.akyoto.dev/go/hash
```
## Usage
```go
sum := hash.Bytes(data)
```
You can use `strconv.FormatUint(sum, 16)` to get a string in hexadecimal format.
## Tests
```
PASS: TestTiny
PASS: TestZeroed
PASS: TestSameByte
PASS: TestDistribution
coverage: 100.0% of statements
```
## Benchmarks
```
BenchmarkSize/___8-12 290052092 4.157 ns/op
BenchmarkSize/__16-12 193105472 6.202 ns/op
BenchmarkSize/__17-12 147168594 8.195 ns/op
BenchmarkSize/__32-12 151655024 7.876 ns/op
BenchmarkSize/__33-12 123326216 9.781 ns/op
BenchmarkSize/__64-12 228098743 5.058 ns/op
BenchmarkSize/__65-12 177117915 6.780 ns/op
BenchmarkSize/_128-12 136319786 8.796 ns/op
BenchmarkSize/_256-12 58794831 20.53 ns/op
BenchmarkSize/_512-12 21937956 54.50 ns/op
BenchmarkSize/1024-12 8905921 134.9 ns/op
BenchmarkSize/2048-12 4063292 295.1 ns/op
BenchmarkSize/4096-12 1947091 617.6 ns/op
```
## License
Please see the [license documentation](https://akyoto.dev/license).
## Copyright
© 2023 Eduard Urbach