home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cactus.zip / cactus.doc next >
Text File  |  1996-04-17  |  17KB  |  393 lines

  1.                    ************* CACTUS *************
  2.  
  3.                    Crypto Algorithm Construction Tool
  4.  
  5.                    **********************************
  6.  
  7. CACTUS
  8. ------
  9. CACTUS is a set of C++ classes for the construction of strong proprietary
  10. cipher algorithms.
  11.  
  12.  
  13. Content of this package
  14. -----------------------
  15. This test and shareware package contains a description of the CACTUS classes
  16. and a set of programs for the demonstration of its use.
  17.  
  18. The programs are designed as demos. They are fully functional but do not have
  19. any error handling. The user has to take care for proper usage.
  20.  
  21. The following programs are compiled with WATCOM C/C++ 10.5a for DOS and
  22. OS/2. The source code for the main files is attached to demonstrate the use of
  23. the CACTUS class.
  24.  
  25. - RNG.EXE     Random Number Generator
  26.               RNG produces an file with random bytes (0 ... 255)
  27.               Usage:  RNG <file.name> <file.length> <preruns> [<seed>]
  28.                       The first three parameters are mandatory, the seed
  29.                       is optional.
  30.               RNG can be used to produce key files. It is recommended to
  31.               use another CACTUS.PAR file for producing the key file then
  32.               for the encryption of files, when the same key file is used
  33.               as key.
  34.  
  35. - FCRYPTX.EXE File encryption/decryption
  36.               Usage:  FCRYPTM -e|d <plain.file> <crypt.file>
  37.                       -e for encryption, -d for decryption
  38.  
  39. - FCRYPTM.EXE File encryption/decryption includes a kind of MIME coding
  40.               to produce a printable crypt file.
  41.               Usage:  FCRYPTM -e|d <plain.file> <crypt.file>
  42.  
  43. - STRCRYPT.EXE String encryption/decryption with some kind of MIME coding.
  44.               STRCRYPT returns the plain and the crypted string.
  45.               Usage:  STRCRYPT -e|d <string>
  46.                       -e encrypts the string, -d decrypts the string.
  47.               STRCRYPT can be used to generate passwords from user names.
  48.  
  49. Only for OS/2 and compiled with IBM VAC++ 3.0 is:
  50.  
  51. - PMCactus.exe   A PM based clipboard encryptor/decryptor.
  52.                  A marked text of any PM application can be copied or cut to
  53.                  the clipboard, then be encrypted and placed back into the
  54.                  application encrypted form. Decryption works the same way.
  55.                  The original text and the modified text (encrypted/
  56.                  decrypted) are shown in two windows and can be control before
  57.                  they are placed into the application. To make the
  58.                  encrypted text printable, some kind of MIME coding is
  59.                  used.
  60.  
  61.                  No editing should be done on the encrypted text. Any
  62.                  insertion or deletion of characters makes decryption
  63.                  impossible. When marking encrypted text for decryption, the
  64.                  marked block should start with '###' and end with ###'.
  65.                  No error detection is build in.
  66.  
  67.                  I have tested it with DeScribe 5.0, MESA, Lotus 123G and
  68.                  several text processors.
  69.  
  70.                  PMCactus is usefull to secure in an easy way some parts of
  71.                  a file or to authenticate an signature.
  72.  
  73. As mentioned earlier, all these programs are added only to demonstrate the
  74. use of the CACTUS classes. The main object is the set of the C++ classes.
  75.  
  76. The programs get their parameters for the cipher algorithm from a
  77. parameter file. An example is included (CACTUS.PAR). The programs look for
  78. the location of this file in the environment parameter CACTUSPAR. You have
  79. to set this parameter in the AUTOEXEC.BAT: SET CACTUSPAR=c:\cactus\cactus.par.
  80.  
  81. Another environment parameter can be set: CACTUSKEY. With CACTUSKEY one can
  82. set the key to be used by the programs.
  83.  
  84. Usage: SET CACTUSKEY=c:\cactus\cactus.key.
  85.  
  86. If no key file is specified in CACTUSKEY, all key and message key bytes will
  87. be set to 0. RNG.EXE has the possibility to add a seed to the key. The seed
  88. is XORed with the key file bytes. If the seed is shorter then the required
  89. length, the seed will be repeated.
  90.  
  91.  
  92. The CACTUS classes
  93. ------------------
  94. There are 3 elementary classes for the construction of any cipher algorithm:
  95.  
  96. - MiShiftReg  A shift register of variable length, and a set of
  97.               three feedback taps.
  98.  
  99.               Public members:
  100.  
  101.               void MiShiftReg::initiate(unsigned len,int t1,int t2,int t3)
  102.                  initialiates the shift register with length and the three taps.
  103.  
  104.               void MiShiftReg::reset(unsigned len,int t1,int t2,int t3)
  105.                  resets the shift register to the original stage.
  106.  
  107.               void MiShiftReg::set(unsigned pos, char val)
  108.                  sets one byte in the shift register. This can be used
  109.                  for initialization or distortion.
  110.  
  111.               void MiShiftReg::rotate(char dist, unsigned count)
  112.                  rotates the shift register _count_ times and XORS the tap
  113.                  bytes with the distortion byte _dist_.
  114.  
  115.               char MiShiftReg::output()
  116.                  output of the byte at position 0.
  117.  
  118. - MiTable     A lookup table with one byte output for one byte input.
  119.  
  120.               Public members:
  121.  
  122.               void MiTable::MiTable()
  123.                  Constructor for the 256 byte array of the table.
  124.  
  125.               void MiTable::fill(char i1, char i2, char i3, char i4, char i5,char i6)
  126.                  fills the table based on the 5 input bytes and a fixed table.
  127.  
  128.               void MiTable::set(unsigned pos, char val)
  129.                   sets one byte of the table. Can also be used to fill the table.
  130.  
  131.               void MiTable::manipulate(char i1,char i2, char i3,char i4)
  132.                   manipulates the table based on the 4 input bytes and a
  133.                   fixed table. An extra manipulation of the table.
  134.  
  135.               char MiTable::output(unsigned in)
  136.                   output of the looked up byte.
  137.  
  138. - MiCombiner  A combiner with 8 bytes input and one byte output. The
  139.               combiner uses one bit of each input byte to generate the
  140.               output byte. The bit selection of the input bytes can be
  141.               changed.
  142.  
  143.               Public members:
  144.  
  145.               void MiCombiner::set(char in)
  146.                   changes the sequence of the input byte bit selection.
  147.  
  148.               void MiCombiner::reset()
  149.                    resets the combiner to the original stage.
  150.  
  151.               char MiCombiner::output(char * reg)
  152.                     output of one byte after input of an 8 byte array.
  153.  
  154. Using these basic classes I have designed the CACTUS class as a complete
  155. algorithm:
  156.  
  157. - MiCactus    A complete cipher algorithm
  158.  
  159.               Public members:
  160.  
  161.               unsigned long lenall
  162.                  the sum of all shift register lengths. This sum is calculated
  163.                  during initialization based on the input from CACTUS.PAR.
  164.  
  165.               void MiCactus::MiCactus()
  166.                  Constructor which also checks the registration from CACTUS.PAR.
  167.  
  168.               void MiCactus::initiate(char * key,char * msk)
  169.                  initialization of the shift registers with _key_ and
  170.                  _message_key_. The user has to take care that key is an array
  171.                  of char with length _lenall_ and msk is an array of char with
  172.                  length _256_.
  173.  
  174.               void MiCactus::reset(char* key, char * msk)
  175.                  resets the algorithm.
  176.  
  177.               char MiCactus::gen_byte()
  178.                   generates one crypto byte.
  179.  
  180. The use of the class members can be seen in the demonstration files.
  181.  
  182.  
  183. Description of the CACTUS algorithm
  184. -----------------------------------
  185. CACTUS consists of
  186.  
  187. - 5  shift registers.
  188.      The length and the 3 taps each can be set in the CACTUS.PAR file.
  189.      This feature is only for the registered users. The unregistered version
  190.      has fixed lengths and taps.
  191.  
  192. - 1  combiner
  193.      The combiner combines the 8 first bytes of the shift registers to one byte.
  194.      The presetting for the combiner is fixed. It can only be changed in the
  195.      source code.
  196.  
  197. - 11 tables
  198.      table[0]... table[7] get input from byte[0] of the next shift register and
  199.      their output is XORed with byte[0] of the shift register. The resulting
  200.      byte is used for feedback to the taps.
  201.  
  202.      table[8] gets one byte from the combiner and produces the output byte.
  203.  
  204.      table[9] gets the same byte from the combiner as table[8] and the output
  205.      of table[9] controls the change of input byte bit selection of the
  206.      combiner and controls table[10].
  207.  
  208.      table[10] controls with each output bit the rotation steps of the
  209.      shift registers.
  210.  
  211.      The filling parameters of the tables are taken from CACTUS.PAR. These
  212.      parameters can be changed in the registered and unregistered version.
  213.  
  214. The configuration is as follows:
  215.  
  216. 8 times this configuration of a shift register:
  217. ===============================================================================
  218.                -----------------------------------
  219.  combiner[0]<- |  shiftreg[0]                     | <- bit[0] from table[10]
  220.                0----------------------------------     if 0: one rotation step
  221.                |        ^     ^       ^ taps 1...3        1: two rotation steps
  222.                |        |_____|_______|
  223.                |              |
  224.                ------------> XOR
  225.                               ^
  226.                           table[0]
  227.                               ^
  228.                               |
  229.                            byte[0] from table[1]
  230.  
  231.                               .
  232.                               .
  233.                               .
  234.                               .
  235.  
  236.                -----------------------------------
  237.  combiner[7]<- |  shiftreg[7]                     | <- bit[7] from table[10]
  238.                0----------------------------------     if 0: one rotation step
  239.                |          ^     ^       ^ taps 1...3      1: two rotation steps
  240.                |          |_____|_______|
  241.                |              |
  242.                ------------> XOR
  243.                               ^
  244.                           table[7]
  245.                               ^
  246.                               |
  247.                            byte[0] from table[0]
  248. ===============================================================================
  249.  
  250. The output and control looks like:
  251. ===============================================================================
  252.                          combiner[0] | <- shiftreg[0][0] | <- table[10],0
  253.                          combiner[1] | <- shiftreg[1][0] | <- table[10],1
  254.                          combiner[2] | <- shiftreg[2][0] | <- table[10],2
  255. output <-table[8]<--     combiner[3] | <- shiftreg[3][0] | <- table[10],3
  256.          table[9]<--  <- combiner[4] | <- shiftreg[4][0] | <- table[10],4
  257.               |          combiner[5] | <- shiftreg[5][0] | <- table[10],5
  258.               |          combiner[6] | <- shiftreg[6][0] | <- table[10],6
  259.               |          combiner[7] | <- shiftreg[7][0] | <- table[10],7
  260.               |                ^                                ^
  261.               |                | changes the combiner           |controls
  262.               |                |                                |table[10]
  263.               |________________|________________________________|
  264. ===============================================================================
  265.  
  266. The rotation of the shift registers is done in sequence 0 to 7. Hence the
  267. distortion byte from the next shift register is the same for one or two
  268. rotation steps.
  269.  
  270.  
  271. Initialization of the CACTUS algorithm
  272. --------------------------------------
  273. The constructor of CACTUS reads all parameters from the file CACTUS.PAR
  274. and checks the username and registration number.
  275.  
  276. - the tables are filled using the 5 parameters from CACTUS.PAR and a fixed table.
  277.  
  278. - the shift registers are filled in sequence with the key bytes, which are XORed
  279.   with the message key bytes.
  280.  
  281. - a number of _prerun_ steps are done. The number of steps is taken from
  282.   CACTUS.PAR. Unregistered version do 256 steps.
  283.  
  284. - optional a manipulation of the tables can be done using the output from the
  285.   crypto generator (only for registered users).
  286.  
  287. - again _prerun_ steps of prerun.
  288.  
  289. Now CACTUS is ready for output.
  290.  
  291. For encryption or decryption the output is XORed with the plain or ciphered
  292. text in an application program.
  293.  
  294. The reset function of CACTUS can be used to do extra preruns, for reset  or to
  295. set the crypto generator to some starting point to keep synchronization in a
  296. multi session environment.
  297.  
  298.  
  299. Restrictions for the unregistered test version
  300. ----------------------------------------------
  301. - The lengths and the taps of the shift registers are fixed. The total length
  302.   of all shift registers is 404.
  303. - Prerun count is fixed to 256.
  304. - Table manipulation off.
  305. - Registration reminder in the programs.
  306.  
  307. The restrictions do not reduce the security. One can test the quality of the
  308. algorithm with the pseudo random output of RNG.EXE.
  309.  
  310.  
  311. Registration scheme
  312. -------------------
  313. The basic registration for using the programs of this package with all
  314. features of CACTUS.PAR is US$10.- Online registration via CompuServe is
  315. prefered (GO SWREG # 11105). I will send the registration number by E-Mail.
  316.  
  317. Source code of the header file CACTUS.HPP is US$50.-. Registration via CIS
  318. (GO SWREG 5 times and an E-Mail to me for notification.
  319. The source code will be sent via CIS or internet.
  320.  
  321. Tayloring of applications to customer needs on request.
  322.  
  323. Also available: QUIPU V1.2 for OS/2 and DOS
  324.                 Full featured file encryption with QUIPU algorithm, which is
  325.                 more complex then CACTUS.
  326.                 Key length of 1632 bytes.
  327.                 Optional file dependend random message key of 256 bytes.
  328.                 Name and CRC of the original file are encrypted in
  329.                     the encrypted file.
  330.                 Compression is included.
  331.                 Authentication of the decrypted file by 32 bit CRC.
  332.                 Much faster then QUIPU V1.1.
  333.                 US$ 15.- for delivery over CIS or internet.
  334.  
  335. My address:
  336. INFOQUEST
  337. Michael Mieves
  338. Wessobrunner Weg 1
  339. D-82407 Wielenbach
  340. Germany
  341.  
  342. CIS:    100334,142
  343. E-Mail: mieves@ibm.net
  344.         mieves@t-online.de
  345.  
  346.  
  347. -----------------------------------------------------------------------------
  348. At the end of all:
  349.  
  350.                 Why CACTUS?????
  351.                 We have already some good ciphers
  352.                 DES PGP IDEA and many more...
  353.  
  354. The more a crypto algorithm is used on the world the more profit does a
  355. hacker get for his effort when he breaks it. It is not profitable for him
  356. to try breaking a rarely used and strong crypto algorithm. One might change
  357. his CACTUS crypro algorithm every day by changing his CACTUS.PAR file.
  358.  
  359. CACTUS is an example for what can be done with the base classes. Using the
  360. source code any other crypto algorithm can be constructed in short time,
  361. optimized for speed, complexity or whatever else.
  362.  
  363. CACTUS is best used for
  364. - securing sensitive files on a PC,
  365. - for securing the communication traffic in closed user groups,
  366. - for generating random byte files,
  367. - creation of passwords or registration codes,
  368. - for authentications.
  369.  
  370. The advantage of CACTUS over other algorithms is the easy change of all
  371. parameters of the algorithm - not only the key - by a parameter file.
  372.  
  373.  
  374. ********************* Important legal aspect *******************************
  375. *                                                                          *
  376. * Most probably CACTUS falls under US governments ITAR regulations. Others *
  377. * then US or Canadian Citizens should get CACTUS from a server outside     *
  378. * of Northamerica to avoid illegal export from the US.                     *
  379. *                                                                          *
  380. * Encryption is prohibited in some countries (i.e. France) without         *
  381. * permission from the government.                                          *
  382. *                                                                          *
  383. ****************************************************************************
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.