home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / answers / cryptography-faq / part08 < prev    next >
Internet Message Format  |  1993-12-26  |  20KB

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