ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Sat Jul 04, 2020 4:10 pm

All times are UTC




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Jun 29, 2018 5:23 pm 

Joined: Tue Feb 02, 2016 2:35 am
Posts: 1126
okay, so i've already written a .bms script out of the DVD.[BIN/DAT] format as seen in WRC: World Rally Championship
the thing is, i want to apart the hashing algorithm as seen in the EVO_OPT4.IRX file into the .bms script - back when i did this i never knew i was pushing myself this hard just for this
Code:
set test01 string "game_intro.str"
strlen name_size test01

log memory_file10 0 0
putct test01 string -1 memory_file10
goto 0 memory_file10

math hash_a_value == 0x7ab7
math hash_b_value == 0x6a2f
math hash == 0

for sb = 0 < name_size
   get string_byte byte memory_file10
   putarray 1 sb string_byte
next sb

for x = 0 < name_size
   getarray string_byte 1 x
   xmath hash1 "(((hash_a_value << 24) | (hash_b_value >> 24)) + string_byte) & 0x7fffffff"
   putarray 0 0 hash1
next x
here's said IRX file for anyone interested
also included is a part of said IRX file i'm trying to adapt into the .bms language


Attachments:
EVO_OPT4[IRX].rar [65.29 KiB]
Downloaded 59 times
hash_function.txt [4.04 KiB]
Downloaded 70 times

_________________
the number one killer is time
it destroys us all
Top
   
PostPosted: Sun Jul 01, 2018 4:56 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 11372
Not sure if yours is a request about bms or reverse engineering, from the bms side you don't need to use memory files and array, just getvarchr.
You can even make a C function and calling it with the "tcc" prototype of calldll.

If you need help with reverse engineering I suggest you searching those constants on a search engine:
"31415" "27183"


Top
   
PostPosted: Sun Jul 01, 2018 6:35 pm 

Joined: Tue Feb 02, 2016 2:35 am
Posts: 1126
holy shit this is *SPAM* startling
they used the most basic shit you can ever find regarding hashing algorithms, i don't even think it's worth posting some random links for

anyway see if i'm getting close enough with this
Code:
math alpha == 0x7ab7
math beta == 0x6a2f
math hash == 0
math table_size == 0x7fffffff

set test01 string "game_intro.str"
strlen name_size test01

for sb = 0 < name_size
   getvarchr string_byte test01 sb byte
   xmath hash "hash * alpha"
   xmath hash "((hash + string_byte) % table_size)"
   xmath alpha "(alpha * beta) % (table_size - 1)"
   putarray 0 0 hash
   putarray 1 0 alpha
next sb

_________________
the number one killer is time
it destroys us all


Top
   
PostPosted: Sun Jul 01, 2018 8:33 pm 

Joined: Tue Feb 02, 2016 2:35 am
Posts: 1126
second try
Code:
math alpha == 0x7ab7
math beta == 0x6a2f
math hash == 0
math table_size == 0x7fffffff

set test01 string "game_intro.str"
strlen name_size test01

for sb = 0 < name_size
   getvarchr string_byte test01 sb byte
   xmath alpha "(alpha * beta) % (table_size - 1)"
   xmath hash "((alpha * hash) + string_byte) % table_size"
   putarray 0 0 alpha
   putarray 1 0 hash
next sb
at this point i might be trying to pick off the MIPS code(hash_function.txt) to flesh this out

_________________
the number one killer is time
it destroys us all


Top
   
PostPosted: Sat Mar 14, 2020 7:32 am 

Joined: Thu Jul 26, 2018 5:15 am
Posts: 13
Hi, sorry for "digging out" this thread after such time, but have you managed to achieve something here? I wanted to fetch game soundtrack from the archive file, but it seems that this is the only thread trying to solve mystery behind game files.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited