decx
November 4th, 2001, 11:12
I think i should post an example too, this is from MD5 used in a very popular CAD program.
Analysing the licensing system will lead you to the suspicion it uses some kind of encryption to generate and validate the keyfiles, actually it was simple since it contained names like NewUserHashFingerprint etc. So knowing it was a hashing algo was rather obvious, but determining the algo was done pretty quick too. Observe the assembly listenings below:
.text:5388C590 mov eax, [esp+arg_0]
.text:5388C594 xor ecx, ecx
.text:5388C596 mov [eax+14h], ecx
.text:5388C599 mov [eax+10h], ecx
.text:5388C59C mov dword ptr [eax], 67452301h
.text:5388C5A2 mov dword ptr [eax+4], 0EFCDAB89h
.text:5388C5A9 mov dword ptr [eax+8], 98BADCFEh
.text:5388C5B0 mov dword ptr [eax+0Ch], 10325476h
.text:5388C5B7 retn
.text:5388C5B7 sub_5388C590 endp
.text:5388C5B7
Now looking in md5.c we see this:
void
md5_init(md5_state_t *pms)
{
pms->count[0] = pms->count[1] = 0;
pms->abcd[0] = 0x67452301;
pms->abcd[1] = 0xefcdab89;
pms->abcd[2] = 0x98badcfe;
pms->abcd[3] = 0x10325476;
}
Pretty obvious huh?

Traceing further will also reveal the Tx constants.
When you see a call with a lot of ror, shr, mov, add, lea etc. juggeling with alot of numbers, you might want to look at it in ida and check out what it might be.