Help reproducing c's XXH64
jorgecarleitao opened this issue · 1 comments
jorgecarleitao commented
given this program,
#define XXH_INLINE_ALL
#include "xxhash.h"
#include <stdlib.h>
#include <stdio.h>
int main()
{
char* src = (char*) malloc(32);
const int N = 32;
for (int i = 0; i < N; i++) {
src[i] = (char) i;
}
for (int i = 0; i <= 4; i++) {
printf("%lldL,\n", (long long) XXH64(src, i, 0));
}
}
I get
-1205034819632174695L,
-1642502924627794072L,
5216751715308240086L,
-1889335612763511331L,
-13835840860730338L,
however,
this one
use std::hash::Hash;
fn main() {
let mut data = [0u8; 32];
for i in 0..32 {
data[i] = i as u8;
}
for i in 0..=4 {
let mut hasher = twox_hash::xxh3::Hash64::with_seed(0);
data[..i].hash(&mut hasher);
let hash = hasher.finish();
println!("{}", hash as i64);
}
}
I am getting
1283693310379569971
-639235051960594343
5951188477818819634
8310689630395635833
-3146810259156790514
is there something I am doing incorrectly? I am trying to reproduce a result and got stuck here.
jorgecarleitao commented
the issue is that xxh3
is not XXH64
, they are different hashes.