
0x0
New User
Mar 14, 2008, 2:42 PM
Views: 4074
|
Hi, I have problem with translating code from C to perl C:
char data1[]={2, 8, 15, 6, 6, 10, 2, 6, 13, 10, 15, 4, 13, 3, 14, 12, 1, 2, 11, 6, 2, 6, 13, 0, 9, 12, 8, 6, 4, 7, 9, 10}; char data2[]={7, 15, 3, 1, 10, 13, 6, 9, 11, 10, 15, 6, 11, 6, 11, 5, 0, 4, 13, 1, 6, 13, 13, 1, 15, 14, 8, 2, 10, 0, 1, 10}; char *do_magic(char *salt,char *magic) { int count; static char code[37]; char salt_tmp[8],magic_tmp[32],x,y; char tab1[32],tab2[32]; unsigned long long time_seed; memcpy(salt_tmp,salt,sizeof salt_tmp); memcpy(magic_tmp,magic,sizeof magic_tmp); memcpy(tab1,data1,sizeof data1); memcpy(tab2,data2,sizeof data2); for(count=0;(count&0x20)==0;count++) { tab1[count]=(char)(tab1[count]+count&0xf); tab2[count]=(char)(tab2[count]-count&0xf); } for(count=0;count<32;count++) { x=magic_tmp[count]; y=salt_tmp[count&0x7]; x=(char)(x<=57?x-48:(x-94)+10); y=(char)(y<=57?y-48:(y-94)+10); x=(char)((x^tab1[count]^y)+tab2[count]&0xf); x=(char)(x<=9?x+48:(x+94)-10); code[count]=x; } code[32] = '0'; code[33] = 'd'; code[34] = 'b'; code[35] = '8'; code[36] = '\0'; return code; }
(This post was edited by 0x0 on Mar 28, 2008, 7:28 AM)
|