home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / UTILITIE / TANGLE30.ZIP / ALGTHM.TXT next >
Text File  |  1990-05-08  |  1KB  |  30 lines

  1. For each block, let us call it page[x,y] where 0<=x<wide and 0<=y<high:
  2. (it is understood that each line is for all x<wide and for all y<high)
  3. -----------------------------------------------------------------------
  4.    1) Do one shuffle:
  5.          page[x,y] := page[x,(y+key[x]) mod high]
  6.          if y is odd then page[x,y] := (page[x,y] XOR page[x,y-1])+1 mod 256
  7.          page[x,y] := page[(x+(y mod (wide-1))+1) mod wide,y]
  8.  
  9.    2) Perform a simple substitution:
  10.          page[x,y] := page[x,y] XOR ((x*high+y)*7 mod 512)
  11.  
  12.    3) Do 9 shuffles:
  13.          page[x,y] := page[x,(y+key[x]) mod high]
  14.          if y is odd then page[x,y] := ((page[x,y]-1 mod 256) XOR page[x,y-1])
  15.          page[x,y] := page[(x+(y mod (wide-1))+1) mod wide,y]
  16.  
  17. Each step in the process is easily reversible.
  18. -------------------------------------------------------------------------
  19.  
  20. The encrypted file format is:
  21.         1) Three decimal integers: program version number (= 3), wide, high.
  22.            Each as chars terminated by a comma (i.e. C format "%d,%d,%d,").
  23.         2) for each block:
  24.               The real number of characters in the block as a comma
  25.               terminated decimal integer (i.e. C format "%d,").
  26.               The block of bytes:
  27.                  for (j:=0..high-1), for (i:=0..wide-1) page[i,j]
  28.  
  29. -------------------------------------------------------------------------
  30.