cespare / xxhash

A Go implementation of the 64-bit xxHash algorithm (XXH64)
MIT License
1.79k stars 123 forks source link

Add constructor that returns hash.Hash interface #36

Closed ycombinator closed 4 years ago

ycombinator commented 4 years ago

This PR adds a constructor that returns the hash.Hash interface so that this xxhash implementation may be used interchangeably with other hash.Hash implementations, such as in the https://github.com/elastic/beats project (see https://www.elastic.co/guide/en/beats/filebeat/master/fingerprint.html).

It leaves the existing New constructor as-is for backwards compatibility.

cespare commented 4 years ago

Note that the signature was intentionally changed as part of moving to v2 of this package (see #13).

I'd rather not add this trivial wrapper. It's easy enough to put that in the client code.