From msuinfo!agate!howland.reston.ans.net!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!netcomsv!netcom.com!grady Tue Feb 8 18:18:30 1994 Newsgroups: sci.crypt Path: msuinfo!agate!howland.reston.ans.net!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!netcomsv!netcom.com!grady From: grady@netcom.com (Grady Ward) Subject: Re: need encryption source code in C Message-ID: Organization: Moby lexical databases X-Newsreader: TIN [version 1.2 PL1] References: <2j6tcu$d9n@news.delphi.com> Date: Tue, 8 Feb 1994 17:16:43 GMT Lines: 45 JWAYNE@DELPHI.COM (jwayne@news.delphi.com) wrote: : I'm looking for some encryption source in C. Something relatively : small and fast. Doesn't have to be DES or anything. I'm : currently using xor'ing with a string (which is also encrypted : in the program) but could use something a _little_ more : secure. For speed it's hard to beat a shift register style cipher. One technique is discussed in Knuth v.2. Start with, say, 55 variables set to random integer values. Call this array of 55 variables 'Y'. Initialize two pointers to this set of variables, j == 24 and k == 55. Now set Y[k] = Y[k] + Y[j] mod (register size) and output Y[k]. XOR Y[k] with a plaintext to produce a ciphertext. Set j = j-1; Set k = k-1; if j = 0, Set j = 55 if k = 0, Set k = 55; goto 'Now set Y[k]...' The period of the generator will be 2^55-1. Other 'magic' sizes are: (27,98) (33,97) (13,87) (31,73) etc. where the first number is the j index and the second is the k index and the size of Y. This cipher can fall to the Massey attack if the attacker knows a Y amount of plaintext, but is strong when plaintext is denied (say the input to this cipher is the output of DES in CBC mode). It is blazingly fast though. -- Grady Ward | compiler of Moby lexicons: | finger grady@netcom.com +1 707 826 7715 | Words, Hyphenator, Part-of-Speech | for more information (voice/24hr FAX) | Pronunciator, Thesaurus | 15 E2 AD D3 D1 C6 F3 FC grady@netcom.com | and Language; all royalty-free | 58 AC F7 3D 4F 01 1E 2F