📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  Target Specific - General  >>  SHA1 question about using precomputed hash with SHA1_Update

Topic created on: April 23, 2008 08:32 CDT by blackd0t .

Hello!

My questions concerns if it's possible to use the precomputed hash in the hashing process. Let me present everything in more detail.

Let's say we have such buffers: char buffer1[4096],buffer2[4096],buffer3[4096] which contain some data that is always the same and there is also another buffer: char magic[16] which contains data that change every time you launch the application. The hash in code is calculated as follows:

sha.Initialize();
sha.UpdateData( magic, 16 );
sha.UpdateData( buffer1, sizeof(buffer1) );
sha.UpdateData( buffer2, sizeof(buffer2) );
sha.UpdateData( buffer3, sizeof(buffer3) );
sha.Finalize();

char hash[0x14];
memcpy( hash, sha.GetDigest(), 0x14 );

So 'hash' is the proper output that I'm expecting to get. Now to my question. Is it possible to precompute the hash of the static buffers and somehow include it in the hashing process? I know I can't hash the hash digest result of the buffers because it wouldn't make sense as it would hash the 0x14 bytes of the hash result. Here is what I want to acheive:

char magic[16];
char buffers_sha1_hash[0x14] = { ...hash... };

sha.Initialize();
sha.UpdateData( buffer1, sizeof(buffer1) );
sha.UpdateData( buffer2, sizeof(buffer2) );
sha.UpdateData( buffer3, sizeof(buffer3) );
sha.Finalize();
memcpy( buffers_sha1_hash, sha.GetDigest(), 0x14 );

sha.Initialize();
sha.UpdateData( magic, 10 );
(( here place some code that would include the precomputed buffers_sha1_hash ))
sha.Finalize();

char hash[0x14];
memcpy( hash, sha.GetDigest(), 0x14 );

I have a feeling it may not be possible as to the way how SHA1_Update() operates using previous hash results from SHA_CTX, but I need someone to tell me that it's the wrong approach. Maybe you'll have some other idea on how to acheive the proper hash without having to compute the hashes of the buffers, which are always the same, every time.

Regards,
Black Dot

No posts found under this topic.
Note: Registration is required to post to the forums.

There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit