WIP: Tillich-Zémor hashing golang implementation
Find a file
Vitaliy Potyarkin ac8eb3da71 [#10] Stop using obsolete .github directory
This commit is a part of multi-repo cleanup effort:
TrueCloudLab/frostfs-infra#136

Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2024-11-06 15:39:01 +03:00
cmd Rename package name 2023-03-07 13:47:29 +03:00
gf127 [#7] pre-commit: Add golangci-lint hook 2023-03-09 23:00:06 +03:00
tz Rename package name 2023-03-07 13:47:29 +03:00
.gitignore [#3] Simplify Makefile 2023-02-13 15:16:25 +03:00
.gitlint [#7] pre-commit: Add gitlint hook 2023-03-09 23:00:06 +03:00
.pre-commit-config.yaml [#7] pre-commit: Add gitlint hook 2023-03-09 23:00:06 +03:00
benchmark.sh [#3] Simplify demo and benchmark 2023-02-13 15:16:25 +03:00
CODEOWNERS [#10] Stop using obsolete .github directory 2024-11-06 15:39:01 +03:00
CONTRIBUTING.md [#10] Stop using obsolete .github directory 2024-11-06 15:39:01 +03:00
demo.sh [#3] Simplify demo and benchmark 2023-02-13 15:16:25 +03:00
Dockerfile Update alpine image, fixup for Makefile, fixup for benchmark 2020-01-16 11:30:46 +03:00
go.mod Rename package name 2023-03-07 13:47:29 +03:00
go.sum go.mod: update dependencies 2022-01-24 13:58:13 +03:00
help.mk [#3] Simplify Makefile 2023-02-13 15:16:25 +03:00
LICENSE [#3] Change license to Apache 2.0 2023-02-13 15:16:25 +03:00
Makefile [#7] pre-commit: Add initial configuration 2023-03-09 23:00:06 +03:00
README.md [#3] Change license to Apache 2.0 2023-02-13 15:16:25 +03:00

Demo

asciicast

In project root:

$ make
...
$ ./demo.sh

Homomorphic hashing in golang

Package tz contains pure-Go (with some Assembly) implementation of hashing function described by Tillich and Zémor.

There are existing implementations already, however they are written in C.

Package gf127 contains arithmetic in GF(2^127) with x^127+x^63+1 as reduction polynomial.

Description

TZ Hash can be used instead of Merkle-tree for data-validation, because homomorphic hashes are concatenable: hash sum of data can be calculated based on hashes of chunks.

The example of how it works can be seen in tests and demo.

Benchmarks

go vs AVX vs AVX2 version

BenchmarkSum/AVX_digest-8             308       3889484 ns/op          25.71 MB/s         5 allocs/op
BenchmarkSum/AVXInline_digest-8       457       2455437 ns/op          40.73 MB/s         5 allocs/op
BenchmarkSum/AVX2_digest-8            399       3031102 ns/op          32.99 MB/s         3 allocs/op
BenchmarkSum/AVX2Inline_digest-8      602       2077719 ns/op          48.13 MB/s         3 allocs/op
BenchmarkSum/PureGo_digest-8           68       17795480 ns/op          5.62 MB/s         5 allocs/op

Makefile

  Usage:

    make <target>

  Targets:

    all       Just `make` will build all possible binaries
    clean     Print version
    dep       Pull go dependencies
    help      Show this help prompt
    test      Run Unit Test with go test
    version   Print version

Contributing

Feel free to contribute to this project after reading the contributing guidelines.

Before starting to work on a certain topic, create a new issue first, describing the feature/topic you are going to implement.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details

References