Cryptography: Difference between revisions

[pending revision][accepted revision]
Content deleted Content added
No edit summary
Citation bot (talk | contribs)
Added bibcode. | Use this bot. Report bugs. | Suggested by Headbomb | Linked from Wikipedia:WikiProject_Academic_Journals/Journals_cited_by_Wikipedia/Sandbox | #UCB_webform_linked 550/1032
 
Line 1:
{{Short description|Practice and study of secure communication techniques}}
[[es:Criptografía]][[fr:Cryptographie]][[de:Kryptographie]][[it:Crittografia]] [[sv:Kryptografi]][[nl:Encryptie]]
{{Redirect|Secret code|the Aya Kamiki album|Secret Code}}
'''Cryptography''' (from [[Greek language|Greek]] ''kryptós'', "hidden", and ''gráphein'', "to write") is the study of the principles and techniques by which information can be translated into a "garbled" version that is difficult for an unauthorized person to read, while still allowing the intended reader to convert the resulting [[gobbledygook]] back into the original information. The term [[cryptology]] has sometimes been used instead of cryptography with this definition; but there is some tension between these two lexigraphic schools. There is also some tension between fans of two spellings of cypher (the alternate is cipher). In English, the cypher spelling has historical pride of place. This and related articles in the Wikipedia are often revised by those with strong opinions on the spelling question.
{{Redirect|Cryptology|the David S. Ware album|Cryptology (album)}}
{{pp-move|small=yes}}
{{pp-pc}}
{{More citations needed|date=March 2021}}
{{Use dmy dates|date=September 2015}}
[[File:Lorenz-SZ42-2.jpg|thumb|alt=Lorenz cipher machine with twelve rotors mechanism|upright=1.5| [[Lorenz cipher]] machine, used in [[World War II]] to encrypt communications of the [[Oberkommando der Wehrmacht|German High Command]]]]
'''Cryptography''', or '''cryptology''' (from {{langx|grc|{{wikt-lang|grc|κρυπτός}}|translit=kryptós}} "hidden, secret"; and {{wikt-lang|grc|γράφειν}} ''graphein'', "to write", or {{wikt-lang|grc|-λογία}} ''[[-logy|-logia]]'', "study", respectively<ref>{{Cite book|last1=Liddell|first1=Henry George|author-link=Henry George Liddell|last2=Scott|first2=Robert|last3=Jones|first3=Henry Stuart|author-link3=Henry Stuart Jones|last4=McKenzie|first4=Roderick|title=A Greek-English Lexicon|publisher=[[Oxford University Press]]|year=1984|title-link=A Greek-English Lexicon}}</ref>), is the practice and study of techniques for [[secure communication]] in the presence of [[Adversary (cryptography)|adversarial]] behavior.<ref>{{cite book|first=Ronald L.|last=Rivest|author-link=Ron Rivest|editor=J. Van Leeuwen|title=Handbook of Theoretical Computer Science|chapter=Cryptography|volume=1|publisher=Elsevier|year=1990}}</ref> More generally, cryptography is about constructing and analyzing [[Communication protocol|protocols]] that prevent third parties or the public from reading private messages.<ref>{{Cite book|first1=Mihir|last1=Bellare|first2=Phillip|last2=Rogaway|title=Introduction to Modern Cryptography|chapter=Introduction|page=10|date=21 September 2005}}</ref> Modern cryptography exists at the intersection of the disciplines of mathematics, [[computer science]], [[information security]], [[electrical engineering]], [[digital signal processing]], physics, and others.<ref>{{Cite book |last=Sadkhan |first=Sattar B. |title=2013 International Conference on Electrical Communication, Computer, Power, and Control Engineering (ICECCPCE) |chapter=Key note lecture multidisciplinary in cryptology and information security |date=Dec 2013 |pages=1–2 |doi=10.1109/ICECCPCE.2013.6998773 |isbn=978-1-4799-5633-3 |s2cid=22378547 }}</ref> Core concepts related to [[information security]] ([[confidentiality|data confidentiality]], [[data integrity]], [[authentication]], and [[non-repudiation]]) are also central to cryptography.<ref name="Menezes-1997">{{cite book |last1=Menezes |first1=A.J. |url=https://archive.org/details/handbookofapplie0000mene |title=Handbook of Applied Cryptography |last2=van Oorschot |first2=P.C. |last3=Vanstone |first3=S.A. |year=1997 |publisher=Taylor & Francis |isbn=978-0-8493-8523-0}}</ref> Practical applications of cryptography include [[electronic commerce]], [[Smart card#EMV|chip-based payment cards]], [[digital currencies]], [[password|computer passwords]], and [[military communications]].
 
Cryptography prior to the modern age was effectively synonymous with [[encryption]], converting readable information ([[plaintext]]) to unintelligible [[nonsense]] text ([[ciphertext]]), which can only be read by reversing the process ([[decryption]]). The sender of an encrypted (coded) message shares the decryption (decoding) technique only with the intended recipients to preclude access from adversaries. The cryptography literature [[Alice and Bob|often uses the names]] "Alice" (or "A") for the sender, "Bob" (or "B") for the intended recipient, and "Eve" (or "E") for the [[eavesdropping]] adversary.<ref name="Biggs-2008">{{cite book|first=Norman|last=Biggs|title=Codes: An introduction to Information Communication and Cryptography|url=https://archive.org/details/codesintroductio00bigg_911|url-access=limited|publisher=Springer|year=2008|page=[https://archive.org/details/codesintroductio00bigg_911/page/n176 171]}}</ref> Since the development of [[Rotor machine|rotor cipher machines]] in [[World War&nbsp;I]] and the advent of computers in [[World War&nbsp;II]], cryptography methods have become increasingly complex and their applications more varied.
Unsurprisingly, the study of hiding messages from others has been accompanied by the study of how to read such messages when one is ''not'' the intended receiver; this area of study is called ''[[cryptanalysis]]''. People involved in such work, and with cryptography in general, are known as cryptographers (or for those in the other school, '''cryptologists''').
 
{{Anchor|infeasible}}Modern cryptography is heavily based on [[mathematical theory]] and computer science practice; cryptographic [[algorithm]]s are designed around [[computational hardness assumption]]s, making such algorithms hard to break in actual practice by any adversary. While it is theoretically possible to break into a well-designed system, it is infeasible in actual practice to do so. Such schemes, if well designed, are therefore termed "computationally secure". Theoretical advances (e.g., improvements in [[integer factorization]] algorithms) and faster computing technology require these designs to be continually reevaluated and, if necessary, adapted. [[Information-theoretic security|Information-theoretically secure]] schemes that {{not a typo|provably}} cannot be broken even with unlimited computing power, such as the [[one-time pad]], are much more difficult to use in practice than the best theoretically breakable but computationally secure schemes.
The original information being sent is usually called the ''plaintext''. ''[[Encryption]]'' is the plaintext-to-garble conversion, and ''[[decryption]]'' is the garble-to-plaintext conversion. One main type of encryption is called ''[[code | encoding]]'' (yielding ''codetext''), after which the receiver decodes the codetext. The other is called ''[[cipher | enciphering]]'' (yielding, naturally, ''cyphertext''), after which the receiver decyphers the cyphertext. The exact operation of the encryption and decryption is controlled by one or more [[Cryptographic key|keys]].
 
The growth of cryptographic technology has raised [[Cryptography law|a number of legal issues]] in the [[Information Age]]. Cryptography's potential for use as a tool for espionage and [[sedition]] has led many governments to classify it as a weapon and to limit or even prohibit its use and export.<ref name="Crypto Law Survey-2013" /> In some jurisdictions where the use of cryptography is legal, laws permit investigators to [[Key disclosure law|compel the disclosure]] of [[Key (cryptography)|encryption keys]] for documents relevant to an investigation.<ref name="PC World-2007" /><ref name="Ranger-2015">{{cite web | url=http://www.techrepublic.com/article/the-undercover-war-on-your-internet-secrets-how-online-surveillance-cracked-our-trust-in-the-web/ | title=The undercover war on your internet secrets: How online surveillance cracked our trust in the web | last=Ranger | first=Steve | publisher=TechRepublic | date=24 March 2015| archive-url=https://web.archive.org/web/20160612190952/http://www.techrepublic.com/article/the-undercover-war-on-your-internet-secrets-how-online-surveillance-cracked-our-trust-in-the-web/ | archive-date=2016-06-12| access-date=2016-06-12}}</ref> Cryptography also plays a major role in [[digital rights management]] and [[copyright infringement]] disputes with regard to [[digital media]].<ref name="Doctorow-2007" />
 
==Terminology==
Cryptography has four main goals, though they are nearly always concealed beneath a blanket of marketing speak in commercial products. Examining any proposed crypto system with these in mind, and ignoring the marketing blather, will be a very useful exercise in the real world. They are:
# message ''confidentiality:'' Only the authorised recipient should be able to extract the contents of the message from its encrypted form. In addition, it should not be possible to obtain information about the message contents (such as a statistical distribution of certain characters) as this makes cryptanalysis easier.
# message ''integrity:'' The recipient should be able to determine if the message has been altered during transmission.
# ''authentication:'' The recipient should be able to identify the sender, and verify that the purported sender actually did send the message.
# ''non-repudiation:'' The sender should not be able to deny sending the message.
 
[[File:Caesar cipher left shift of 3.svg|thumb|alt=diagram showing shift three alphabetic cypher D becomes A and E becomes B|Alphabet shift ciphers are believed to have been used by [[Julius Caesar]] over 2,000 years ago.<ref name="Biggs-2008" /> This is an example with {{nowrap|1=''k'' = 3}}. In other words, the letters in the alphabet are shifted three in one direction to encrypt and three in the other direction to decrypt.]]
Not all cryptographic systems or algorithms achieve all of the above goals, or are even intended to. Poorly designed, or poorly implemented, crypto systems achieve them only by accident, and users can and do reduce even well designed and implemented crypto systems to the security equivalent of Swiss cheese. But even with well designed, well implemented, and properly used crypto systems, some goals aren't practical (or desirable) in some contexts. For example, the sender of the message may want to be anonymous, or the system may be intended for an environment with limited computing resources, or confidentiality might not matter.
The first use of the term "cryptograph" (as opposed to "[[cryptogram]]") dates back to the 19th century—originating from "[[The Gold-Bug]]", a story by [[Edgar Allan Poe]].<ref>{{cite journal |last1=Whalen |first1=Terence |title=The Code for Gold: Edgar Allan Poe and Cryptography |journal=Representations |issue=46 |date=1994 |volume=46 |pages=35–57 |doi=10.2307/2928778 |publisher=University of California Press|jstor=2928778}}</ref><ref>{{cite book|last=Rosenheim|first=Shawn|title=The Cryptographic Imagination: Secret Writing from Edgar Poe to the Internet|publisher=Johns Hopkins University Press|isbn=978-0801853319|url=https://books.google.com/books?id=sjhbAAAAMAAJ|year=1997|page=20}}</ref>
 
Until modern times, cryptography referred almost exclusively to "encryption", which is the process of converting ordinary information (called [[plaintext]]) into an unintelligible form (called [[ciphertext]]).<ref name="Kahn-1967" /> Decryption is the reverse, in other words, moving from the unintelligible ciphertext back to plaintext. A [[cipher]] (or cypher) is a pair of algorithms that carry out the encryption and the reversing decryption. The detailed operation of a cipher is controlled both by the algorithm and, in each instance, by a "key". The key is a secret (ideally known only to the communicants), usually a string of characters (ideally short so it can be remembered by the user), which is needed to decrypt the ciphertext. In formal mathematical terms, a "[[cryptosystem]]" is the ordered list of elements of finite possible plaintexts, finite possible cyphertexts, finite possible keys, and the encryption and decryption algorithms that correspond to each key. Keys are important both formally and in actual practice, as ciphers without variable keys can be trivially broken with only the knowledge of the cipher used and are therefore useless (or even counter-productive) for most purposes. Historically, ciphers were often used directly for encryption or decryption without additional procedures such as [[authentication]] or integrity checks.
In addition, some confusion may arise in a crypto system design regarding whom we are referring to when speaking of the "sender" or "recipient"; some examples for real crypto systems in the modern world include:
 
There are two main types of cryptosystems: [[Symmetric-key algorithm|symmetric]] and [[Public-key cryptography|asymmetric]]. In symmetric systems, the only ones known until the 1970s, the same secret key encrypts and decrypts a message. Data manipulation in symmetric systems is significantly faster than in asymmetric systems. Asymmetric systems use a "public key" to encrypt a message and a related "private key" to decrypt it. The advantage of asymmetric systems is that the public key can be freely published, allowing parties to establish secure communication without having a shared secret key. In practice, asymmetric systems are used to first exchange a secret key, and then secure communication proceeds via a more efficient symmetric system using that key.<ref>{{Cite web|url = https://www.giac.org/paper/gsec/2604/introduction-modern-cryptosystems/104482|title = An Introduction to Modern Cryptosystems|access-date = 12 October 2015|archive-date = 17 November 2015|archive-url = https://web.archive.org/web/20151117030739/https://www.giac.org/paper/gsec/2604/introduction-modern-cryptosystems/104482|url-status = live}}</ref> Examples of asymmetric systems include [[Diffie–Hellman key exchange]], RSA ([[RSA (cryptosystem)|Rivest–Shamir–Adleman]]), ECC ([[Elliptic Curve Cryptography]]), and [[Post-quantum cryptography]]. Secure symmetric algorithms include the commonly used AES ([[Advanced Encryption Standard]]) which replaced the older DES ([[Data Encryption Standard]]).<ref>{{Cite book|date = 2011-11-01|pages = 13–19|doi = 10.1109/THS.2011.6107841|first = M.S.|last = Sharbaf| title=2011 IEEE International Conference on Technologies for Homeland Security (HST) | chapter=Quantum cryptography: An emerging technology in network security |isbn = 978-1-4577-1376-7|s2cid = 17915038}}</ref> Insecure symmetric algorithms include children's language tangling schemes such as [[Pig Latin]] or other [[Cant (language)|cant]], and all historical cryptographic schemes, however seriously intended, prior to the invention of the [[one-time pad]] early in the 20th century.
:1) a computer program on a local system,
:2) a computer program on a 'nearby' system which 'provides security services' for users on other nearby systems,
:3) or -- what most people assume is "obviously" meant -- a human being using some computer system. Even in this case, the human doesn't not actually encrypt or sign or decrypt or authenticate anything. At most, when all is right in the world, the user instructs a computer program to encrypt or sign or ... This buffering of human action from actions which are thought to have 'been done by a human' is a source of problems in crypto system design and implementation. Such problems are generally quite subtle and correspondingly obscure. Often, even to practicing cryptographers.
 
In [[colloquial]] use, the term "[[code (cryptography)|code]]" is often used to mean any method of encryption or concealment of meaning. However, in cryptography, code has a more specific meaning: the replacement of a unit of plaintext (i.e., a meaningful word or phrase) with a [[Code word (communication)|code word]] (for example, "wallaby" replaces "attack at dawn"). A cypher, in contrast, is a scheme for changing or substituting an element below such a level (a letter, a syllable, or a pair of letters, etc.) to produce a cyphertext.
When confusion on these points is present (at the design stage, during implementation, or by a user), unintended failures in reaching each of the stated goals can occur quite easily, often without notice to any human involved, and even given perfect algorithms, superb and provably secure system design, and error free implementation. Such failures are most often due to extra-cryptographic issues; each such failure demonstrates that good algorithms and good protocols alone do not provide 'security'. Instead, careful thought is required regarding the entire system design -- and too often, this is absent in practice with real-world crypto systems.
 
[[Cryptanalysis]] is the term used for the study of methods for obtaining the meaning of encrypted information without access to the key normally required to do so; i.e., it is the study of how to "crack" encryption algorithms or their implementations.
Although cryptography has a long and complex history, it wasn't until the [[19th century]] that it developed anything more than ad hoc approaches to either [[cryptanalysis]] (eg, [[Charles Babbage]]'s Crimean War era work on mathematical cryptanalysis of polyalphabetic cyphers, repeated publicly rather later by the Prussian Kasiski) or encryption (eg, [[Auguste Kerckhoffs]]' writings in the later 19th century). An increasingly mathematically theoretical trend accelerated up to [[World War II]] (notably in [[William F. Friedman]]'s application of statistical techniques to cryptography and in [[Marian Rejewski]]'s initial break into the German Army's version of the [[Enigma]] system). Both cryptography and cryptanalysis have become far more mathematical since WWII. Even then, it has taken widely available computers, and the [[Internet]], to bring effective cryptography into common use by anyone other than national governments or similarly sized enterprises.
 
Some use the terms "cryptography" and "cryptology" interchangeably in English,<ref>{{Cite web |title=cryptology {{!}} Britannica |url=https://www.britannica.com/topic/cryptology |access-date=2022-06-22 |website=www.britannica.com |language=en |archive-date=10 July 2022 |archive-url=https://web.archive.org/web/20220710193304/https://www.britannica.com/topic/cryptology |url-status=live }}</ref> while others (including US military practice generally) use "cryptography" to refer specifically to the use and practice of cryptographic techniques and "cryptology" to refer to the combined study of cryptography and cryptanalysis.<ref>[[Oded Goldreich]], ''Foundations of Cryptography, Volume 1: Basic Tools'', Cambridge University Press, 2001, {{ISBN|0-521-79172-3}}</ref><ref>{{cite encyclopedia |encyclopedia=[[Merriam-Webster's Collegiate Dictionary]] |title=Cryptology (definition) |url=http://www.merriam-webster.com/dictionary/cryptology |access-date=26 March 2015 |edition=11th |publisher=[[Merriam-Webster]]}}</ref> English is more flexible than several other languages in which "cryptology" (done by cryptologists) is always used in the second sense above. {{IETF RFC|2828}} advises that [[steganography]] is sometimes included in cryptology.{{ref RFC|2828}}
== Classical Cryptography ==
 
The study of characteristics of languages that have some application in cryptography or cryptology (e.g. frequency data, letter combinations, universal patterns, etc.) is called [[cryptolinguistics]]. Cryptolingusitics is especially used in military intelligence applications for deciphering foreign communications.<ref>{{Cite web |last=Military.com |date=2021-05-13 |title=What's a Cryptologic Linguist? |url=https://www.military.com/join-armed-forces/army-cryptologic-linguist.html |access-date=2023-07-17 |website=Military.com |language=en}}</ref><ref>{{Cite book |title=Linguistics in a Systemic Perspective |date=January 1988 |publisher=John Benjamins Publishing Company |isbn=9789027278760 |editor=James D. Benson |editor2=Michael J. Cummings |editor3=William S. Greaves |pages=38}}</ref>
The earliest known use of cryptography is found in non-standard [[hieroglyphics]] on monuments from Egypt's Old Kingdom (ca 4000 years ago). These are not thought to be serious attempts at secret communications, however, but rather attempts at mystery, intrigue, or even amusement for literate onlookers. Each of which has been, intermittently, still another use of cryptography, or of something that looks (impressively if misleadingly) like it. Later, [[Hebrew]] scholars made use of simple [[substitution ciphers]] (such as the [[Atbash cipher]]) beginning perhaps around 500 to 600 BCE. Cryptography has a long tradition in religious writing likely to offend the dominant culture or political authorities. Perhaps the most famous is the 'Number of the Beast' from the book of Revelations in the Christian New Testament. 666 is almost certainly a cryptographic (ie, coded) way of concealing a dangerous reference; most scholars believe it's a way of referring to Rome (and so to Roman policies of persecution) that would be understood by the initiated (who 'had the codebook') and yet be safe (or less dangerous) if it came to the attention of those authorities. At least for orthodox Christian writing, the need for such concealment ended with Constantine's conversion.
 
==History==
The classical Greeks are said to have known of cyphers (eg, the [[scytale]] transposition cypher said to have been used by the Spartan military). Herodutus tells us of secret messages physically concealed beneath wax on wooden tablets or as a tattoo on a slave's head concealed by regrown hair. The Romans certainly did (eg, the [[Caesar cipher]] and its variations). There is mention of a book about Roman military cryptography (especially Julius Caesar's); it has been, unfortunately, lost. Cryptography became (secretly) important still later as a consequence of political competition and religous analysis. For instance, in Europe during and after the Renaissance, citizens of the various Italian states, most specifically including the Papacy, were responsible for substantial improvements in cryptographic practice (eg, polyalphabetic cyphers by [[Leon Alberti]]). And in the Arab world, textual analysis of the Koran led to the invention of the letter frequency counting technique for breaking monoalphabetic substitution cyphers around 1000 CE.
{{Main|History of cryptography}}
Before the modern era, cryptography focused on message confidentiality (i.e., encryption)—conversion of [[information|messages]] from a comprehensible form into an incomprehensible one and back again at the other end, rendering it unreadable by interceptors or [[eavesdropper]]s without secret knowledge (namely the key needed for decryption of that message). Encryption attempted to ensure [[secrecy]] in communication, such as those of [[spy|spies]], military leaders, and diplomats. In recent decades, the field has expanded beyond confidentiality concerns to include techniques for message integrity checking, sender/receiver identity authentication, [[digital signature]]s, [[Interactive proof system|interactive proofs]] and [[secure multiparty computation|secure computation]], among others.
 
===Classic cryptography===
Both cryptography, [[cryptanalysis]], and secret agent betrayal featured in the [[Babington plot]] during the reign of Queen [[Elizabeth I]]. And an encrypted message from the time of the Man in the Iron Mask (decrypted around 1900 by [[Étienne Bazeries]]) has shed some, regrettably non-definitive, light on the identity of that legendary, and unfortunate, prisoner. Cryptography, and its misuse, was involved in the plotting which led to the execution of [[Mata Hari]] and even more reprehensibly in the travesty which led to [[Dreyfus affair|Dreyfus' conviction]] and imprisonment, both in the early [[20th century]]. Fortunately, cryptographers were also involved in setting Dreyfus free; Mata Hari, in contrast, was shot.
[[File:Skytala&EmptyStrip-Shaded.png|thumb|alt=Skytala stick with strip of paper wound around in spiral|Reconstructed [[ancient Greek]] ''[[scytale]]'', an early cipher device]]
The main classical cipher types are [[transposition cipher]]s, which rearrange the order of letters in a message (e.g., 'hello world' becomes 'ehlol owrdl' in a trivially simple rearrangement scheme), and [[substitution cipher]]s, which systematically replace letters or groups of letters with other letters or groups of letters (e.g., 'fly at once' becomes 'gmz bu podf' by replacing each letter with the one following it in the [[Latin alphabet]]).<ref>{{Cite journal |last=Saltzman |first=Benjamin A. |date=2018-10-01 |title=Vt hkskdkxt: Early Medieval Cryptography, Textual Errors, and Scribal Agency |url=https://www.journals.uchicago.edu/doi/10.1086/698861 |journal=Speculum |language=en |volume=93 |issue=4 |pages=975–1009 |doi=10.1086/698861 |s2cid=165362817 |issn=0038-7134 |access-date=26 February 2022 |archive-date=26 February 2022 |archive-url=https://web.archive.org/web/20220226185812/https://www.journals.uchicago.edu/doi/10.1086/698861 |url-status=live |url-access=subscription }}</ref> Simple versions of either have never offered much confidentiality from enterprising opponents. An early substitution cipher was the [[Caesar cipher]], in which each letter in the plaintext was replaced by a letter three positions further down the alphabet.<ref>{{cite book |last1=Katz |first1=Jonathan |last2=Lindell |first2=Yehuda |year=2014 |title=Introduction to Modern Cryptography |publisher=Chapman and Hall |edition=2nd |page=9 |isbn=9781466570269}}</ref> [[Suetonius]] reports that [[Julius Caesar]] used it with a shift of three to communicate with his generals. [[Atbash]] is an example of an early Hebrew cipher. The earliest known use of cryptography is some carved ciphertext on stone in [[Egypt]] ({{circa|1900 BCE}}), but this may have been done for the amusement of literate observers rather than as a way of concealing information.
 
The [[Ancient Greece|Greeks of Classical times]] are said to have known of ciphers (e.g., the [[scytale]] transposition cipher claimed to have been used by the [[Sparta]]n military).<ref>{{Cite book|first=V.V.|last=I︠A︡shchenko|title=Cryptography: an introduction|year=2002|url={{Google books|cH-NGrpcIMcC|page=6|plainurl=yes}}|publisher=AMS Bookstore|page=6|isbn=978-0-8218-2986-8}}</ref> [[Steganography]] (i.e., hiding even the existence of a message so as to keep it confidential) was also first developed in ancient times. An early example, from [[Herodotus]], was a message tattooed on a slave's shaved head and concealed under the regrown hair.<ref name="Kahn-1967">{{Cite book|last=Kahn|first=David|author-link=David Kahn (writer)|title=The Codebreakers|year=1967|isbn=978-0-684-83130-5|title-link=The Codebreakers}}</ref> Other steganography methods involve 'hiding in plain sight,' such as using a [[music cipher#Musical Steganography|music cipher]] to disguise an encrypted message within a regular piece of sheet music. More modern examples of steganography include the use of [[invisible ink]], [[microdot]]s, and [[digital watermark]]s to conceal information.
Mathematical cryptography leapt ahead (mostly secretly) after [[World War I]]. Marian Rejewski, in [[Poland]], attacked and 'broke' the early German Army Enigma system (an electromechanical rotor cypher machine) using purely mathematical techniques in ([[1932]] and up to '39). His work was extended by [[Alan Turing]], Gordon Welchman, and others at [[Bletchley Park]] beginning in [[1939]], leading to sustained breaks into several other of the Enigma variants and their assorted networks. [[US Navy]] cryptographers (with help from the British and the Dutch after 1940) broke into several [[Japanese Navy]] crypto systems. The break into one of them famously led to the US victory in the [[Battle of Midway]]. A US Army group, the [[SIS]], managed to break the highest security Japanese diplomatic cypher system (an electromechanical 'stepping switch' machine called [[Purple code|Purple]] by the Americans) before WWII began. The Americans referred to the intelligence resulting from cryptanalysis, perhaps especially that from the Purple machine, as '[[Magic]]'. The British eventually settled on '[[Ultra]]' for intelligence resulting from cryptanalysis, particularly that from message traffic enciphered by the various Enigmas. An earlier British term had been 'Boniface'.
 
In India, the 2000-year-old ''[[Kama Sutra]]'' of [[Vātsyāyana]] speaks of two different kinds of ciphers called Kautiliyam and Mulavediya. In the Kautiliyam, the cipher letter substitutions are based on phonetic relations, such as vowels becoming consonants. In the Mulavediya, the cipher alphabet consists of pairing letters and using the reciprocal ones.<ref name="Kahn-1967" />
=== World War II Cryptography ===
 
In [[Sassanid Persia]], there were two secret scripts, according to the Muslim author [[Ibn al-Nadim]]: the ''šāh-dabīrīya'' (literally "King's script") which was used for official correspondence, and the ''rāz-saharīya'' which was used to communicate secret messages with other countries.<ref>{{cite web|url=http://www.iranicaonline.org/articles/codes-romuz-sg|title=CODES – Encyclopaedia Iranica|last=electricpulp.com|website=www.iranicaonline.org|access-date=4 March 2017|archive-date=5 March 2017|archive-url=https://web.archive.org/web/20170305113651/http://www.iranicaonline.org/articles/codes-romuz-sg|url-status=live}}</ref>
By [[World War II]] mechanical and electromechanical cryptographic machines were in wide use, although where these were impractical manual systems were still used. Great advances were made in both practical and mathematical cryptography in this period, all in secrecy. Some information about this period has begun to be declassified in recent years as the official 50-year (British) secrecy period has come to an end, and as the relevant US have slowly opened.
 
[[David Kahn (writer)|David Kahn]] notes in ''[[The Codebreakers]]'' that modern cryptology originated among the [[Arabs]], the first people to systematically document cryptanalytic methods.<ref>{{cite book|last1=Kahn|first1=David|title=The Codebreakers: The Comprehensive History of Secret Communication from Ancient Times to the Internet|date=1996|publisher=Simon and Schuster|isbn=978-1439103555|url=https://books.google.com/books?id=3S8rhOEmDIIC&q=david+kahn+the+codebreakers|access-date=16 October 2020|archive-date=1 July 2023|archive-url=https://web.archive.org/web/20230701101753/https://books.google.com/books?id=3S8rhOEmDIIC&q=david+kahn+the+codebreakers|url-status=live}}</ref> [[Al-Khalil ibn Ahmad al-Farahidi|Al-Khalil]] (717–786) wrote the ''Book of Cryptographic Messages'', which contains the first use of [[wikt:permutation|permutations and combinations]] to list all possible Arabic words with and without vowels.<ref>{{cite journal|last=Broemeling|first=Lyle D.|title=An Account of Early Statistical Inference in Arab Cryptology|journal=The American Statistician|date=1 November 2011|volume=65|issue=4|pages=255–257|doi=10.1198/tas.2011.10191|s2cid=123537702}}</ref>
The Germans made heavy use (in several variants) of an electromechanical rotor system known as [[Enigma]], the Japanese Foreign Office used the independently developed electrical stepping switch based system called Purple by the US, and also used several similar machines for attaches in some Japanese embassies. One of these was called the 'M-machine' by the US, another was referred to as 'Red'. All were broken, to one degree or another by the Allies. Other cypher machines used in WWII included the British Type X and the American SIGABA; both were electromechanical rotor designs similar in spirit to the Enigma. Neither is known to have been broken by anyone.
 
[[File:Al-kindi cryptographic.png|thumb|alt=Arabic text of a book by Al-Kindi|First page of a book by [[Al-Kindi]] which discusses encryption of messages]]
=== Modern Cryptography ===
 
Ciphertexts produced by a [[classical cipher]] (and some modern ciphers) will reveal statistical information about the plaintext, and that information can often be used to break the cipher. After the discovery of [[frequency analysis]], nearly all such ciphers could be broken by an informed attacker.<ref>{{Cite book |title=Cryptography Exam Study Essentials - A Comprehensive Guide to Cryptography Concepts for Exams |publisher=Cybellium Ltd |year=2024 |isbn=9781836794936 |edition=1st |publication-date=October 26, 2024 |pages=78 |language=EN}}</ref> Such classical ciphers still enjoy popularity today, though mostly as [[puzzle]]s (see [[cryptogram]]). The [[mathematics in medieval Islam|Arab mathematician]] and [[polymath]] Al-Kindi wrote a book on cryptography entitled ''Risalah fi Istikhraj al-Mu'amma'' (''Manuscript for the Deciphering Cryptographic Messages''), which described the first known use of frequency analysis cryptanalysis techniques.<ref>{{cite book |last=Singh |first=Simon |title=The Code Book |title-link=The Code Book |publisher=[[Anchor Books]] |year=2000 |isbn=978-0-385-49532-5 |___location=New York |pages=14–20 |authorlink=Simon Singh}}</ref><ref name="Al-Kadi-1992">{{Cite journal|first=Ibrahim A.|last=Al-Kadi|date=April 1992|title=The origins of cryptology: The Arab contributions|journal=[[Cryptologia]]|volume=16|number=2|pages=97–126|doi=10.1080/0161-119291866801}}</ref>
The era of modern cryptographic theory started with [[Claude Shannon]], arguably the father of mathematical cryptography. In [[1949]] he published the paper [http://www3.edgenet.net/dcowley/docs.html Communication Theory of Secrecy Systems] in the Bell System Technical Journal and a little later the book, Mathematical Theory of Communication, with Warren Weaver. These, in addition to his other works on [[information theory|information and communication theory]] established a strong theoretical basis for cryptography.
 
[[File:16th century French cypher machine in the shape of a book with arms of Henri II.jpg|thumb|alt=book sized metal machine with large dial left page and nineteen small dials right page|16th-century book-shaped French cipher machine, with arms of [[Henri II of France]]]]
[[1976]] saw two major public (ie, non-secret!) advances. First was the [[DES]] (Data Encryption Standard) submitted, at the invitation of the National Bureau of Standards (now NIST), by [[IBM]] in an effort to develop secure electronic communication facilities for businesses such as banks. It was adopted, after 'advice' and modification by the [[NSA]]. DES was published as a [[FIPS]] (Federal Information Processing Standard) in [[1977]] (currently at FIPS 46-3), and has been made effectively obsolete by the adoption of the Advanced Encryption Standard, also a NIST project, as FIPS 197. DES was the first cipher algorithm accessible to the public 'blessed' by a national crypto agency such as NSA. The release of the specifications of the DES algorithm by NBS (now NIST) stimulated an explosion of public and academic interest in cryptography. DES and more secure variants of it (such as [[3DES]], see FIPS 46-3) are still used today, although DES was officially supplanted by [[AES]] (Advanced Encryption Standard) in [[2001]] when NIST announced the selection of Rinjdael, by two Belgian cryptographers. It remains in wide use nonetheless, having been incorporated into many national and organizational standards. However, it has been broken (by the [[Electronic Frontier Foundation]], a cyber civil rights group -- the story is in ''Cracking DES'', published by O'Reilly and Associates).
[[File:Encoded letter of Gabriel Luetz d Aramon after 1546 with partial deciphering.jpg|thumb|alt=manuscript from Gabriel de Luetz d'Aramon in bound volume|Enciphered letter from [[Gabriel de Luetz d'Aramon]], [[French Ambassador to the Ottoman Empire]], after 1546, with partial decipherment]]
 
Language letter frequencies may offer little help for some extended historical encryption techniques such as [[Substitution cipher#Homophonic|homophonic cipher]] that tend to flatten the frequency distribution. For those ciphers, language letter group (or n-gram) frequencies may provide an attack.
Secondly, and even more importantly, was the publication of the paper [http://citeseer.nj.nec.com/340126.html New Directions in Cryptography] by [[Whitfield Diffie]] and [[Martin Hellman]]. This paper introduced a radically new method of distributing cryptographic keys, known as asymmetric key cryptography. This essentially solved one of the fundamental problems of cryptography, key distribution.
 
Essentially all ciphers remained vulnerable to cryptanalysis using the frequency analysis technique until the development of the [[polyalphabetic cipher]], most clearly by [[Leon Battista Alberti]] around the year 1467, though there is some indication that it was already known to Al-Kindi.<ref name="Al-Kadi-1992"/> Alberti's innovation was to use different ciphers (i.e., substitution alphabets) for various parts of a message (perhaps for each successive plaintext letter at the limit). He also invented what was probably the first automatic [[Alberti Cipher Disk|cipher device]], a wheel that implemented a partial realization of his invention. In the [[Vigenère cipher]], a [[polyalphabetic cipher]], encryption uses a ''key word'', which controls letter substitution depending on which letter of the key word is used. In the mid-19th century [[Charles Babbage]] showed that the Vigenère cipher was vulnerable to [[Kasiski examination]], but this was first published about ten years later by [[Friedrich Kasiski]].<ref>{{cite journal|last=Schrödel |first=Tobias|date=October 2008|title=Breaking Short Vigenère Ciphers |journal=[[Cryptologia]]|volume=32|issue=4|pages=334–337|doi=10.1080/01611190802336097|s2cid=21812933}}</ref>
Prior to this, all useful modern encryption algorithms had been [[symmetric key algorithm]]s, in which the same [[cryptographic key]] is used with the underlying algorithm by both the sender and the recipient. All of the electromechanical machines used in WWII were of this logical class, as were the Caesar and Atbash cyphers and essentially all crypto systems throughout history. The 'key' for a code is, of course, the codebook, which must be distributed and kept secret. Of necessity, a key in any such system had to be exchanged between the communicating parties in some secure way prior to any use of the system -- the term usually used is 'via a secure channel') such as a trustworthy courier with a briefcase handcuffed to a wrist or face-to-face contact. This requirement rapidly becomes unmanageable when the number of participants increases beyond some small number, or when (really) secure channels aren't available for key exchange. In particular, a separate key is required for each communicating pair if other parties are not to be able to decrypt their messages. A system of this kind is also known as a [[private key]], secret key, or conventional key cryptosystem.
 
Although frequency analysis can be a powerful and general technique against many ciphers, encryption has still often been effective in practice, as many a would-be cryptanalyst was unaware of the technique. Breaking a message without using frequency analysis essentially required knowledge of the cipher used and perhaps of the key involved, thus making espionage, bribery, burglary, defection, etc., more attractive approaches to the cryptanalytically uninformed. It was finally explicitly recognized in the 19th century that secrecy of a cipher's algorithm is not a sensible nor practical safeguard of message security; in fact, it was further realized that any adequate cryptographic scheme (including ciphers) should remain secure even if the adversary fully understands the cipher algorithm itself. Security of the key used should alone be sufficient for a good cipher to maintain confidentiality under an attack. This fundamental principle was first explicitly stated in 1883 by [[Auguste Kerckhoffs]] and is generally called [[Kerckhoffs's Principle]]; alternatively and more bluntly, it was restated by [[Claude Shannon]], the inventor of [[information theory]] and the fundamentals of theoretical cryptography, as ''Shannon's Maxim''—'the enemy knows the system'.
In contrast, in [[asymmetric key algorithm|asymmetric key]] cryptography, there is a pair of mathematically related keys for the algorithm, one of which is used for encryption and the other for decryption. Some of these algorithms have the additional property that one of the keys may be made public since the other cannot be (by any currently known method) deduced from the 'public' key. The other key in these systems is kept secret and is usually called the 'private' key. An algorithm of this kind is known as a [[public key / private key algorithm]], although the term [[asymmetric key cryptography]] is preferred by those who wish to avoid the ambiguity of using that term for all such algorithms and to stress that there are two distinct keys with different secrecy requirements.
 
Different physical devices and aids have been used to assist with ciphers. One of the earliest may have been the scytale of ancient Greece, a rod supposedly used by the Spartans as an aid for a transposition cipher. In medieval times, other aids were invented such as the [[grille (cryptography)|cipher grille]], which was also used for a kind of steganography. With the invention of polyalphabetic ciphers came more sophisticated aids such as Alberti's own [[cipher disk]], [[Johannes Trithemius]]' [[tabula recta]] scheme, and [[Thomas Jefferson]]'s [[Jefferson disk|wheel cypher]] (not publicly known, and reinvented independently by [[Bazeries]] around 1900). Many mechanical encryption/decryption devices were invented early in the 20th century, and several patented, among them [[rotor machine]]s—famously including the [[Enigma machine]] used by the German government and military from the late 1920s and during [[World War II]].<ref>{{cite book| last = Hakim | first = Joy | author-link = Joy Hakim | title = A History of US: War, Peace and all that Jazz | publisher = [[Oxford University Press]] | year = 1995 | ___location = New York | isbn = 978-0-19-509514-2 | title-link = A History of US}}</ref> The ciphers implemented by better quality examples of these machine designs brought about a substantial increase in cryptanalytic difficulty after WWI.<ref>{{Cite book|last=Gannon|first=James|author-link=James Gannon (author)|title=Stealing Secrets, Telling Lies: How Spies and Codebreakers Helped Shape the Twentieth Century|___location=Washington, D.C.|publisher=Brassey's|year=2001|isbn=978-1-57488-367-1|url=https://archive.org/details/stealingsecretst00gann}}</ref>
As a result, only one key pair is now needed per recipient (regardless of number of senders) as possession of a public key (by anyone whatsoever) does not compromise the 'security' of the algorithm so long as the corresponding private key is not known to any attacker (effectively this means not known to anyone except the sender). Note, however, that it has NOT been proven, for any of the good public/private asymmetric key algorithms, that a private key cannot be deduced from a public key (or vice versa). Informed observers believe it to be currently impossible (and perhaps forever impossible) for the 'good' algorithms, however. No workable deduction techniques have been publicly shown for any of them. Some asymmetric key algorithms have quite thoroughly broken, just as many symmetric key algorithms have; there is no special magic attached to using two keys.
 
=== Early computer-era cryptography ===
Nevertheless, some of the well respected, and widely used, public key / private key algorithms can be broken by one or another cryptanalytic attack and so, like most encryption algorithms, the protocols within which they are used must be chosen and implemented carefully. _All_ of them can be broken if the key length used is short enough to permit practical brute force key search; indeed this is true of all encryption algorithms using keys, regardless of class.
Cryptanalysis of the new mechanical ciphering devices proved to be both difficult and laborious. In the United Kingdom, cryptanalytic efforts at [[Bletchley Park]] during WWII spurred the development of more efficient means for carrying out repetitive tasks, such [[Code-breaking|as military code breaking (decryption)]]. This culminated in the development of the [[Colossus computer|Colossus]], the world's first fully electronic, digital, [[computer programming|programmable]] computer, which assisted in the decryption of ciphers generated by the German Army's [[Lorenz SZ40/42]] machine.
 
Extensive open academic research into cryptography is relatively recent, beginning in the mid-1970s. In the early 1970s [[IBM]] personnel designed the Data Encryption Standard (DES) algorithm that became the first federal government cryptography standard in the United States.<ref>{{Cite web|title=The Legacy of DES – Schneier on Security|url=https://www.schneier.com/blog/archives/2004/10/the_legacy_of_d.html|access-date=2022-01-26|website=www.schneier.com|date=6 October 2004 |archive-date=23 February 2022|archive-url=https://web.archive.org/web/20220223233956/https://www.schneier.com/blog/archives/2004/10/the_legacy_of_d.html|url-status=live}}</ref> In 1976 [[Whitfield Diffie]] and [[Martin Hellman]] published the Diffie–Hellman key exchange algorithm.<ref name="Diffie-1976" /> In 1977 the [[RSA (algorithm)|RSA algorithm]] was published in [[Martin Gardner]]'s ''[[Scientific American]]'' column.<ref>{{cite book|last1=Singh|first1=Simon|title=The Code Book: The Science of Secrecy From Ancient Egypt To Quantum Cryptography|date=1999|publisher=Anchor Books|___location=New York|isbn=978-0-385-49532-5|pages=[https://archive.org/details/codebook00simo/page/278 278]|edition=First Anchor Books|url-access=registration|url=https://archive.org/details/codebook00simo/page/278}}</ref> Since then, cryptography has become a widely used tool in communications, [[computer network]]s, and [[computer security]] generally.
This is an example of the fundamental problem for those who wish to keep their communications secure; they must choose a crypto system (algorithms + protocols + operation) that resists all attack from any attacker. There being no way to know who those attackers might be, nor what resources they might be able to deploy, nor what advances in cryptanalysis (or its associated mathematics) might in future occur, users may ONLY do the best they know how, and then hope. In practice, for well designed / implemented / used crypto systems, this is believed to be enough, possibly even for all(?) future attackers. Distinguishing between well designed / implemented / used crypto systems and crypto trash is another, quite difficult, problem for those who are not themselves expert cryptographers. It is even quite difficult for those who are.
 
Some modern cryptographic techniques can only keep their keys secret if certain mathematical problems are [[Computational complexity theory#Intractability|intractable]], such as the [[integer factorization]] or the [[discrete logarithm]] problems, so there are deep connections with [[abstract mathematics]]. There are very few cryptosystems that are proven to be unconditionally secure. The [[one-time pad]] is one, and was proven to be so by Claude Shannon. There are a few important algorithms that have been proven secure under certain assumptions. For example, the infeasibility of factoring extremely large integers is the basis for believing that RSA is secure, and some other systems, but even so, proof of unbreakability is unavailable since the underlying mathematical problem remains open. In practice, these are widely used, and are believed unbreakable in practice by most competent observers. There are systems similar to RSA, such as one by [[Michael O. Rabin]] that are provably secure provided factoring ''n = pq'' is impossible; it is quite unusable in practice. The [[discrete logarithm problem]] is the basis for believing some other cryptosystems are secure, and again, there are related, less practical systems that are provably secure relative to the solvability or insolvability discrete log problem.<ref>''Cryptography: Theory and Practice'', Third Edition (Discrete Mathematics and Its Applications), 2005, by Douglas R. Stinson, Chapman and Hall/CRC</ref>
Both asymmetric key cryptography and the best known of the public key / private key algorithms (ie, what is usually called the RSA algorithm) seem to have been developed by a UK intelligence agency before the public announcement in '76. [[GCHQ]] has released documents claiming that they had developed public key cryptography before the publication of Diffie and Hellman's paper. Various classified papers were written during the [[1960s]] and [[1970s]] which eventually led to schemes essentially identical to [[RSA]] encryption and to [[Diffie-Hellman]] key exchange in [[1973]] and [[1974]]. Some of these have now been published, and the inventors (James Ellis, Clifford Cocks, and Malcolm Williamson) have made public (some of) their work.
 
As well as being aware of cryptographic history, [[cryptographic algorithm]] and system designers must also sensibly consider probable future developments while working on their designs. For instance, continuous improvements in computer processing power have increased the scope of [[brute-force attack]]s, so when specifying [[key length]]s, the required key lengths are similarly advancing.<ref>{{cite web|url=http://www.fortify.net/related/cryptographers.html|title=Minimal key lengths for symmetric ciphers to provide adequate commercial security|last1=Blaze|first1=Matt|author-link1=Matt Blaze|last2=Diffie|first2=Whitefield|author-link2=Whitfield Diffie|date=January 1996|publisher=[[Fortify (Netscape)|Fortify]]|access-date=26 March 2015|last3=Rivest|first3=Ronald L.|author-link3=Ron Rivest|last4=Schneier|first4=Bruce|author-link4=Bruce Schneier|last5=Shimomura|first5=Tsutomu|author-link5=Tsutomu Shimomura|last6=Thompson|first6=Eric|last7=Wiener|first7=Michael|archive-date=24 September 2015|archive-url=https://web.archive.org/web/20150924014751/http://www.fortify.net/related/cryptographers.html|url-status=live}}</ref> The potential impact of [[quantum computing]] are already being considered by some cryptographic system designers developing post-quantum cryptography.{{when|date=January 2022}} The announced imminence of small implementations of these machines may be making the need for preemptive caution rather more than merely speculative.<ref name="Menezes-1997" />
==Some algorithms of various kinds==
 
==Modern cryptography==
=== [[Hash function]]s, aka message digest functions, cryptographic hash functions ===
[[Claude Shannon]]'s two papers, his [[A Mathematical Theory of Communication|1948 paper]] on [[information theory]], and especially his [[Communication Theory of Secrecy Systems|1949 paper]] on cryptography, laid the foundations of modern cryptography and provided a mathematical basis for future cryptography.<ref>{{Cite book |last1=Piper |first1=F. C. |url=https://books.google.com/books?id=HvR0DgAAQBAJ |title=Cryptography: A Very Short Introduction |last2=Murphy |first2=Sean |date=2002 |publisher=Oxford University Press |isbn=978-0-19-280315-3 |series=Very short introductions |___location=Oxford; New York |pages=75 |language=en |oclc=ocm48932608}}</ref><ref>{{Cite book |last1=Hoffstein |first1=Jeffrey |url=https://books.google.com/books?id=cbl_BAAAQBAJ |title=An Introduction to Mathematical Cryptography |last2=Pipher |first2=Jill Catherine |last3=Silverman |first3=Joseph H. |date=2014 |publisher=Springer |isbn=978-1-4939-1710-5 |edition=2nd |series= |___location=New York |pages=263 |language=en |oclc=891676484}}</ref> His 1949 paper has been noted as having provided a "solid theoretical basis for cryptography and for cryptanalysis",<ref>{{Cite book |last=O'Regan |first=Gerard |url=https://books.google.com/books?id=081H96F1enMC |title=A Brief History of Computing |date=2008 |publisher=Springer |isbn=978-1-84800-083-4 |___location=London |pages=61 |language=en |oclc=183149167}}</ref> and as having turned cryptography from an "art to a science".<ref>{{Cite book |last=Zheng |first=Zhiyong |url=https://books.google.com/books?id=dG1rEAAAQBAJ&dq=most+important+cryptography+paper+shannon&pg=PR6 |title=Modern Cryptography Volume 1: A Classical Introduction to Informational and Mathematical Principle |date=2022 |publisher=Springer Singapore |isbn=978-981-19-0919-1 |series=Financial Mathematics and Fintech |___location=Singapore |pages=vi |language=en |doi=10.1007/978-981-19-0920-7}}</ref> As a result of his contributions and work, he has been described as the "founding father of modern cryptography".<ref>{{Cite book |last1=Bruen |first1=Aiden A. |url=https://books.google.com/books?id=fd2LtVgFzoMC&dq=claude+shannon+father+of+cryptography&pg=PA3 |title=Cryptography, Information Theory, and Error-Correction: A Handbook for the 21st Century |last2=Forcinito |first2=Mario |date=2005 |publisher=Wiley-Interscience |isbn=978-0-471-65317-2 |___location=Hoboken, N.J |pages=3 |language=en |oclc=ocm56191935}}</ref>
* [[MD5]]
* [[SHA-1]]
* [[RIPEMD-160]]
* Tiger
 
Prior to the early 20th century, cryptography was mainly concerned with [[language|linguistic]] and [[lexicographic code|lexicographic]] patterns. Since then cryptography has broadened in scope, and now makes extensive use of mathematical subdisciplines, including information theory, [[computational complexity theory|computational complexity]], statistics, [[combinatorics]], [[abstract algebra]], [[number theory]], and [[finite mathematics]].<ref>{{cite journal |last1=Diffie |first1=W. |last2=Hellman |first2=M. |title=New directions in cryptography |url=https://dl.acm.org/doi/10.1109/TIT.1976.1055638 |journal=IEEE Transactions on Information Theory |pages=644–654 |doi=10.1109/TIT.1976.1055638 |date=1 September 2006 |volume=22 |issue=6 |access-date=19 April 2022 |archive-date=19 April 2022 |archive-url=https://web.archive.org/web/20220419150601/https://dl.acm.org/doi/10.1109/TIT.1976.1055638 |url-status=live |url-access=subscription }}</ref> Cryptography is also a branch of engineering, but an unusual one since it deals with active, intelligent, and malevolent opposition; other kinds of engineering (e.g., civil or chemical engineering) need deal only with neutral natural forces. There is also active research examining the relationship between cryptographic problems and [[quantum physics]].
=== Public key / private key encryption algorithms (aka [[asymmetric key algorithm]]s) ===
* [[Diffie-Hellman]]
* [[El Gamal]]
* [[Elliptic curve cryptography]]
* [[PGP]]
* [[RSA]]
 
Just as the development of digital computers and electronics helped in cryptanalysis, it made possible much more complex ciphers. Furthermore, computers allowed for the encryption of any kind of data representable in any binary format, unlike classical ciphers which only encrypted written language texts; this was new and significant. Computer use has thus supplanted linguistic cryptography, both for cipher design and cryptanalysis. Many computer ciphers can be characterized by their operation on [[binary numeral system|binary]] [[bit]] sequences (sometimes in groups or blocks), unlike classical and mechanical schemes, which generally manipulate traditional characters (i.e., letters and digits) directly. However, computers have also assisted cryptanalysis, which has compensated to some extent for increased cipher complexity. Nonetheless, good modern ciphers have stayed ahead of cryptanalysis; it is typically the case that use of a quality cipher is very efficient (i.e., fast and requiring few resources, such as memory or CPU capability), while breaking it requires an effort many orders of magnitude larger, and vastly larger than that required for any classical cipher, making cryptanalysis so inefficient and impractical as to be effectively impossible.
=== Secret key algorithms (aka [[symmetric key algorithm]]s) ===
* [[Enigma]]
* [[One-time pad]]
* [[Data Encryption Standard]] (DES, FIPS 46-3)
* [[Lucifer cipher]]
* [[RC4 cipher]]
* [[Blowfish encryption algorithm|Blowfish]]
* [[International Data Encryption Algorithm]] (IDEA)
* [[Advanced Encryption Standard]] (AES, FIPS 197)
* [[IDEA encryption algorithm|IDEA]]
* [[Twofish encryption algorithm|Twofish]]
* [[RC6 encryption algorithm|RC6]]
* [[Iraqi Block Cipher]] (IBC)
 
Research into '''post-quantum cryptography''' (PQC) has intensified because practical quantum computers would break widely deployed public-key systems such as RSA, Diffie–Hellman and ECC. A 2017 review in ''Nature'' surveys the leading PQC families—lattice-based, code-based, multivariate-quadratic and hash-based schemes—and stresses that standardisation and deployment should proceed well before large-scale quantum machines become available.<ref name="BernsteinLange2017">{{Cite journal |last1=Bernstein |first1=Daniel J. |last2=Lange |first2=Tanja |authorlink1=Daniel J. Bernstein |authorlink2=Tanja Lange |date=September 14, 2017 |title=Post-quantum cryptography |url=http://www.nature.com/articles/nature23461 |journal=Nature |language=en |volume=549 |issue=7671 |pages=188–194 |doi=10.1038/nature23461 |pmid=28905891 |bibcode=2017Natur.549..188B |s2cid=4446249 |issn=0028-0836 |access-date=26 August 2022 |archive-date=10 July 2022 |archive-url=https://web.archive.org/web/20220710194707/https://www.nature.com/articles/nature23461 |url-status=live }}</ref>
=== [[Pseudo-random number generator]]s ===
* [[Blum Blum Shub]]
* [[Yarrow algorithm|Yarrow]]
 
===Symmetric-key cryptography===
=== Anonymous communication ===
{{Main|Symmetric-key algorithm}}
* [[Dining cryptographers protocol]]
[[File:Symmetric key encryption.svg|thumb|upright=1.15|alt=Diagram showing an encrypt and decrypt process with a key|Symmetric-key cryptography, where a single key is used for both encryption and decryption]]
* [[Anonymous remailer]]
Symmetric-key cryptography refers to encryption methods in which both the sender and receiver share the same key (or, less commonly, in which their keys are different, but related in an easily computable way). This was the only kind of encryption publicly known until June 1976.<ref name="Diffie-1976">{{cite journal|last1=Diffie|first1=Whitfield|author-link=Whitfield Diffie|last2=Hellman|first2=Martin|author-link2=Martin Hellman|date=November 1976|title=New Directions in Cryptography|url=http://www-ee.stanford.edu/~hellman/publications/24.pdf|journal=IEEE Transactions on Information Theory|volume=IT-22|issue=6|pages=644–654|citeseerx=10.1.1.37.9720|doi=10.1109/tit.1976.1055638|access-date=16 November 2015|archive-date=3 December 2017|archive-url=https://web.archive.org/web/20171203090237/https://www-ee.stanford.edu/~hellman/publications/24.pdf|url-status=live}}</ref>
[[File:International Data Encryption Algorithm InfoBox Diagram.svg|thumb|alt=logic diagram showing International Data Encryption Algorithm cypher process|One round (out of 8.5) of the [[International Data Encryption Algorithm|IDEA]] cipher, used in most versions of [[Pretty Good Privacy|PGP]] and OpenPGP compatible software for time-efficient encryption of messages]]
Symmetric key ciphers are implemented as either [[block ciphers]] or [[stream ciphers]]. A block cipher enciphers input in blocks of plaintext as opposed to individual characters, the input form used by a stream cipher.
 
The [[Data Encryption Standard]] (DES) and the [[Advanced Encryption Standard]] (AES) are block cipher designs that have been designated [[cryptography standards]] by the US government (though DES's designation was finally withdrawn after the AES was adopted).<ref>{{Cite web|url=http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf|title=FIPS PUB 197: The official Advanced Encryption Standard|publisher=[[National Institute of Standards and Technology]]|website=Computer Security Resource Center|access-date=26 March 2015|archive-url=https://web.archive.org/web/20150407153905/http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf|archive-date=7 April 2015|url-status=dead}}</ref> Despite its deprecation as an official standard, DES (especially its still-approved and much more secure [[triple-DES]] variant) remains quite popular; it is used across a wide range of applications, from ATM encryption<ref>{{Cite web|url=http://www.ncua.gov/Resources/Documents/LCU2004-09.pdf|title=NCUA letter to credit unions|website=[[National Credit Union Administration]]|date=July 2004|access-date=26 March 2015|archive-date=12 September 2014|archive-url=https://web.archive.org/web/20140912045940/http://www.ncua.gov/Resources/Documents/LCU2004-09.pdf|url-status=live}}</ref> to [[e-mail privacy]]{{ref RFC|2440}} and [[Secure Shell|secure remote access]].<ref>{{Cite web|url=http://www.windowsecurity.com/articles/SSH.html|title=SSH|website=WindowSecurity|first=Pawel|last=Golen|date=19 July 2002|access-date=26 March 2015|archive-date=29 October 2009|archive-url=https://web.archive.org/web/20091029164411/http://www.windowsecurity.com/articles/SSH.html|url-status=live}}</ref> Many other block ciphers have been designed and released, with considerable variation in quality. Many, even some designed by capable practitioners, have been thoroughly broken, such as [[FEAL]].<ref name="Menezes-1997" /><ref name="Schneier-1996">{{Cite book|first=Bruce|last=Schneier|author-link=Bruce Schneier|title=Applied Cryptography|url=https://archive.org/details/Applied_Cryptography_2nd_ed._B._Schneier|edition=2nd|publisher=[[John Wiley & Sons|Wiley]]|year=1996|isbn=978-0-471-11709-4}}</ref>
=== Terminology ===
* [[Cryptographic key]]
* [[Cipher]]
* [[Code]]
* [[Brute force attack]]
* [[Dictionary attack]]
* [[Unicity distance]]
 
Stream ciphers, in contrast to the 'block' type, create an arbitrarily long stream of key material, which is combined with the plaintext bit-by-bit or character-by-character, somewhat like the [[one-time pad]]. In a stream cipher, the output stream is created based on a hidden internal state that changes as the cipher operates. That internal state is initially set up using the secret key material. [[RC4]] is a widely used stream cipher.<ref name="Menezes-1997" /> Block ciphers can be used as stream ciphers by generating blocks of a keystream (in place of a [[Pseudorandom number generator]]) and applying an [[Exclusive or|XOR]] operation to each bit of the plaintext with each bit of the keystream.<ref>{{Cite book|last=Paar|first=Christof|title=Understanding cryptography : a textbook for students and practitioners|date=2009|publisher=Springer|page=123|others=Jan Pelzl|isbn=978-3-642-04101-3|___location=Berlin|oclc=567365751}}</ref>
== Further Reading ==
* General note on cryptographic references: There is a great amount of myth and misunderstanding in wide circulation about topics cryptographic. Some is grossly wrong, some is 'merely' subtley misleading. There is also a very great selection of poorly done, non-secure crytographic software on the market (purchaseware, shareware, freeware, xyzware). Readers and buyers should exercise substantially more than the usual caution lest they lose one, two, or all of the reasons they have bothered with cryptography at all (see the article above for the goals of cryptography use). At the time this sentence was written, each of the following references is reliable -- mostly. Consider that none covers up_to_date secret cryptography (at minimum, publishing schedules do not permit it) and so much may be missing. All of this may produce considerable distortions in your understanding of the current state of the art in cryptography, but try these references first if you wish to minimize those distortions.
* [http://www.murky.org/cryptography/index.shtml The Beginner's Guide to Cryptography] - This website gives a (quite) elementary overview of some basic areas of cryptography.
* [[Niels Ferguson|Ferguson, Niels]], [[Bruce Schneier|Schneier, Bruce]] - ''Practical Cryptography'', Wiley, 2003, ISBN 0471223573. Up to date cryptography reference. Describes how to implement a particular crypto system using cryptographic protocols. This is an in depth consideration of one cryptographic problem including paths not taken. Not otherwise available in a single source. A follow-up to 'Applied Cryptography' (see below)
* [[Bruce Schneier|Schneier, Bruce]] - ''Applied Cryptography'', 2 ed, Wiley, ISBN 0471117099. The best single volume available covering modern cryptographic practice. Not overly mathematical and so accessible -- mostly -- to the non-technical.
* [[Bruce Schneier|Schneier, Bruce]] - ''Secrets and Lies'', Wiley, ISBN 0471253111, a discussion of the context within which cryptography and cryptosystems work. Meta-cryptography, if you will. Required reading for would be cryptographers, and nearly so for all cryptography users.
* Ross Anderson -- ''Security Engineering'', advanced coverage of computer security issues, including cryptography, by one of its foremost practicioners, and most likely its best writer.
* Bamford, James - ''The Puzzle Palace : A Report on America's Most Secret Agency'' ISBN 0140067485, and the more recent "Body of Secrets". The best of a quite small group of books about NSA. Most are inadequate, and untrustworthy, for various reasons.
* A. J. Menezes, P. C. van Oorschot and S. A. Vanstone - ''Handbook of Applied Cryptography'' ISBN 0849385237 ([http://cacr.math.uwaterloo.ca/hac/ online version]) Equivalent to Applied Cryptography in many ways, but seriously mathematical.
* Kahn, David - ''The Codebreakers'' ISBN 0684831309 The best available single source for cryptographic history, at least for events up to the mid '60s. The added chapter on more recent developments (in the most recent edition) is regrettably far too thin. See also his other publications on cryptography which are uniformly excellent.
* Singh, Simon - ''The Code Book'' ISBN 1857028899. An anecdotal introduction to the history of cryptography, but much better than such an approach might be expected to produce. Covers more recent material than does Kahn's The Codebreakers. Well written. Sadly, the included cryptanalytic contest has been won and the prize awarded; the cyphers are still worth having a go at, however.
 
[[Message authentication code]]s (MACs) are much like [[cryptographic hash function]]s, except that a secret key can be used to authenticate the hash value upon receipt;<ref name="Menezes-1997" /><ref name="BernsteinLange2017"/> this additional complication blocks an attack scheme against bare [[Md5|digest algorithms]], and so has been thought worth the effort. Cryptographic hash functions are a third type of cryptographic algorithm. They take a message of any length as input, and output a short, fixed-length [[hash function|hash]], which can be used in (for example) a digital signature. For good hash functions, an attacker cannot find two messages that produce the same hash. [[MD4]] is a long-used hash function that is now broken; [[MD5]], a strengthened variant of MD4, is also widely used but broken in practice. The US [[National Security Agency]] developed the Secure Hash Algorithm series of MD5-like hash functions: SHA-0 was a flawed algorithm that the agency withdrew; [[SHA-1]] is widely deployed and more secure than MD5, but cryptanalysts have identified attacks against it; the [[SHA-2]] family improves on SHA-1, but is vulnerable to clashes as of 2011; and the US standards authority thought it "prudent" from a security perspective to develop a new standard to "significantly improve the robustness of [[National Institute of Standards and Technology|NIST]]'s overall hash algorithm toolkit."<ref name="Federal Register-2007">{{Cite journal |journal=[[Federal Register]]|volume=72|number=212|date=2 November 2007 |url=https://www.govinfo.gov/content/pkg/FR-2007-11-02/pdf/E7-21581.pdf |title=Announcing Request for Candidate Algorithm Nominations for a New Cryptographic Hash Algorithm (SHA–3) Family |archive-url=https://web.archive.org/web/20080228075550/http://csrc.nist.gov/groups/ST/hash/documents/FR_Notice_Nov07.pdf |archive-date=28 February 2008 |url-status=live}}</ref> Thus, a [[NIST hash function competition|hash function design competition]] was meant to select a new U.S. national standard, to be called [[SHA-3]], by 2012. The competition ended on October 2, 2012, when the NIST announced that [[Keccak]] would be the new SHA-3 hash algorithm.<ref name="NIST-2012">{{cite journal|url=https://www.nist.gov/itl/csd/sha-100212.cfm|title=NIST Selects Winner of Secure Hash Algorithm (SHA-3) Competition|journal=NIST|publisher=[[National Institute of Standards and Technology]]|date=October 2, 2012|access-date=26 March 2015|archive-date=2 April 2015|archive-url=https://web.archive.org/web/20150402081721/http://www.nist.gov/itl/csd/sha-100212.cfm|url-status=live}}</ref> Unlike block and stream ciphers that are invertible, cryptographic hash functions produce a hashed output that cannot be used to retrieve the original input data. Cryptographic hash functions are used to verify the authenticity of data retrieved from an untrusted source or to add a layer of security.
== Related topics ==
 
[[Echelon]], [[Enigma]], [[Espionage]], [[IACR]], [[Purple code]], [[Ultra]], [[Security engineering]], [[SIGINT]], [[Steganography]], [[Cryptographers]], [[Secure Sockets Layer|SSL]], [[Quantum Cryptography]], [[Crypto-anarchism]], [[Cypherpunk]]
===Public-key cryptography===
{{Main|Public-key cryptography}}
[[File:Public key encryption.svg|thumb|upright=1.15|alt=diagram of Public-key cryptography showing public key and private key|Public-key cryptography, where different keys are used for encryption and decryption]]
 
Symmetric-key cryptosystems use the same key for encryption and decryption of a message, although a message or group of messages can have a different key than others. A significant disadvantage of symmetric ciphers is the [[key management]] necessary to use them securely. Each distinct pair of communicating parties must, ideally, share a different key, and perhaps for each ciphertext exchanged as well. The number of keys required increases as the [[square (algebra)|square]] of the number of network members, which very quickly requires complex key management schemes to keep them all consistent and secret.
 
[[File:Diffie and Hellman.jpg|thumb|left|alt=headshots of Whitfield Diffie and Martin Hellman|[[Whitfield Diffie]] and [[Martin Hellman]], authors of the first published paper on public-key cryptography]]
In a groundbreaking 1976 paper, Whitfield Diffie and Martin Hellman proposed the notion of ''public-key'' (also, more generally, called ''asymmetric key'') cryptography in which two different but mathematically related keys are used—a ''public'' key and a ''private'' key.<ref>{{Cite book|first1=Whitfield|last1=Diffie|author-link=Whitfield Diffie|first2=Martin|last2=Hellman|title=Proceedings of the June 7-10, 1976, national computer conference and exposition on - AFIPS '76 |chapter=Multiuser cryptographic techniques |author-link2=Martin Hellman|volume=45|pages=109–112|date=8 June 1976|doi=10.1145/1499799.1499815|s2cid=13210741}}</ref> A public key system is so constructed that calculation of one key (the 'private key') is computationally infeasible from the other (the 'public key'), even though they are necessarily related. Instead, both keys are generated secretly, as an interrelated pair.<ref>[[Ralph Merkle]] was working on similar ideas at the time and encountered publication delays, and Hellman has suggested that the term used should be Diffie–Hellman–Merkle asymmetric key cryptography.</ref> The historian [[David Kahn (writer)|David Kahn]] described public-key cryptography as "the most revolutionary new concept in the field since polyalphabetic substitution emerged in the Renaissance".<ref>{{Cite journal|first=David|last=Kahn|title=Cryptology Goes Public|journal=[[Foreign Affairs]]|volume=58|pages=141–159|number=1|date=Fall 1979|doi=10.2307/20040343|jstor=20040343}}</ref>
 
In public-key cryptosystems, the public key may be freely distributed, while its paired private key must remain secret. In a public-key encryption system, the ''public key'' is used for encryption, while the ''private'' or ''secret key'' is used for decryption. While Diffie and Hellman could not find such a system, they showed that public-key cryptography was indeed possible by presenting the [[Diffie–Hellman key exchange]] protocol, a solution that is now widely used in secure communications to allow two parties to secretly agree on a [[symmetric-key algorithm|shared encryption key]].<ref name="Diffie-1976" />
The [[X.509]] standard defines the most commonly used format for [[public key certificates]].<ref>{{cite web|url=https://www.ssltrust.com.au/help/setup-guides/client-certificate-authentication|title=Using Client-Certificate based authentication with NGINX on Ubuntu|website=SSLTrust|access-date=13 June 2019|archive-date=26 August 2019|archive-url=https://web.archive.org/web/20190826005346/https://www.ssltrust.com.au/help/setup-guides/client-certificate-authentication|url-status=live}}</ref>
 
Diffie and Hellman's publication sparked widespread academic efforts in finding a practical public-key encryption system. This race was finally won in 1978 by [[Ronald Rivest]], [[Adi Shamir]], and [[Len Adleman]], whose solution has since become known as the [[RSA (cryptosystem)|RSA algorithm]].<ref>{{Cite journal|first1=Ronald L.|last1=Rivest|author-link=Ronald L. Rivest|first2=A.|last2=Shamir|first3=L.|last3=Adleman|title=A Method for Obtaining Digital Signatures and Public-Key Cryptosystems|journal=Communications of the ACM|volume=21|number=2|pages=120–126|year=1978|doi=10.1145/359340.359342|citeseerx=10.1.1.607.2677|s2cid=2873616 |url=http://theory.lcs.mit.edu/~rivest/rsapaper.pdf |archive-url=https://web.archive.org/web/20011116122233/http://theory.lcs.mit.edu/~rivest/rsapaper.pdf |archive-date=16 November 2001 |url-status=dead}} Previously released as an [[MIT]] "Technical Memo" in April 1977, and published in [[Martin Gardner]]'s ''[[Scientific American]]'' [[Mathematical recreations]] column</ref>
 
The [[Diffie–Hellman key exchange|Diffie–Hellman]] and [[RSA (cryptosystem)|RSA algorithms]], in addition to being the first publicly known examples of high-quality public-key algorithms, have been among the most widely used. Other [[:Category:Asymmetric-key algorithms|asymmetric-key algorithms]] include the [[Cramer–Shoup cryptosystem]], [[ElGamal encryption]], and various [[Elliptic curve cryptography|elliptic curve techniques]].
 
A document published in 1997 by the Government Communications Headquarters ([[GCHQ]]), a British intelligence organization, revealed that cryptographers at GCHQ had anticipated several academic developments.<ref name="Wayner-1997">{{cite news|last=Wayner|first=Peter|url=https://www.nytimes.com/library/cyber/week/122497encrypt.html|title=British Document Outlines Early Encryption Discovery|date=24 December 1997|access-date=2015-03-26|newspaper=[[The New York Times]]|archive-date=27 June 2017|archive-url=https://web.archive.org/web/20170627155400/http://www.nytimes.com/library/cyber/week/122497encrypt.html|url-status=live}}</ref> Reportedly, around 1970, [[James H. Ellis]] had conceived the principles of asymmetric key cryptography. In 1973, [[Clifford Cocks]] invented a solution that was very similar in design rationale to RSA.<ref name="Wayner-1997" /><ref>{{Cite journal|url=http://www.fi.muni.cz/usr/matyas/lecture/paper2.pdf|first=Clifford|last=Cocks|title=A Note on 'Non-Secret Encryption'|journal=CESG Research Report|date=20 November 1973|access-date=22 July 2009|archive-date=27 July 2011|archive-url=https://web.archive.org/web/20110727161329/http://www.fi.muni.cz/usr/matyas/lecture/paper2.pdf|url-status=live}}</ref> In 1974, [[Malcolm J. Williamson]] is claimed to have developed the Diffie–Hellman key exchange.<ref>{{cite book | first=Simon | last=Singh | title=The Code Book | url=https://archive.org/details/codebookevolutio00sing | url-access=registration | publisher=[[Doubleday (publisher)|Doubleday]] | year=1999 | pages=[https://archive.org/details/codebookevolutio00sing/page/279 279–292]| isbn=9780385495318 }}</ref>
 
[[File:Private key signing.svg|thumb|250px|In this example the message is only signed and not encrypted.
1) Alice signs a message with her private key.
2) Bob can verify that Alice sent the message and that the message has not been modified.]]
Public-key cryptography is also used for implementing [[digital signature]] schemes. A digital signature is reminiscent of an ordinary signature; they both have the characteristic of being easy for a user to produce, but difficult for anyone else to [[forgery|forge]]. Digital signatures can also be permanently tied to the content of the message being signed; they cannot then be 'moved' from one document to another, for any attempt will be detectable. In digital signature schemes, there are two algorithms: one for ''signing'', in which a secret key is used to process the message (or a hash of the message, or both), and one for ''verification'', in which the matching public key is used with the message to check the validity of the signature. RSA and [[Digital Signature Algorithm|DSA]] are two of the most popular digital signature schemes. Digital signatures are central to the operation of [[public key infrastructure]]s and many network security schemes (e.g., [[Transport Layer Security|SSL/TLS]], many [[VPN]]s, etc.).<ref name="Schneier-1996" />
 
Public-key algorithms are most often based on the [[computational complexity theory|computational complexity]] of "hard" problems, often from [[number theory]]. For example, the hardness of RSA is related to the [[integer factorization]] problem, while Diffie–Hellman and DSA are related to the [[discrete logarithm]] problem. The security of [[elliptic curve cryptography]] is based on number theoretic problems involving [[elliptic curve]]s. Because of the difficulty of the underlying problems, most public-key algorithms involve operations such as [[modular arithmetic|modular]] multiplication and exponentiation, which are much more computationally expensive than the techniques used in most block ciphers, especially with typical key sizes. As a result, public-key cryptosystems are commonly [[hybrid cryptosystem]]s, in which a fast high-quality symmetric-key encryption algorithm is used for the message itself, while the relevant symmetric key is sent with the message, but encrypted using a public-key algorithm. Similarly, hybrid signature schemes are often used, in which a cryptographic hash function is computed, and only the resulting hash is digitally signed.<ref name="Menezes-1997" />
 
===Cryptographic hash functions===
Cryptographic hash functions are functions that take a variable-length input and return a fixed-length output, which can be used in, for example, a digital signature. For a hash function to be secure, it must be difficult to compute two inputs that hash to the same value ([[collision resistance]]) and to compute an input that hashes to a given output ([[Preimage attack|preimage resistance]]). [[MD4]] is a long-used hash function that is now broken; [[MD5]], a strengthened variant of MD4, is also widely used but broken in practice. The US [[National Security Agency]] developed the Secure Hash Algorithm series of MD5-like hash functions: SHA-0 was a flawed algorithm that the agency withdrew; [[SHA-1]] is widely deployed and more secure than MD5, but cryptanalysts have identified attacks against it; the [[SHA-2]] family improves on SHA-1, but is vulnerable to clashes as of 2011; and the US standards authority thought it "prudent" from a security perspective to develop a new standard to "significantly improve the robustness of [[National Institute of Standards and Technology|NIST]]'s overall hash algorithm toolkit."<ref name="Federal Register-2007" /> Thus, a [[NIST hash function competition|hash function design competition]] was meant to select a new U.S. national standard, to be called [[SHA-3]], by 2012. The competition ended on October 2, 2012, when the NIST announced that [[Keccak]] would be the new SHA-3 hash algorithm.<ref name="NIST-2012" /> Unlike block and stream ciphers that are invertible, cryptographic hash functions produce a hashed output that cannot be used to retrieve the original input data. Cryptographic hash functions are used to verify the authenticity of data retrieved from an untrusted source or to add a layer of security.
 
===Cryptanalysis===
{{Main|Cryptanalysis}}
[[File:Enigma Machine at NSA.jpg|thumb|alt=Enigma machine typewriter keypad over many rotors in a wood box|Variants of the [[Enigma machine]], used by Germany's military and civil authorities from the late 1920s through [[World War II]], implemented a complex electro-mechanical polyalphabetic [[cipher]]. [[Cryptanalysis of the Enigma|Breaking and reading of the Enigma cipher]] at Poland's [[Biuro Szyfrów|Cipher Bureau]], for 7 years before the war, and subsequent decryption at [[Bletchley Park]], was important to Allied victory.<ref name="Kahn-1967" />]]
The goal of cryptanalysis is to find some weakness or insecurity in a cryptographic scheme, thus permitting its subversion or evasion.
 
It is a common misconception that every encryption method can be broken. In connection with his WWII work at [[Bell Labs]], [[Claude Shannon]] proved that the [[one-time pad]] cipher is unbreakable, provided the key material is truly [[Statistical randomness|random]], never reused, kept secret from all possible attackers, and of equal or greater length than the message.<ref>{{Cite book |first1=Claude |last1=Shannon |first2=Warren |last2=Weaver |authorlink1=Claude Shannon |authorlink2=Warren Weaver |title=[[The Mathematical Theory of Communication]] |year=1949 |bibcode=1949mtc..book.....S }}</ref> Most [[cipher]]s, apart from the one-time pad, can be broken with enough computational effort by [[brute force attack]], but the amount of effort needed may be [[exponential time|exponentially]] dependent on the key size, as compared to the effort needed to make use of the cipher. In such cases, effective security could be achieved if it is proven that the effort required (i.e., "work factor", in Shannon's terms) is beyond the ability of any adversary. This means it must be shown that no efficient method (as opposed to the time-consuming brute force method) can be found to break the cipher. Since no such proof has been found to date, the one-time-pad remains the only theoretically unbreakable cipher. Although well-implemented one-time-pad encryption cannot be broken, traffic analysis is still possible.
 
There are a wide variety of cryptanalytic attacks, and they can be classified in any of several ways. A common distinction turns on what Eve (an attacker) knows and what capabilities are available. In a [[ciphertext-only attack]], Eve has access only to the ciphertext (good modern cryptosystems are usually effectively immune to ciphertext-only attacks). In a [[known-plaintext attack]], Eve has access to a ciphertext and its corresponding plaintext (or to many such pairs). In a [[chosen-plaintext attack]], Eve may choose a plaintext and learn its corresponding ciphertext (perhaps many times); an example is [[gardening (cryptanalysis)|gardening]], used by the British during WWII. In a [[chosen-ciphertext attack]], Eve may be able to ''choose'' ciphertexts and learn their corresponding plaintexts.<ref name="Menezes-1997" /> Finally in a [[Man-in-the-middle attack|man-in-the-middle]] attack Eve gets in between Alice (the sender) and Bob (the recipient), accesses and modifies the traffic and then forward it to the recipient.<ref>{{Cite web|url = http://www8.cs.umu.se/education/examina/Rapporter/MattiasEriksson.pdf|title = An Example of a Man-in-the-middle Attack Against Server Authenticated SSL-sessions|access-date = 13 October 2015|archive-date = 3 June 2016|archive-url = https://web.archive.org/web/20160603222024/http://www8.cs.umu.se/education/examina/Rapporter/MattiasEriksson.pdf|url-status = live}}</ref> Also important, often overwhelmingly so, are mistakes (generally in the design or use of one of the [[cryptographic protocol|protocols]] involved).
 
Cryptanalysis of symmetric-key ciphers typically involves looking for attacks against the block ciphers or stream ciphers that are more efficient than any attack that could be against a perfect cipher. For example, a simple brute force attack against DES requires one known plaintext and 2<sup>55</sup> decryptions, trying approximately half of the possible keys, to reach a point at which chances are better than even that the key sought will have been found. But this may not be enough assurance; a [[linear cryptanalysis]] attack against DES requires 2<sup>43</sup> known plaintexts (with their corresponding ciphertexts) and approximately 2<sup>43</sup> DES operations.<ref>{{Cite book|first=Pascal|last=Junod|title=Selected Areas in Cryptography |chapter=On the Complexity of Matsui's Attack |url=http://citeseer.ist.psu.edu/cache/papers/cs/22094/http:zSzzSzeprint.iacr.orgzSz2001zSz056.pdf/junod01complexity.pdf|volume=2259|pages=199–211|year=2001|doi=10.1007/3-540-45537-X_16|series=Lecture Notes in Computer Science|isbn=978-3-540-43066-7}}</ref> This is a considerable improvement over brute force attacks.
 
Public-key algorithms are based on the computational difficulty of various problems. The most famous of these are the difficulty of [[integer factorization]] of [[semiprime]]s and the difficulty of calculating [[discrete logarithm]]s, both of which are not yet proven to be solvable in [[P (complexity)|polynomial time]] ('''P''') using only a classical [[Turing completeness|Turing-complete]] computer. Much public-key cryptanalysis concerns designing algorithms in '''P''' that can solve these problems, or using other technologies, such as [[Quantum computing|quantum computers]]. For instance, the best-known algorithms for solving the [[elliptic curve cryptography|elliptic curve-based]] version of discrete logarithm are much more time-consuming than the best-known algorithms for factoring, at least for problems of more or less equivalent size. Thus, to achieve an equivalent strength of encryption, techniques that depend upon the difficulty of factoring large composite numbers, such as the RSA cryptosystem, require larger keys than elliptic curve techniques. For this reason, public-key cryptosystems based on elliptic curves have become popular since their invention in the mid-1990s.
 
While pure cryptanalysis uses weaknesses in the algorithms themselves, other attacks on cryptosystems are based on actual use of the algorithms in real devices, and are called ''[[side-channel attack]]s''. If a cryptanalyst has access to, for example, the amount of time the device took to encrypt a number of plaintexts or report an error in a password or PIN character, they may be able to use a [[timing attack]] to break a cipher that is otherwise resistant to analysis. An attacker might also study the pattern and length of messages to derive valuable information; this is known as [[traffic analysis]]<ref>{{Cite journal|first1=Dawn|last1=Song|first2=David A.|last2=Wagner|author-link2=David A. Wagner|first3=Xuqing|last3=Tian|url=http://citeseer.ist.psu.edu/cache/papers/cs/22094/http:zSzzSzeprint.iacr.orgzSz2001zSz056.pdf/junod01complexity.pdf|title=Timing Analysis of Keystrokes and Timing Attacks on SSH|journal=Tenth USENIX Security Symposium|year=2001}}</ref> and can be quite useful to an alert adversary. Poor administration of a cryptosystem, such as permitting too short keys, will make any system vulnerable, regardless of other virtues. [[social engineering (security)|Social engineering]] and other attacks against humans (e.g., bribery, [[extortion]], [[blackmail]], espionage, [[rubber-hose cryptanalysis]] or torture) are usually employed due to being more cost-effective and feasible to perform in a reasonable amount of time compared to pure cryptanalysis by a high margin.
 
===Cryptographic primitives===
Much of the theoretical work in cryptography concerns [[cryptographic primitive|cryptographic ''primitives'']]—algorithms with basic cryptographic properties—and their relationship to other cryptographic problems. More complicated cryptographic tools are then built from these basic primitives. These primitives provide fundamental properties, which are used to develop more complex tools called ''cryptosystems'' or ''cryptographic protocols'', which guarantee one or more high-level security properties. Note, however, that the distinction between cryptographic ''primitives'' and cryptosystems, is quite arbitrary; for example, the RSA algorithm is sometimes considered a cryptosystem, and sometimes a primitive. Typical examples of cryptographic primitives include [[pseudorandom function]]s, [[one-way function]]s, etc.
 
===Cryptosystems===
{{main|List of cryptosystems}}
One or more cryptographic primitives are often used to develop a more complex algorithm, called a cryptographic system, or ''cryptosystem''. Cryptosystems (e.g., [[ElGamal encryption|El-Gamal encryption]]) are designed to provide particular functionality (e.g., public key encryption) while guaranteeing certain security properties (e.g., [[Chosen-plaintext attack|chosen-plaintext attack (CPA)]] security in the [[random oracle model]]). Cryptosystems use the properties of the underlying cryptographic primitives to support the system's security properties. As the distinction between primitives and cryptosystems is somewhat arbitrary, a sophisticated cryptosystem can be derived from a combination of several more primitive cryptosystems. In many cases, the cryptosystem's structure involves back and forth communication among two or more parties in space (e.g., between the sender of a secure message and its receiver) or across time (e.g., cryptographically protected [[backup]] data). Such cryptosystems are sometimes called ''[[cryptographic protocol]]s''.
 
Some widely known cryptosystems include RSA, [[Schnorr signature]], [[ElGamal encryption]], and [[Pretty Good Privacy]] (PGP). More complex cryptosystems include [[Digital currency|electronic cash]]<ref>{{Cite book|first=S. |last=Brands |title=Advances in Cryptology – CRYPTO' 93 |url=http://ftp.se.kde.org/pub/security/docs/ecash/crypto93.ps.gz |chapter=Untraceable Off-line Cash in Wallet with Observers |volume=773 |pages=302–318 |year=1994 |url-status=dead |archive-url=https://web.archive.org/web/20110726214409/http://ftp.se.kde.org/pub/security/docs/ecash/crypto93.ps.gz |archive-date=26 July 2011 |doi=10.1007/3-540-48329-2_26 |series=Lecture Notes in Computer Science |isbn=978-3-540-57766-9}}</ref> systems, [[signcryption]] systems, etc. Some more 'theoretical'{{clarify |date=December 2018 |reason= What's "theoretical" about it? They are implementable and proven to work, unlike theories which are partially proven conjecture.}} cryptosystems include [[interactive proof system]]s,<ref>{{Cite book|first=László|last=Babai|title=Proceedings of the seventeenth annual ACM symposium on Theory of computing – STOC '85 |chapter=Trading group theory for randomness|pages=421–429|year=1985|doi=10.1145/22145.22192|doi-access=free|isbn=978-0-89791-151-1|citeseerx=10.1.1.130.3397|s2cid=17981195}}</ref> (like [[zero-knowledge proof]]s)<ref>{{Cite journal|author-link=Shafi Goldwasser|first1=S.|last1=Goldwasser|author-link2=Silvio Micali|first2=S.|last2=Micali|author-link3=Charles Rackoff|first3=C.|last3=Rackoff|title=The Knowledge Complexity of Interactive Proof Systems|journal=[[SIAM Journal on Computing]]|volume=18|number=1|pages=186–208|year=1989|doi=10.1137/0218012|citeseerx=10.1.1.397.4002}}</ref> and systems for [[secret sharing]].<ref>{{Cite book|author-link=George Blakley|first=G.|last=Blakley |title=1979 International Workshop on Managing Requirements Knowledge (MARK) |chapter=Safeguarding cryptographic keys |volume=48|pages=313–317|date=June 1979|doi=10.1109/MARK.1979.8817296|isbn=978-1-5090-3181-8 }}</ref><ref>{{Cite journal|first=A.|last=Shamir|title=How to share a secret|journal=Communications of the ACM|volume=22|issue=11|pages=612–613|year=1979|doi=10.1145/359168.359176|s2cid=16321225|doi-access=free}}</ref>
 
=== Lightweight cryptography ===
Lightweight cryptography (LWC) concerns cryptographic algorithms developed for a strictly constrained environment. The growth of [[Internet of things|Internet of Things (IoT)]] has spiked research into the development of lightweight algorithms that are better suited for the environment. An IoT environment requires strict constraints on power consumption, processing power, and security.<ref>{{Cite book|last1=Gunathilake|first1=Nilupulee A.|last2=Al-Dubai|first2=Ahmed|last3=Buchana|first3=William J.|title=2020 16th International Conference on Network and Service Management (CNSM) |chapter=Recent Advances and Trends in Lightweight Cryptography for IoT Security |date=2020-11-02|chapter-url=https://ieeexplore.ieee.org/document/9269083|___location=Izmir, Turkey|publisher=IEEE|pages=1–5|doi=10.23919/CNSM50824.2020.9269083|isbn=978-3-903176-31-7|s2cid=227277538|url=https://napier-surface.worktribe.com/2746967/1/Recent%20Advances%20and%20Trends%20in%20Lightweight%20Cryptography%20for%20IoT%20Security |access-date=24 April 2021|archive-date=24 April 2021|archive-url=https://web.archive.org/web/20210424034813/https://ieeexplore.ieee.org/document/9269083/|url-status=live}}</ref> Algorithms such as PRESENT, [[Advanced Encryption Standard|AES]], and [[Speck (cipher)|SPECK]] are examples of the many LWC algorithms that have been developed to achieve the standard set by the [[National Institute of Standards and Technology]].<ref>{{Cite journal|last1=Thakor|first1=Vishal A.|last2=Razzaque|first2=Mohammad Abdur|last3=Khandaker|first3=Muhammad R. A.|date=2021|title=Lightweight Cryptography Algorithms for Resource-Constrained IoT Devices: A Review, Comparison and Research Opportunities|journal=IEEE Access|volume=9|pages=28177–28193|doi=10.1109/ACCESS.2021.3052867|bibcode=2021IEEEA...928177T |s2cid=232042514|issn=2169-3536|doi-access=free}}</ref>
 
== Applications ==
{{Expand section|date=December 2021}}<!-- I added this section per [[User:Nageh]]'s feedback at [[Wikipedia:Featured_article_review/Cryptography/archive1]]. ~Duckmather -->
{{Main category|Applications of cryptography}}
 
Cryptography is widely used on the internet to help protect user-data and prevent eavesdropping. To ensure secrecy during transmission, many systems use private key cryptography to protect transmitted information. With public-key systems, one can maintain secrecy without a master key or a large number of keys.<ref>{{Cite web|last=Cohen|first=Fred|date=1995|title=2.4 – Applications of Cryptography|url=http://all.net/edu/curr/ip/Chap2-4.html|url-status=live|archive-url=https://web.archive.org/web/19990824044441/http://all.net/edu/curr/ip/Chap2-4.html|archive-date=24 August 1999|access-date=21 December 2021|website=all.net}}</ref> But, some algorithms like [[BitLocker]] and [[VeraCrypt]] are generally not private-public key cryptography. For example, Veracrypt uses a password hash to generate the single private key. However, it can be configured to run in public-private key systems. The [[C++]] opensource encryption library [[OpenSSL]] provides [[Free and open-source software|free and opensource]] encryption software and tools. The most commonly used encryption cipher suit is [[Advanced Encryption Standard|AES]],<ref>{{Cite web |title=4 Common Encryption Methods to Shield Sensitive Data From Prying Eyes |url=https://www.getapp.com/resources/common-encryption-methods/ |access-date=2022-05-14 |website=GetApp |language=en |archive-date=14 May 2022 |archive-url=https://web.archive.org/web/20220514061045/https://www.getapp.com/resources/common-encryption-methods/ |url-status=live }}</ref> as it has hardware acceleration for all [[x86]] based processors that has [[AES instruction set|AES-NI]]. A close contender is [[ChaCha20-Poly1305]], which is a [[stream cipher]], however it is commonly used for mobile devices as they are [[ARM architecture family|ARM]] based which does not feature AES-NI instruction set extension.
 
=== Cybersecurity ===
{{Main|Cybersecurity}}
Cryptography can be used to secure communications by encrypting them. Websites use encryption via [[HTTPS]].<ref name="Chamberlain-2017">{{Cite web|last=Chamberlain|first=Austin|date=12 March 2017|title=Applications of Cryptography {{!}} UCL Risky Business|url=https://blogs.ucl.ac.uk/infosec/2017/03/12/applications-of-cryptography/|url-status=live|archive-url=https://web.archive.org/web/20180226185448/https://blogs.ucl.ac.uk/infosec/2017/03/12/applications-of-cryptography/|archive-date=26 February 2018|access-date=21 December 2021|website=blogs.ucl.ac.uk}}</ref> "End-to-end" encryption, where only sender and receiver can read messages, is implemented for email in [[Pretty Good Privacy]] and for secure messaging in general in [[WhatsApp]], [[Signal (messaging app)|Signal]] and [[Telegram (software)|Telegram]].<ref name="Chamberlain-2017" />
 
Operating systems use encryption to keep passwords secret, conceal parts of the system, and ensure that software updates are truly from the system maker.<ref name="Chamberlain-2017" /> Instead of storing plaintext passwords, computer systems store hashes thereof; then, when a user logs in, the system passes the given password through a cryptographic hash function and compares it to the hashed value on file. In this manner, neither the system nor an attacker has at any point access to the password in plaintext.<ref name="Chamberlain-2017" />
 
Encryption is sometimes used to encrypt one's entire drive. For example, [[University College London]] has implemented [[BitLocker]] (a program by Microsoft) to render drive data opaque without users logging in.<ref name="Chamberlain-2017" />
 
=== Cryptocurrencies and cryptoeconomics ===
Cryptographic techniques enable [[cryptocurrency]] technologies, such as [[Distributed Ledger Technology|distributed ledger technologies]] (e.g., [[blockchain]]s), which finance [[cryptoeconomics]] applications such as [[Decentralized finance|decentralized finance (DeFi)]]. Key cryptographic techniques that enable cryptocurrencies and cryptoeconomics include, but are not limited to: [[cryptographic keys]], cryptographic hash function, [[Public key encryption|asymmetric (public key) encryption]], [[Multi-factor authentication|Multi-Factor Authentication (MFA)]], [[End-to-end encryption|End-to-End Encryption (E2EE)]], and [[Zero-knowledge proof|Zero Knowledge Proofs (ZKP)]].
 
=== Quantum computing cybersecurity ===
Estimates suggest that a [[quantum computer]] could reduce the effort required to break today’s strongest [[RSA (cryptosystem)|RSA]] or [[Elliptic-curve cryptography|elliptic-curve]] keys from millennia to mere seconds, rendering current protocols (such as the versions of [[Transport Layer Security|TLS]] that rely on those keys) insecure.<ref>{{Cite web
|title=Cryptography use cases: From secure communication to data security
|url=https://www.ibm.com/think/topics/cryptography-use-cases
|website=IBM
|date=17 January 2024
|access-date=1 August 2025
}}</ref>
 
To mitigate this “quantum threat”, researchers are developing [[Post-quantum cryptography|quantum-resistant algorithms]] whose security rests on problems believed to remain hard for both classical and quantum computers.<ref>{{Cite web
|title=Prepping For Post-Quantum Cryptography
|url=https://spectrum.ieee.org/post-quantum-cryptography-2667758178
|website=IEEE Spectrum
|date=16 April 2024
|access-date=1 August 2025
}}</ref>
 
==Legal issues==
{{See also|Cryptography laws in different nations}}
 
===Prohibitions===
Cryptography has long been of interest to intelligence gathering and [[law enforcement agency|law enforcement agencies]].<ref name="Ranger-2015" /> Secret communications may be criminal or even [[treason]]ous.{{citation needed|date=April 2016}}<!--it is not clear how secure communication might be construed as treason--> Because of its facilitation of [[privacy]], and the diminution of privacy attendant on its prohibition, cryptography is also of considerable interest to civil rights supporters. Accordingly, there has been a history of controversial legal issues surrounding cryptography, especially since the advent of inexpensive computers has made widespread access to high-quality cryptography possible.
 
In some countries, even the domestic use of cryptography is, or has been, restricted. Until 1999, France significantly restricted the use of cryptography domestically, though it has since relaxed many of these rules. In [[People's Republic of China|China]] and [[Islamic Republic of Iran|Iran]], a license is still required to use cryptography.<ref name="Crypto Law Survey-2013">{{cite web|url=http://www.cryptolaw.org/cls2.htm|title=Overview per country|website=Crypto Law Survey|date=February 2013|access-date=26 March 2015|archive-date=1 January 2013|archive-url=https://web.archive.org/web/20130101062615/http://www.cryptolaw.org/cls2.htm|url-status=live}}</ref> Many countries have tight restrictions on the use of cryptography. Among the more restrictive are laws in [[Belarus]], [[Kazakhstan]], [[Mongolia]], [[Pakistan]], Singapore, [[Tunisia]], and [[Vietnam]].<ref>{{cite web|url=http://www.emc.com/emc-plus/rsa-labs/standards-initiatives/cryptographic-policies-countries.htm|title=6.5.1 What Are the Cryptographic Policies of Some Countries?|publisher=[[RSA Laboratories]]|access-date=26 March 2015|archive-date=16 April 2015|archive-url=https://web.archive.org/web/20150416025558/http://www.emc.com/emc-plus/rsa-labs/standards-initiatives/cryptographic-policies-countries.htm|url-status=live}}</ref>
 
In the United States, cryptography is legal for domestic use, but there has been much conflict over legal issues related to cryptography.<ref name="Ranger-2015" /> One particularly important issue has been the [[export of cryptography]] and cryptographic software and hardware. Probably because of the importance of cryptanalysis in [[World War II]] and an expectation that cryptography would continue to be important for national security, many Western governments have, at some point, strictly regulated export of cryptography. After World War II, it was illegal in the US to sell or distribute encryption technology overseas; in fact, encryption was designated as auxiliary military equipment and put on the [[United States Munitions List]].<ref>{{Cite news|title=Cryptography & Speech|last=Rosenoer|first=Jonathan|website=CyberLaw|date=1995 |url=http://www.cyberlaw.com/cylw1095.html |access-date=23 June 2006 |archive-url=https://web.archive.org/web/20051201184530/http://www.cyberlaw.com/cylw1095.html |archive-date=1 December 2005 |url-status=dead}}</ref> Until the development of the personal computer, asymmetric key algorithms (i.e., public key techniques), and the Internet, this was not especially problematic. However, as the Internet grew and computers became more widely available, high-quality encryption techniques became well known around the globe.
 
===Export controls===
{{Main|Export of cryptography}}
In the 1990s, there were several challenges to US export regulation of cryptography. After the [[source code]] for [[Philip Zimmermann]]'s [[Pretty Good Privacy]] (PGP) encryption program found its way onto the Internet in June 1991, a complaint by [[RSA Security]] (then called RSA Data Security, Inc.) resulted in a lengthy criminal investigation of Zimmermann by the US Customs Service and the [[Federal Bureau of Investigation|FBI]], though no charges were ever filed.<ref>{{Cite web|url=http://www.ieee-security.org/Cipher/Newsbriefs/1996/960214.zimmerman.html|title=Case Closed on Zimmermann PGP Investigation|website=[[IEEE Computer Society]]'s Technical Committee on Security and Privacy|date=14 February 1996|access-date=26 March 2015|archive-date=11 June 2010|archive-url=https://web.archive.org/web/20100611230953/http://www.ieee-security.org/Cipher/Newsbriefs/1996/960214.zimmerman.html|url-status=live}}</ref><ref name="Levy-2001">{{cite book |last=Levy |first=Steven |author-link=Steven Levy |title=Crypto: How the Code Rebels Beat the Government – Saving Privacy in the Digital Age |publisher=[[Penguin Books]] |year=2001 |isbn=978-0-14-024432-8 |page=56 |oclc=244148644}}</ref> [[Daniel J. Bernstein]], then a graduate student at [[UC Berkeley]], brought a lawsuit against the US government challenging some aspects of the restrictions based on [[First Amendment|free speech]] grounds. The 1995 case ''[[Bernstein v. United States]]'' ultimately resulted in a 1999 decision that printed source code for cryptographic algorithms and systems was protected as [[freedom of speech|free speech]] by the United States Constitution.<ref>{{Cite web|title=Bernstein v USDOJ|url=http://www.epic.org/crypto/export_controls/bernstein_decision_9_cir.html|publisher=[[United States Court of Appeals for the Ninth Circuit]]|website=[[Electronic Privacy Information Center]]|date=6 May 1999|access-date=26 March 2015|archive-date=13 August 2009|archive-url=https://web.archive.org/web/20090813015456/http://epic.org/crypto/export_controls/bernstein_decision_9_cir.html|url-status=live}}</ref>
 
In 1996, thirty-nine countries signed the [[Wassenaar Arrangement]], an arms control treaty that deals with the export of arms and "dual-use" technologies such as cryptography. The treaty stipulated that the use of cryptography with short key-lengths (56-bit for symmetric encryption, 512-bit for RSA) would no longer be export-controlled.<ref>{{cite web|url=https://www.bis.doc.gov/index.php/documents/regulations-docs/445-category-5-part-2-information-security/file|format=PDF|title=Dual-use List – Category 5 – Part 2 – "Information Security"|website=[[Wassenaar Arrangement]]|access-date=26 March 2015|archive-date=26 September 2018|archive-url=https://web.archive.org/web/20180926085950/https://www.bis.doc.gov/index.php/documents/regulations-docs/445-category-5-part-2-information-security/file|url-status=live}}</ref> Cryptography exports from the US became less strictly regulated as a consequence of a major relaxation in 2000;<ref>{{Cite web|title=.4 United States Cryptography Export/Import Laws|website=[[RSA Laboratories]]|url=http://www.emc.com/emc-plus/rsa-labs/standards-initiatives/united-states-cryptography-export-import.htm|access-date=26 March 2015|archive-date=31 March 2015|archive-url=https://web.archive.org/web/20150331004104/http://www.emc.com/emc-plus/rsa-labs/standards-initiatives/united-states-cryptography-export-import.htm|url-status=live}}</ref> there are no longer very many restrictions on key sizes in US-[[Export of cryptography|exported]] mass-market software. Since this relaxation in US export restrictions, and because most personal computers connected to the Internet include US-sourced [[web browser]]s such as [[Firefox]] or [[Internet Explorer]], almost every Internet user worldwide has potential access to quality cryptography via their browsers (e.g., via [[Transport Layer Security]]). The [[Mozilla Thunderbird]] and [[Microsoft Outlook]] [[E-mail client]] programs similarly can transmit and receive emails via TLS, and can send and receive email encrypted with [[S/MIME]]. Many Internet users do not realize that their basic application software contains such extensive [[cryptosystem]]s. These browsers and email programs are so ubiquitous that even governments whose intent is to regulate civilian use of cryptography generally do not find it practical to do much to control distribution or use of cryptography of this quality, so even when such laws are in force, actual enforcement is often effectively impossible.{{citation needed|date=August 2013}}
 
===NSA involvement===
[[File:National Security Agency headquarters, Fort Meade, Maryland.jpg|thumb|right|NSA headquarters in Fort Meade, Maryland]]
{{See also|Clipper chip}}
Another contentious issue connected to cryptography in the United States is the influence of the [[National Security Agency]] on cipher development and policy.<ref name="Ranger-2015" /> The NSA was involved with the design of [[Data Encryption Standard|DES]] during its development at [[IBM]] and its consideration by the [[National Bureau of Standards]] as a possible Federal Standard for cryptography.<ref>{{Cite web|url=http://www.schneier.com/crypto-gram-0006.html#DES|title=The Data Encryption Standard (DES)|author-link=Bruce Schneier|first=Bruce|last=Schneier|website=Crypto-Gram|date=15 June 2000|access-date=26 March 2015|archive-date=2 January 2010|archive-url=https://web.archive.org/web/20100102025613/http://schneier.com/crypto-gram-0006.html#DES|url-status=live}}</ref> DES was designed to be resistant to [[differential cryptanalysis]],<ref>{{cite journal| last = Coppersmith| first = D.| date = May 1994| title = The Data Encryption Standard (DES) and its strength against attacks| journal = IBM Journal of Research and Development| volume = 38| issue = 3| pages = 243–250| url = http://domino.watson.ibm.com/tchjr/journalindex.nsf/0/94f78816c77fc77885256bfa0067fb98?OpenDocument| format = PDF| doi = 10.1147/rd.383.0243| access-date = 26 March 2015| archive-date = 4 March 2016| archive-url = https://web.archive.org/web/20160304061501/http://domino.watson.ibm.com/tchjr/journalindex.nsf/0/94f78816c77fc77885256bfa0067fb98?OpenDocument| url-status = live}}</ref> a powerful and general cryptanalytic technique known to the NSA and IBM, that became publicly known only when it was rediscovered in the late 1980s.<ref>{{Cite journal|author-link=Eli Biham|first1=E.|last1=Biham|first2=A.|last2=Shamir|title=Differential cryptanalysis of DES-like cryptosystems|journal=Journal of Cryptology|volume=4|number=1|pages=3–72|year=1991|doi=10.1007/bf00630563|s2cid=206783462}}</ref> According to [[Steven Levy]], IBM discovered differential cryptanalysis,<ref name="Levy-2001" /> but kept the technique secret at the NSA's request. The technique became publicly known only when Biham and Shamir re-discovered and announced it some years later. The entire affair illustrates the difficulty of determining what resources and knowledge an attacker might actually have.
 
Another instance of the NSA's involvement was the 1993 [[Clipper chip]] affair, an encryption microchip intended to be part of the [[Capstone (cryptography)|Capstone]] cryptography-control initiative. Clipper was widely criticized by cryptographers for two reasons. The cipher algorithm (called [[Skipjack (cipher)|Skipjack]]) was then classified (declassified in 1998, long after the Clipper initiative lapsed). The classified cipher caused concerns that the NSA had deliberately made the cipher weak to assist its intelligence efforts. The whole initiative was also criticized based on its violation of [[Kerckhoffs's Principle]], as the scheme included a special [[key escrow|escrow key]] held by the government for use by law enforcement (i.e. [[Telephone tapping|wiretapping]]).<ref name="Levy-2001" />
 
===Digital rights management===
{{Main|Digital rights management}}
Cryptography is central to digital rights management (DRM), a group of techniques for technologically controlling use of [[copyright]]ed material, being widely implemented and deployed at the behest of some copyright holders. In 1998, U.S. President [[Bill Clinton]] signed the [[Digital Millennium Copyright Act]] (DMCA), which criminalized all production, dissemination, and use of certain cryptanalytic techniques and technology (now known or later discovered); specifically, those that could be used to circumvent DRM technological schemes.<ref>{{cite web |url=http://www.copyright.gov/legislation/dmca.pdf |title=The Digital Millennium Copyright Act of 1998 |website=[[United States Copyright Office]] |access-date=26 March 2015 |archive-date=8 August 2007 |archive-url=https://web.archive.org/web/20070808232655/http://www.copyright.gov/legislation/dmca.pdf |url-status=live }}</ref> This had a noticeable impact on the cryptography research community since an argument can be made that any cryptanalytic research violated the DMCA. Similar statutes have since been enacted in several countries and regions, including the implementation in the [[Directive on the harmonisation of certain aspects of copyright and related rights in the information society|EU Copyright Directive]]. Similar restrictions are called for by treaties signed by [[World Intellectual Property Organization]] member-states.
 
The [[United States Department of Justice]] and [[Federal Bureau of Investigation|FBI]] have not enforced the DMCA as rigorously as had been feared by some, but the law, nonetheless, remains a controversial one. [[Niels Ferguson]], a well-respected cryptography researcher, has publicly stated that he will not release some of his research into an [[Intel Corporation|Intel]] security design for fear of prosecution under the DMCA.<ref>{{Cite web|title=Censorship in action: why I don't publish my HDCP results|last=Ferguson|first=Niels|date=15 August 2001|url=http://www.macfergus.com/niels/dmca/cia.html |access-date=16 February 2009 |archive-url=https://web.archive.org/web/20011201184919/http://www.macfergus.com/niels/dmca/cia.html |archive-date=1 December 2001 |url-status=dead}}</ref> Cryptologist [[Bruce Schneier]] has argued that the DMCA encourages [[vendor lock-in]], while inhibiting actual measures toward cyber-security.<ref>{{cite web |url=https://www.schneier.com/essays/archives/2001/08/arrest_of_computer_r.html |title=Arrest of Computer Researcher Is Arrest of First Amendment Rights |last=Schneier |first=Bruce |author-link=Bruce Schneier |publisher=InternetWeek |date=2001-08-06 |access-date=2017-03-07 |archive-date=7 March 2017 |archive-url=https://web.archive.org/web/20170307204724/https://www.schneier.com/essays/archives/2001/08/arrest_of_computer_r.html |url-status=live }}</ref> Both [[Alan Cox (computer programmer)|Alan Cox]] (longtime [[Linux kernel]] developer) and [[Edward Felten]] (and some of his students at Princeton) have encountered problems related to the Act. [[Dmitry Sklyarov]] was arrested during a visit to the US from Russia, and jailed for five months pending trial for alleged violations of the DMCA arising from work he had done in Russia, where the work was legal. In 2007, the cryptographic keys responsible for [[Blu-ray]] and [[HD DVD]] content scrambling were [[AACS encryption key controversy|discovered and released onto the Internet]]. In both cases, the [[MPAA|Motion Picture Association of America]] sent out numerous DMCA takedown notices, and there was a massive Internet backlash<ref name="Doctorow-2007">{{cite web|url=http://boingboing.net/2007/05/02/digg-users-revolt-ov.html|title=Digg users revolt over AACS key|access-date=26 March 2015|date=2 May 2007|first=Cory|last=Doctorow|website=[[Boing Boing]]|archive-date=12 May 2015|archive-url=https://web.archive.org/web/20150512030538/http://boingboing.net/2007/05/02/digg-users-revolt-ov.html|url-status=live}}</ref> triggered by the perceived impact of such notices on [[fair use]] and [[free speech]].
 
===Forced disclosure of encryption keys===
{{Main|Key disclosure law}}
In the United Kingdom, the [[Regulation of Investigatory Powers Act 2000|Regulation of Investigatory Powers Act]] gives UK police the powers to force suspects to decrypt files or hand over passwords that protect encryption keys. Failure to comply is an offense in its own right, punishable on conviction by a two-year jail sentence or up to five years in cases involving national security.<ref name="PC World-2007">{{cite web |url=http://www.pcworld.com/article/137881/uk_data_encryption_disclosure_law_takes_effect.html |title=UK Data Encryption Disclosure Law Takes Effect |website=[[PC World]] |date=1 October 2007 |access-date=26 March 2015 |archive-date=20 January 2012 |archive-url=https://web.archive.org/web/20120120135135/http://www.pcworld.com/article/137881/uk_data_encryption_disclosure_law_takes_effect.html |url-status=dead }}</ref> Successful prosecutions have occurred under the Act; the first, in 2009,<ref>{{cite web|url=https://www.theregister.co.uk/2009/08/11/ripa_iii_figures/|title=Two convicted for refusal to decrypt data|first=Christopher|last=Williams|website=[[The Register]]|date=11 August 2009|access-date=26 March 2015|archive-date=17 March 2015|archive-url=https://web.archive.org/web/20150317130319/http://www.theregister.co.uk/2009/08/11/ripa_iii_figures/|url-status=live}}</ref> resulted in a term of 13 months' imprisonment.<ref>{{cite web |url=https://www.theregister.co.uk/2009/11/24/ripa_jfl/ |title=UK jails schizophrenic for refusal to decrypt files |first=Christopher |last=Williams |website=[[The Register]] |date=24 November 2009 |access-date=26 March 2015 |archive-date=26 March 2015 |archive-url=https://web.archive.org/web/20150326053131/http://www.theregister.co.uk/2009/11/24/ripa_jfl/ |url-status=live }}</ref> Similar forced disclosure laws in Australia, Finland, France, and India compel individual suspects under investigation to hand over encryption keys or passwords during a criminal investigation.
 
In the United States, the federal criminal case of ''[[United States v. Fricosu]]'' addressed whether a search warrant can compel a person to reveal an [[encryption]] [[passphrase]] or password.<ref>{{cite news |url=http://www.denverpost.com/news/ci_19669803 |title=Password case reframes Fifth Amendment rights in context of digital world |newspaper=[[The Denver Post]] |date=January 4, 2012 |first=John |last=Ingold |access-date=26 March 2015 |archive-date=2 April 2015 |archive-url=https://web.archive.org/web/20150402121718/http://www.denverpost.com/news/ci_19669803 |url-status=live }}</ref> The [[Electronic Frontier Foundation]] (EFF) argued that this is a violation of the protection from self-incrimination given by the [[Fifth Amendment to the United States Constitution|Fifth Amendment]].<ref>{{cite web |last=Leyden |first=John |url=https://www.theregister.co.uk/2011/07/13/eff_piles_in_against_forced_decryption/ |title=US court test for rights not to hand over crypto keys |website=[[The Register]] |date=13 July 2011 |access-date=26 March 2015 |archive-date=24 October 2014 |archive-url=https://web.archive.org/web/20141024034741/http://www.theregister.co.uk/2011/07/13/eff_piles_in_against_forced_decryption/ |url-status=live }}</ref> In 2012, the court ruled that under the [[All Writs Act]], the defendant was required to produce an unencrypted hard drive for the court.<ref>{{Cite web|title=Order Granting Application under the All Writs Act Requiring Defendant Fricosu to Assist in the Execution of Previously Issued Search Warrants|publisher=[[United States District Court for the District of Colorado]]|url=https://www.wired.com/images_blogs/threatlevel/2012/01/decrypt.pdf|access-date=26 March 2015|archive-date=9 June 2021|archive-url=https://web.archive.org/web/20210609162701/https://www.wired.com/images_blogs/threatlevel/2012/01/decrypt.pdf|url-status=live}}</ref>
 
In many jurisdictions, the legal status of forced disclosure remains unclear.
 
The 2016 [[FBI–Apple encryption dispute]] concerns the ability of courts in the United States to compel manufacturers' assistance in unlocking cell phones whose contents are cryptographically protected.
 
As a potential counter-measure to forced disclosure some cryptographic software supports [[plausible deniability]], where the encrypted data is indistinguishable from unused random data (for example such as that of a [[Data remanence|drive which has been securely wiped]]).
 
==See also==
<!-- Please A-Z -->
* [[Collision attack]]
* {{annotated link|Comparison of cryptography libraries}}
* {{annotated link|Cryptovirology}}
* {{annotated link|Crypto Wars}}
* {{annotated link|Encyclopedia of Cryptography and Security}}
* {{annotated link|Global surveillance}}
* {{Annotated link|Indistinguishability obfuscation}}
* {{annotated link|Information theory}}
* {{annotated link|Outline of cryptography}}
** {{annotated link|List of cryptographers}}
** {{annotated link|List of multiple discoveries#20th century|List of multiple discoveries}}
** [[List of free and open-source software packages#Cypherpunk software|List of open-source Cypherpunk software]]
** {{annotated link|List of unsolved problems in computer science}}
* {{annotated link|Pre-shared key}}
* [[Secure cryptoprocessor]]
* {{annotated link|Strong cryptography}}
* {{annotated link|Syllabical and Steganographical Table}} – first cryptography chart
* [[World Wide Web Consortium]]'s {{annotated link|Web Cryptography API}}
 
==References==
{{reflist}}
 
==Further reading==
{{further|Books on cryptography}}
{{Refbegin|30em}}
* {{cite book | last1 = Arbib | first1 = Jonathan | last2 = Dwyer | first2 = John | title = Discrete Mathematics for Cryptography | publisher = Algana Publishing | edition = | date = 2011 | isbn = 978-1-907934-01-8 }}
* {{cite book | author=Becket, B | title=Introduction to Cryptology | publisher=Blackwell Scientific Publications | year=1988 | isbn=978-0-632-01836-9 | oclc=16832704}} Excellent coverage of many classical ciphers and cryptography concepts and of the "modern" DES and RSA systems.
* {{Cite book |url=http://www.cryptool.org/download/CrypToolScript-en.pdf |first=Bernhard |last=Esslinger |display-authors=etal |edition=10th |title=The CrypTool Script |access-date=23 December 2013 |archive-date=22 July 2011 |archive-url=https://web.archive.org/web/20110722183013/http://www.cryptool.org/download/CrypToolScript-en.pdf}} [[CrypTool]] is the most widespread e-learning program about cryptography and cryptanalysis, open source.
* ''In Code: A Mathematical Journey'' by [[Sarah Flannery]] (with David Flannery). Popular account of Sarah's award-winning project on public-key cryptography, co-written with her father.
* [[James Gannon (author)|James Gannon]], ''Stealing Secrets, Telling Lies: How Spies and Codebreakers Helped Shape the Twentieth Century'', Washington, D.C., Brassey's, 2001, {{isbn|1-57488-367-4}}.
* [[Oded Goldreich]], [http://www.wisdom.weizmann.ac.il/~oded/foc-book.html ''Foundations of Cryptography''] {{Webarchive|url=https://web.archive.org/web/20160809044453/http://www.wisdom.weizmann.ac.il/~oded/PSBookFrag/part2N.ps |date=9 August 2016 }}, in two volumes, Cambridge University Press, 2001 and 2004.
* ''Alvin's Secret Code'' by [[Clifford B. Hicks]] (children's novel that introduces some basic cryptography and cryptanalysis).
* ''[http://www.cs.umd.edu/~jkatz/imc.html Introduction to Modern Cryptography] {{Webarchive|url=https://web.archive.org/web/20091016160136/http://www.cs.umd.edu/~jkatz/imc.html |date=16 October 2009 }}'' by Jonathan Katz and Yehuda Lindell.
* Ibrahim A. Al-Kadi, "The Origins of Cryptology: the Arab Contributions," Cryptologia, vol. 16, no. 2 (April 1992), pp.&nbsp;97–126.
* [https://web.archive.org/web/20060709111152/http://www.crypto.rub.de/en_paar.html Christof Paar], Jan Pelzl, [http://www.cryptography-textbook.com/ ''Understanding Cryptography, A Textbook for Students and Practitioners''.] {{Webarchive|url=https://web.archive.org/web/20201031190651/http://cryptography-textbook.com/ |date=31 October 2020 }} Springer, 2009. (Slides, online cryptography lectures and other information are available on the companion web site.) Very accessible introduction to practical cryptography for non-mathematicians.
* {{cite web|url=http://www.mpepil.com/|title=Max Planck Encyclopedia of Public International Law|access-date=15 December 2021|archive-date=1 May 2018|archive-url=https://web.archive.org/web/20180501072701/http://www.mpepil.com/|url-status=live}}, giving an overview of international law issues regarding cryptography.
* ''Introduction to Modern Cryptography'' by [[Phillip Rogaway]] and [[Mihir Bellare]], a mathematical introduction to theoretical cryptography including reduction-based security proofs. [http://www.cs.ucdavis.edu/~rogaway/classes/227/spring05/book/main.pdf PDF download] {{Webarchive|url=https://web.archive.org/web/20090924102944/http://www.cs.ucdavis.edu/~rogaway/classes/227/spring05/book/main.pdf |date=24 September 2009 }}.
* {{cite book|last=Stallings |first=William |author-link=William Stallings |title=Cryptography and Network Security: Principles and Practice |publisher=Prentice Hall |date=2013 |edition=6th |isbn=978-0-13-335469-0}}
* Tenzer, Theo (2021): ''Super Secreto – The Third Epoch of Cryptography: Multiple, exponential, quantum-secure and above all, simple and practical Encryption for Everyone'', Norderstedt, {{ISBN|978-3755761174}}.
* Johann-Christoph Woltag, 'Coded Communications (Encryption)' in Rüdiger Wolfrum (ed) ''[http://www.csil.cn/upFiles/files/International%20Law.pdf Max Planck Encyclopedia of Public International Law]'' (Oxford University Press 2009).
{{Refend}}
 
==External links==
<!-- Please A-Z -->
{{Wikiquote}}
{{Wikibooks}}
{{Wikiversity department}}
{{EB1911 poster|Cryptography}}
{{Library resources box|onlinebooks=yes}}
* {{Wiktionary-inline}}
* {{Commons category-inline|Cryptography}}
* {{In Our Time|Cryptography|p004y272|Cryptography}}
* [https://ciphersbyritter.com/GLOSSARY.HTM Crypto Glossary and Dictionary of Technical Cryptography] {{Webarchive|url=https://web.archive.org/web/20220704220419/http://www.ciphersbyritter.com/GLOSSARY.HTM |date=4 July 2022 }}
* [https://www.cs.cornell.edu/courses/cs4830/2010fa/lecnotes.pdf A Course in Cryptography] by Raphael Pass & Abhi Shelat – offered at Cornell in the form of lecture notes.
* For more on the use of cryptographic elements in fiction, see: {{cite web |url=http://faculty.knox.edu/jdooley/Crypto/CryptoFiction.htm |title=Cryptology in Fiction |last1=Dooley |first1=John F. |date=23 August 2012 |access-date=20 February 2015 |archive-date=29 July 2020 |archive-url=https://web.archive.org/web/20200729044734/http://faculty.knox.edu/jdooley/Crypto/CryptoFiction.htm |url-status=dead }}
* [https://www.loc.gov/rr/rarebook/coll/073.html The George Fabyan Collection] at the [[Library of Congress]] has early editions of works of seventeenth-century English literature, publications relating to cryptography.
 
{{Navboxes
|title=Articles relating to Cryptography
|list1=
{{Cryptography navbox|public-key}}
{{Cryptography navbox|hash}}
{{Cryptography navbox|block}}
{{Cryptography navbox|stream}}
}}
{{Espionage}}
{{Hidden messages}}
{{Intelligence cycle management}}
{{Authority control|state=expanded}}
 
[[Category:Cryptography| ]]
<!-- Please respect alphabetical order -->
[[Category:Applied mathematics]]
[[Category:Banking technology]]
[[Category:Formal sciences]]
[[Category:Prison-related crime]]