XXhash

Doubts, help and support about QuickBMS and other game research tools
chrrox
Posts: 388
Joined: Thu Aug 07, 2014 10:28 pm

XXhash

Post by chrrox »

I see it mentioned in quickbms but i could not find an example

sample .net code

Code: Select all

using System;
using System.Text;
using System.Security.Cryptography;
using Extensions.Data;
               
public class Program
{
   public static void Main()
   {
      byte[] input = Encoding.ASCII.GetBytes("Portal_QBHN.plist");         // the data to be hashed.
      byte[] result = null;
      using (HashAlgorithm xxhash = XXHash64.Create())
      {
         result = xxhash.ComputeHash(input);               // compute the hash.
      }
      if (result != null)
      {
         Console.WriteLine(BitConverter.ToInt64(result, 0).ToString("x"));
      }
   }
}


input
Portal_QBHN.plist

output 0x22d6307b60c66430

How would I convert that to

Code: Select all

\22\d6307b60c66430
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: XXhash

Post by aluigi »

This is the code for quickbms for calculating xxhash64:

Code: Select all

encryption crc 0 "0 0 0 25 0 1"
set VAR string "Portal_QBHN.plist"
string VAR e VAR
print "%QUICKBMS_CRC|x%"

And the equivalent if the input is a file:

Code: Select all

set MEMORY_FILE binary "Portal_QBHN.plist"
encryption crc 0 "0 0 0 25 0 1"
get SIZE asize MEMORY_FILE
log MEMORY_FILE 0 SIZE MEMORY_FILE
print "%QUICKBMS_CRC|x%"

You need to use quickbms_4gb_files.exe for the work because it's a 64bit crc.

If you want to "dump" that number in a variable use: string VAR = QUICKBMS_CRC
With endian big the result will just be the one you were expecting: "Ö0{`Æd0
Another alternative is using the byte2hex conversion (string or log)