idnits 2.17.00 (12 Aug 2021) /tmp/idnits46085/draft-eastlake-randomness2-00.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Looks like you're using RFC 2026 boilerplate. This must be updated to follow RFC 3978/3979, as updated by RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** Missing document type: Expected "INTERNET-DRAFT" in the upper left hand corner of the first page ** The document seems to lack a 1id_guidelines paragraph about Internet-Drafts being working documents. ** The document seems to lack a 1id_guidelines paragraph about 6 months document validity -- however, there's a paragraph with a matching beginning. Boilerplate error? == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. ** There are 4 instances of too long lines in the document, the longest one being 3 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The "Author's Address" (or "Authors' Addresses") section title is misspelled. -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (July 2000) is 7979 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'SHS' is mentioned on line 876, but not defined == Unused Reference: 'ASYMMETRIC' is defined on line 1889, but no explicit reference was found in the text == Unused Reference: 'CRYPTO1' is defined on line 1902, but no explicit reference was found in the text == Unused Reference: 'DNSSEC' is defined on line 1935, but no explicit reference was found in the text == Unused Reference: 'IPSEC' is defined on line 1946, but no explicit reference was found in the text == Unused Reference: 'MAIL PGP' is defined on line 1966, but no explicit reference was found in the text == Unused Reference: 'SHIFT1' is defined on line 1984, but no explicit reference was found in the text == Unused Reference: 'SHIFT2' is defined on line 1987, but no explicit reference was found in the text == Unused Reference: 'STERN' is defined on line 1994, but no explicit reference was found in the text == Unused Reference: 'TLS' is defined on line 1997, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'ASYMMETRIC' -- Possible downref: Non-RFC (?) normative reference: ref. 'BBS' -- Possible downref: Non-RFC (?) normative reference: ref. 'BRILLINGER' -- Possible downref: Non-RFC (?) normative reference: ref. 'CRC' -- Possible downref: Non-RFC (?) normative reference: ref. 'CRYPTO1' -- Possible downref: Non-RFC (?) normative reference: ref. 'CRYPTO2' -- Possible downref: Non-RFC (?) normative reference: ref. 'CRYPTO3' -- Possible downref: Non-RFC (?) normative reference: ref. 'DAVIS' -- Possible downref: Non-RFC (?) normative reference: ref. 'DES' -- Possible downref: Non-RFC (?) normative reference: ref. 'DES MODES' -- Possible downref: Non-RFC (?) normative reference: ref. 'D-H' ** Obsolete normative reference: RFC 2535 (ref. 'DNSSEC') (Obsoleted by RFC 4033, RFC 4034, RFC 4035) -- Possible downref: Non-RFC (?) normative reference: ref. 'DoD' -- Possible downref: Non-RFC (?) normative reference: ref. 'GIFFORD' ** Obsolete normative reference: RFC 2401 (ref. 'IPSEC') (Obsoleted by RFC 4301) -- Possible downref: Non-RFC (?) normative reference: ref. 'KNUTH' -- Possible downref: Non-RFC (?) normative reference: ref. 'KRAWCZYK' ** Downref: Normative reference to an Historic RFC: RFC 1421 (ref. 'MAIL PEM') ** Obsolete normative reference: RFC 2440 (ref. 'MAIL PGP') (Obsoleted by RFC 4880) ** Obsolete normative reference: RFC 1320 (ref. 'MD4') (Obsoleted by RFC 6150) ** Downref: Normative reference to an Informational RFC: RFC 1321 (ref. 'MD5') ** Obsolete normative reference: RFC 1750 (Obsoleted by RFC 4086) -- Possible downref: Non-RFC (?) normative reference: ref. 'SHANNON' -- Possible downref: Non-RFC (?) normative reference: ref. 'SHIFT1' -- Possible downref: Non-RFC (?) normative reference: ref. 'SHIFT2' -- Possible downref: Non-RFC (?) normative reference: ref. 'SHA1' -- Possible downref: Non-RFC (?) normative reference: ref. 'STERN' ** Obsolete normative reference: RFC 2246 (ref. 'TLS') (Obsoleted by RFC 4346) -- Possible downref: Non-RFC (?) normative reference: ref. 'VON NEUMANN' Summary: 15 errors (**), 0 flaws (~~), 12 warnings (==), 23 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Network Working Group Donald E. Eastlake, 3rd 2 OBSOLETES RFC 1750 Jeffrey I. Schiller 3 Steve Crocker 4 Expires Januray 2001 July 2000 6 Randomness Requirements for Security 7 ---------- ------------ --- -------- 8 10 Status of This Document 12 This document is intended to become a Best Current Practice. 13 Comments should be sent to the authors. Distribution is unlimited. 15 This document is an Internet-Draft and is in full conformance with 16 all provisions of Section 10 of RFC2026. Internet-Drafts are working 17 documents of the Internet Engineering Task Force (IETF), its areas, 18 and its working groups. Note that other groups may also distribute 19 working documents as Internet-Drafts. 21 Internet-Drafts are draft documents valid for a maximum of six 22 months. Internet-Drafts may be updated, replaced, or obsoleted by 23 other documents at any time. It is not appropriate to use Internet- 24 Drafts as reference material or to cite them other than as a 25 ``working draft'' or ``work in progress.'' 27 The list of current Internet-Drafts can be accessed at 28 http://www.ietf.org/ietf/1id-abstracts.txt 30 The list of Internet-Draft Shadow Directories can be accessed at 31 http://www.ietf.org/shadow.html. 33 Abstract 35 Security systems today are built on increasingly strong cryptographic 36 algorithms that foil pattern analysis attempts. However, the security 37 of these systems is dependent on generating secret quantities for 38 passwords, cryptographic keys, and similar quantities. The use of 39 pseudo-random processes to generate secret quantities can result in 40 pseudo-security. The sophisticated attacker of these security 41 systems may find it easier to reproduce the environment that produced 42 the secret quantities, searching the resulting small set of 43 possibilities, than to locate the quantities in the whole of the 44 number space. 46 Choosing random quantities to foil a resourceful and motivated 47 adversary is surprisingly difficult. This document points out many 48 pitfalls in using traditional pseudo-random number generation 49 techniques for choosing such quantities. It recommends the use of 50 truly random hardware techniques and shows that the existing hardware 51 on many systems can be used for this purpose. It provides 52 suggestions to ameliorate the problem when a hardware solution is not 53 available. And it gives examples of how large such quantities need 54 to be for some particular applications. 56 Acknowledgements 58 Special thanks to the authors of "Minimal Key Lengths for Symmetric 59 Ciphers to Provide Adequate Commercial Security" which is 60 incorporated as Appendix A. 62 The following persons (in alpahbetic order) contributed to RFC 1750, 63 the predeceasor of this document: 65 David M. Balenson, Don T. Davis, Carl Ellison, Marc Horowitz, 66 Christian Huitema, Charlie Kaufman, Steve Kent, Hal Murray, Neil 67 Haller, Richard Pitkin, Tim Redmond, Doug Tygar. 69 Status of This Document....................................1 71 Abstract...................................................2 72 Acknowledgements...........................................2 74 Table of Contents..........................................3 76 1. Introduction............................................5 78 2. Requirements............................................6 80 3. Traditional Pseudo-Random Sequences.....................8 82 4. Unpredictability.......................................10 83 4.1 Problems with Clocks and Serial Numbers...............10 84 4.2 Timing and Content of External Events.................11 85 4.3 The Fallacy of Complex Manipulation...................11 86 4.4 The Fallacy of Selection from a Large Database........12 88 5. Hardware for Randomness................................13 89 5.1 Volume Required.......................................13 90 5.2 Sensitivity to Skew...................................13 91 5.2.1 Using Stream Parity to De-Skew......................14 92 5.2.2 Using Transition Mappings to De-Skew................15 93 5.2.3 Using FFT to De-Skew................................16 94 5.2.4 Using Compression to De-Skew........................16 95 5.3 Existing Hardware Can Be Used For Randomness..........17 96 5.3.1 Using Existing Sound/Video Input....................17 97 5.3.2 Using Existing Disk Drives..........................17 99 6. Recommended Non-Hardware Strategy......................18 100 6.1 Mixing Functions......................................18 101 6.1.1 A Trivial Mixing Function...........................18 102 6.1.2 Stronger Mixing Functions...........................19 103 6.1.3 Diff-Hellman as a Mixing Function...................20 104 6.1.4 Using a Mixing Function to Stretch Random Bits......21 105 6.1.5 Other Factors in Choosing a Mixing Function.........21 106 6.2 Non-Hardware Sources of Randomness....................22 107 6.3 Cryptographically Strong Sequences....................23 108 6.3.1 Traditional Strong Sequences........................23 109 6.3.2 The Blum Blum Shub Sequence Generator...............24 111 7. Key Generation Standards...............................26 112 7.1 US DoD Recommendations for Password Generation........26 113 7.2 X9.17 Key Generation..................................26 115 8. Examples of Randomness Required........................28 116 8.1 Password Generation..................................28 117 8.2 A Very High Security Cryptographic Key................29 118 8.2.1 Effort per Key Trial................................29 119 8.2.2 Meet in the Middle Attacks..........................29 120 8.2.3 Other Considerations................................30 122 9. Conclusion.............................................32 123 10. Security Considerations...............................32 125 Appendix: Minimal Secure Key Lengths Study................33 126 Appendix: Abstract........................................33 127 A.1. Encryption Plays an Essential Role in Protecting.....34 128 A.1.1 There is a need for information security............34 129 A.1.2 Encryption to protect confidentiality...............35 130 A.1.3 There are a variety of attackers....................36 131 A.1.4 Strong encryption is not expensive..................37 132 A.2. Brute-Forece is becoming easier......................37 133 A.3. 40-Bit Key Lengths Offer Virtually No Protection.....39 134 A.4. Even DES with 56-Bit Keys Is Increasingly Inadequate.40 135 A.4.1 DES is no panacea today.............................40 136 A.4.2 There are smarter avenues of attack than brute force41 137 A.4.3 Other algorithms are similar........................41 138 A.5. Appropriate Key Lengths for the Future --- A Proposal42 139 Appendix: About the Authors...............................44 140 Appendix: Acknowledgement.................................45 142 References................................................46 144 Authors Addresses.........................................49 145 File Name and Expiration..................................49 147 1. Introduction 149 [Other than the addition of Appendix A, the changes in this version 150 from RFC 1750 are relatively minor. Comments and suggestions are 151 solicited.] 153 Software cryptography is coming into wider use. Systems like IPSEC, 154 TLS, S/MIME, PGP, DNSSEC, Kerberos, etc. are maturing and becoming a 155 part of the network landscape [DNSSEC, IPSEC, MAIL*, TLS]. By 156 comparison, when the previous version of this document [RFC 1750] was 157 issued in 1994, about the only cryptographic security specification 158 in the IETF was the Privacy Enhanced Mail protocol [MAIL PEM]. 160 These systems provide substantial protection against snooping and 161 spoofing. However, there is a potential flaw. At the heart of all 162 cryptographic systems is the generation of secret, unguessable (i.e., 163 random) numbers. 165 For the present, the lack of generally available facilities for 166 generating such unpredictable numbers is an open wound in the design 167 of cryptographic software. For the software developer who wants to 168 build a key or password generation procedure that runs on a wide 169 range of hardware, the only safe strategy so far has been to force 170 the local installation to supply a suitable routine to generate 171 random numbers. To say the least, this is an awkward, error-prone 172 and unpalatable solution. 174 It is important to keep in mind that the requirement is for data that 175 an adversary has a very low probability of guessing or determining. 176 This will fail if pseudo-random data is used which only meets 177 traditional statistical tests for randomness or which is based on 178 limited range sources, such as clocks. Frequently such random 179 quantities are determinable by an adversary searching through an 180 embarrassingly small space of possibilities. 182 This informational document suggests techniques for producing random 183 quantities that will be resistant to such attack. It recommends that 184 future systems include hardware random number generation or provide 185 access to existing hardware that can be used for this purpose. It 186 suggests methods for use if such hardware is not available. And it 187 gives some estimates of the number of random bits required for sample 188 applications. 190 2. Requirements 192 Probably the most commonly encountered randomness requirement today 193 is the user password. This is usually a simple character string. 194 Obviously, if a password can be guessed, it does not provide 195 security. (For re-usable passwords, it is desirable that users be 196 able to remember the password. This may make it advisable to use 197 pronounceable character strings or phrases composed on ordinary 198 words. But this only affects the format of the password information, 199 not the requirement that the password be very hard to guess.) 201 Many other requirements come from the cryptographic arena. 202 Cryptographic techniques can be used to provide a variety of services 203 including confidentiality and authentication. Such services are 204 based on quantities, traditionally called "keys", that are unknown to 205 and unguessable by an adversary. 207 In some cases, such as the use of symmetric encryption with the one 208 time pads [CRYPTO*] or the US Data Encryption Standard [DES], the 209 parties who wish to communicate confidentially and/or with 210 authentication must all know the same secret key. In other cases, 211 using what are called asymmetric or "public key" cryptographic 212 techniques, keys come in pairs. One key of the pair is private and 213 must be kept secret by one party, the other is public and can be 214 published to the world. It is computationally infeasible to 215 determine the private key from the public key. [ASYMMETRIC, CRYPTO*] 217 The frequency and volume of the requirement for random quantities 218 differs greatly for different cryptographic systems. Using pure RSA 219 [CRYPTO*], random quantities are required when the key pair is 220 generated, but thereafter any number of messages can be signed 221 without any further need for randomness. The public key Digital 222 Signature Algorithm devused by the US National Institute of Standards 223 and Technology (NIST) requires good random numbers for each 224 signature. And encrypting with a one time pad, in principle the 225 strongest possible encryption technique, requires a volume of 226 randomness equal to all the messages to be processed. 228 In most of these cases, an adversary can try to determine the 229 "secret" key by trial and error. (This is possible as long as the 230 key is enough smaller than the message that the correct key can be 231 uniquely identified.) The probability of an adversary succeeding at 232 this must be made acceptably low, depending on the particular 233 application. The size of the space the adversary must search is 234 related to the amount of key "information" present in the information 235 theoretic sense [SHANNON]. This depends on the number of different 236 secret values possible and the probability of each value as follows: 238 ----- 239 \ 240 Bits-of-info = \ - p * log ( p ) 241 / i 2 i 242 / 243 ----- 245 where i varies from 1 to the number of possible secret values and p 246 sub i is the probability of the value numbered i. (Since p sub i is 247 less than one, the log will be negative so each term in the sum will 248 be non-negative.) 250 If there are 2^n different values of equal probability, then n bits 251 of information are present and an adversary would, on the average, 252 have to try half of the values, or 2^(n-1) , before guessing the 253 secret quantity. If the probability of different values is unequal, 254 then there is less information present and fewer guesses will, on 255 average, be required by an adversary. In particular, any values that 256 the adversary can know are impossible, or are of low probability, can 257 be initially ignored by an adversary, who will search through the 258 more probable values first. 260 For example, consider a cryptographic system that uses 56 bit keys. 261 If these 56 bit keys are derived by using a fixed pseudo-random 262 number generator that is seeded with an 8 bit seed, then an adversary 263 needs to search through only 256 keys (by running the pseudo-random 264 number generator with every possible seed), not the 2^56 keys that 265 may at first appear to be the case. Only 8 bits of "information" are 266 in these 56 bit keys. 268 3. Traditional Pseudo-Random Sequences 270 Most traditional sources of random numbers use deterministic sources 271 of "pseudo-random" numbers. These typically start with a "seed" 272 quantity and use numeric or logical operations to produce a sequence 273 of values. 275 [KNUTH] has a classic exposition on pseudo-random numbers. 276 Applications he mentions are simulation of natural phenomena, 277 sampling, numerical analysis, testing computer programs, decision 278 making, and games. None of these have the same characteristics as 279 the sort of security uses we are talking about. Only in the last two 280 could there be an adversary trying to find the random quantity. 281 However, in these cases, the adversary normally has only a single 282 chance to use a guessed value. In guessing passwords or attempting 283 to break an encryption scheme, the adversary normally has many, 284 perhaps unlimited, chances at guessing the correct value and should 285 be assumed to be aided by a computer. 287 For testing the "randomness" of numbers, Knuth suggests a variety of 288 measures including statistical and spectral. These tests check 289 things like autocorrelation between different parts of a "random" 290 sequence or distribution of its values. They could be met by a 291 constant stored random sequence, such as the "random" sequence 292 printed in the CRC Standard Mathematical Tables [CRC]. 294 A typical pseudo-random number generation technique, known as a 295 linear congruence pseudo-random number generator, is modular 296 arithmetic where the N+1th value is calculated from the Nth value by 298 V = ( V * a + b )(Mod c) 299 N+1 N 301 The above technique has a strong relationship to linear shift 302 register pseudo-random number generators, which are well understood 303 cryptographically [SHIFT*]. In such generators bits are introduced 304 at one end of a shift register as the Exclusive Or (binary sum 305 without carry) of bits from selected fixed taps into the register. 306 For example: 308 +----+ +----+ +----+ +----+ 309 | B | <-- | B | <-- | B | <-- . . . . . . <-- | B | <-+ 310 | 0 | | 1 | | 2 | | n | | 311 +----+ +----+ +----+ +----+ | 312 | | | | 313 | | V +-----+ 314 | V +----------------> | | 315 V +-----------------------------> | XOR | 316 +---------------------------------------------------> | | 317 +-----+ 319 V = ( ( V * 2 ) + B .xor. B ... )(Mod 2^n) 320 N+1 N 0 2 322 The goodness of traditional pseudo-random number generator algorithms 323 is measured by statistical tests on such sequences. Carefully chosen 324 values of the initial V and a, b, and c or the placement of shift 325 register tap in the above simple processes can produce excellent 326 statistics. 328 These sequences may be adequate in simulations (Monte Carlo 329 experiments) as long as the sequence is orthogonal to the structure 330 of the space being explored. Even there, subtle patterns may cause 331 problems. However, such sequences are clearly bad for use in 332 security applications. They are fully predictable if the initial 333 state is known. Depending on the form of the pseudo-random number 334 generator, the sequence may be determinable from observation of a 335 short portion of the sequence [CRYPTO*, STERN]. For example, with 336 the generators above, one can determine V(n+1) given knowledge of 337 V(n). In fact, it has been shown that with these techniques, even if 338 only one bit of the pseudo-random values are released, the seed can 339 be determined from short sequences. 341 Not only have linear congruent generators been broken, but techniques 342 are now known for breaking all polynomial congruent generators. 343 [KRAWCZYK] 345 4. Unpredictability 347 Randomness in the traditional sense described in section 3 is NOT the 348 same as the unpredictability required for security use. 350 For example, use of a widely available constant sequence, such as 351 that from the CRC tables, is very weak against an adversary. Once 352 they learn of or guess it, they can easily break all security, future 353 and past, based on the sequence. [CRC] Yet the statistical properties 354 of these tables are good. 356 The following sections describe the limitations of some randomness 357 generation techniques and sources. 359 4.1 Problems with Clocks and Serial Numbers 361 Computer clocks, or similar operating system or hardware values, 362 provide significantly fewer real bits of unpredictability than might 363 appear from their specifications. 365 Tests have been done on clocks on numerous systems and it was found 366 that their behavior can vary widely and in unexpected ways. One 367 version of an operating system running on one set of hardware may 368 actually provide, say, microsecond resolution in a clock while a 369 different configuration of the "same" system may always provide the 370 same lower bits and only count in the upper bits at much lower 371 resolution. This means that successive reads on the clock may 372 produce identical values even if enough time has passed that the 373 value "should" change based on the nominal clock resolution. There 374 are also cases where frequently reading a clock can produce 375 artificial sequential values because of extra code that checks for 376 the clock being unchanged between two reads and increases it by one! 377 Designing portable application code to generate unpredictable numbers 378 based on such system clocks is particularly challenging because the 379 system designer does not always know the properties of the system 380 clocks that the code will execute on. 382 Use of a hardware serial number such as an Ethernet address may also 383 provide fewer bits of uniqueness than one would guess. Such 384 quantities are usually heavily structured and subfields may have only 385 a limited range of possible values or values easily guessable based 386 on approximate date of manufacture or other data. For example, it is 387 likely that a company that manfactures both computers and Ethernet 388 adapters will, at least internally, use its own adapters, which 389 significantly limits the range of built in addresses. 391 Problems such as those described above related to clocks and serial 392 numbers make code to produce unpredictable quantities difficult if 393 the code is to be ported across a variety of computer platforms and 394 systems. 396 4.2 Timing and Content of External Events 398 It is possible to measure the timing and content of mouse movement, 399 key strokes, and similar user events. This is a reasonable source of 400 unguessable data with some qualifications. On some machines, inputs 401 such as key strokes are buffered. Even though the user's inter- 402 keystroke timing may have sufficient variation and unpredictability, 403 there might not be an easy way to access that variation. Another 404 problem is that no standard method exists to sample timing details. 405 This makes it hard to build standard software intended for 406 distribution to a large range of machines based on this technique. 408 The amount of mouse movement or the keys actually hit are usually 409 easier to access than timings but may yield less unpredictability as 410 the user may provide highly repetitive input. 412 Other external events, such as network packet arrival times, can also 413 be used with care. In particular, the possibility of manipulation of 414 such times by an adversary and the lack of history on system start up 415 must be considered. 417 4.3 The Fallacy of Complex Manipulation 419 One strategy which may give a misleading appearance of 420 unpredictability is to take a very complex algorithm (or an excellent 421 traditional pseudo-random number generator with good statistical 422 properties) and calculate a cryptographic key by starting with the 423 current value of a computer system clock as the seed. An adversary 424 who knew roughly when the generator was started would have a 425 relatively small number of seed values to test as they would know 426 likely values of the system clock. Large numbers of pseudo-random 427 bits could be generated but the search space an adversary would need 428 to check could be quite small. 430 Thus very strong and/or complex manipulation of data will not help if 431 the adversary can learn what the manipulation is and there is not 432 enough unpredictability in the starting seed value. Even if they can 433 not learn what the manipulation is, they may be able to use the 434 limited number of results stemming from a limited number of seed 435 values to defeat security. 437 Another serious strategy error is to assume that a very complex 438 pseudo-random number generation algorithm will produce strong random 439 numbers when there has been no theory behind or analysis of the 440 algorithm. There is a excellent example of this fallacy right near 441 the beginning of chapter 3 in [KNUTH] where the author describes a 442 complex algorithm. It was intended that the machine language program 443 corresponding to the algorithm would be so complicated that a person 444 trying to read the code without comments wouldn't know what the 445 program was doing. Unfortunately, actual use of this algorithm 446 showed that it almost immediately converged to a single repeated 447 value in one case and a small cycle of values in another case. 449 Not only does complex manipulation not help you if you have a limited 450 range of seeds but blindly chosen complex manipulation can destroy 451 the randomness in a good seed! 453 4.4 The Fallacy of Selection from a Large Database 455 Another strategy that can give a misleading appearance of 456 unpredictability is selection of a quantity randomly from a database 457 and assume that its strength is related to the total number of bits 458 in the database. For example, typical USENET servers process many 459 megabytes of information per day. Assume a random quantity was 460 selected by fetching 32 bytes of data from a random starting point in 461 this data. This does not yield 32*8 = 256 bits worth of 462 unguessability. Even after allowing that much of the data is human 463 language and probably has more like 2 or 3 bits of information per 464 byte, it doesn't yield 32*2.5 = 80 bits of unguessability. For an 465 adversary with access to the same usenet database the unguessability 466 rests only on the starting point of the selection. That is perhaps a 467 little over a couple of dozen bits of unguessability. 469 The same argument applies to selecting sequences from the data on a 470 CD/DVD recording or any other large public database. If the 471 adversary has access to the same database, this "selection from a 472 large volume of data" step buys very little. However, if a selection 473 can be made from data to which the adversary has no access, such as 474 system buffers on an active multi-user system, it may be of help. 476 5. Hardware for Randomness 478 Is there any hope for strong portable randomness in the future? 479 There might be. All that's needed is a physical source of 480 unpredictable numbers. 482 A thermal noise or radioactive decay source and a fast, free-running 483 oscillator would do the trick directly [GIFFORD]. This is a trivial 484 amount of hardware, and could easily be included as a standard part 485 of a computer system's architecture. Furthermore, any system with a 486 spinning disk or the like has an adequate source of randomness 487 [DAVIS]. All that's needed is the common perception among computer 488 vendors that this small additional hardware and the software to 489 access it is necessary and useful. 491 5.1 Volume Required 493 How much unpredictability is needed? Is it possible to quantify the 494 requirement in, say, number of random bits per second? 496 The answer is not very much is needed. For DES, the key is 56 bits 497 and, as we show in an example in Section 8, even the highest security 498 system is unlikely to require a keying material of over 200 bits. If 499 a series of keys are needed, they can be generated from a strong 500 random seed using a cryptographically strong sequence as explained in 501 Section 6.3. A few hundred random bits generated once a day would be 502 enough using such techniques. Even if the random bits are generated 503 as slowly as one per second and it is not possible to overlap the 504 generation process, it should be tolerable in high security 505 applications to wait 200 seconds occasionally. 507 These numbers are trivial to achieve. It could be done by a person 508 repeatedly tossing a coin. Almost any hardware process is likely to 509 be much faster. 511 5.2 Sensitivity to Skew 513 Is there any specific requirement on the shape of the distribution of 514 the random numbers? The good news is the distribution need not be 515 uniform. All that is needed is a conservative estimate of how non- 516 uniform it is to bound performance. Two simple techniques to de-skew 517 the bit stream are given below and stronger techniques are mentioned 518 in Section 6.1.2 below. 520 5.2.1 Using Stream Parity to De-Skew 522 Consider taking a sufficiently long string of bits and map the string 523 to "zero" or "one". The mapping will not yield a perfectly uniform 524 distribution, but it can be as close as desired. One mapping that 525 serves the purpose is to take the parity of the string. This has the 526 advantages that it is robust across all degrees of skew up to the 527 estimated maximum skew and is absolutely trivial to implement in 528 hardware. 530 The following analysis gives the number of bits that must be sampled: 532 Suppose the ratio of ones to zeros is 0.5 + e : 0.5 - e, where e is 533 between 0 and 0.5 and is a measure of the "eccentricity" of the 534 distribution. Consider the distribution of the parity function of N 535 bit samples. The probabilities that the parity will be one or zero 536 will be the sum of the odd or even terms in the binomial expansion of 537 (p + q)^N, where p = 0.5 + e, the probability of a one, and q = 0.5 - 538 e, the probability of a zero. 540 These sums can be computed easily as 542 N N 543 1/2 * ( ( p + q ) + ( p - q ) ) 544 and 545 N N 546 1/2 * ( ( p + q ) - ( p - q ) ). 548 (Which one corresponds to the probability the parity will be 1 549 depends on whether N is odd or even.) 551 Since p + q = 1 and p - q = 2e, these expressions reduce to 553 N 554 1/2 * [1 + (2e) ] 555 and 556 N 557 1/2 * [1 - (2e) ]. 559 Neither of these will ever be exactly 0.5 unless e is zero, but we 560 can bring them arbitrarily close to 0.5. If we want the 561 probabilities to be within some delta d of 0.5, i.e. then 563 N 564 ( 0.5 + ( 0.5 * (2e) ) ) < 0.5 + d. 566 Solving for N yields N > log(2d)/log(2e). (Note that 2e is less than 567 1, so its log is negative. Division by a negative number reverses 568 the sense of an inequality.) 569 The following table gives the length of the string which must be 570 sampled for various degrees of skew in order to come within 0.001 of 571 a 50/50 distribution. 573 +---------+--------+-------+ 574 | Prob(1) | e | N | 575 +---------+--------+-------+ 576 | 0.5 | 0.00 | 1 | 577 | 0.6 | 0.10 | 4 | 578 | 0.7 | 0.20 | 7 | 579 | 0.8 | 0.30 | 13 | 580 | 0.9 | 0.40 | 28 | 581 | 0.95 | 0.45 | 59 | 582 | 0.99 | 0.49 | 308 | 583 +---------+--------+-------+ 585 The last entry shows that even if the distribution is skewed 99% in 586 favor of ones, the parity of a string of 308 samples will be within 587 0.001 of a 50/50 distribution. 589 5.2.2 Using Transition Mappings to De-Skew 591 Another technique, originally due to von Neumann [VON NEUMANN], is to 592 examine a bit stream as a sequence of non-overlapping pairs. You 593 could then discard any 00 or 11 pairs found, interpret 01 as a 0 and 594 10 as a 1. Assume the probability of a 1 is 0.5+e and the 595 probability of a 0 is 0.5-e where e is the eccentricity of the source 596 and described in the previous section. Then the probability of each 597 pair is as follows: 599 +------+-----------------------------------------+ 600 | pair | probability | 601 +------+-----------------------------------------+ 602 | 00 | (0.5 - e)^2 = 0.25 - e + e^2 | 603 | 01 | (0.5 - e)*(0.5 + e) = 0.25 - e^2 | 604 | 10 | (0.5 + e)*(0.5 - e) = 0.25 - e^2 | 605 | 11 | (0.5 + e)^2 = 0.25 + e + e^2 | 606 +------+-----------------------------------------+ 608 This technique will completely eliminate any bias but at the expense 609 of taking an indeterminate number of input bits for any particular 610 desired number of output bits. The probability of any particular 611 pair being discarded is 0.5 + 2e^2 so the expected number of input 612 bits to produce X output bits is X/(0.25 - e^2). 614 This technique assumes that the bits are from a stream where each bit 615 has the same probability of being a 0 or 1 as any other bit in the 616 stream and that bits are not correlated, i.e., that the bits are 617 identical independent distributions. If alternate bits were from two 618 correlated sources, for example, the above analysis breaks down. 620 The above technique also provides another illustration of how a 621 simple statistical analysis can mislead if one is not always on the 622 lookout for patterns that could be exploited by an adversary. If the 623 algorithm were mis-read slightly so that overlapping successive bits 624 pairs were used instead of non-overlapping pairs, the statistical 625 analysis given is the same; however, instead of providing an unbiased 626 uncorrelated series of random 1's and 0's, it instead produces a 627 totally predictable sequence of exactly alternating 1's and 0's. 629 5.2.3 Using FFT to De-Skew 631 When real world data consists of strongly biased or correlated bits, 632 it may still contain useful amounts of randomness. This randomness 633 can be extracted through use of the discrete Fourier transform or its 634 optimized variant, the FFT. 636 Using the Fourier transform of the data, strong correlations can be 637 discarded. If adequate data is processed and remaining correlations 638 decay, spectral lines approaching statistical independence and 639 normally distributed randomness can be produced [BRILLINGER]. 641 5.2.4 Using Compression to De-Skew 643 Reversible compression techniques also provide a crude method of de- 644 skewing a skewed bit stream. This follows directly from the 645 definition of reversible compression and the formula in Section 2 646 above for the amount of information in a sequence. Since the 647 compression is reversible, the same amount of information must be 648 present in the shorter output than was present in the longer input. 649 By the Shannon information equation, this is only possible if, on 650 average, the probabilities of the different shorter sequences are 651 more uniformly distributed than were the probabilities of the longer 652 sequences. Thus the shorter sequences are de-skewed relative to the 653 input. 655 However, many compression techniques add a somewhat predictable 656 preface to their output stream and may insert such a sequence again 657 periodically in their output or otherwise introduce subtle patterns 658 of their own. They should be considered only a rough technique 659 compared with those described above or in Section 6.1.2. At a 660 minimum, the beginning of the compressed sequence should be skipped 661 and only later bits used for applications requiring random bits. 663 5.3 Existing Hardware Can Be Used For Randomness 665 As described below, many computers come with hardware that can, with 666 care, be used to generate truly random quantities. 668 5.3.1 Using Existing Sound/Video Input 670 Increasingly computers are being built with inputs that digitize some 671 real world analog source, such as sound from a microphone or video 672 input from a camera. Under appropriate circumstances, such input can 673 provide reasonably high quality random bits. The "input" from a 674 sound digitizer with no source plugged in or a camera with the lens 675 cap on, if the system has enough gain to detect anything, is 676 essentially thermal noise. 678 For example, on a SPARCstation, one can read from the /dev/audio 679 device with nothing plugged into the microphone jack. Such data is 680 essentially random noise although it should not be trusted without 681 some checking in case of hardware failure. It will, in any case, 682 need to be de-skewed as described elsewhere. 684 Combining this with compression to de-skew one can, in UNIXese, 685 generate a huge amount of medium quality random data by doing 687 cat /dev/audio | compress - >random-bits-file 689 5.3.2 Using Existing Disk Drives 691 Disk drives have small random fluctuations in their rotational speed 692 due to chaotic air turbulence [DAVIS]. By adding low level disk seek 693 time instrumentation to a system, a series of measurements can be 694 obtained that include this randomness. Such data is usually highly 695 correlated so that significant processing is needed, including FFT 696 (see section 5.2.3). Nevertheless experimentation has shown that, 697 with such processing, disk drives easily produce 100 bits a minute or 698 more of excellent random data. 700 Partly offsetting this need for processing is the fact that disk 701 drive failure will normally be rapidly noticed. Thus, problems with 702 this method of random number generation due to hardware failure are 703 very unlikely. 705 6. Recommended Non-Hardware Strategy 707 What is the best overall strategy for meeting the requirement for 708 unguessable random numbers in the absence of a reliable hardware 709 source? It is to obtain random input from a number of uncorrelated 710 sources and to mix them with a strong mixing function. Such a 711 function will preserve the randomness present in any of the sources 712 even if other quantities being combined are fixed or easily 713 guessable. This may be advisable even with a good hardware source as 714 hardware can also fail, though this should be weighed against any 715 increase in the chance of overall failure due to added software 716 complexity. 718 6.1 Mixing Functions 720 A strong mixing function is one which combines two or more inputs and 721 produces an output where each output bit is a different complex non- 722 linear function of all the input bits. On average, changing any 723 input bit will change about half the output bits. But because the 724 relationship is complex and non-linear, no particular output bit is 725 guaranteed to change when any particular input bit is changed. 727 Consider the problem of converting a stream of bits that is skewed 728 towards 0 or 1 to a shorter stream which is more random, as discussed 729 in Section 5.2 above. This is simply another case where a strong 730 mixing function is desired, mixing the input bits to produce a 731 smaller number of output bits. The technique given in Section 5.2.1 732 of using the parity of a number of bits is simply the result of 733 successively Exclusive Or'ing them which is examined as a trivial 734 mixing function immediately below. Use of stronger mixing functions 735 to extract more of the randomness in a stream of skewed bits is 736 examined in Section 6.1.2. 738 6.1.1 A Trivial Mixing Function 740 A trivial example for single bit inputs is the Exclusive Or function, 741 which is equivalent to addition without carry, as show in the table 742 below. This is a degenerate case in which the one output bit always 743 changes for a change in either input bit. But, despite its 744 simplicity, it will still provide a useful illustration. 746 +-----------+-----------+----------+ 747 | input 1 | input 2 | output | 748 +-----------+-----------+----------+ 749 | 0 | 0 | 0 | 750 | 0 | 1 | 1 | 751 | 1 | 0 | 1 | 752 | 1 | 1 | 0 | 753 +-----------+-----------+----------+ 755 If inputs 1 and 2 are uncorrelated and combined in this fashion then 756 the output will be an even better (less skewed) random bit than the 757 inputs. If we assume an "eccentricity" e as defined in Section 5.2 758 above, then the output eccentricity relates to the input eccentricity 759 as follows: 761 e = 2 * e * e 762 output input 1 input 2 764 Since e is never greater than 1/2, the eccentricity is always 765 improved except in the case where at least one input is a totally 766 skewed constant. This is illustrated in the following table where 767 the top and left side values are the two input eccentricities and the 768 entries are the output eccentricity: 770 +--------+--------+--------+--------+--------+--------+--------+ 771 | e | 0.00 | 0.10 | 0.20 | 0.30 | 0.40 | 0.50 | 772 +--------+--------+--------+--------+--------+--------+--------+ 773 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 774 | 0.10 | 0.00 | 0.02 | 0.04 | 0.06 | 0.08 | 0.10 | 775 | 0.20 | 0.00 | 0.04 | 0.08 | 0.12 | 0.16 | 0.20 | 776 | 0.30 | 0.00 | 0.06 | 0.12 | 0.18 | 0.24 | 0.30 | 777 | 0.40 | 0.00 | 0.08 | 0.16 | 0.24 | 0.32 | 0.40 | 778 | 0.50 | 0.00 | 0.10 | 0.20 | 0.30 | 0.40 | 0.50 | 779 +--------+--------+--------+--------+--------+--------+--------+ 781 However, keep in mind that the above calculations assume that the 782 inputs are not correlated. If the inputs were, say, the parity of 783 the number of minutes from midnight on two clocks accurate to a few 784 seconds, then each might appear random if sampled at random intervals 785 much longer than a minute. Yet if they were both sampled and 786 combined with xor, the result would be zero most of the time. 788 6.1.2 Stronger Mixing Functions 790 The US Government Data Encryption Standard [DES] is an example of a 791 strong mixing function for multiple bit quantities. It takes up to 792 120 bits of input (64 bits of "data" and 56 bits of "key") and 793 produces 64 bits of output each of which is dependent on a complex 794 non-linear function of all input bits. Other strong encryption 795 functions with this characteristic can also be used by considering 796 them to mix all of their key and data input bits. 798 Another good family of mixing functions are the "message digest" or 799 hashing functions such as The US Government Secure Hash Standard 800 [SHA1] and the MD4, MD5 [MD4, MD5] series. These functions all take 801 an arbitrary amount of input and produce an output mixing all the 802 input bits. The MD* series produce 128 bits of output and SHA1 803 produces 160 bits. 805 Although the message digest functions are designed for variable 806 amounts of input, DES and other encryption functions can also be used 807 to combine any number of inputs. If 64 bits of output is adequate, 808 the inputs can be packed into a 64 bit data quantity and successive 809 56 bit keys, padding with zeros if needed, which are then used to 810 successively encrypt using DES in Electronic Codebook Mode [DES 811 MODES]. If more than 64 bits of output are needed, use more complex 812 mixing. For example, if inputs are packed into three quantities, A, 813 B, and C, use DES to encrypt A with B as a key and then with C as a 814 key to produce the 1st part of the output, then encrypt B with C and 815 then A for more output and, if necessary, encrypt C with A and then B 816 for yet more output. Still more output can be produced by reversing 817 the order of the keys given above to stretch things. The same can be 818 done with the hash functions by hashing various subsets of the input 819 data to produce multiple outputs. But keep in mind that it is 820 impossible to get more bits of "randomness" out than are put in. 822 An example of using a strong mixing function would be to reconsider 823 the case of a string of 308 bits each of which is biased 99% towards 824 zero. The parity technique given in Section 5.2.1 above reduced this 825 to one bit with only a 1/1000 deviance from being equally likely a 826 zero or one. But, applying the equation for information given in 827 Section 2, this 308 bit skewed sequence has over 5 bits of 828 information in it. Thus hashing it with SHA1 or MD5 and taking the 829 bottom 5 bits of the result would yield 5 unbiased random bits as 830 opposed to the single bit given by calculating the parity of the 831 string. 833 6.1.3 Diff-Hellman as a Mixing Function 835 Diffie-Hellman exponential key exchange is a technique that yields a 836 shared secret between two parties that can be made computationally 837 infeasible for a third party to determine even if they can observe 838 all the messages between the two communicating parties. This shared 839 secret is a mixture of initial quantities generated by each of them 840 [D-H]. If these initial quantities are random, then the shared 841 secret contains the combined randomness of them both, assuming they 842 are uncorrelated. 844 6.1.4 Using a Mixing Function to Stretch Random Bits 846 While it is not necessary for a mixing function to produce the same 847 or fewer bits than its inputs, mixing bits cannot "stretch" the 848 amount of random unpredictability present in the inputs. Thus four 849 inputs of 32 bits each where there is 12 bits worth of 850 unpredicatability (such as 4,096 equally probable values) in each 851 input cannot produce more than 48 bits worth of unpredictable output. 852 The output can be expanded to hundreds or thousands of bits by, for 853 example, mixing with successive integers, but the clever adversary's 854 search space is still 2^48 possibilities. Furthermore, mixing to 855 fewer bits than are input will tend to strengthen the randomness of 856 the output the way using Exclusive Or to produce one bit from two did 857 above. 859 The last table in Section 6.1.1 shows that mixing a random bit with a 860 constant bit with Exclusive Or will produce a random bit. While this 861 is true, it does not provide a way to "stretch" one random bit into 862 more than one. If, for example, a random bit is mixed with a 0 and 863 then with a 1, this produces a two bit sequence but it will always be 864 either 01 or 10. Since there are only two possible values, there is 865 still only the one bit of original randomness. 867 6.1.5 Other Factors in Choosing a Mixing Function 869 For local use, DES has the advantages that it has been widely tested 870 for flaws, is widely documented, and is widely implemented with 871 hardware and software implementations available all over the world 872 including source code available on the Internet. The SHA1 and MD* 873 family are younger algorithms which have been less tested but there 874 is no particular reason to believe they are flawed. Both MD5 and SHS 875 were derived from the earlier MD4 algorithm. They all have source 876 code available [SHS, MD4, MD5]. 878 DES and SHA1 have been vouched for the the US National Security 879 Agency (NSA) on the basis of criteria that primarily remain secret. 880 While this is the cause of much speculation and doubt, investigation 881 of DES over the years has indicated that NSA involvement in 882 modifications to its design, which originated with IBM, was primarily 883 to strengthen it. No concealed or special weakness has been found in 884 DES. It is almost certain that the NSA modification to MD4 to 885 produce the SHA1 similarly strengthened the algorithm, possibly 886 against threats not yet known in the public cryptographic community. 888 DES, SHA1, MD4, and MD5 are royalty free for all purposes. Continued 889 advances in crypography and computing power have cast some doubts on 890 MD4 and MD5 so their use is not recommended. 892 Another advantage of the MD* or similar hashing algorithms over 893 encryption algorithms is that they are not subject to the same 894 regulations imposed by the US Government prohibiting the unlicensed 895 export or import of encryption/decryption software and hardware. The 896 same should be true of DES rigged to produce an irreversible hash 897 code but most DES packages are oriented to reversible encryption. 899 6.2 Non-Hardware Sources of Randomness 901 The best source of input for mixing would be a hardware randomness 902 such as disk drive timing effected by air turbulence, audio input 903 with thermal noise, or radioactive decay. However, if that is not 904 available there are other possibilities. These include system 905 clocks, system or input/output buffers, user/system/hardware/network 906 serial numbers and/or addresses and timing, and user input. 907 Unfortunately, any of these sources can produce limited or 908 predicatable values under some circumstances. 910 Some of the sources listed above would be quite strong on multi-user 911 systems where, in essence, each user of the system is a source of 912 randomness. However, on a small single user system, it might be 913 possible for an adversary to assemble a similar configuration. This 914 could give the adversary inputs to the mixing process that were 915 sufficiently correlated to those used originally as to make 916 exhaustive search practical. 918 The use of multiple random inputs with a strong mixing function is 919 recommended and can overcome weakness in any particular input. For 920 example, the timing and content of requested "random" user keystrokes 921 can yield hundreds of random bits but conservative assumptions need 922 to be made. For example, assuming a few bits of randomness if the 923 inter-keystroke interval is unique in the sequence up to that point 924 and a similar assumption if the key hit is unique but assuming that 925 no bits of randomness are present in the initial key value or if the 926 timing or key value duplicate previous values. The results of mixing 927 these timings and characters typed could be further combined with 928 clock values and other inputs. 930 This strategy may make practical portable code to produce good random 931 numbers for security even if some of the inputs are very weak on some 932 of the target systems. However, it may still fail against a high 933 grade attack on small single user systems, especially if the 934 adversary has ever been able to observe the generation process in the 935 past. A hardware based random source is still preferable. 937 6.3 Cryptographically Strong Sequences 939 In cases where a series of random quantities must be generated, an 940 adversary may learn some values in the sequence. In general, they 941 should not be able to predict other values from the ones that they 942 know. 944 The correct technique is to start with a strong random seed, take 945 cryptographically strong steps from that seed [CRYPTO2, CRYPTO3], and 946 do not reveal the complete state of the generator in the sequence 947 elements. If each value in the sequence can be calculated in a fixed 948 way from the previous value, then when any value is compromised, all 949 future values can be determined. This would be the case, for 950 example, if each value were a constant function of the previously 951 used values, even if the function were a very strong, non-invertible 952 message digest function. 954 It should be noted that if your technique for generating a sequence 955 of key values is fast enough, it can trivially be used as the basis 956 for a confidentiality system. If two parties use the same sequence 957 generating technique and start with the same seed material, they will 958 generate identical sequences. These could, for example, be xor'ed at 959 one end with data being send, encrypting it, and xor'ed with this 960 data as received, decrypting it due to the reversible properties of 961 the xor operation. 963 6.3.1 Traditional Strong Sequences 965 A traditional way to achieve a strong sequence has been to have the 966 values be produced by hashing the quantities produced by 967 concatenating the seed with successive integers or the like and then 968 mask the values obtained so as to limit the amount of generator state 969 available to the adversary. 971 It may also be possible to use an "encryption" algorithm with a 972 random key and seed value to encrypt and feedback some or all of the 973 output encrypted value into the value to be encrypted for the next 974 iteration. Appropriate feedback techniques will usually be 975 recommended with the encryption algorithm. An example is shown below 976 where shifting and masking are used to combine the cypher output 977 feedback. This type of feedback is recommended by the US Government 978 in connection with DES [DES MODES]. 980 +---------------+ 981 | V | 982 | | n | 983 +--+------------+ 984 | | +---------+ 985 | +---------> | | +-----+ 986 +--+ | Encrypt | <--- | Key | 987 | +-------- | | +-----+ 988 | | +---------+ 989 V V 990 +------------+--+ 991 | V | | 992 | n+1 | 993 +---------------+ 995 Note that if a shift of one is used, this is the same as the shift 996 register technique described in Section 3 above but with the all 997 important difference that the feedback is determined by a complex 998 non-linear function of all bits rather than a simple linear or 999 polynomial combination of output from a few bit position taps. 1001 It has been shown by Donald W. Davies that this sort of shifted 1002 partial output feedback significantly weakens an algorithm compared 1003 will feeding all of the output bits back as input. In particular, 1004 for DES, repeated encrypting a full 64 bit quantity will give an 1005 expected repeat in about 2^63 iterations. Feeding back anything less 1006 than 64 (and more than 0) bits will give an expected repeat in 1007 between 2**31 and 2**32 iterations! 1009 To predict values of a sequence from others when the sequence was 1010 generated by these techniques is equivalent to breaking the 1011 cryptosystem or inverting the "non-invertible" hashing involved with 1012 only partial information available. The less information revealed 1013 each iteration, the harder it will be for an adversary to predict the 1014 sequence. Thus it is best to use only one bit from each value. It 1015 has been shown that in some cases this makes it impossible to break a 1016 system even when the cryptographic system is invertible and can be 1017 broken if all of each generated value was revealed. 1019 6.3.2 The Blum Blum Shub Sequence Generator 1021 Currently the generator which has the strongest public proof of 1022 strength is called the Blum Blum Shub generator after its inventors 1023 [BBS]. It is also very simple and is based on quadratic residues. 1024 It's only disadvantage is that is is computationally intensive 1025 compared with the traditional techniques give in 6.3.1 above. This 1026 is not a serious draw back if it is used for moderately infrequent 1027 purposes, such as generating session keys. 1029 Simply choose two large prime numbers, say p and q, which both have 1030 the property that you get a remainder of 3 if you divide them by 4. 1031 Let n = p * q. Then you choose a random number x relatively prime to 1032 n. The initial seed for the generator and the method for calculating 1033 subsequent values are then 1035 2 1036 s = ( x )(Mod n) 1037 0 1039 2 1040 s = ( s )(Mod n) 1041 i+1 i 1043 You must be careful to use only a few bits from the bottom of each s. 1044 It is always safe to use only the lowest order bit. If you use no 1045 more than the 1046 log ( log ( s ) ) 1047 2 2 i 1048 low order bits, then predicting any additional bits from a sequence 1049 generated in this manner is provable as hard as factoring n. As long 1050 as the initial x is secret, you can even make n public if you want. 1052 An intersting characteristic of this generator is that you can 1053 directly calculate any of the s values. In particular 1055 i 1056 ( ( 2 )(Mod (( p - 1 ) * ( q - 1 )) ) ) 1057 s = ( s )(Mod n) 1058 i 0 1060 This means that in applications where many keys are generated in this 1061 fashion, it is not necessary to save them all. Each key can be 1062 effectively indexed and recovered from that small index and the 1063 initial s and n. 1065 7. Key Generation Standards 1067 Several public standards are now in place for the generation of keys. 1068 Two of these are described below. Both use DES but any equally 1069 strong or stronger mixing function could be substituted. 1071 7.1 US DoD Recommendations for Password Generation 1073 The United States Department of Defense has specific recommendations 1074 for password generation [DoD]. They suggest using the US Data 1075 Encryption Standard [DES] in Output Feedback Mode [DES MODES] as 1076 follows: 1078 use an initialization vector determined from 1079 the system clock, 1080 system ID, 1081 user ID, and 1082 date and time; 1083 use a key determined from 1084 system interrupt registers, 1085 system status registers, and 1086 system counters; and, 1087 as plain text, use an external randomly generated 64 bit 1088 quantity such as 8 characters typed in by a system 1089 administrator. 1091 The password can then be calculated from the 64 bit "cipher text" 1092 generated in 64-bit Output Feedback Mode. As many bits as are needed 1093 can be taken from these 64 bits and expanded into a pronounceable 1094 word, phrase, or other format if a human being needs to remember the 1095 password. 1097 7.2 X9.17 Key Generation 1099 The American National Standards Institute has specified a method for 1100 generating a sequence of keys as follows: 1102 s is the initial 64 bit seed 1103 0 1105 g is the sequence of generated 64 bit key quantities 1106 n 1108 k is a random key reserved for generating this key sequence 1109 t is the time at which a key is generated to as fine a resolution 1110 as is available (up to 64 bits). 1112 DES ( K, Q ) is the DES encryption of quantity Q with key K 1114 g = DES ( k, DES ( k, t ) .xor. s ) 1115 n n 1117 s = DES ( k, DES ( k, t ) .xor. g ) 1118 n+1 n 1120 If g sub n is to be used as a DES key, then every eighth bit should 1121 be adjusted for parity for that use but the entire 64 bit unmodified 1122 g should be used in calculating the next s. 1124 8. Examples of Randomness Required 1126 [This section is expected to be modified and to have references to 1127 appendix A added.] 1129 Below are two examples showing rough calculations of needed 1130 randomness for security. The first is for moderate security 1131 passwords while the second assumes a need for a very high security 1132 cryptographic key. 1134 8.1 Password Generation 1136 Assume that user passwords change once a year and it is desired that 1137 the probability that an adversary could guess the password for a 1138 particular account be less than one in a thousand. Further assume 1139 that sending a password to the system is the only way to try a 1140 password. Then the crucial question is how often an adversary can 1141 try possibilities. Assume that delays have been introduced into a 1142 system so that, at most, an adversary can make one password try every 1143 six seconds. That's 600 per hour or about 15,000 per day or about 1144 5,000,000 tries in a year. Assuming any sort of monitoring, it is 1145 unlikely someone could actually try continuously for a year. In 1146 fact, even if log files are only checked monthly, 500,000 tries is 1147 more plausible before the attack is noticed and steps taken to change 1148 passwords and make it harder to try more passwords. 1150 To have a one in a thousand chance of guessing the password in 1151 500,000 tries implies a universe of at least 500,000,000 passwords or 1152 about 2^29. Thus 29 bits of randomness are needed. This can probably 1153 be achieved using the US DoD recommended inputs for password 1154 generation as it has 8 inputs which probably average over 5 bits of 1155 randomness each (see section 7.1). Using a list of 1000 words, the 1156 password could be expressed as a three word phrase (1,000,000,000 1157 possibilities) or, using case insensitive letters and digits, six 1158 would suffice ((26+10)^6 = 2,176,782,336 possibilities). 1160 For a higher security password, the number of bits required goes up. 1161 To decrease the probability by 1,000 requires increasing the universe 1162 of passwords by the same factor which adds about 10 bits. Thus to 1163 have only a one in a million chance of a password being guessed under 1164 the above scenario would require 39 bits of randomness and a password 1165 that was a four word phrase from a 1000 word list or eight 1166 letters/digits. To go to a one in 10^9 chance, 49 bits of randomness 1167 are needed implying a five word phrase or ten letter/digit password. 1169 In a real system, of course, there are also other factors. For 1170 example, the larger and harder to remember passwords are, the more 1171 likely users are to write them down resulting in an additional risk 1172 of compromise. 1174 8.2 A Very High Security Cryptographic Key 1176 Assume that a very high security key is needed for symmetric 1177 encryption / decryption between two parties. Assume an adversary can 1178 observe communications and knows the algorithm being used. Within 1179 the field of random possibilities, the adversary can try key values 1180 in hopes of finding the one in use. Assume further that brute force 1181 trial of keys is the best the adversary can do. 1183 8.2.1 Effort per Key Trial 1185 How much effort will it take to try each key? For very high security 1186 applications it is best to assume a low value of effort. Even if it 1187 would clearly take tens of thousands of computer cycles or more to 1188 try a single key, there may be some pattern that enables huge blocks 1189 of key values to be tested with much less effort per key. Thus it is 1190 probably best to assume no more than a couple hundred cycles per key. 1191 (There is no clear lower bound on this as computers operate in 1192 parallel on a number of bits and a poor encryption algorithm could 1193 allow many keys or even groups of keys to be tested in parallel. 1194 However, we need to assume some value and can hope that a reasonably 1195 strong algorithm has been chosen for our hypothetical high security 1196 task.) 1198 If the adversary can command a highly parallel processor or a large 1199 network of work stations, 2*10^10 cycles per second is probably a 1200 minimum assumption for availability today. Looking forward just a 1201 couple years, there should be at least an order of magnitude 1202 improvement. Thus assuming 10^9 keys could be checked per second or 1203 3.6*10^11 per hour or 6*10^13 per week or 2.4*10^14 per month is 1204 reasonable. This implies a need for a minimum of 51 bits of 1205 randomness in keys to be sure they cannot be found in a month. Even 1206 then it is possible that, a few years from now, a highly determined 1207 and resourceful adversary could break the key in 2 weeks (on average 1208 they need try only half the keys). 1210 8.2.2 Meet in the Middle Attacks 1212 If chosen or known plain text and the resulting encrypted text are 1213 available, a "meet in the middle" attack is possible if the structure 1214 of the encryption algorithm allows it. (In a known plain text 1215 attack, the adversary knows all or part of the messages being 1216 encrypted, possibly some standard header or trailer fields. In a 1217 chosen plain text attack, the adversary can force some chosen plain 1218 text to be encrypted, possibly by "leaking" an exciting text that 1219 would then be sent by the adversary over an encrypted channel.) 1221 An oversimplified explanation of the meet in the middle attack is as 1222 follows: the adversary can half-encrypt the known or chosen plain 1223 text with all possible first half-keys, sort the output, then half- 1224 decrypt the encoded text with all the second half-keys. If a match 1225 is found, the full key can be assembled from the halves and used to 1226 decrypt other parts of the message or other messages. At its best, 1227 this type of attack can halve the exponent of the work required by 1228 the adversary while adding a large but roughly constant factor of 1229 effort. To be assured of safety against this, a doubling of the 1230 amount of randomness in the key to a minimum of 102 bits is required. 1232 The meet in the middle attack assumes that the cryptographic 1233 algorithm can be decomposed in this way but we can not rule that out 1234 without a deep knowledge of the algorithm. Even if a basic algorithm 1235 is not subject to a meet in the middle attack, an attempt to produce 1236 a stronger algorithm by applying the basic algorithm twice (or two 1237 different algorithms sequentially) with different keys may gain less 1238 added security than would be expected. Such a composite algorithm 1239 would be subject to a meet in the middle attack. 1241 Enormous resources may be required to mount a meet in the middle 1242 attack but they are probably within the range of the national 1243 security services of a major nation. Essentially all nations spy on 1244 other nations government traffic and several nations are believed to 1245 spy on commercial traffic for economic advantage. 1247 8.2.3 Other Considerations 1249 Since we have not even considered the possibilities of special 1250 purpose code breaking hardware or just how much of a safety margin we 1251 want beyond our assumptions above, probably a good minimum for a very 1252 high security cryptographic key is 128 bits of randomness which 1253 implies a minimum key length of 128 bits. If the two parties agree 1254 on a key by Diffie-Hellman exchange [D-H], then in principle only 1255 half of this randomness would have to be supplied by each party. 1256 However, there is probably some correlation between their random 1257 inputs so it is probably best to assume that each party needs to 1258 provide at least 96 bits worth of randomness for very high security 1259 if Diffie-Hellman is used. 1261 This amount of randomness is beyond the limit of that in the inputs 1262 recommended by the US DoD for password generation and could require 1263 user typing timing, hardware random number generation, or other 1264 sources. 1266 It should be noted that key length calculations such at those above 1267 are controversial and depend on various assumptions about the 1268 cryptographic algorithms in use. In some cases, a professional with 1269 a deep knowledge of code breaking techniques and of the strength of 1270 the algorithm in use could be satisfied with less than half of the 1271 key size derived above. 1273 9. Conclusion 1275 Generation of unguessable "random" secret quantities for security use 1276 is an essential but difficult task. 1278 We have shown that hardware techniques to produce such randomness 1279 would be relatively simple. In particular, the volume and quality 1280 would not need to be high and existing computer hardware, such as 1281 disk drives, can be used. Computational techniques are available to 1282 process low quality random quantities from multiple sources or a 1283 larger quantity of such low quality input from one source and produce 1284 a smaller quantity of higher quality, less predictable key material. 1285 In the absence of hardware sources of randomness, a variety of user 1286 and software sources can frequently be used instead with care; 1287 however, most modern systems already have hardware, such as disk 1288 drives or audio input, that could be used to produce high quality 1289 randomness. 1291 Once a sufficient quantity of high quality seed key material (a few 1292 hundred bits) is available, strong computational techniques are 1293 available to produce cryptographically strong sequences of 1294 unpredicatable quantities from this seed material. 1296 10. Security Considerations 1298 The entirety of this document concerns techniques and recommendations 1299 for generating unguessable "random" quantities for use as passwords, 1300 cryptographic keys, initialiazation vectors, sequence numbers, and 1301 similar security uses. 1303 Appendix: Minimal Secure Key Lengths Study 1305 Minimal Key Lengths for Symmetric Ciphers 1306 to Provide Adequate Commercial Security 1308 A Report by an Ad Hoc Group of 1309 Cryptographers and Computer Scientists 1311 Matt Blaze, AT&T Research, mab@research.att.com 1312 Whitfield Diffie, Sun Microsystems, diffie@eng.sun.com 1313 Ronald L. Rivest, MIT LCS, rivest@lcs.mit.edu 1314 Bruce Schneier, Counterpane Systems, schneier@counterpane.com 1315 Tsutomu Shimomura, San Diego Supercomputer Center, tsutomu@sdsc.edu 1316 Eric Thompson Access Data, Inc., eric@accessdata.com 1317 Michael Wiener, Bell Northern Research, wiener@bnr.ca 1319 January 1996 1321 Appendix: Abstract 1323 Encryption plays an essential role in protecting the privacy of 1324 electronic information against threats from a variety of potential 1325 attackers. In so doing, modern cryptography employs a combination of 1326 _conventional_ or _symmetric_ cryptographic systems for encrypting 1327 data and _public key_ or _asymmetric_ systems for managing the _keys_ 1328 used by the symmetric systems. Assessing the strength required of 1329 the symmetric cryptographic systems is therefore an essential step in 1330 employing cryptography for computer and communication security. 1332 Technology readily available today (late 1995) makes _brute- 1333 force_ attacks against cryptographic systems considered adequate for 1334 the past several years both fast and cheap. General purpose 1335 computers can be used, but a much more efficient approach is to 1336 employ commercially available _Field Programmable Gate Array (FPGA)_ 1337 technology. For attackers prepared to make a higher initial 1338 investment, custom-made, special-purpose chips make such calculations 1339 much faster and significantly lower the amortized cost per solution. 1341 As a result, cryptosystems with 40-bit keys offer virtually no 1342 protection at this point against brute-force attacks. Even the U.S. 1343 Data Encryption Standard with 56-bit keys is increasingly inadequate. 1344 As cryptosystems often succumb to `smarter' attacks than brute-force 1345 key search, it is also important to remember that the keylengths 1346 discussed here are the minimum needed for security against the 1347 computational threats considered. 1349 Fortunately, the cost of very strong encryption is not 1351 significantly greater than that of weak encryption. Therefore, to 1352 provide adequate protection against the most serious threats --- 1353 well-funded commercial enterprises or government intelligence 1354 agencies --- keys used to protect data today should be at least 75 1355 bits long. To protect information adequately for the next 20 years 1356 in the face of expected advances in computing power, keys in newly- 1357 deployed systems should be at least 90 bits long. 1359 A.1. Encryption Plays an Essential Role in Protecting 1360 the Privacy of Electronic Information 1362 A.1.1 There is a need for information security 1364 As we write this paper in late 1995, the development of 1365 electronic commerce and the Global Information Infrastructure is at a 1366 critical juncture. The dirt paths of the middle ages only became 1367 highways of business and culture after the security of travelers and 1368 the merchandise they carried could be assured. So too the 1369 information superhighway will be an ill-traveled road unless 1370 information, the goods of the Information Age, can be moved, stored, 1371 bought, and sold securely. Neither corporations nor individuals will 1372 entrust their private business or personal data to computer networks 1373 unless they can assure their information's security. 1375 Today, most forms of information can be stored and processed 1376 electronically. This means a wide variety of information, with 1377 varying economic values and privacy aspects and with a wide variation 1378 in the time over which the information needs to be protected, will be 1379 found on computer networks. Consider the spectrum: 1381 o Electronic Funds Transfers of millions or even billions of 1382 dollars, whose short term security is essential but whose 1383 exposure is brief; 1385 o A company's strategic corporate plans, whose confidentiality 1386 must be preserved for a small number of years; 1388 o A proprietary product (Coke formula, new drug design) that 1389 needs to be protected over its useful life, often decades; 1390 and 1392 o Information private to an individual (medical condition, 1393 employment evaluation) that may need protection for the 1394 lifetime of the individual. 1396 A.1.2 Encryption to protect confidentiality 1398 Encryption Can Provide Strong Confidentiality Protection 1400 Encryption is accomplished by scrambling data using mathematical 1401 procedures that make it extremely difficult and time consuming for 1402 anyone other than authorized recipients --- those with the correct 1403 decryption _keys_ --- to recover the _plain text_. Proper encryption 1404 guarantees that the information will be safe even if it falls into 1405 hostile hands. 1407 Encryption --- and decryption --- can be performed by either 1408 computer software or hardware. Common approaches include writing the 1409 algorithm on a disk for execution by a computer central processor; 1410 placing it in ROM or PROM for execution by a microprocessor; and 1411 isolating storage and execution in a computer accessory device (smart 1412 card or PCMCIA card). 1414 The degree of protection obtained depends on several factors. 1415 These include: the quality of the cryptosystem; the way it is 1416 implemented in software or hardware (especially its reliability and 1417 the manner in which the keys are chosen); and the total number of 1418 possible keys that can be used to encrypt the information. A 1419 cryptographic algorithm is considered strong if: 1421 1. There is no shortcut that allows the opponent to recover the 1422 plain text without using brute force to test keys until the 1423 correct one is found; and 1425 2. The number of possible keys is sufficiently large to make 1426 such an attack infeasible. 1428 The principle here is similar to that of a combination lock on a 1429 safe. If the lock is well designed so that a burglar cannot hear or 1430 feel its inner workings, a person who does not know the combination 1431 can open it only by dialing one set of numbers after another until it 1432 yields. 1434 The sizes of encryption keys are measured in bits and the 1435 difficulty of trying all possible keys grows exponentially with the 1436 number of bits used. Adding one bit to the key doubles the number of 1437 possible keys; adding ten increases it by a factor of more than a 1438 thousand. 1440 There is no definitive way to look at a cipher and determine 1441 whether a shortcut exists. Nonetheless, several encryption 1442 algorithms --- most notably the U.S Data Encryption Standard (DES) 1443 --- have been extensively studied in the public literature and are 1444 widely believed to be of very high quality. An essential element in 1445 cryptographic algorithm design is thus the length of the key, whose 1446 size places an upper bound on the system's strength. 1448 Throughout this paper, we will assume that there are no shortcuts 1449 and treat the length of the key as representative of the 1450 cryptosystem's _workfactor_ --- the minimum amount of effort required 1451 to break the system. It is important to bear in mind, however, that 1452 cryptographers regard this as a rash assumption and many would 1453 recommend keys two or more times as long as needed to resist brute- 1454 force attacks. Prudent cryptographic designs not only employ longer 1455 keys than might appear to be needed, but devote more computation to 1456 encrypting and decrypting. A good example of this is the popular 1457 approach of using _triple-DES_: encrypting the output of DES twice 1458 more, using a total of three distinct keys. 1460 Encryption systems fall into two broad classes. Conventional or 1461 symmetric cryptosystems --- those in which an entity with the ability 1462 to encrypt also has the ability to decrypt and vice versa --- are the 1463 systems under consideration in this paper. The more recent public 1464 key or asymmetric cryptosystems have the property that the ability to 1465 encrypt does not imply the ability to decrypt. In contemporary 1466 cryptography, public-key systems are indispensable for managing the 1467 keys of conventional cryptosystems. All known public key 1468 cryptosystems, however, are subject to shortcut attacks and must 1469 therefore use keys ten or more times the lengths of those discussed 1470 here to achieve the an equivalent level of security. 1472 Although computers permit electronic information to be encrypted 1473 using very large keys, advances in computing power keep pushing up 1474 the size of keys that can be considered large and thus keep making it 1475 easier for individuals and organizations to attack encrypted 1476 information without the expenditure of unreasonable resources. 1478 A.1.3 There are a variety of attackers 1480 There Are Threats from a Variety of Potential Attackers. 1482 Threats to confidentiality of information come from a number of 1483 directions and their forms depend on the resources of the attackers. 1484 `Hackers,' who might be anything from high school students to 1485 commercial programmers, may have access to mainframe computers or 1486 networks of workstations. The same people can readily buy 1487 inexpensive, off-the-shelf, boards, containing _Field Programmable 1488 Gate Array (FPGA)_ chips that function as `programmable hardware' and 1489 vastly increase the effectiveness of a cryptanalytic effort. A 1490 startup company or even a well-heeled individual could afford large 1491 numbers of these chips. A major corporation or organized crime 1492 operation with `serious money' to spend could acquire custom computer 1493 chips specially designed for decryption. An intelligence agency, 1494 engaged in espionage for national economic advantage, could build a 1495 machine employing millions of such chips. 1497 A.1.4 Strong encryption is not expensive 1499 Current Technology Permits Very Strong Encryption for Effectively the 1500 Same Cost As Weaker Encryption. 1502 It is a property of computer encryption that modest increases in 1503 computational cost can produce vast increases in security. 1504 Encrypting information very securely (e.g., with 128-bit keys) 1505 typically requires little more computing than encrypting it weakly 1506 (e.g., with 40-bit keys). In many applications, the cryptography 1507 itself accounts for only a small fraction of the computing costs, 1508 compared to such processes as voice or image compression required to 1509 prepare material for encryption. 1511 One consequence of this uniformity of costs is that there is 1512 rarely any need to tailor the strength of cryptography to the 1513 sensitivity of the information being protected. Even if most of the 1514 information in a system has neither privacy implications nor monetary 1515 value, there is no practical or economic reason to design computer 1516 hardware or software to provide differing levels of encryption for 1517 different messages. It is simplest, most prudent, and thus 1518 fundamentally most economical, to employ a uniformly high level of 1519 encryption: the strongest encryption required for any information 1520 that might be stored or transmitted by a secure system. 1522 A.2. Brute-Forece is becoming easier 1524 Readily Available Technology Makes Brute-Force Decryption Attacks 1525 Faster and Cheaper. 1527 The kind of hardware used to mount a brute-force attack against 1528 an encryption algorithm depends on the scale of the cryptanalytic 1529 operation and the total funds available to the attacking enterprise. 1530 In the analysis that follows, we consider three general classes of 1531 technology that are likely to be employed by attackers with differing 1532 resources available to them. Not surprisingly, the cryptanalytic 1533 technologies that require larger up-front investments yield the 1534 lowest cost per recovered key, amortized over the life of the 1535 hardware. 1537 It is the nature of brute-force attacks that they can be 1538 parallelized indefinitely. It is possible to use as many machines as 1539 are available, assigning each to work on a separate part of the 1540 problem. Thus regardless of the technology employed, the search time 1541 can be reduced by adding more equipment; twice as much hardware can 1542 be expected to find the right key in half the time. The total 1543 investment will have doubled, but if the hardware is kept constantly 1544 busy finding keys, the cost per key recovered is unchanged. 1546 At the low end of the technology spectrum is the use of 1547 conventional personal computers or workstations programmed to test 1548 keys. Many people, by virtue of already owning or having access to 1549 the machines, are in a position use such resources at little or no 1550 cost. However, general purpose computers --- laden with such 1551 ancillary equipment as video controllers, keyboards, interfaces, 1552 memory, and disk storage --- make expensive search engines. They are 1553 therefore likely to be employed only by casual attackers who are 1554 unable or unwilling to invest in more specialized equipment. 1556 A more efficient technological approach is to take advantage of 1557 commercially available Field Programmable Gate Arrays. FPGAs 1558 function as programmable hardware and allow faster implementations of 1559 such tasks as encryption and decryption than conventional processors. 1560 FPGAs are a commonly used tool for simple computations that need to 1561 be done very quickly, particularly simulating integrated circuits 1562 during development. 1564 FPGA technology is fast and cheap. The cost of an AT&T ORCA chip 1565 that can test 30 million DES keys per second is $200. This is 1,000 1566 times faster than a PC at about one-tenth the cost! FPGAs are widely 1567 available and, mounted on cards, can be installed in standard PCs 1568 just like sound cards, modems, or extra memory. 1570 FPGA technology may be optimal when the same tool must be used 1571 for attacking a variety of different cryptosystems. Often, as with 1572 DES, a cryptosystem is sufficiently widely used to justify the 1573 construction of more specialized facilities. In these circumstances, 1574 the most cost-effective technology, but the one requiring the largest 1575 initial investment, is the use of _Application-Specific Integrated 1576 Circuits (ASICs)_. A $10 chip can test 200 million keys per second. 1577 This is seven times faster than an FPGA chip at one-twentieth the 1578 cost. 1580 Because ASICs require a far greater engineering investment than 1581 FPGAs and must be fabricated in quantity before they are economical, 1582 this approach is only available to serious, well-funded operations 1583 such as dedicated commercial (or criminal) enterprises and government 1584 intelligence agencies. 1586 A.3. 40-Bit Key Lengths Offer Virtually No Protection 1588 Current U.S. Government policy generally limits exportable mass 1589 market software that incorporates encryption for confidentiality to 1590 using the RC2 or RC4 algorithms with 40-bit keys. A 40-bit key 1591 length means that there are 2^40 possible keys. On average, half of 1592 these (2^39) must be tried to find the correct one. Export of other 1593 algorithms and key lengths must be approved on a case by case basis. 1594 For example, DES with a 56-bit key has been approved for certain 1595 applications such as financial transactions. 1597 The recent successful brute-force attack by two French graduate 1598 students on Netscape's 40-bit RC4 algorithm demonstrates the dangers 1599 of such short keys. These students at the Ecole Polytechnique in 1600 Paris used `idle time' on the school's computers, incurring no cost 1601 to themselves or their school. Even with these limited resources, 1602 they were able to recover the 40-bit key in a few days. 1604 There is no need to have the resources of an institution of 1605 higher education at hand, however. Anyone with a modicum of computer 1606 expertise and a few hundred dollars would be able to attack 40-bit 1607 encryption much faster. An FPGA chip --- costing approximately $400 1608 mounted on a card --- would on average recover a 40-bit key in five 1609 hours. Assuming the FPGA lasts three years and is used continuously 1610 to find keys, the average cost per key is eight cents. 1612 A more determined commercial predator, prepared to spend $10,000 1613 for a set-up with 25 ORCA chips, can find 40-bit keys in an average 1614 of 12 minutes, at the same average eight cent cost. Spending more 1615 money to buy more chips reduces the time accordingly: $300,000 1616 results in a solution in an average of 24 seconds; $10,000,000 1617 results in an average solution in 0.7 seconds. 1619 As already noted, a corporation with substantial resources can 1620 design and commission custom chips that are much faster. By doing 1621 this, a company spending $300,000 could find the right 40-bit key in 1622 an average of 0.18 seconds at 1/10th of a cent per solution; a larger 1623 company or government agency willing to spend $10,000,000 could find 1624 the right key on average in 0.005 seconds (again at 1/10th of a cent 1625 per solution). (Note that the cost per solution remains constant 1626 because we have conservatively assumed constant costs for chip 1627 acquisition --- in fact increasing the quantities purchased of a 1628 custom chip reduces the average chip cost as the initial design and 1629 set-up costs are spread over a greater number of chips.) 1631 These results are summarized in Table I (below). 1633 A.4. Even DES with 56-Bit Keys Is Increasingly Inadequate 1635 A.4.1 DES is no panacea today 1637 The Data Encryption Standard (DES) was developed in the 1970s by 1638 IBM and NSA and adopted by the U.S. Government as a Federal 1639 Information Processing Standard for data encryption. It was intended 1640 to provide strong encryption for the government's sensitive but 1641 unclassified information. It was recognized by many, even at the 1642 time DES was adopted, that technological developments would make 1643 DES's 56-bit key exceedingly vulnerable to attack before the end of 1644 the century. 1646 Today, DES may be the most widely employed encryption algorithm 1647 and continues to be a commonly cited benchmark. Yet DES-like 1648 encryption strength is no panacea. Calculations show that DES is 1649 inadequate against a corporate or government attacker committing 1650 serious resources. The bottom line is that DES is cheaper and easier 1651 to break than many believe. 1653 As explained above, 40-bit encryption provides inadequate 1654 protection against even the most casual of intruders, content to 1655 scavenge time on idle machines or to spend a few hundred dollars. 1656 Against such opponents, using DES with a 56-bit key will provide a 1657 substantial measure of security. At present, it would take a year 1658 and a half for someone using $10,000 worth of FPGA technology to 1659 search out a DES key. In ten years time an investment of this size 1660 would allow one to find a DES key in less than a week. 1662 The real threat to commercial transactions and to privacy on the 1663 Internet is from individuals and organizations willing to invest 1664 substantial time and money. As more and more business and personal 1665 information becomes electronic, the potential rewards to a dedicated 1666 commercial predator also increase significantly and may justify the 1667 commitment of adequate resources. 1669 A serious effort --- on the order of $300,000 --- by a legitimate 1670 or illegitimate business could find a DES key in an average of 19 1671 days using off-the-shelf technology and in only 3 hours using a 1672 custom developed chip. In the latter case, it would cost $38 to find 1673 each key (again assuming a 3 year life to the chip and continual 1674 use). A business or government willing to spend $10,000,000 on 1675 custom chips, could recover DES keys in an average of 6 minutes, for 1676 the same $38 per key. 1678 At the very high end, an organization --- presumably a government 1679 intelligence agency --- willing to spend $300,000,000 could recover 1680 DES keys in 12 seconds each! The investment required is large but 1681 not unheard of in the intelligence community. It is less than the 1682 cost of the Glomar Explorer, built to salvage a single Russian 1683 submarine, and far less than the cost of many spy satellites. Such 1684 an expense might be hard to justify in attacking a single target, but 1685 seems entirely appropriate against a cryptographic algorithm, like 1686 DES, enjoying extensive popularity around the world. 1688 There is ample evidence of the danger presented by government 1689 intelligence agencies seeking to obtain information not only for 1690 military purposes but for commercial advantage. Congressional 1691 hearings in 1993 highlighted instances in which the French and 1692 Japanese governments spied on behalf of their countries' own 1693 businesses. Thus, having to protect commercial information against 1694 such threats is not a hypothetical proposition. 1696 A.4.2 There are smarter avenues of attack than brute force 1698 It is easier to walk around a tree than climb up and down it. 1699 There is no need to break the window of a house to get in if the 1700 front door is unlocked. 1702 Calculations regarding the strength of encryption against brute- 1703 force attack are _worst case_ scenarios. They assume that the 1704 ciphers are in a sense perfect and that attempts to find shortcuts 1705 have failed. One important point is that the crudest approach --- 1706 searching through the keys --- is entirely feasible against many 1707 widely used systems. Another is that the keylengths we discuss are 1708 always minimal. As discussed earlier, prudent designs might use keys 1709 twice or three times as long to provide a margin of safety. 1711 A.4.3 Other algorithms are similar 1713 The Analysis for Other Algorithms Is Roughly Comparable. 1715 The above analysis has focused on the time and money required to 1716 find a key to decrypt information using the RC4 algorithm with a 40- 1717 bit key or the DES algorithm with its 56-bit key, but the results are 1718 not peculiar to these ciphers. Although each algorithm has its own 1719 particular characteristics, the effort required to find the keys of 1720 other ciphers is comparable. There may be some differences as the 1721 result of implementation procedures, but these do not materially 1722 affect the brute-force breakability of algorithms with roughly 1723 comparable key lengths. 1725 Specifically, it has been suggested at times that differences in 1726 set-up procedures, such as the long key-setup process in RC4, result 1727 in some algorithms having effectively longer keys than others. For 1728 the purpose of our analysis, such factors appear to vary the 1729 effective key length by no more than about eight bits. 1731 A.5. Appropriate Key Lengths for the Future --- A Proposal 1733 Table I summarizes the costs of carrying out brute-force attacks 1734 against symmetric cryptosystems with 40-bit and 56-bit keys using 1735 networks of general purpose computers, Field Programmable Gate 1736 Arrays, and special-purpose chips. 1738 It shows that 56 bits provides a level of protection --- about a 1739 year and a half --- that would be adequate for many commercial 1740 purposes against an opponent prepared to invest $10,000. Against an 1741 opponent prepared to invest $300,000, the period of protection has 1742 dropped to the barest minimum of 19 days. Above this, the protection 1743 quickly declines to negligible. A very large, but easily imaginable, 1744 investment by an intelligence agency would clearly allow it to 1745 recover keys in real time. 1747 What workfactor would be required for security today? For an 1748 opponent whose budget lay in the $10 to 300 million range, the time 1749 required to search out keys in a 75-bit keyspace would be between 6 1750 years and 70 days. Although the latter figure may seem comparable to 1751 the `barest minimum' 19 days mentioned earlier, it represents --- 1752 under our amortization assumptions --- a cost of $19 million and a 1753 recovery rate of only five keys a year. The victims of such an 1754 attack would have to be fat targets indeed. 1756 Because many kinds of information must be kept confidential for 1757 long periods of time, assessment cannot be limited to the protection 1758 required today. Equally important, cryptosystems --- especially if 1759 they are standards --- often remain in use for years or even decades. 1760 DES, for example, has been in use for more than 20 years and will 1761 probably continue to be employed for several more. In particular, 1762 the lifetime of a cryptosystem is likely to exceed the lifetime of 1763 any individual product embodying it. 1765 A rough estimate of the minimum strength required as a function 1766 of time can be obtained by applying an empirical rule, popularly 1767 called `Moore's Law,' which holds that the computing power available 1768 for a given cost doubles every 18 months. Taking into account both 1769 the lifetime of cryptographic equipment and the lifetime of the 1770 secrets it protects, we believe it is prudent to require that 1771 encrypted data should still be secure in 20 years. Moore's Law thus 1772 predicts that the keys should be approximately 14 bits longer than 1773 required to protect against an attack today. 1775 *Bearing in mind that the additional computational costs of 1776 stronger encryption are modest, we strongly recommend a minimum key- 1777 length of 90 bits for symmetric cryptosystems.* 1779 It is instructive to compare this recommendation with both 1780 Federal Information Processing Standard 46, The Data Encryption 1781 Standard (DES), and Federal Information Processing Standard 185, The 1782 Escrowed Encryption Standard (EES). DES was proposed 21 years ago 1783 and used a 56-bit key. Applying Moore's Law and adding 14 bits, we 1784 see that the strength of DES when it was proposed in 1975 was 1785 comparable to that of a 70-bit system today. Furthermore, it was 1786 estimated at the time that DES was not strong enough and that keys 1787 could be recovered at a rate of one per day for an investment of 1788 about twenty-million dollars. Our 75-bit estimate today corresponds 1789 to 61 bits in 1975, enough to have moved the cost of key recovery 1790 just out of reach. The Escrowed Encryption Standard, while 1791 unacceptable to many potential users for other reasons, embodies a 1792 notion of appropriate key length that is similar to our own. It uses 1793 80-bit keys, a number that lies between our figures of 75 and 90 1794 bits. 1796 Table I 1798 Time and cost Length Needed 1799 Type of Budget Tool per key recovered for protection 1800 Attacker 40bits 56bits in Late 1995 1802 Pedestrian Hacker 1804 tiny scavenged 1 week infeasible 45 1805 computer 1806 time 1808 $400 FPGA 5 hours 38 years 50 1809 ($0.08) ($5,000) 1811 Small Business 1813 $10,000 FPGA 12 minutes 556 days 55 1814 ($0.08) ($5,000) 1816 Corporate Department 1818 $300K FPGA 24 seconds 19 days 60 1819 or ($0.08) ($5,000) 1820 ASIC .18 seconds 3 hours 1821 ($0.001) ($38) 1823 Big Company 1824 $10M FPGA .7 seconds 13 hours 70 1825 or ($0.08) ($5,000) 1826 ASIC .005 seconds 6 minutes 1827 ($0.001) ($38) 1829 Intellegence Agency 1831 $300M ASIC .0002 seconds 12 seconds 75 1832 ($0.001) ($38) 1834 Appendix: About the Authors 1836 *Matt Blaze* is a senior research scientist at AT&T Research in the 1837 area of computer security and cryptography. Recently Blaze 1838 demonstrated weaknesses in the U.S. government's `Clipper Chip' key 1839 escrow encryption system. His current interests include large-scale 1840 trust management and the applications of smartcards. 1842 *Whitfield Diffie* is a distinguished Engineer at Sun Microsystems 1843 specializing in security. In 1976 Diffie and Martin Hellman created 1844 public key cryptography, which solved the problem of sending coded 1845 information between individuals with no prior relationship and is the 1846 basis for widespread encryption in the digital information age. 1848 *Ronald L. Rivest* is a professor of computer science at the 1849 Massachusetts Institute of Technology, and is Associate Director of 1850 MIT's Laboratory for Computer Science. Rivest, together with Leonard 1851 Adleman and Adi Shamir, invented the RSA public-key cryptosystem that 1852 is used widely throughout industry. Ron Rivest is one of the 1853 founders of RSA Data Security Inc. and is the creator of variable key 1854 length symmetric key ciphers (e.g., RC4). 1856 *Bruce Schneier* is president of Counterpane Systems, a consulting 1857 firm specializing in cryptography and computer security. Schneier 1858 writes and speaks frequently on computer security and privacy and is 1859 the author of a leading cryptography textbook, Applied Cryptography, 1860 and is the creator of the symmetric key cipher Blowfish. 1862 *Tsutomu Shimomura* is a computational physicist employed by the San 1863 Diego Supercomputer Center who is an expert in designing software 1864 security tools. Last year, Shimomura was responsible for tracking 1865 down the computer outlaw Kevin Mitnick, who electronically stole and 1866 altered valuable electronic information around the country. 1868 *Eric Thompson* heads AccessData Corporation's cryptanalytic team and 1869 is a frequent lecturer on applied crytography. AccessData 1870 specializes in data recovery and decrypting information utilizing 1871 brute force as well as `smarter' attacks. Regular clients include 1872 the FBI and other law enforcement agencies as well as corporations. 1874 *Michael Wiener* is a cryptographic advisor at Bell-Northern Research 1875 where he focuses on cryptanalysis, security architectures, and 1876 public-key infrastructures. His influential 1993 paper, Efficient 1877 DES Key Search, describes in detail how to construct a machine to 1878 brute force crack DES coded information (and provides cost estimates 1879 as well). 1881 Appendix: Acknowledgement 1883 The authors would like to thank the Business Software Alliance, 1884 which provided support for a one-day meeting, held in Chicago on 20 1885 November 1995. 1887 References 1889 [ASYMMETRIC] - "Secure Communications and Asymmetric Cryptosystems", 1890 edited by Gustavus J. Simmons, AAAS Selected Symposium 69, Westview 1891 Press, Inc. 1893 [BBS] - "A Simple Unpredictable Pseudo-Random Number Generator", SIAM 1894 Journal on Computing, v. 15, n. 2, 1986, L. Blum, M. Blum, & M. Shub. 1896 [BRILLINGER] - "Time Series: Data Analysis and Theory", Holden-Day, 1897 1981, David Brillinger. 1899 [CRC] - "C.R.C. Standard Mathematical Tables", Chemical Rubber 1900 Publishing Company. 1902 [CRYPTO1] - "Cryptography: A Primer", A Wiley-Interscience 1903 Publication, John Wiley & Sons, 1981, Alan G. Konheim. 1905 [CRYPTO2] - "Cryptography: A New Dimension in Computer Data 1906 Security", A Wiley-Interscience Publication, John Wiley & Sons, 1982, 1907 Carl H. Meyer & Stephen M. Matyas. 1909 [CRYPTO3] - "Applied Cryptography: Protocols, Algorithsm, and Source 1910 Code in C", Second Edition, John Wiley & Sons, 1996, Bruce Schneier. 1912 [DAVIS] - "Cryptographic Randomness from Air Turbulence in Disk 1913 Drives", Advances in Cryptology - Crypto '94, Springer-Verlag Lecture 1914 Notes in Computer Science #839, 1984, Don Davis, Ross Ihaka, and 1915 Philip Fenstermacher. 1917 [DES] - "Data Encryption Standard", United States of America, 1918 Department of Commerce, National Institute of Standards and 1919 Technology, Federal Information Processing Standard (FIPS) 46-1. 1920 - "Data Encryption Algorithm", American National Standards Institute, 1921 ANSI X3.92-1981. 1922 (See also FIPS 112, Password Usage, which includes FORTRAN code for 1923 performing DES.) 1925 [DES MODES] - "DES Modes of Operation", United States of America, 1926 Department of Commerce, National Institute of Standards and 1927 Technology, Federal Information Processing Standard (FIPS) 81. 1928 - Data Encryption Algorithm - Modes of Operation, American National 1929 Standards Institute, ANSI X3.106-1983. 1931 [D-H] - "New Directions in Cryptography", IEEE Transactions on 1932 Information Technology, November, 1976, Whitfield Diffie and Martin 1933 E. Hellman. 1935 [DNSSEC] - RFC 2535, "Domain Name System Security Extensions", D. 1936 Eastlake, March 1999. 1938 [DoD] - "Password Management Guideline", United States of America, 1939 Department of Defense, Computer Security Center, CSC-STD-002-85. 1940 (See also FIPS 112, Password Usage, which incorporates CSC-STD-002-85 1941 as one of its appendices.) 1943 [GIFFORD] - "Natural Random Number", MIT/LCS/TM-371, September 1988, 1944 David K. Gifford 1946 [IPSEC] - RFC 2401, "Security Architecture for the Internet 1947 Protocol", S. Kent, R. Atkinson, November 1998 1949 [KNUTH] - "The Art of Computer Programming", Volume 2: Seminumerical 1950 Algorithms, Chapter 3: Random Numbers. Addison Wesley Publishing 1951 Company, Second Edition 1982, Donald E. Knuth. 1953 [KRAWCZYK] - "How to Predict Congruential Generators", Journal of 1954 Algorithms, V. 13, N. 4, December 1992, H. Krawczyk 1956 [MAIL PEM] - RFCs 1421 through 1424: 1957 - RFC 1424, Privacy Enhancement for Internet Electronic Mail: Part 1958 IV: Key Certification and Related Services, 02/10/1993, B. Kaliski 1959 - RFC 1423, Privacy Enhancement for Internet Electronic Mail: Part 1960 III: Algorithms, Modes, and Identifiers, 02/10/1993, D. Balenson 1961 - RFC 1422, Privacy Enhancement for Internet Electronic Mail: Part 1962 II: Certificate-Based Key Management, 02/10/1993, S. Kent 1963 - RFC 1421, Privacy Enhancement for Internet Electronic Mail: Part I: 1964 Message Encryption and Authentication Procedures, 02/10/1993, J. Linn 1966 [MAIL PGP] - RFC 2440, "OpenPGP Message Format", J. Callas, L. 1967 Donnerhacke, H. Finney, R. Thayer", November 1998 1969 [MAIL S/MIME] - RFC 2633, "S/MIME Version 3 Message Specification", 1970 B. Ramsdell, Ed., June 1999. 1972 [MD4] - The MD4 Message-Digest Algorithm, RFC1320, April 1992, R. 1973 Rivest 1974 [MD5] - The MD5 Message-Digest Algorithm, RFC1321, April 1992, R. 1975 Rivest 1977 [RFC 1750] - "Randomness Requirements for Security", D. Eastlake, S. 1978 Crocker, J. Schiller, December 1994. 1980 [SHANNON] - "The Mathematical Theory of Communication", University of 1981 Illinois Press, 1963, Claude E. Shannon. (originally from: Bell 1982 System Technical Journal, July and October 1948) 1984 [SHIFT1] - "Shift Register Sequences", Aegean Park Press, Revised 1985 Edition 1982, Solomon W. Golomb. 1987 [SHIFT2] - "Cryptanalysis of Shift-Register Generated Stream Cypher 1988 Systems", Aegean Park Press, 1984, Wayne G. Barker. 1990 [SHA1] - Secure Hash Standard, United States of American, National 1991 Institute of Science and Technology, Federal Information Processing 1992 Standard (FIPS) 180-1, April 1993. 1994 [STERN] - "Secret Linear Congruential Generators are not 1995 Cryptograhically Secure", Proceedings of IEEE STOC, 1987, J. Stern. 1997 [TLS] - RFC 2246, "The TLS Protocol Version 1.0", T. Dierks, C. 1998 Allen, January 1999. 2000 [VON NEUMANN] - "Various techniques used in connection with random 2001 digits", von Neumann's Collected Works, Vol. 5, Pergamon Press, 1963, 2002 J. von Neumann. 2004 Authors Addresses 2006 Donald E. Eastlake 3rd 2007 Motorola 2008 140 Forest Avenue 2009 Hudson, MA 01749 USA 2011 Telephone: +1 508-261-5434 (w) 2012 +1 978-562-2827 (h) 2013 FAX: +1 508-261-4447 (w) 2014 EMail: Donald.Eastlake@motorola.com 2016 Jeffrey I. Schiller 2017 MIT Room E40-311 2018 77 Massachusetts Avenue 2019 Cambridge, MA 02139-4307 USA 2021 Telephone: +1 617-253-0161 2022 E-mail: jis@mit.edu 2024 Steve Crocker 2025 Longitude Systems, Inc. 2026 Suite 100 2027 1319 Shepard Drive 2028 Sterling, VA 20164 USA 2030 Telephone: +1 703-433-0808 x206 2031 FAX: +1 202-478-0458 2032 EMail: steve@stevecrocker.com 2034 File Name and Expiration 2036 This is file draft-eastlake-randomness2-00.txt. 2038 It expires January 2001.