ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Sat Sep 21, 2019 11:21 pm

All times are UTC




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
 Post subject: generate md5 hash
PostPosted: Mon Apr 15, 2019 8:01 pm 

Joined: Thu Aug 07, 2014 10:28 pm
Posts: 242
What is the correct way to generate an md5 hash on a file or sting in quickbms.
I tried.
Code:
set TMP string dolls.prd.cdn/76000
encryption md5 ""
string TMP e TMP
print "%TMP%"


Top
   
 Post subject: Re: generate md5 hash
PostPosted: Mon Apr 15, 2019 9:25 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 10569
That method is perfect, remember to use 'E' instead of 'e' since you have a string there.

Other examples:
Code:
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.


Top
   
 Post subject: Re: generate md5 hash
PostPosted: Mon Apr 15, 2019 11:19 pm 

Joined: Thu Aug 07, 2014 10:28 pm
Posts: 242
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:
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:
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


Top
   
 Post subject: Re: generate md5 hash
PostPosted: Tue Apr 16, 2019 11:46 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 10569
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.


Top
   
 Post subject: Re: generate md5 hash
PostPosted: Tue Apr 16, 2019 11:51 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 10569
Here we go:
Code:
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%"


Top
   
 Post subject: Re: generate md5 hash
PostPosted: Tue Apr 16, 2019 11:53 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 10569
And this is an alternative solution:
Code:
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%"


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 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