-
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
[Auditbeat] Add XXH64 File Integrity Checks (#6626) #7311
Conversation
func HashAddXx64(builder *flatbuffers.Builder, xx64 flatbuffers.UOffsetT) { | ||
builder.PrependUOffsetTSlot(15, flatbuffers.UOffsetT(xx64), 0) | ||
} | ||
func HashStartXx64Vector(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 HashStartXx64Vector should have comment or be unexported
@@ -374,6 +391,12 @@ func HashAddBlake2b512(builder *flatbuffers.Builder, blake2b512 flatbuffers.UOff | |||
func HashStartBlake2b512Vector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { | |||
return builder.StartVector(1, numElems, 1) | |||
} | |||
func HashAddXx64(builder *flatbuffers.Builder, xx64 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 HashAddXx64 should have comment or be unexported
return 0 | ||
} | ||
|
||
func (rcv *Hash) Xx64Length() 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.Xx64Length should have comment or be unexported
@@ -281,8 +281,25 @@ func (rcv *Hash) Blake2b512Length() int { | |||
return 0 | |||
} | |||
|
|||
func (rcv *Hash) Xx64(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.Xx64 should have comment or be unexported
c3d98fb
to
f6094bf
Compare
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.
Can you also add an entry to the CHANGELOG.asciidoc file, please.
Overall looks good. Just a few redlines. Thanks for adding it.
@@ -172,6 +172,7 @@ func TestHashFile(t *testing.T) { | |||
SHA3_256: mustDecodeHex("3cb5385a2987ca45888d7877fbcf92b4854f7155ae19c96cecc7ea1300c6f5a4"), | |||
SHA3_384: mustDecodeHex("f19539818b4f29fa0ee599db4113fd81b77cd1119682e6d799a052849d2e40ef0dad84bc947ba2dee742d9731f1b9e9b"), | |||
SHA3_512: mustDecodeHex("f0a2c0f9090c1fd6dedf211192e36a6668d2b3c7f57a35419acb1c4fc7dfffc267bbcd90f5f38676caddcab652f6aacd1ed4e0ad0a8e1e4b98f890b62b6c7c5c"), | |||
XXH64: mustDecodeHex("d3e8573b7abf279a"), |
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.
✅ Checks out for me.
$ pip install xxhash
macbook15:beats akroh$ python
Python 2.7.14 (default, Mar 10 2018, 00:01:04)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
>>> import xxhash
>>> xxhash.xxh64(b'hello world!\n').hexdigest()
'd3e8573b7abf279a'
@@ -20,6 +20,8 @@ import ( | |||
"golang.org/x/crypto/blake2b" | |||
"golang.org/x/crypto/sha3" | |||
|
|||
"github.com/OneOfOne/xxhash" |
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.
Normally we have three import groups (stdlib, non-elastic, then elastic). So just merge this one into the group above.
@@ -58,7 +58,7 @@ | |||
|
|||
# Hash types to compute when the file changes. Supported types are | |||
# blake2b_256, blake2b_384, blake2b_512, md5, sha1, sha224, sha256, sha384, | |||
# sha512, sha512_224, sha512_256, sha3_224, sha3_256, sha3_384 and sha3_512. | |||
# sha512, sha512_224, sha512_256, sha3_224, sha3_256, sha3_384, sha3_512 and xxh64. |
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.
Add an Oxford comma.
@@ -96,7 +96,7 @@ a suffix to the value. The supported units are `b` (default), `kib`, `kb`, `mib` | |||
*`hash_types`*:: A list of hash types to compute when the file changes. | |||
The supported hash types are `blake2b_256`, `blake2b_384`, `blake2b_512`, `md5`, | |||
`sha1`, `sha224`, `sha256`, `sha384`, `sha512`, `sha512_224`, `sha512_256`, | |||
`sha3_224`, `sha3_256`, `sha3_384`, and `sha3_512`. The default value is `sha1`. | |||
`sha3_224`, `sha3_256`, `sha3_384`, `sha3_512` and `xxh64`. The default value is `sha1`. |
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.
Add an Oxford comma.
@andrewkroh thanks, all fixed I think :) |
I'm probably hitting the upper read limit of the SSD with these benchmarks. I should probably refactor them to be performed on data from memory only.
|
Adds XXH64 for #6626 (as instructed by #6626 (comment))
Definitely significantly faster than the other algorithms:
Output of
BenchmarkHashFile
(last one is xxh64)