cespare / xxhash

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

get 16/32 byte sized hash from some input #38

Closed vtolstov closed 4 years ago

vtolstov commented 4 years ago

i want to replace sha256 hashing in my program, i don't need strongly crypto hashing function. but i'm need to have hash with 16 or 32 byte long. How can i do that?

cespare commented 4 years ago

The XXH64 algorithm implemented by this package produces 64-bit (8-byte) values. If your application requires 16+ bytes, then it's up to you how you will produce 8 extra bytes. You could pad with 0 bytes, for instance, or you could repeat the hash bytes.