home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / com / utils / elm / sources / readme < prev    next >
Text File  |  1992-05-19  |  8KB  |  210 lines

  1.  
  2.  
  3.     UFC-crypt: ultra fast 'crypt' implementation
  4.     ============================================
  5.  
  6.     @(#)README    2.19 5/19/92
  7.  
  8. Design goals/non goals:
  9. ----------------------
  10.  
  11. - Crypt implementation plugin compatible with crypt(3)/fcrypt.
  12.  
  13. - High performance when used for password cracking.
  14.  
  15. - Portable to most 32/64 bit machines.
  16.  
  17. - Startup time/mixed salt performance not critical.
  18.  
  19. Features of the implementation:
  20. ------------------------------
  21.  
  22. - On most machines, UFC-crypt runs 30-60 times faster than crypt(3) when
  23.   invoked repeated times with the same salt and varying passwords.
  24.  
  25. - With mostly constant salts, performance is about two to three times
  26.   that of the default fcrypt implementation shipped with Alec
  27.   Muffets 'Crack' password cracker. For instructions on how to
  28.   plug UFC-crypt into 'Crack', see below.
  29.  
  30. - With alternating salts, performance is only about twice
  31.   that of crypt(3).
  32.  
  33. - Tested on 680x0, 386, SPARC, MIPS, HP-PA, Convex, Cray,
  34.   Pyramid and IBM RS/6000 systems as well as with gcc on IBM PS/2(DOS)
  35.   and Linux on a 386 PC.
  36.  
  37. - Requires 165 kb for tables.
  38.  
  39. - UFC-crypt is known to have compilation problems with some micro computer
  40.   C compilers (e.g. Turbo C++) due to its table sizes. Flame the vendors
  41.   for placing arbitrary limitations on their products. Use & support the
  42.   GNU C compiler, gcc.
  43.  
  44. - Also includes 'fcrypt16' - the function used with DEC's enhanced
  45.   security setup.
  46.  
  47. Author & licensing etc
  48. ----------------------
  49.  
  50. UFC-crypt is created by Michael Glad, email: glad@daimi.aau.dk, and has
  51. been donated to the Free Software Foundation, Inc. It is covered by the
  52. GNU library license version 2, see the file 'COPYING'.
  53.  
  54. Installing UFC-crypt
  55. --------------------
  56.  
  57. Installing as part of the GNU C Library:
  58. ***************************************
  59.  
  60. Unpack UFC-crypt and move the directory holding the sources into the
  61. C library source directory as 'crypt'.
  62.  
  63. UNIX install
  64. ************
  65.  
  66. Edit the Makefile setting the variables
  67.  
  68. CRYPT:    The encryption module to use; crypt.o should always work.
  69.         If compiling for one of the machines for which special support
  70.     is available, select the appropriate module.
  71.  
  72. CC:    The compiler to use.
  73.  
  74. OFLAGS: The highest level of optimization available.
  75.  
  76. Now run 'make'. UFC-crypt is compiled into 'libufc.a'. A test program: ufc
  77. is also linked. Try it out: './ufc 1' to test proper operation.
  78.  
  79. For a more thorough test, run 'make tests'. This compiles and invokes
  80. a DES validation suite as well as two benchmark programs comparing
  81. UFC-crypt with the native crypt(3) implementation.
  82.  
  83. If your friendly vendor has omitted crypt(3) from libc, compilation of
  84. the native benchmark program 'speedc' will fail. Compilation of the
  85. 'speed*' programs may also fail as they use timer facilities not present
  86. in the same form in all UNIX implementations. If so is, you may choose to
  87.  run '/bin/time ./ufc 10000' and divide the CPU time used by 10000.
  88.  
  89. 'libufc.a' can be linked into your applications. It is compatible with
  90. both crypt(3) and the fcrypt shipped with Alec Muffett's Crack program.
  91.  
  92. DOS install
  93. ***********
  94.  
  95. UFC-crypt compiles under DOS at least with MSC 6.00A. To compile,
  96. move 'patchlevel.h' to 'pl.h', 'ufc-crypt.h' to 'ufc.h' and 'crypt_util.c'
  97. to 'cryptutl.c'. When compiling, define the macro 'DOS' ( -DDOS ).
  98. You should compile & link the programs by hand. Refer to the Makefile to
  99. see which modules is needed for a program. You should be able to compile &
  100. run the verification programs 'cert' and 'ufc' but not the benchmark program
  101. 'speedf'. For benchmarking, measure the running time of 'ufc 10000'.
  102. Having compiled the modules, you can link 'cryptutl.o' and 'crypt.o' into
  103. your application programs or put them into a library.
  104.  
  105. Installing UFC-crypt into Crack:
  106. *******************************
  107.  
  108. Crack Release 4.0a: in 'Sources/Makefile', change the CRACKCRYPT macro
  109.             to a path leading to 'libufc.a' and invoke the Crack
  110.             script as usual.
  111.  
  112. 4.1 and later:      Crack knows about UFC-crypt. Refer to the Crack docs
  113.             for instructions.
  114.  
  115. Benchmark table:
  116. ---------------
  117.  
  118. The table shows how many operations per second UFC-crypt can
  119. do on various machines.
  120.  
  121. |--------------|-------------------------------------------|
  122. |Machine       |  SUN*  SUN*   HP*     DecStation   HP     |
  123. |              | 3/50   ELC  9000/425e    3100    9000/720 |
  124. |--------------|-------------------------------------------|
  125. | Crypt(3)/sec |  4.6    30     15         25        57    |
  126. | Ufc/sec      |  220   990    780       1015      3500    |
  127. |--------------|-------------------------------------------|
  128. | Speedup      |   48    30     52         40        60    |
  129. |--------------|-------------------------------------------|
  130.  
  131. *) Compiled using special assembly language support module.
  132.  
  133. It seems as if performance is limited by CPU bus and data cache capacity.
  134. This also makes the benchmarks debatable compared to a real test with
  135. UFC-crypt wired into Crack. However, the table gives an outline of
  136. what can be expected.
  137.  
  138. Optimizations:
  139. -------------
  140.  
  141. Here are the optimizations used relative to an ordinary implementation
  142. such as the one said to be used in crypt(3).
  143.  
  144. Major optimizations
  145. *******************
  146.  
  147. - Keep data packed as bits in integer variables -- allows for
  148.   fast permutations & parallel xor's in CPU hardware.
  149.  
  150. - Let adjacent final & initial permutations collapse.
  151.  
  152. - Keep working data in 'E expanded' format all the time.
  153.  
  154. - Implement DES 'f' function mostly by table lookup
  155.  
  156. - Calculate the above function on 12 bit basis rather than 6
  157.   as would be the most natural.
  158.  
  159. - Implement setup routines so that performance is limited by the DES
  160.   inner loops only.
  161.  
  162. Minor (dirty) optimizations
  163. ***************************
  164.  
  165. - combine iterations of DES inner loop so that DES only loops
  166.   8 times. This saves a lot of variable swapping.
  167.  
  168. - Implement key access by a walking pointer rather than coding
  169.   as array indexing.
  170.  
  171. - As described, the table based f function uses a 3 dimensional array:
  172.  
  173.     sb ['number of 12 bit segment']['12 bit index']['48 bit half index']
  174.  
  175.   Code the routine with 4 (one dimensional) vectors.
  176.  
  177. - Design the internal data format & uglify the DES loops so that
  178.   the compiler does not need to do bit shifts when indexing vectors.
  179.  
  180. Portability issues
  181. ******************
  182.  
  183. UFC-crypt does not need to know the byte endianness of the machine is runs on.
  184.  
  185. To speed up the DES inner loop, it does a dirty trick requiring the
  186. availability of a integer flavoured data type occupying exactly 32 (or 64)
  187. bits. This is normally the case of 'long'. The header file 'ufc-crypt.h'
  188. contains typedefs for this type. If you have to change it (or any other part)
  189. to get things working, please drop me a note.
  190.  
  191. UFC-crypt can take advantage of 64 bit integers. At the moment, it is
  192. configured to do so automatically for Convex & Cray machines.
  193.  
  194. Revision history
  195. ****************
  196.  
  197. UFC patchlevel 0: base version; released to alt.sources on Sep 24 1991
  198. UFC patchlevel 1: patch released to alt.sources on Sep 27 1991.
  199.           No longer rebuilds sb tables when seeing a new salt.
  200. UFC-crypt pl0:      Essentially UFC pl 1. Released to comp.sources.misc
  201.           on Oct 22 1991.
  202. UFC-crypt pl1:    Released to comp.sources.misc in march 1992
  203.           * setkey/encrypt routines added
  204.           * added validation/benchmarking programs
  205.           * reworked keyschedule setup code
  206.           * memory demands reduced
  207.           * 64 bit support added
  208.  
  209.  
  210.