kbug
September 27th, 2005, 03:45
Hi all:
I find a piece code of a unknow cryptogrphics ,and i rewrite it in C, but it look like stupid and may be have wrong ,can any body make it grace?
thank you waste time reading this shit
I find a piece code of a unknow cryptogrphics ,and i rewrite it in C, but it look like stupid and may be have wrong ,can any body make it grace?
Code:
005AF69C 55 push ebp 005AF69D 8BEC mov ebp,esp 005AF69F 83C4 F8 add esp,-8 005AF6A2 33C0 xor eax,eax
005AF6A4 53 push ebx
005AF6A5 56 push esi
005AF6A6 8945 FC mov dword ptr ss:[ebp-4],eax ; [ebp-4] is a local var
005AF6A9 8B55 08 mov edx,dword ptr ss:[ebp+8] ; arg 1
005AF6AC 03D2 add edx,edx
005AF6AE C1E2 02 shl edx,2
005AF6B1 0155 0C add dword ptr ss:[ebp+C],edx
005AF6B4 8B4D 10 mov ecx,dword ptr ss:[ebp+10]
005AF6B7 8B45 08 mov eax,dword ptr ss:[ebp+8]
005AF6BA 8D1481 lea edx,dword ptr ds:[ecx+eax*4]
005AF6BD 8955 F8 mov dword ptr ss:[ebp-8],edx
005AF6C0 E9 A9000000 jmp Target Name Deleted.005AF76E
005AF6C5 8B4D F8 mov ecx,dword ptr ss:[ebp-8]
005AF6C8 8B19 mov ebx,dword ptr ds:[ecx]
005AF6CA 8BD3 mov edx,ebx
005AF6CC 0FB7C2 movzx eax,dx
005AF6CF 8BC8 mov ecx,eax
005AF6D1 0FAFC8 imul ecx,eax
005AF6D4 C1EB 10 shr ebx,10
005AF6D7 8BC1 mov eax,ecx
005AF6D9 0FB7CB movzx ecx,bx
005AF6DC 0FB7F3 movzx esi,bx
005AF6DF 0FB7DB movzx ebx,bx
005AF6E2 0FB7D2 movzx edx,dx
005AF6E5 0FAFDA imul ebx,edx
005AF6E8 0FAFCE imul ecx,esi
005AF6EB 8BF3 mov esi,ebx
005AF6ED 8BD0 mov edx,eax
005AF6EF C1E6 10 shl esi,10
005AF6F2 03C6 add eax,esi
005AF6F4 8BF3 mov esi,ebx
005AF6F6 C1EE 10 shr esi,10
005AF6F9 3BC2 cmp eax,edx
005AF6FB 0F92C2 setb dl
005AF6FE 83E2 01 and edx,1
005AF701 03F2 add esi,edx
005AF703 8BD0 mov edx,eax
005AF705 03CE add ecx,esi
005AF707 8BF3 mov esi,ebx
005AF709 C1E6 10 shl esi,10
005AF70C C1EB 10 shr ebx,10
005AF70F 03C6 add eax,esi
005AF711 3BC2 cmp eax,edx
005AF713 0F92C2 setb dl
005AF716 83E2 01 and edx,1
005AF719 03DA add ebx,edx
005AF71B 8BD0 mov edx,eax
005AF71D 0345 FC add eax,dword ptr ss:[ebp-4]
005AF720 03CB add ecx,ebx
005AF722 3BC2 cmp eax,edx
005AF724 0F92C2 setb dl
005AF727 836D 0C 04 sub dword ptr ss:[ebp+C],4
005AF72B 8B5D 0C mov ebx,dword ptr ss:[ebp+C]
005AF72E 83E2 01 and edx,1
005AF731 03CA add ecx,edx
005AF733 8BD0 mov edx,eax
005AF735 0303 add eax,dword ptr ds:[ebx]
005AF737 8B5D 0C mov ebx,dword ptr ss:[ebp+C]
005AF73A 3BC2 cmp eax,edx
005AF73C 8BD1 mov edx,ecx
005AF73E 8903 mov dword ptr ds:[ebx],eax
005AF740 0F92C3 setb bl
005AF743 83E3 01 and ebx,1
005AF746 03CB add ecx,ebx
005AF748 3BCA cmp ecx,edx
005AF74A 8BD1 mov edx,ecx
005AF74C 0F92C0 setb al
005AF74F 83E0 01 and eax,1
005AF752 8945 FC mov dword ptr ss:[ebp-4],eax
005AF755 836D 0C 04 sub dword ptr ss:[ebp+C],4
005AF759 8B45 0C mov eax,dword ptr ss:[ebp+C]
005AF75C 0308 add ecx,dword ptr ds:[eax]
005AF75E 8B45 0C mov eax,dword ptr ss:[ebp+C]
005AF761 3BCA cmp ecx,edx
005AF763 0F92C2 setb dl
005AF766 83E2 01 and edx,1
005AF769 8908 mov dword ptr ds:[eax],ecx
005AF76B 0155 FC add dword ptr ss:[ebp-4],edx
005AF76E 8345 F8 FC add dword ptr ss:[ebp-8],-4
005AF772 8B4D 08 mov ecx,dword ptr ss:[ebp+8]
005AF775 8345 08 FF add dword ptr ss:[ebp+8],-1
005AF779 85C9 test ecx,ecx
005AF77B ^ 0F85 44FFFFFF jnz Target Name Deleted.005AF6C5
005AF781 5E pop esi
005AF782 5B pop ebx
005AF783 59 pop ecx
005AF784 59 pop ecx
005AF785 5D pop ebp
005AF786 C3 retn
I written it in C , but when i look on it , i just wanna kill myself
void decrypt2(int len, long *pdest, long *pcryptdat)
{
ulong key, m1,m2,m3,m4;
short int al,ah, bl,bh;
ulong ms;
pdest = pdest + len * 2;
pcryptdat = pcryptdat + len;
pcryptdat--;
while(len--)
{
al = loword(*pcryptdat)
m1 = al * al;
m2 = al * ah;
m3 = ah * ah;
temp = m1;
ms = m2 << 16;
m1 = m1 + ms;
if(m1 < temp)
ms++;
temp = m1;
m3 = m3 + ms;
ms = m2 << 16;
m2 = m2 >> 16;
m1 = m1 + ms;
if(m1 < temp)
m2++;
temp = m1;
m1 = m1 + key;
if (m1 < temp)
m3++;
pdest--;
temp = m1;
m1 = m1 + *pdest;
*pdest = m1;
if(m1 < temp)
m3++;
pdest--;
m3 = m3 + *pdest;
}
}
thank you waste time reading this shit
