home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / sci / crypt / 5197 < prev    next >
Encoding:
Internet Message Format  |  1992-11-23  |  2.4 KB

  1. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!ux1.cso.uiuc.edu!news.cs.indiana.edu!noose.ecn.purdue.edu!sparkyfs.erg.sri.com!csl.sri.com!boucher
  2. From: boucher@csl.sri.com (Peter K. Boucher)
  3. Newsgroups: sci.crypt
  4. Subject: Stream Cipher Program.  Comments?
  5. Date: 23 Nov 1992 12:19:40 GMT
  6. Organization: Computer Science Lab, SRI International
  7. Lines: 65
  8. Distribution: world
  9. Message-ID: <1eqi8sINNbmt@roche.csl.sri.com>
  10. NNTP-Posting-Host: affirmed.csl.sri.com
  11.  
  12. Following is the heart of the program (though not necessarily
  13. the most important part).  If you assume that the three key 
  14. arrays are full of unpredictable PRNs and that the seed is an
  15. unpredictable PRN, and that zipkeys fills up the three arrays
  16. with more unpredictable PRNs, what is the weakness of this 
  17. algorithm?
  18.  
  19. Note:
  20.   KLEN1 = 1013
  21.   KLEN2 = 1019
  22.   KLEN3 = 1021
  23.   PRIME(X) = the (X % 613)th of a list of 613 prime numbers
  24.              (which are stored in a pseudo-random order).
  25.  
  26. Also note:  The PRN generator is salted with nine bytes of
  27.             data (4 from keystroke latency, 2 from time of
  28.             day, 2 from process id, and 1 from the cleartext).
  29.             These are all jumbled together (so that each of
  30.             the nine salts is partially a function of each of
  31.             the rest), and then stored, encrypted (of course),
  32.             as the first nine bytes of cipher text.
  33.  
  34. The idea is to generate ~3K bytes of computationally expensive
  35. PRNs, and milk ~1M byte of cheap-but-unpredictable key stream.
  36. Is there a reason why this won't work?
  37.  
  38. ----------------------- clip clip ---------------------
  39. void scramble(seed)
  40. uint seed;
  41. {
  42.     rint   inc;
  43.     ruint  outc;
  44.     ruint  i1=(PRIME(seed)*PRIME(KLEN2))%KLEN1;    /* index into key1 */
  45.     ruint  i2=(PRIME(seed+i1)*PRIME(KLEN3))%KLEN2; /* index into key2 */
  46.     ruint  i3=(PRIME(seed+i2)*PRIME(KLEN1))%KLEN3; /* index into key3 */
  47.     ruint  prev_feedback = seed;
  48.     ruint  feedback;
  49.  
  50.     while ((inc=fgetc(inf)) != EOF)
  51.     {
  52.         feedback = prev_feedback;
  53.  
  54.         outc = (inc ^ key1[i1++] ^ key2[i2++] ^ key3[i3]);
  55.  
  56.         i3 = (i1+12+i3+feedback) % KLEN3;
  57.         if (i1 >= KLEN1) i1=0;
  58.         if (i2 >= KLEN2) i2=0;
  59.  
  60.         if (!i1 && !i2)
  61.         {
  62.             zipkeys(feedback);
  63.         }
  64.  
  65.         prev_feedback = ((ENCRYPT) ? outc : inc);
  66.  
  67.         fputc(outc, outf);
  68.     }
  69. }
  70.  
  71. ----------------------- clip clip ---------------------
  72.  
  73. -- 
  74. Peter K. Boucher
  75. --
  76. RIPEM public key available upon request.
  77.