private void OnButtonCalculate(object sender, EventArgs e) { try { byte[] data = ConvertString(textBoxSrc.Text); uint hash32 = FNV32.Hash(data, 0, data.Length); hash32 = _CheckSwap.Checked ? hash32.Swap() : hash32; textBox32.Text = string.Format("0x{0:X8}", hash32); ulong hash64 = FNV64.Hash(data, 0, data.Length); hash64 = _CheckSwap.Checked ? hash64.Swap() : hash64; textBox64.Text = string.Format("0x{0:X16}", hash64); } catch (Exception ex) { Helpers.ShowError(ex); } }
public static void LoadStorage() { // Load string table for XBins. string[] LoadedLines = File.ReadAllLines("Resources//GameData//XBin_Hashes.txt"); // Create all arrays StringTable = new string[LoadedLines.Length]; FNV32Storage = new Dictionary <uint, uint>(); FNV64Storage = new Dictionary <ulong, uint>(); // iterate through all lines and build our storage. for (uint i = 0; i < LoadedLines.Length; i++) { string Line = LoadedLines[i]; StringTable[i] = Line; ulong FNV64Hash = FNV64.Hash(Line); uint FNV32Hash = FNV32.Hash(Line); FNV64Storage.TryAdd(FNV64Hash, i); FNV32Storage.TryAdd(FNV32Hash, i); } }
public void SetName(string Value) { _name = Value; Hash = FNV32.Hash(Name); }