Skip to content

Commit

Permalink
New hashing algorithm for fingerprint processor (elastic#15418)
Browse files Browse the repository at this point in the history
* XXHash configuration and test

* Removed unused option

* Inlining function

* Changelog documentation

* xxhash library vendored

* Updated changelog

* Update NOTICE.txt

* * Update version github.com/OneOfOne/xxhash@1.2.7
* Using a new constructor function xxhash.NewHash64

* Add xxhash as option for hashing algorithm in fingerprint's docs

* Update NOTICE.txt
  • Loading branch information
rvillablanca authored and ycombinator committed Jan 10, 2020
1 parent 2806a91 commit e51ad5d
Show file tree
Hide file tree
Showing 13 changed files with 1,068 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add `add_id` processor. {pull}14524[14524]
- Enable TLS 1.3 in all beats. {pull}12973[12973]
- Spooling to disk creates a lockfile on each platform. {pull}15338[15338]
- Fingerprint processor adds a new xxhash hashing algorithm {pull}15418[15418]

*Auditbeat*

Expand Down
10 changes: 10 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4521,6 +4521,16 @@ 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.

--------------------------------------------------------------------
Dependency: github.com/OneOfOne/xxhash
Version: v1.2.7
Revision: 85d5025fe15b385888b1886ea99f722f549a6934
License type (autodetected): Apache-2.0
./vendor/github.com/OneOfOne/xxhash/LICENSE:
--------------------------------------------------------------------
Apache License 2.0


--------------------------------------------------------------------
Dependency: github.com/opencontainers/go-digest
Revision: ac19fd6e7483ff933754af248d80be865e543d22
Expand Down
2 changes: 1 addition & 1 deletion libbeat/processors/fingerprint/docs/fingerprint.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ The following settings are supported:
`fields`:: List of fields to use as the source for the fingerprint.
`ignore_missing`:: (Optional) Whether to ignore missing fields. Default is `false`.
`target_field`:: (Optional) Field in which the generated fingerprint should be stored. Default is `fingerprint`.
`method`:: (Optional) Algorithm to use for computing the fingerprint. Must be one of: `md5`, `sha1`, `sha256`, `sha384`, `sha512`. Default is `sha256`.
`method`:: (Optional) Algorithm to use for computing the fingerprint. Must be one of: `md5`, `sha1`, `sha256`, `sha384`, `sha512`, `xxhash`. Default is `sha256`.
`encoding`:: (Optional) Encoding to use on the fingerprint value. Must be one of `hex`, `base32`, or `base64`. Default is `hex`.
1 change: 1 addition & 0 deletions libbeat/processors/fingerprint/fingerprint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func TestHashMethods(t *testing.T) {
"sha256": {"1208288932231e313b369bae587ff574cd3016a408e52e7128d7bee752674003"},
"sha384": {"295adfe0bc03908948e4b0b6a54f441767867e426dda590430459c8a147fbba242a38cba282adee78335b9e08877b86c"},
"sha512": {"f50ad51b63c92a0ed0c910527119b81806f3110f0afaa1dcb93506a78371ea761e50c0fc09b08c441d832dd2da1b45e5d8361adfb240e1fffc2695122a23e183"},
"xxhash": {"37bc50682fba6686"},
}

for method, test := range tests {
Expand Down
3 changes: 3 additions & 0 deletions libbeat/processors/fingerprint/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"crypto/sha512"
"hash"
"strings"

"github.com/OneOfOne/xxhash"
)

type hashMethod func() hash.Hash
Expand All @@ -34,6 +36,7 @@ var hashes = map[string]hashMethod{
"sha256": sha256.New,
"sha384": sha512.New384,
"sha512": sha512.New,
"xxhash": xxhash.NewHash64,
}

// Unpack creates the hashMethod from the given string
Expand Down
187 changes: 187 additions & 0 deletions vendor/github.com/OneOfOne/xxhash/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions vendor/github.com/OneOfOne/xxhash/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/OneOfOne/xxhash/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e51ad5d

Please sign in to comment.