FLFacHash Tool
-
StarTrader wrote:
Apart from universe.ini in [Base] entries (W02Fxx) I haven’t needed a hashcode for factions until now, where are they given/used?As far as I know, faction hash codes are used exclusively in the save game files.
If you decode any of the save game files, you’ll notice right away that there’s a massive section of the file in this format: “visit = (some very big number here), (much smaller number here)”. Most of the bigger numbers are in the 2 - 3 billion range – these would be the hash codes for most Freelancer entities.
However, near the beginning of the visit section, you’ll also notice a bunch of visit lines in which the big number is much smaller – smaller than 65536, in fact. These are the faction ID hash codes. If a faction’s hash code is present in the save file indicates then that faction should show up in the player’s reputation list. Otherwise, it won’t.
How is this useful? Well, for example, in the vanilla game the Order faction will never show up in your faction reputation list thanks to some stuff hard-coded into the Freelancer main executable. If you’re not into exe hacking, one way you can get it to show up is to generate the Faction hash code for the Order (fc_or_grp => 3775), and stuff the line “visit=3775, 65” at the appropriate place in the save file.
Cannon wrote:
Wonderful, I’ve been wondering about the algorithm for ages but never found the time, motivation or talent to figure it out. Very nice.I know. Actually, that’s how I found out that no algorithm for hashing faction IDs was out there in the first place. I downloaded your Discovery Account Manager (very nice tool, btw) and browsed through the source code, and saw your comments about how hashing faction IDs was still unknown. Seeing that I had solved that nearly 3 years ago and was rather selfishly not sharing, I decided to do the right thing, extract the snippet of code needed, re-compile a new executable in the grand ol’ tradition of command-line based FLHash.exe, and make it public. Probably should’ve done it back then – just surprised that no one else had bothered to decode the algorithm since that time.
Anyway, I hope this would be of use to you in your Discovery Account Manager.
Cheers,
– The Haen.
-
Excellent work and thanks a lot for sharing, this sure will prove useful
Welcome to The Starport!
-
Thanks all of you guys!!
By the way, something I’ve often needed but not found, is a way to use the hash generator for a list of nicknames, and get the list back in an output with the original nickname and its hashcode after it. Maybe with an = between as a delimiter, I can easily remove it if needed.
Like this:-
ge_s_battery_01 = 2596081674
ge_s_repair_01 = 2911012559
…And preferably I would like to be able to specify the list’s filename in an input window (not CMD please! :pint: ), so I don’t have to use the same filename each time, this way I can prepare several list files and run them one by one.
Is this something one of you guys here can turn out during a coffee break? :oops:
I’ve been using excel to do it line by line until now, and it’s a pain.
:-?
-
The FL Player Cleaner does something similar, it puts 1 line with the nickname then the next line with the hash…
-
Why avoid CMD if you can do it all in practically 1 line using DOS’s “for” command?
Suppose you have FLFacHash and your input file with a list of IDs to be hashed (say, Input.txt) in the same directory. Then just open up the command prompt and enter the following commands:
echo off for /F %i in (Input.txt) do FLFacHash %i >> Output.txt echo on
Open up Output.txt and you should have the information you need in almost the format you wanted. If you are hashing normal hashes, then you can use FLHash instead of FLFacHash.
– The Haen.
-
If you like this
ge_s_battery_01_loot
F:\PRIVAT\FL\DATA\EQUIPMENT\misc_equip.ini
0xe3d9bbbf 2667548365
ge_s_battery_01
F:\PRIVAT\FL\DATA\EQUIPMENT\misc_equip.ini
0x179c884a 2596081674check the ‘CRC Tool’.
It creates a text file besides the database. -
FLDev also creates a similar file in its CRC tab (has both CRCs and Hashes), but I thought this wasn’t what you were after, from what I gathered.
-
StarTrader wrote:
I’ve been using excel to do it line by line until now, and it’s a pain.
If you actually want to use it in Excel, CreateID’s output is tab-delimited (with an option for CSV), so you should be able to import that and just swap the columns around. Or I could just modify CreateID to put the nickname first…
-
Wow, good responses guys!
Now you gave me another problem, I’ll have to try out and assess each of your suggestions! :?
But I ain’t got enough time! Haven’t you lot seen my avatar for goodness’ sakes!!??
Haen - now I KNOW you’re an old bugger like me!!
Actually your suggestion is very helpful, I think I can work my way around the FOR command and make a cmd/bat file to give it the input & output filenames and tailor the output results the way I want too.
Many thanks, guys.
-
Haen - now I KNOW you’re an old bugger like me!!
I’m not THAT old. In fact, believe or not, I’m not even an programmer – I’m a business major!
A quick question for Jason: I just noticed you mentioned “location hashes” for your createid program. Are you referring to the hash number after the “location =” entry in the save game files? If yes, do you know if they are used anywhere else?
Cheers,
– The Haen.
-
downloaded the tool to try it out, double clicked the exe file and i get a black box appear for a nano second and then nothing.
-
It’s a command-line program! Try running it through the command host (cmd)
-
adoxa wrote:
That’s right. I don’t believe so.Ah, I see. Thanks for your answer.
I always thought of location hashes as FLHash being applied twice over. I didn’t know that Freelancer actually called a different routine just for location hashes. Though on further reflection, I guess I should have anticipated that.
At any rate, now that I’ve got these three hashes, that gives me an idea with which I can play around…
– The Haen.
-
Having decoded the faction hash algorithm, I would’ve thought you’d know how it generates the location hash, too. It takes the hex of the base hash, appends an underscore and the name of the room, then hashes that. For example, Manhattan’s bar is: Manhattan = li01_01_base = A7303E0D, so hash “A7303E0D_bar” = 2729128783. Of course, if you’re importing from common.dll, just do MakeLocationID( CreateID( “li01_01_base” ), “bar” ). My version of FlCodec is capable of converting the hashes back to nicknames (Li01_01_Base/Bar) or names (Planet Manhattan Bar), using the database made by CreateID.
-
adoxa wrote:
Having decoded the faction hash algorithm, I would’ve thought you’d know how it generates the location hash, too.Oh, I know how to generate it all right. I apologize if I conveyed otherwise.
Like you wrote, it hashes the base name, prepends the hex as a string plus the underscore to the room name, and then hashes the new string. I have been manually determining location hashes using this process via the original FLHash.exe tool. I simply thought of the entire process as calling on the default hash algorithm twice, which was what I meant as “applied twice over”.
On another note, I spotted a minor error with FLFacHash’s output formatting. I’ve corrected the error and will re-upload once the problems with the Downloads are gone.
– The Haen.
-
It’s a command-line program! Try running it through the command host (cmd)
tried that and it tells me
Error, wrong number of arguments
whatever that means
-
Dragnite_MU wrote:
It’s a command-line program! Try running it through the command host (cmd)
tried that and it tells me
Error, wrong number of arguments
whatever that means
That means you need to give FLFacHash a faction ID to process. This error message appears if you entered the FLFacHash in the command prompt by itself without supplying any IDs with which it can work.
For example, if you want find out the hash code for the Kusari State Police, then you’d enter the following in the command line:
C:\>FLFacHash ku_p_grp
This should return the hashcode of 552.
– The Haen.
-
ah i see, ill give that a try then