home *** CD-ROM | disk | FTP | other *** search
/ Danny Amor's Online Library / Danny Amor's Online Library - Volume 1.iso / html / faqs / faq / cryptography-faq / part08 < prev    next >
Encoding:
Text File  |  1995-07-25  |  18.7 KB  |  388 lines

  1. Subject: Cryptography FAQ (08/10: Technical Miscellany)
  2. Newsgroups: sci.crypt,talk.politics.crypto,sci.answers,news.answers,talk.answers
  3. From: crypt-comments@math.ncsu.edu
  4. Date: 22 Nov 1994 05:55:05 GMT
  5.  
  6. Archive-name: cryptography-faq/part08
  7. Last-modified: 94/01/25
  8.  
  9.  
  10. This is the eighth of ten parts of the sci.crypt FAQ. The parts are
  11. mostly independent, but you should read the first part before the rest.
  12. We don't have the time to send out missing parts by mail, so don't ask.
  13. Notes such as ``[KAH67]'' refer to the reference list in the last part.
  14.  
  15. The sections of this FAQ are available via anonymous FTP to rtfm.mit.edu 
  16. as /pub/usenet/news.answers/cryptography-faq/part[xx]. The Cryptography 
  17. FAQ is posted to the newsgroups sci.crypt, talk.politics.crypto, 
  18. sci.answers, and news.answers every 21 days.
  19.  
  20.  
  21.  
  22. Contents
  23.  
  24. 8.1. How do I recover from lost passwords in WordPerfect?
  25. 8.2. How do I break a Vigenere (repeated-key) cipher?
  26. 8.3. How do I send encrypted mail under UNIX? [PGP, RIPEM, PEM, ...]
  27. 8.4. Is the UNIX crypt command secure?
  28. 8.5. How do I use compression with encryption?
  29. 8.6. Is there an unbreakable cipher?
  30. 8.7. What does ``random'' mean in cryptography?
  31. 8.8. What is the unicity point (a.k.a. unicity distance)?
  32. 8.9. What is key management and why is it important?
  33. 8.10. Can I use pseudo-random or chaotic numbers as a key stream?
  34. 8.11. What is the correct frequency list for English letters?
  35. 8.12. What is the Enigma?
  36. 8.13. How do I shuffle cards?
  37. 8.14. Can I foil S/W pirates by encrypting my CD-ROM?
  38. 8.15. Can you do automatic cryptanalysis of simple ciphers?
  39. 8.16. What is the coding system used by VCR+?
  40.  
  41.  
  42. 8.1. How do I recover from lost passwords in WordPerfect?
  43.  
  44.   WordPerfect encryption has been shown to be very easy to break.
  45.   The method uses XOR with two repeating key streams: a typed password
  46.   and a byte-wide counter initialized to 1+<the password length>. Full
  47.   descriptions are given in Bennett [BEN87] and Bergen and Caelli
  48.   [BER91].
  49.  
  50.   Chris Galas writes: ``Someone awhile back was looking for a way to
  51.   decrypt WordPerfect document files and I think I have a solution. 
  52.   There is a software company named: Accessdata (87 East 600 South,
  53.   Orem, UT 84058), 1-800-658-5199 that has a software package that will
  54.   decrypt any WordPerfect, Lotus 1-2-3, Quatro-Pro, MS Excel and Paradox
  55.   files. The cost of the package is $185. Steep prices, but if you
  56.   think your pw key is less than 10 characters, (or 10 char) give them a
  57.   call and ask for the free demo disk. The demo disk will decrypt files
  58.   that have a 10 char or less pw key.'' Bruce Schneier says the phone
  59.   number for AccessData is 801-224-6970.
  60.  
  61. 8.2. How do I break a Vigenere (repeated-key) cipher?
  62.  
  63.   A repeated-key cipher, where the ciphertext is something like the
  64.   plaintext xor KEYKEYKEYKEY (and so on), is called a Vigenere cipher.
  65.   If the key is not too long and the plaintext is in English, do the
  66.   following: 
  67.  
  68.   1. Discover the length of the key by counting coincidences.
  69.   (See Gaines [GAI44], Sinkov [SIN66].) Trying each displacement of
  70.   the ciphertext against itself, count those bytes which are equal. 
  71.   If the two ciphertext portions have used the same key, something
  72.   over 6% of the bytes will be equal. If they have used different
  73.   keys, then less than 0.4% will be equal (assuming random 8-bit bytes
  74.   of key covering normal ASCII text). The smallest displacement which
  75.   indicates an equal key is the length of the repeated key.
  76.  
  77.   2. Shift the text by that length and XOR it with itself. This
  78.   removes the key and leaves you with text XORed with itself. Since
  79.   English has about 1 bit of real information per byte, 2 streams of
  80.   text XORed together has 2 bits of info per 8-bit byte, providing
  81.   plenty of redundancy for choosing a unique decryption. (And in fact
  82.   one stream of text XORed with itself has just 1 bit per byte.)
  83.  
  84.   If the key is short, it might be even easier to treat this as a
  85.   standard polyalphabetic substitution. All the old cryptanalysis
  86.   texts show how to break those. It's possible with those methods, in
  87.   the hands of an expert, if there's only ten times as much text as key.
  88.   See, for example, Gaines [GAI44], Sinkov [SIN66].
  89.  
  90. 8.3. How do I send encrypted mail under UNIX? [PGP, RIPEM, PEM, ...]
  91.  
  92.   Here's one popular method, using the des command:
  93.  
  94.     cat file | compress | des private_key | uuencode | mail
  95.  
  96.   Meanwhile, there is a de jure Internet standard in the works called
  97.   PEM (Privacy Enhanced Mail). It is described in RFCs 1421 through
  98.   1424. To join the PEM mailing list, contact pem-dev-request@tis.com.
  99.   There is a beta version of PEM being tested at the time of this
  100.   writing.
  101.  
  102.   There are also two programs available in the public domain for encrypting
  103.   mail: PGP and RIPEM. Both are available by FTP. Each has its own
  104.   newsgroup: alt.security.pgp and alt.security.ripem. Each has its own FAQ
  105.   as well.
  106.  
  107.   PGP is most commonly used outside the USA since it uses the RSA algorithm
  108.   without a license and RSA's patent is valid only (or at least primarily)
  109.   in the USA.
  110.  
  111.   RIPEM is most commonly used inside the USA since it uses the RSAREF which
  112.   is freely available within the USA but not available for shipment outside
  113.   the USA.
  114.  
  115.   Since both programs use a secret key algorithm for encrypting the body of
  116.   the message (PGP used IDEA; RIPEM uses DES) and RSA for encrypting the
  117.   message key, they should be able to interoperate freely. Although there
  118.   have been repeated calls for each to understand the other's formats and
  119.   algorithm choices, no interoperation is available at this time (as far as
  120.   we know).
  121.  
  122. 8.4. Is the UNIX crypt command secure?
  123.  
  124.   No. See [REE84]. There is a program available called cbw (crypt
  125.   breaker's workbench) which can be used to do ciphertext-only attacks
  126.   on files encrypted with crypt. One source for CBW is [FTPCB].
  127.  
  128. 8.5. How do I use compression with encryption?
  129.  
  130.   A number of people have proposed doing perfect compression followed by
  131.   some simple encryption method (e.g., XOR with a repeated key).  This
  132.   would work, if you could do perfect compression.  Unfortunately, you can
  133.   only compress perfectly if you know the exact distribution of possible
  134.   inputs, and that is almost certainly not possible.
  135.  
  136.   Compression aids encryption by reducing the redundancy of the plaintext.
  137.   This increases the amount of ciphertext you can send encrypted under a
  138.   given number of key bits.  (See "unicity distance")
  139.  
  140.   Nearly all practical compression schemes, unless they have been designed
  141.   with cryptography in mind, produce output that actually starts off with
  142.   high redundancy. For example, the output of UNIX compress begins with a
  143.   well-known three-byte ``magic number''.  This produces a field of "known
  144.   plaintext" which can be used for some forms of cryptanalytic attack.
  145.   Compression is generally of value, however, because it removes other
  146.   known plaintext in the middle of the file being encrypted.  In general,
  147.   the lower the redundancy of the plaintext being fed an encryption
  148.   algorithm, the more difficult the cryptanalysis of that algorithm.
  149.  
  150.   In addition, compression shortens the input file, shortening the output
  151.   file and reducing the amount of CPU required to do the encryption
  152.   algorithm, so even if there were no enhancement of security, compression
  153.   before encryption would be worthwhile.
  154.  
  155.   Compression after encryption is silly.  If an encryption algorithm is
  156.   good, it will produce output which is statistically indistinguishable
  157.   from random numbers and no compression algorithm will successfully
  158.   compress random numbers.  On the other hand, if a compression algorithm
  159.   succeeds in finding a pattern to compress out of an encryption's output,
  160.   then a flaw in that algorithm has been found.
  161.  
  162. 8.6. Is there an unbreakable cipher?
  163.  
  164.   Yes. The one-time pad is unbreakable; see part 4. Unfortunately the
  165.   one-time pad requires secure distribution of as much key material as
  166.   plaintext.
  167.  
  168.   Of course, a cryptosystem need not be utterly unbreakable to be
  169.   useful. Rather, it needs to be strong enough to resist attacks by
  170.   likely enemies for whatever length of time the data it protects is
  171.   expected to remain valid.
  172.  
  173. 8.7. What does ``random'' mean in cryptography?
  174.  
  175.   Cryptographic applications demand much more out of a pseudorandom
  176.   number generator than most applications. For a source of bits to be
  177.   cryptographically random, it must be computationally impossible to
  178.   predict what the Nth random bit will be given complete knowledge of
  179.   the algorithm or hardware generating the stream and the sequence of
  180.   0th through N-1st bits, for all N up to the lifetime of the source.
  181.  
  182.   A software generator (also known as pseudo-random) has the function
  183.   of expanding a truly random seed to a longer string of apparently
  184.   random bits. This seed must be large enough not to be guessed by
  185.   the opponent. Ideally, it should also be truly random (perhaps
  186.   generated by a hardware random number source).
  187.  
  188.   Those who have Sparcstation 1 workstations could, for example,
  189.   generate random numbers using the audio input device as a source of
  190.   entropy, by not connecting anything to it. For example,
  191.  
  192.         cat /dev/audio | compress - >foo
  193.  
  194.   gives a file of high entropy (not random but with much randomness in
  195.   it). One can then encrypt that file using part of itself as a key,
  196.   for example, to convert that seed entropy into a pseudo-random
  197.   string.
  198.  
  199.   When looking for hardware devices to provide this entropy, it is
  200.   important really to measure the entropy rather than just assume that
  201.   because it looks complicated to a human, it must be "random". For
  202.   example, disk operation completion times sound like they might be
  203.   unpredictable (to many people) but a spinning disk is much like a
  204.   clock and its output completion times are relatively low in entropy.
  205.  
  206. 8.8. What is the unicity point (a.k.a. unicity distance)?
  207.  
  208.   See [SHA49]. The unicity distance is an approximation to that amount
  209.   of ciphertext such that the sum of the real information (entropy) in
  210.   the corresponding source text and encryption key equals the number
  211.   of ciphertext bits used. Ciphertexts significantly longer than this
  212.   can be shown probably to have a unique decipherment. This is used to
  213.   back up a claim of the validity of a ciphertext-only cryptanalysis. 
  214.   Ciphertexts significantly shorter than this are likely to have
  215.   multiple, equally valid decryptions and therefore to gain security
  216.   from the opponent's difficulty choosing the correct one.
  217.  
  218.   Unicity distance, like all statistical or information-theoretic
  219.   measures, does not make deterministic predictions but rather gives
  220.   probabilistic results: namely, the minimum amount of ciphertext
  221.   for which it is likely that there is only a single intelligible
  222.   plaintext corresponding to the ciphertext, when all possible keys
  223.   are tried for the decryption. Working cryptologists don't normally
  224.   deal with unicity distance as such. Instead they directly determine
  225.   the likelihood of events of interest.
  226.  
  227.   Let the unicity distance of a cipher be D characters. If fewer than
  228.   D ciphertext characters have been intercepted, then there is not
  229.   enough information to distinguish the real key from a set of
  230.   possible keys. DES has a unicity distance of 17.5 characters,
  231.   which is less than 3 ciphertext blocks (each block corresponds to
  232.   8 ASCII characters). This may seem alarmingly low at first, but
  233.   the unicity distance gives no indication of the computational work
  234.   required to find the key after approximately D characters have been
  235.   intercepted.
  236.  
  237.   In fact, actual cryptanalysis seldom proceeds along the lines used
  238.   in discussing unicity distance. (Like other measures such as key
  239.   size, unicity distance is something that guarantees insecurity if
  240.   it's too small, but doesn't guarantee security if it's high.) Few
  241.   practical cryptosystems are absolutely impervious to analysis; all
  242.   manner of characteristics might serve as entering ``wedges'' to crack
  243.   some cipher messages. However, similar information-theoretic
  244.   considerations are occasionally useful, for example, to determine a
  245.   recommended key change interval for a particular cryptosystem.
  246.   Cryptanalysts also employ a variety of statistical and
  247.   information-theoretic tests to help guide the analysis in the most
  248.   promising directions.
  249.  
  250.   Unfortunately, most literature on the application of information
  251.   statistics to cryptanalysis remains classified, even the seminal
  252.   1940 work of Alan Turing (see [KOZ84]). For some insight into the
  253.   possibilities, see [KUL68] and [GOO83].
  254.  
  255. 8.9. What is key management and why is it important?
  256.  
  257.   One of the fundamental axioms of cryptography is that the enemy is in
  258.   full possession of the details of the general cryptographic system,
  259.   and lacks only the specific key data employed in the encryption. (Of
  260.   course, one would assume that the CIA does not make a habit of telling
  261.   Mossad about its cryptosystems, but Mossad probably finds out anyway.)
  262.   Repeated use of a finite amount of key provides redundancy that can
  263.   eventually facilitate cryptanalytic progress. Thus, especially in
  264.   modern communication systems where vast amounts of information are
  265.   transferred, both parties must have not only a sound cryptosystem but
  266.   also enough key material to cover the traffic.
  267.  
  268.   Key management refers to the distribution, authentication, and
  269.   handling of keys.
  270.  
  271.   A publicly accessible example of modern key management technology
  272.   is the STU III secure telephone unit, which for classified use
  273.   employs individual coded ``Crypto Ignition Keys'' and a central Key
  274.   Management Center operated by NSA. There is a hierarchy in that
  275.   certain CIKs are used by authorized cryptographic control
  276.   personnel to validate the issuance of individual traffic keys and
  277.   to perform installation/maintenance functions, such as the
  278.   reporting of lost CIKs.
  279.  
  280.   This should give an inkling of the extent of the key management
  281.   problem. For public-key systems, there are several related issues,
  282.   many having to do with ``whom do you trust?''
  283.  
  284. 8.10. Can I use pseudo-random or chaotic numbers as a key stream?
  285.  
  286.   Chaotic equations and fractals produce an apparent randomness from
  287.   relatively compact generators. Perhaps the simplest example is a
  288.   linear congruential sequence, one of the most popular types of random
  289.   number generators, where there is no obvious dependence between seeds
  290.   and outputs. Unfortunately the graph of any such sequence will, in a
  291.   high enough dimension, show up as a regular lattice. Mathematically
  292.   this lattice corresponds to structure which is notoriously easy for
  293.   cryptanalysts to exploit. More complicated generators have more
  294.   complicated structure, which is why they make interesting pictures---
  295.   but a cryptographically strong sequence will have no computable
  296.   structure at all.
  297.  
  298.   See [KNU81], exercise 3.5-7; [REE77]; and [BOY89].
  299.  
  300. 8.11. What is the correct frequency list for English letters?
  301.  
  302.   There are three answers to this question, each slightly deeper than
  303.   the one before. You can find the first answer in various books:
  304.   namely, a frequency list computed directly from a certain sample of
  305.   English text.
  306.  
  307.   The second answer is that ``the English language'' varies from author
  308.   to author and has changed over time, so there is no definitive list.
  309.   Of course the lists in the books are ``correctly'' computed, but
  310.   they're all different: exactly which list you get depends on which
  311.   sample was taken. Any particular message will have different
  312.   statistics from those of the language as a whole.
  313.  
  314.   The third answer is that yes, no particular message is going to have
  315.   exactly the same characteristics as English in general, but for all
  316.   reasonable statistical uses these slight discrepancies won't matter.
  317.   In fact there's an entire field called ``Bayesian statistics'' (other
  318.   buzzwords are ``maximum entropy methods'' and ``maximum likelihood
  319.   estimation'') which studies questions like ``What's the chance that a
  320.   text with these letter frequencies is in English?'' and comes up with
  321.   reasonably robust answers.
  322.  
  323.   So make your own list from your own samples of English text. It will
  324.   be good enough for practical work, if you use it properly.
  325.  
  326. 8.12. What is the Enigma?
  327.  
  328.   ``For a project in data security we are looking for sources of
  329.   information about the German Enigma code and how it was broken by
  330.   the British during WWII.''
  331.  
  332.   See [WEL82], [DEA85], [KOZ84], [HOD83], [KAH91].
  333.  
  334. 8.13. How do I shuffle cards?
  335.  
  336.   Card shuffling is a special case of the permutation of an array of
  337.   values, using a random or pseudo-random function. All possible output
  338.   permutations of this process should be equally likely. To do this, you
  339.   need a random function (modran(x)) which will produce a uniformly
  340.   distributed random integer in the interval [0..x-1]. Given that
  341.   function, you can shuffle with the following [C] code: (assuming ARRLTH
  342.   is the length of array arr[] and swap() interchanges values at the two
  343.   addresses given)
  344.  
  345.   for ( n = ARRLTH-1; n > 0 ; n-- ) swap( &arr[modran( n+1 )], &arr[n] ) ;
  346.  
  347.   modran(x) can not be achieved exactly with a simple (ranno() % x) since
  348.   ranno()'s interval may not be divisible by x, although in most cases the
  349.   error will be very small. To cover this case, one can take ranno()'s
  350.   modulus mod x, call that number y, and if ranno() returns a value less
  351.   than y, go back and get another ranno() value.
  352.  
  353.   See [KNU81] for further discussion.
  354.  
  355. 8.14. Can I foil S/W pirates by encrypting my CD-ROM?
  356.  
  357.   Someone will frequently express the desire to publish a CD-ROM with
  358.   possibly multiple pieces of software, perhaps with each encrypted
  359.   separately, and will want to use different keys for each user (perhaps
  360.   even good for only a limited period of time) in order to avoid piracy.
  361.  
  362.   As far as we know, this is impossible, since there is nothing in standard
  363.   PC or workstation hardware which uniquely identifies the user at the
  364.   keyboard. If there were such an identification, then the CD-ROM could be
  365.   encrypted with a key based in part on the one sold to the user and in
  366.   part on the unique identifier. However, in this case the CD-ROM is one
  367.   of a kind and that defeats the intended purpose.
  368.  
  369.   If the CD-ROM is to be encrypted once and then mass produced, there must
  370.   be a key (or set of keys) for that encryption produced at some stage in
  371.   the process. That key is useable with any copy of the CD-ROM's data.
  372.   The pirate needs only to isolate that key and sell it along with the
  373.   illegal copy.
  374.  
  375. 8.15. Can you do automatic cryptanalysis of simple ciphers?
  376.  
  377.   Certainly. For commercial products you can try AccessData; see
  378.   question 8.1. We are not aware of any FTP sites for such software,
  379.   but there are many papers on the subject. See [PEL79], [LUC88],
  380.   [CAR86], [CAR87], [KOC87], [KOC88], [KIN92], [KIN93], [SPI93].
  381.  
  382. 8.16. What is the coding system used by VCR+?
  383.  
  384.   One very frequently asked question in sci.crypt is how the VCR+ codes
  385.   work. The codes are used to program a VCR based on numerical input.
  386.   See [SHI92] for an attempt to describe it.
  387.  
  388.