Torchmodders

Mod Projects => Mod Showcase => Topic started by: Chthon on November 17, 2017, 04:12:54 am


Title: Another Tag/Hash Tool
Post by: Chthon on November 17, 2017, 04:12:54 am
Saw a couple posts recently where this could be useful, thought I'd post it.

RGTools is my unfinished/abandoned set of mod tools for Rebel Galaxy. Most of it's irrelevant, but two tools related to tag hashing are also useful for TL2 because both games use the same hash function.

One tool is a brute force hash reverser. You can invoke it from the command line with:
Code: [Select]
rgtools.exe -m brutehash -h <hash> -w <guess>where <hash> is the hash you want to reverse (decimal notation)
and <guess> is a text string that's a guess at the original input string with the $ symbol in place of unknown characters.

For example,
Code: [Select]
rgtools.exe -m brutehash -h 250724719 -w M$$$$will try to find a 5-letter string starting with 'M' that hashes to 250724719.

A few things to note:

1. This program can take a very, very long time to run (days, weeks, months, years) if the guess is long or contains many unknown characters. Ctrl+C is the shortcut to abort a command line program.

2. Runic's hash is not a very good one, in that it suffers from very frequent collisions, cases where multiple inputs yield the same hash. For instance, the example above finds two strings that hash to 250724719: "MARIO" and "MB2IO." If the guess is long or contains many unknown characters, the number of strings found will grow very, very large. You may need to direct rgtools' output to a file to prevent it from scrolling off the screen and disappearing, like this:
Code: [Select]
rgtools.exe -m brutehash -h 250724719 -w M$$$$ > some_output_file.txt
3. If all you want is to fix files so that they repack, then ANY string with the correct hash will work. For instance, over in this thread (http://torchmodders.com/forums/modding-questions/tag-fix/), Zayn wants a string that hashes to 1897279165. I have no idea what string the original .dat file used, but "BWZSNKGX" will hash to the same value, and therefore repack into an identical .bindat file.  ;D

(I don't have any good solution to finding a semantically meaningful string buried in the pile of gibberish strings that share the same hash.)



The other tool is a command line version of the hasher. Invoke it like this:
Code: [Select]
rgtools.exe -m hash -w <input>where <input> is the string you want to hash.

This does the same thing as the hasher in TL2 Tag Fixer, just in command line form. It might be useful if you're faster with a keyboard than a mouse, especially if you've already got a command prompt open.
Title: Re: Another Tag/Hash Tool
Post by: Phanjam on November 17, 2017, 05:05:02 am
@Chthon thank u So Much for sharing the tools And the tips for using them! Hope things are well with u senpai!