static private void Bug_004_64() { Stream stream = File.OpenRead(CURRENT_PATH + @"\Resources\bug004.txt"); XXHash.State64 state = XXHash.CreateState64(); XXHash.UpdateState64(state, new byte[] { 0x01 }); XXHash.UpdateState64(state, stream); ulong result = XXHash.DigestState64(state); // compute the XXH64 hash value. Console.WriteLine(result.ToString("x8")); }
/* * TODO: * https://github.com/brandondahler/Data.HashFunction * https://www.nuget.org/packages/System.Data.HashFunction.xxHash * http://datahashfunction.azurewebsites.net/1.8.1/html/787eb446-5a08-d4ea-fde3-955fa4463198.htm */ private string HashFile(string path) { Stream stream = File.OpenRead(path); XXHash.State64 state = XXHash.CreateState64(); XXHash.UpdateState64(state, stream); ulong result = XXHash.DigestState64(state); return(result.ToString("X").ToLower()); }
static private void DemoXXHash64() { Stream stream = File.OpenRead(CURRENT_PATH + @"\Resources\letters.txt"); // the data to be hashed XXHash.State64 state = XXHash.CreateState64(); // create and initialize a xxH states instance. // NOTE: // xxHash require a xxH state object for keeping // data, seed, and vectors. XXHash.UpdateState64(state, stream); // puts the file stream into specified xxH state. ulong result = XXHash.DigestState64(state); // compute the XXH32 hash value. Console.WriteLine(result.ToString("x8")); }