generate md5 hash

Doubts, help and support about QuickBMS and other game research tools
chrrox
Posts: 388
Joined: Thu Aug 07, 2014 10:28 pm

generate md5 hash

Post by chrrox »

What is the correct way to generate an md5 hash on a file or sting in quickbms.
I tried.

Code: Select all

set TMP string dolls.prd.cdn/76000
encryption md5 ""
string TMP e TMP
print "%TMP%"
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: generate md5 hash

Post by aluigi »

That method is perfect, remember to use 'E' instead of 'e' since you have a string there.

Other examples:

Code: Select all

set VAR string "hello world"

# method 1
strlen VARSZ VAR
encryption md5 VAR "" 0 VARSZ
print "%QUICKBMS_HEXHASH%"

# method 2
encryption md5 ""
string TMP E VAR
print "%QUICKBMS_HEXHASH%"

# method 3
strlen VARSZ VAR
log MEMORY_FILE 0 0
putdstring VAR VARSZ MEMORY_FILE
encryption md5 ""
log MEMORY_FILE 0 VARSZ MEMORY_FILE
print "%QUICKBMS_HEXHASH%"

# method 4
log MEMORY_FILE 0 0
encryption md5 ""
filecrypt 1
putct VAR string -1 MEMORY_FILE
filecrypt 0
print "%QUICKBMS_HEXHASH%"

Obviously use QUICKBMS_HASH for the non-hex data.
chrrox
Posts: 388
Joined: Thu Aug 07, 2014 10:28 pm

Re: generate md5 hash

Post by chrrox »

Thanks that worked good how would I convert this to a string

set CDN string "dolls.prd.cdn/"
set VERSION string "76000"
set TMP string CDN
string TMP + VERSION
encryption md5 ""
string TMP E= TMP # 'E' is different than 'e'!

Code: Select all

print "%QUICKBMS_HASH|x%"
string TEST b QUICKBMS_HASH
string TEST - -32
print "%TEST%"
set TEST2 TEST
string TEST2 - -1
print "%TEST2%"
string TEST < TEST2
print "%TEST%"
string TEST3 = TEST
print "%TEST3%"
encryption md5 ""
string TEST3 E= TEST3 # 'E' is different than 'e'!
print "%QUICKBMS_HASH|x%"

this does not give me the output abd513b6a9e1f9809b4416979bf760e2
but if i do

Code: Select all

set TEST3 string 7F794CF201D7F785E9997E34826B87F
encryption md5 ""
string TEST3 E= TEST3 # 'E' is different than 'e'!
print "%QUICKBMS_HASH|x%"

i get abd513b6a9e1f9809b4416979bf760e2

also if there is a better way to do this operation let me know.
i am trying to
take md5 of dolls.prd.cdn/76000
take 1st number of that
subtract that from the md5 start
then generate the md5 hash of that result.

so in this case
17f794cf201d7f785e9997e34826b87f
then i split off the 1
7f794cf201d7f785e9997e34826b87f
then that md5 hash is
abd513b6a9e1f9809b4416979bf760e2
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: generate md5 hash

Post by aluigi »

Don't mix binary and text/hex data or it will be a mess.
If you need to use binary data it's better if you dump it in a memory file.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: generate md5 hash

Post by aluigi »

Here we go:

Code: Select all

set CDN string "dolls.prd.cdn/"
set VERSION string "76000"
set TMP string CDN
string TMP + VERSION

encryption md5 ""
string TMP E TMP

string QUICKBMS_HEXHASHL << 1

encryption md5 ""
string TMP E QUICKBMS_HEXHASHL

print "%QUICKBMS_HEXHASHL%"
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: generate md5 hash

Post by aluigi »

And this is an alternative solution:

Code: Select all

set CDN string "dolls.prd.cdn/"
set VERSION string "76000"
set TMP string CDN
string TMP + VERSION

strlen VARSZ TMP
encryption md5 TMP "" 0 VARSZ

string QUICKBMS_HEXHASHL << 1

strlen VARSZ QUICKBMS_HEXHASHL
encryption md5 QUICKBMS_HEXHASHL "" 0 VARSZ

print "%QUICKBMS_HEXHASHL%"