m (Caesar's cipher)
m
Line 43: Line 43:
 
While Caesar's cipher had only one number, the $x$ in <tt>rot</tt>$x$, to encrypt and decrypt, one can easily make the cipher more robust by using a "key", which encodes the information that encrypts the message. The simplest variation is to decide on a key, for instance:
 
While Caesar's cipher had only one number, the $x$ in <tt>rot</tt>$x$, to encrypt and decrypt, one can easily make the cipher more robust by using a "key", which encodes the information that encrypts the message. The simplest variation is to decide on a key, for instance:
  
: secretkey
+
: secret
  
which  
+
which translates in arithmetics as:
 +
 
 +
: 19.5.3.14.5.20
 +
 
 +
turns [[Jule Vernes]]' message
 +
 
 +
: Man, a mere inhabitant of the earth, cannot overstep its boundaries! But though he is confined to its crust, he may penetrate into all its secrets.
 +
 
 +
into
 +
 
 +
: Eep, r qxji kelttmvrrm gj vyi xsvvy, gtfrqk sowvukii axu ssnfhcimxk! Fwk xagyiy lx aw efryargu xh axu tvnkx, jv qtq tgeimjevv mgls ccp blw uvgkwxu.
 +
 
 +
since the plaintext in alphabet arithmetics reads:
 +
 
 +
: 13.1.14, 1 13.5.18.5 ...
 +
 
 +
which yields:
 +
 
 +
: 13$\oplus$19.1$\oplus$5.14$\oplus$3.1$\oplus$14.13$\oplus$5.5$\oplus$20.18$\oplus$19.5$\oplus$5
 +
 
 +
which evaluates to
 +
 
 +
:
  
 
== One-time pad ==
 
== One-time pad ==

Revision as of 22:12, 31 March 2020

Contents

Cryptography

Cryptography, from the Greek kryptós (secret) and graphein (writting) is the technique of transmitting secret information that a recipient can access without other parties being able to. Terminology is now established that we call Alice ("A") the sender, Bob ("B") the recipient and Eve ("E") the eavesdropper. The message is called plaintext and its encrypted version is called cyphertext. Cryptography consists in using a cypher (an algorithm) to turn the plaintext into cyphertext and back:

plaintext 🡒 cyphertext.

Both the destination and a Hacker will reverse this process, one legitimately and accessing the intended information, the other in violation of the intended secrecy.

Caesar's cipher

An example of a cipher is, for instance, the following sequence:

Na rknzcyr bs n pvcure vf, sbe vafgnapr, gur sbyybjvat frdhrapr:

which is a naively encrypted version of the original sentence, using the rot13 algorithm which rotates by 13 the Latin alphabet, i.e., a🡒n, b🡒o, c🡒p, etc. Because 13 is half the alphabet, rotating it twice brings us back to the original message: a🡒n🡒a, b🡒o🡒b, etc. This is a 13-shift version of a cipher actually used by Caesar, who was rotating the alphabet by -3 letter:

a🡒x, b🡒y, c🡒z, d🡒a, e🡒b

Such operations are described mathematically by modular arithmetics, $\oplus$, which equates two numbers $a$ and $b$ modulo $m$, written

$$a\equiv b \pmod m$$

if they differ by a multiple of the modulo $m$, i.e., iff there exists $k\in\mathbb{N}$ such that

$$a=b+km$$

Here is a text Caesar might have encoded:

Yhql, ylgl, ylfl

in rot13, this would have given:

Irav, ivqv, ivpv

in rot1

Wfoj, wjej, wjdj

One problem of such ciphers is that one can notice patterns and break them. Caesar's cipher is particularly fragile because one can try all rotations of the alphabet and see which soup of letter makes sense. This is called a "brute-force attack".

Vegenere cipher

While Caesar's cipher had only one number, the $x$ in rot$x$, to encrypt and decrypt, one can easily make the cipher more robust by using a "key", which encodes the information that encrypts the message. The simplest variation is to decide on a key, for instance:

secret

which translates in arithmetics as:

19.5.3.14.5.20

turns Jule Vernes' message

Man, a mere inhabitant of the earth, cannot overstep its boundaries! But though he is confined to its crust, he may penetrate into all its secrets.

into

Eep, r qxji kelttmvrrm gj vyi xsvvy, gtfrqk sowvukii axu ssnfhcimxk! Fwk xagyiy lx aw efryargu xh axu tvnkx, jv qtq tgeimjevv mgls ccp blw uvgkwxu.

since the plaintext in alphabet arithmetics reads:

13.1.14, 1 13.5.18.5 ...

which yields:

13$\oplus$19.1$\oplus$5.14$\oplus$3.1$\oplus$14.13$\oplus$5.5$\oplus$20.18$\oplus$19.5$\oplus$5

which evaluates to

One-time pad

The process of encryption/decryption is typically , thanks to a key (one key for "symmetric" cyphers, two for "asymmetric" ones).


It represents perfect cryptography, in the sense that it cannot be broken even with unlimited computing power (this was proven by Claude Shannon).


Asymmetric systems use a public key to encrypt a message and a private key to decrypt it