www.icarusindie.com/devzone/projects/

currbyte == the position of the byte not the value

I'm using a slightly modified version of "encrypt" found at the above.
Instead of using the format shown on the page a second key is used which
defines how any file (read in as binary) is interpreted to form the
polynomial function.

Using the given private key

"jksdhfjsdhfjdgfgdfgbytuiy345cjbdsfetrewqvxnbdsafewrq3"

I stopped checking for the generated key (what's actually applied to the
data) at length ~10500 bytes before giving up using simple pattern checking.
At that point it's well past less efficient than brute forcing the given
key.  I'm curious as to what it would take to go about checking for
weaknesses in this method.  And better ways to go about getting the length
of the generated key.

Ben Kucenski
www.icarusindie.com


#include "encrypt.h" //encrypt.cpp stuffed in a class

void main()
{
 FILE * log;
 log=fopen("results.txt","w");
 int len,pos,match,diff,k;
 cEncrypt enc("key.txt");

 len=2;
 diff=1;
 while(diff>0)
 {
  match=0;
  diff=0;
  for(pos=0;pos<len*10;pos++)
   for(k=0;k<8;k++)
  {//compare bits
   if(enc.encryptByte(0,pos)==enc.encryptByte(0,pos+len))
    match++;
   else
    diff++;
  }
  printf("len: %i\n",len);
  len++;
 }
 printf("key length: %i\n",len-1);
 fprintf(log,"key length: %i\n",len-1);
 for(k=0;k<10;k++)
 {
  for(pos=0;pos<len-1;pos++)
  {
   fprintf(log,"%i ",enc.encryptByte(0,pos+k*len-k));
  }
  fprintf(log,"\n");
 }
 fclose(log);
}


_______________________________________________
mozilla-crypto mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-crypto

Reply via email to