Blame crypt/README.ufc-crypt

Packit 6c4009
The following is the README for UFC-crypt, with those portions deleted
Packit 6c4009
that are known to be incorrect for the implementation used with the
Packit 6c4009
GNU C library.
Packit 6c4009
Packit 6c4009
Packit 6c4009
	UFC-crypt: ultra fast 'crypt' implementation
Packit 6c4009
	============================================
Packit 6c4009
Packit 6c4009
	@(#)README	2.27 11 Sep 1996
Packit 6c4009
Packit 6c4009
Design goals/non goals:
Packit 6c4009
----------------------
Packit 6c4009
Packit 6c4009
- Crypt implementation plugin compatible with crypt(3)/fcrypt.
Packit 6c4009
Packit 6c4009
- High performance when used for password cracking.
Packit 6c4009
Packit 6c4009
- Portable to most 32/64 bit machines.
Packit 6c4009
Packit 6c4009
- Startup time/mixed salt performance not critical.
Packit 6c4009
Packit 6c4009
Features of the implementation:
Packit 6c4009
------------------------------
Packit 6c4009
Packit 6c4009
- On most machines, UFC-crypt runs 30-60 times faster than crypt(3) when
Packit 6c4009
  invoked repeated times with the same salt and varying passwords.
Packit 6c4009
Packit 6c4009
- With mostly constant salts, performance is about two to three times
Packit 6c4009
  that of the default fcrypt implementation shipped with Alec
Packit 6c4009
  Muffets 'Crack' password cracker. For instructions on how to
Packit 6c4009
  plug UFC-crypt into 'Crack', see below.
Packit 6c4009
Packit 6c4009
- With alternating salts, performance is only about twice
Packit 6c4009
  that of crypt(3).
Packit 6c4009
Packit 6c4009
- Requires 165 kb for tables.
Packit 6c4009
Packit 6c4009
Author & licensing etc
Packit 6c4009
----------------------
Packit 6c4009
Packit 6c4009
UFC-crypt is created by Michael Glad, email: glad@daimi.aau.dk, and has
Packit 6c4009
been donated to the Free Software Foundation, Inc. It is covered by the
Packit 6c4009
GNU library license version 2, see the file 'COPYING.LIB'.
Packit 6c4009
Packit 6c4009
NOTES FOR USERS OUTSIDE THE US:
Packit 6c4009
------------------------------
Packit 6c4009
Packit 6c4009
The US government limits the export of DES based software/hardware.
Packit 6c4009
This software is written in Aarhus, Denmark. It can therefore be retrieved
Packit 6c4009
from ftp sites outside the US without breaking US law. Please do not
Packit 6c4009
ftp it from american sites.
Packit 6c4009
Packit 6c4009
Benchmark table:
Packit 6c4009
---------------
Packit 6c4009
Packit 6c4009
The table shows how many operations per second UFC-crypt can
Packit 6c4009
do on various machines.
Packit 6c4009
Packit 6c4009
|--------------|-------------------------------------------|
Packit 6c4009
|Machine       |  SUN*  SUN*   HP*     DecStation   HP     |
Packit 6c4009
|              | 3/50   ELC  9000/425e    3100    9000/720 |
Packit 6c4009
|--------------|-------------------------------------------|
Packit 6c4009
| Crypt(3)/sec |  4.6    30     15         25        57    |
Packit 6c4009
| Ufc/sec      |  220   990    780       1015      3500    |
Packit 6c4009
|--------------|-------------------------------------------|
Packit 6c4009
| Speedup      |   48    30     52         40        60    |
Packit 6c4009
|--------------|-------------------------------------------|
Packit 6c4009
Packit 6c4009
*) Compiled using special assembly language support module.
Packit 6c4009
Packit 6c4009
It seems as if performance is limited by CPU bus and data cache capacity.
Packit 6c4009
This also makes the benchmarks debatable compared to a real test with
Packit 6c4009
UFC-crypt wired into Crack. However, the table gives an outline of
Packit 6c4009
what can be expected.
Packit 6c4009
Packit 6c4009
Optimizations:
Packit 6c4009
-------------
Packit 6c4009
Packit 6c4009
Here are the optimizations used relative to an ordinary implementation
Packit 6c4009
such as the one said to be used in crypt(3).
Packit 6c4009
Packit 6c4009
Major optimizations
Packit 6c4009
*******************
Packit 6c4009
Packit 6c4009
- Keep data packed as bits in integer variables -- allows for
Packit 6c4009
  fast permutations & parallel xor's in CPU hardware.
Packit 6c4009
Packit 6c4009
- Let adjacent final & initial permutations collapse.
Packit 6c4009
Packit 6c4009
- Keep working data in 'E expanded' format all the time.
Packit 6c4009
Packit 6c4009
- Implement DES 'f' function mostly by table lookup
Packit 6c4009
Packit 6c4009
- Calculate the above function on 12 bit basis rather than 6
Packit 6c4009
  as would be the most natural.
Packit 6c4009
Packit 6c4009
- Implement setup routines so that performance is limited by the DES
Packit 6c4009
  inner loops only.
Packit 6c4009
Packit 6c4009
- Instead of doing salting in the DES inner loops, modify the above tables
Packit 6c4009
  each time a new salt is seen. According to the BSD crypt code this is
Packit 6c4009
  ugly :-)
Packit 6c4009
Packit 6c4009
Minor (dirty) optimizations
Packit 6c4009
***************************
Packit 6c4009
Packit 6c4009
- combine iterations of DES inner loop so that DES only loops
Packit 6c4009
  8 times. This saves a lot of variable swapping.
Packit 6c4009
Packit 6c4009
- Implement key access by a walking pointer rather than coding
Packit 6c4009
  as array indexing.
Packit 6c4009
Packit 6c4009
- As described, the table based f function uses a 3 dimensional array:
Packit 6c4009
Packit 6c4009
	sb ['number of 12 bit segment']['12 bit index']['48 bit half index']
Packit 6c4009
Packit 6c4009
  Code the routine with 4 (one dimensional) vectors.
Packit 6c4009
Packit 6c4009
- Design the internal data format & uglify the DES loops so that
Packit 6c4009
  the compiler does not need to do bit shifts when indexing vectors.
Packit 6c4009
Packit 6c4009
Revision history
Packit 6c4009
****************
Packit 6c4009
Packit 6c4009
UFC patchlevel 0: base version; released to alt.sources on Sep 24 1991
Packit 6c4009
UFC patchlevel 1: patch released to alt.sources on Sep 27 1991.
Packit 6c4009
		  No longer rebuilds sb tables when seeing a new salt.
Packit 6c4009
UFC-crypt pl0:	  Essentially UFC pl 1. Released to comp.sources.misc
Packit 6c4009
		  on Oct 22 1991.
Packit 6c4009
UFC-crypt pl1:    Released to comp.sources.misc in march 1992
Packit 6c4009
		  * setkey/encrypt routines added
Packit 6c4009
		  * added validation/benchmarking programs
Packit 6c4009
		  * reworked keyschedule setup code
Packit 6c4009
		  * memory demands reduced
Packit 6c4009
		  * 64 bit support added