private bool TryGetHashEntry(string filename, out MpqHash hash) { uint index = StormBuffer.HashString(filename, 0); index &= _mpqHeader.HashTableSize - 1; uint name1 = StormBuffer.HashString(filename, 0x100); uint name2 = StormBuffer.HashString(filename, 0x200); for (uint i = index; i < _hashTable.Size; ++i) { hash = _hashTable[i]; if (hash.Name1 == name1 && hash.Name2 == name2) { return(true); } } for (uint i = 0; i < index; i++) { hash = _hashTable[i]; if (hash.Name1 == name1 && hash.Name2 == name2) { return(true); } } hash = new MpqHash(); return(false); }
public MpqHash(string fileName, uint mask, uint locale, uint blockIndex) : this(StormBuffer.HashString(fileName, 0x100), StormBuffer.HashString(fileName, 0x200), locale, blockIndex, mask) { }
public static uint GetIndex(string path, uint mask) { return(StormBuffer.HashString(path, 0) & mask); }
public static void Decrypt(byte[] data, string key) { StormBuffer.DecryptBlock(data, StormBuffer.HashString(key, 0x300)); }