Unreal Engine 4 .locres file hash function

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
akintos
Posts: 88
Joined: Tue May 08, 2018 7:48 pm

Unreal Engine 4 .locres file hash function

Post by akintos »

I almost finished writing parser for locres files. the only missing part is the hash function used to hash strings.

Hash of (God Dammit!.)

Code: Select all

47 6F 64 20 44 61 6D 6D 69 74 21 00
is

Code: Select all

07 A8 93 3E


I think it might be CityHash? The Unreal Engine core API has it https://api.unrealengine.com/INT/API/Runtime/Core/Hash/index.html
Last edited by akintos on Sun Sep 02, 2018 2:33 pm, edited 1 time in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Unreal Engine 4 .locres file hash function

Post by aluigi »

If you are interested in "brute forcing" many hash/crc algorithms for finding the expected one, I suggest you this script for quickbms:
http://aluigi.org/bms/crc_scan.bms

Usage example:
Create a new file containing the string, in this case "God Dammit!" without the final NULL byte I guess since that's never hashed (but feel free to make a second scanning with it too).
My suggestion is to check ever the file with a hex editor for being 100% sure that it contains the correct string without unexpected line feeds or utf16/bom (expect if they are necessary) and so on.

Then run: quickbms.exe crc_scan.bms string.txt > output.txt

Open output.txt with a text editor and search for the expected crc like 07A8933E
Don't worry the output will contain the crc in both endianesses so you can't be wrong :)

This is just a generic usage and is not referred to this specific case.
akintos
Posts: 88
Joined: Tue May 08, 2018 7:48 pm

Re: Unreal Engine 4 .locres file hash function

Post by akintos »

Found String CRC32 code from UE4 core source code.

C++ code : https://pastebin.com/0F2ShREL
Python implementation : https://pastebin.com/gVkmcDG9
Delutto
Posts: 561
Joined: Tue Oct 13, 2015 1:26 pm

Re: Unreal Engine 4 .locres file hash function

Post by Delutto »

akintos wrote:Found String CRC32 code from UE4 core source code.
C++ code : https://pastebin.com/0F2ShREL
Python implementation : https://pastebin.com/gVkmcDG9
Your goal is make a locres file for a game that don't have it?
ghylard
Posts: 77
Joined: Wed Oct 08, 2014 1:03 pm

Re: Unreal Engine 4 .locres file hash function

Post by ghylard »

makc_ar provided me with a locres file for the game Xing The land beyond which has no locres file.
Unfortunately, due to insufficient information on my part and especially to a significant update of the game, it lacks a lot of text.
Having a tool available to create a locres file or update it would be really great! :D