forked from pool/xxhash
19 lines
443 B
C++
19 lines
443 B
C++
#include <xxhash.h>
|
|
#include <unistd.h>
|
|
#include <cstdio>
|
|
|
|
int main()
|
|
{
|
|
auto state = XXH3_createState();
|
|
XXH3_128bits_reset(state);
|
|
char buffer[1048576];
|
|
ssize_t count;
|
|
while ((count = read(STDIN_FILENO, buffer, sizeof(buffer))) > 0)
|
|
XXH3_128bits_update(state, buffer, count);
|
|
XXH128_canonical_t canon{};
|
|
XXH128_canonicalFromHash(&canon, XXH3_128bits_digest(state));
|
|
for (auto u : canon.digest)
|
|
printf("%02x", u);
|
|
printf("\n");
|
|
}
|