Cleanup
This commit is contained in:
parent
30c46352b0
commit
9bbff2e6ed
@ -1,9 +0,0 @@
|
|||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = false
|
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,9 +1,7 @@
|
|||||||
*
|
*
|
||||||
!*/
|
!*/
|
||||||
!.gitignore
|
|
||||||
!.editorconfig
|
|
||||||
!go.sum
|
|
||||||
!go.mod
|
|
||||||
!README.md
|
|
||||||
!LICENSE
|
|
||||||
!*.go
|
!*.go
|
||||||
|
!*.mod
|
||||||
|
!*.sum
|
||||||
|
!*.md
|
||||||
|
!.gitignore
|
||||||
|
@ -8,7 +8,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func BenchmarkSize(b *testing.B) {
|
func BenchmarkSize(b *testing.B) {
|
||||||
b.Run(" 7", bench(7))
|
|
||||||
b.Run(" 8", bench(8))
|
b.Run(" 8", bench(8))
|
||||||
b.Run(" 16", bench(16))
|
b.Run(" 16", bench(16))
|
||||||
b.Run(" 17", bench(17))
|
b.Run(" 17", bench(17))
|
||||||
|
9
LICENSE
9
LICENSE
@ -1,9 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2023 Eduard Urbach
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27
README.md
27
README.md
@ -2,7 +2,13 @@
|
|||||||
|
|
||||||
This is a non-cryptographic hash (aka checksum) to verify data integrity.
|
This is a non-cryptographic hash (aka checksum) to verify data integrity.
|
||||||
|
|
||||||
## API
|
## Installation
|
||||||
|
|
||||||
|
```shell
|
||||||
|
go get git.akyoto.dev/go/hash
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
```go
|
```go
|
||||||
sum := hash.Bytes(data)
|
sum := hash.Bytes(data)
|
||||||
@ -10,10 +16,19 @@ sum := hash.Bytes(data)
|
|||||||
|
|
||||||
You can use `strconv.FormatUint(sum, 16)` to get a string in hexadecimal format.
|
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
|
## Benchmarks
|
||||||
|
|
||||||
```
|
```
|
||||||
BenchmarkSize/___7-12 144845362 8.282 ns/op
|
|
||||||
BenchmarkSize/___8-12 318401613 3.779 ns/op
|
BenchmarkSize/___8-12 318401613 3.779 ns/op
|
||||||
BenchmarkSize/__16-12 273568264 4.400 ns/op
|
BenchmarkSize/__16-12 273568264 4.400 ns/op
|
||||||
BenchmarkSize/__17-12 222336567 5.425 ns/op
|
BenchmarkSize/__17-12 222336567 5.425 ns/op
|
||||||
@ -28,3 +43,11 @@ BenchmarkSize/1024-12 8913499 134.5 ns/op
|
|||||||
BenchmarkSize/2048-12 4074927 294.5 ns/op
|
BenchmarkSize/2048-12 4074927 294.5 ns/op
|
||||||
BenchmarkSize/4096-12 1952067 625.4 ns/op
|
BenchmarkSize/4096-12 1952067 625.4 ns/op
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Please see the [license documentation](https://akyoto.dev/license).
|
||||||
|
|
||||||
|
## Copyright
|
||||||
|
|
||||||
|
© 2023 Eduard Urbach
|
||||||
|
Loading…
Reference in New Issue
Block a user