dion

December 13th, 2005, 02:30

hi, i was trying to figure out the invert function of "foo":

foo parameters :

return value in a.

b and c are input number, can be different/same value.

is this function was well known? all i know is just the modulus op. but the if(sctemp[I].... line make this little complicated. or any known attacks except blind bruteforce?

thanks

Code:

#include "stdafx.h"

#include <big.h>

miracl *mip = mirsys(100,16);

big str2,key1;

void foo(big a, big b, big c)

{

zero(a);

//countbits(big c)

char sctemp[200];

unsigned int bitcount;

mip->IOBASE=2;

bitcount = cotstr(c,sctemp);

unsigned int i;

mip->IOBASE=16;

for (i=0;i<bitcount;i++)

{

add(a,a,a);

if (sctemp[I] == '1') add(a,b,a);

}

big localtemp = mirvar(0);

divide(a,str2,localtemp);

}

int main(int argc, char* argv[])

{

key1 = mirvar(0);

str2 = mirvar(0);

big key1fix = mirvar(0);

mip->IOBASE=16;

cinstr(str2,"E9D3D13D9906C1622D5ECCB0AC41A8B56A64CF5F";

cinstr(key1,"5DAB51C2E2A4F1EE514664FFA4C770D06C5F74CA";

cinstr(key1fix,"5DAB51C2E2A4F1EE514664FFA4C770D06C5F74CA";

big temp = mirvar(0);

foo(temp,key1,key1);

otnum(temp,stdout);

copy(temp,key1);

foo(temp,key1,key1);

otnum(temp,stdout);

....

foo parameters :

return value in a.

b and c are input number, can be different/same value.

is this function was well known? all i know is just the modulus op. but the if(sctemp[I].... line make this little complicated. or any known attacks except blind bruteforce?

thanks