-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add blake2b hashing algorithm #5926
Conversation
SHA3_512 HashType = "sha3_512" | ||
SHA512 HashType = "sha512" | ||
SHA512_224 HashType = "sha512_224" | ||
SHA512_256 HashType = "sha512_256" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use ALL_CAPS in Go names; use CamelCase
SHA3_384 HashType = "sha3_384" | ||
SHA3_512 HashType = "sha3_512" | ||
SHA512 HashType = "sha512" | ||
SHA512_224 HashType = "sha512_224" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use ALL_CAPS in Go names; use CamelCase
SHA3_224 HashType = "sha3_224" | ||
SHA3_256 HashType = "sha3_256" | ||
SHA3_384 HashType = "sha3_384" | ||
SHA3_512 HashType = "sha3_512" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use ALL_CAPS in Go names; use CamelCase
SHA384 HashType = "sha384" | ||
SHA3_224 HashType = "sha3_224" | ||
SHA3_256 HashType = "sha3_256" | ||
SHA3_384 HashType = "sha3_384" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use ALL_CAPS in Go names; use CamelCase
SHA256 HashType = "sha256" | ||
SHA384 HashType = "sha384" | ||
SHA3_224 HashType = "sha3_224" | ||
SHA3_256 HashType = "sha3_256" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use ALL_CAPS in Go names; use CamelCase
func HashAddBlake2b384(builder *flatbuffers.Builder, blake2b384 flatbuffers.UOffsetT) { | ||
builder.PrependUOffsetTSlot(13, flatbuffers.UOffsetT(blake2b384), 0) | ||
} | ||
func HashStartBlake2b384Vector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported function HashStartBlake2b384Vector should have comment or be unexported
func HashStartBlake2b256Vector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { | ||
return builder.StartVector(1, numElems, 1) | ||
} | ||
func HashAddBlake2b384(builder *flatbuffers.Builder, blake2b384 flatbuffers.UOffsetT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported function HashAddBlake2b384 should have comment or be unexported
func HashAddBlake2b256(builder *flatbuffers.Builder, blake2b256 flatbuffers.UOffsetT) { | ||
builder.PrependUOffsetTSlot(12, flatbuffers.UOffsetT(blake2b256), 0) | ||
} | ||
func HashStartBlake2b256Vector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported function HashStartBlake2b256Vector should have comment or be unexported
@@ -305,6 +356,24 @@ func HashAddSha3512(builder *flatbuffers.Builder, sha3512 flatbuffers.UOffsetT) | |||
func HashStartSha3512Vector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { | |||
return builder.StartVector(1, numElems, 1) | |||
} | |||
func HashAddBlake2b256(builder *flatbuffers.Builder, blake2b256 flatbuffers.UOffsetT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported function HashAddBlake2b256 should have comment or be unexported
return 0 | ||
} | ||
|
||
func (rcv *Hash) Blake2b512Length() int { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method Hash.Blake2b512Length should have comment or be unexported
All of the Hound comments are on generated code. |
SHA3_256: mustDecodeHex("3cb5385a2987ca45888d7877fbcf92b4854f7155ae19c96cecc7ea1300c6f5a4"), | ||
SHA3_384: mustDecodeHex("f19539818b4f29fa0ee599db4113fd81b77cd1119682e6d799a052849d2e40ef0dad84bc947ba2dee742d9731f1b9e9b"), | ||
SHA3_512: mustDecodeHex("f0a2c0f9090c1fd6dedf211192e36a6668d2b3c7f57a35419acb1c4fc7dfffc267bbcd90f5f38676caddcab652f6aacd1ed4e0ad0a8e1e4b98f890b62b6c7c5c"), | ||
BLAKE2B_256: mustDecodeHex("0f0cc1f0ea4ef962d6a150ae0b77bc320b57ed24e1609b933fa2274484f59145"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new values were computed with pyblake2.
f53f205
to
98915b9
Compare
Allow BLAKE2b as a file hashing algorithm (https://blake2.net/). In my benchmarks it is quite fast. | Hash Algorithm | Time per 100 MiB File (ns) | MiB / sec | |---------------------------------|----------------------------|-------------| | BenchmarkHashFile/blake2b_256-8 | 127116193 | 786.6818353 | | BenchmarkHashFile/blake2b_512-8 | 127239979 | 785.9165082 | | BenchmarkHashFile/blake2b_384-8 | 129671956 | 771.1767686 | | BenchmarkHashFile/sha1-8 | 131347484 | 761.3392884 | | BenchmarkHashFile/md5-8 | 170146968 | 587.7271936 | | BenchmarkHashFile/sha512-8 | 200803749 | 497.9986703 | | BenchmarkHashFile/sha384-8 | 201153073 | 497.1338419 | | BenchmarkHashFile/sha512_224-8 | 201987854 | 495.0792734 | | BenchmarkHashFile/sha512_256-8 | 202126889 | 494.7387282 | | BenchmarkHashFile/sha256-8 | 297884549 | 335.7005267 | | BenchmarkHashFile/sha224-8 | 299384125 | 334.0190466 | | BenchmarkHashFile/sha3_224-8 | 335496603 | 298.0656111 | | BenchmarkHashFile/sha3_256-8 | 352318502 | 283.834086 | | BenchmarkHashFile/sha3_384-8 | 461460154 | 216.7034339 | | BenchmarkHashFile/sha3_512-8 | 651817080 | 153.4172747 |
98915b9
to
7abe013
Compare
return 0 | ||
} | ||
|
||
func (rcv *Hash) Blake2b512(j int) int8 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method Hash.Blake2b512 should have comment or be unexported
return 0 | ||
} | ||
|
||
func (rcv *Hash) Blake2b384Length() int { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method Hash.Blake2b384Length should have comment or be unexported
return 0 | ||
} | ||
|
||
func (rcv *Hash) Blake2b384(j int) int8 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method Hash.Blake2b384 should have comment or be unexported
return 0 | ||
} | ||
|
||
func (rcv *Hash) Blake2b256Length() int { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method Hash.Blake2b256Length should have comment or be unexported
@@ -230,8 +230,59 @@ func (rcv *Hash) Sha3512Length() int { | |||
return 0 | |||
} | |||
|
|||
func (rcv *Hash) Blake2b256(j int) int8 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method Hash.Blake2b256 should have comment or be unexported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Allow BLAKE2b as a file hashing algorithm (https://blake2.net/). In my benchmarks
it is quite fast.