Sunteți pe pagina 1din 5

Discrete Mathematics 2002 Lecture 35, 17-October-2002

Introduction to Cryptography
• This work is based loosely on Chapter 12
(“Number Theory”) of the text
• Security is very important in IT, and a key aspect
of this is privacy (or confidentiality) – e.g. in
credit card transactions on the internet
• We want secure communication, where only the
sender & receiver of a message can understand it
• This is achieved by encrypting (or enciphering)
the message at the sender site, & decrypting (or
deciphering) it at the receiver site
• Hopefully, an intruder who obtains the encrypted
message is unable to understand its contents 1

Caesar’s Cipher
• A very early example of encryption is due to
Julius Caesar (100–44 BC)
• We call data that is not encrypted plaintext (or
cleartext), while encrypted data is ciphertext
• Caesar encrypted his messages using the table
Plaintext a b c d e f g h i j k l m n o p q r s t u v w x y z
Ciphertext D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
• Thus discrete is encrypted as GLVFUHWH, and
SULYDFB is decrypted as privacy
• This cipher is termed a monoalphabetic cipher,
since each plaintext letter is always encrypted by
the same ciphertext letter 2

Caesar’s Cipher (continued)


• This example of Caesar’s cipher involves a shift
of each letter of the alphabet by 3 positions
• There is nothing particularly significant about the
use of 3 – we could have shifted each letter by 7
positions, or 19 positions, etc
• Altogether, there are 26 different ciphers that can
be constructed using Caesar’s approach
(including the trivial cipher)
• They can be described in the following way
• Suppose our cipher involves a shift of each letter
by s positions 3

1
Discrete Mathematics 2002 Lecture 35, 17-October-2002

Caesar’s Cipher (continued)


• Identify a with 1, b with 2, c with 3, …, x with
24, y with 25, and z with 0
• To encipher a plaintext letter:
1. Encode the letter as its corresponding number
2. Add s to the number
3. If the result is ≤ 25, translate it back to a letter
4. If the result is ≥ 26, divide it by 26, and
translate the remainder back to a letter
• Examples: Encipher the letters b and x using
Caesar’s cipher with a shift of 6 positions
• Because of Step 2 above, the Caesar ciphers are
known as additive ciphers 4

Multiplicative Ciphers
• A cipher can also be obtained by multiplication
by a number t, as follows
• To encipher a plaintext letter:
1. Encode the letter as its corresponding number
2. Multiply the number by t
3. Use the remainder when this number is
divided by 26, and translate it back to a letter
• If t = 2, we obtain
Plaintext a b c d e f g h i j k l m n o p q r s t u v w x y z
Ciphertext B D F H J L N P R T V X Z B D F H J L N P R T V X Z
• Note this is not a useful cipher, as the message
‘LRN’ could mean ‘fig’,‘fit’,‘sit’, etc 5

Multiplicative Ciphers (cont)


• The multiplicative cipher with t = 2 isn’t useful
because we need to be able to reconstruct the
plaintext uniquely from the ciphertext
• However, if t = 3, we do obtain a useful cipher
Plaintext a b c d e f g h i j k l m n o p q r s t u v w x y z
Ciphertext C F I L O R U X A D G J M P S V Y B E H K N Q T W Z

• It can be checked that valid multiplicative ciphers


are obtained if t = 1 (the trivial cipher), 3, 5, 7, 9,
11, 15, 17, 19, 21, 23 and 25 – so there are 12
multiplicative ciphers
6

2
Discrete Mathematics 2002 Lecture 35, 17-October-2002

Affine Ciphers
• If a message is encrypted with an additive or
multiplicative cipher, it would not take an
intruder very long to discover the number s or t,
and so break the cipher
• Thus these methods offer very limited security
• However, the two approaches can be combined:
1. Encode the plaintext letter as a number
2. Add s, and encode the resulting letter as a no.
3. Multiply this number by t, and interpret the
result as the ciphertext letter
• The result is the affine cipher [s, t]
• e.g: w is encrypted as C in the cipher [8, 11] 7

Affine Ciphers (continued)


• There are 26 possible values for s, & 12 possible
values for t, so there are 26 × 12 = 312 different
affine ciphers, each identified by the key [s, t]
• Thus there are many more possible ciphers than
before, and a naive approach to deciphering an
intercepted message sent with an affine cipher
might lead to some frustration
• However, it would not take too long for an
intruder to break the cipher (especially with the
help of a computer)
• So affine ciphers don’t offer much security 8

Secret Key Encryption


• If we send a message using an affine cipher, then
both sender & receiver need to know the secret
key (i.e. [s, t]), which is the same for both parties
• However, the encryption & decryption
algorithms are the inverse (or reverse) of each
other – e.g. if something is added to the data
during encryption, then the same amount will be
subtracted from the data during decryption
• An affine cipher is an example of secret key
encryption – in secret key encryption, the same
key is used in encryption & decryption, but the
two algorithms are the inverse of each other 9

3
Discrete Mathematics 2002 Lecture 35, 17-October-2002

Diagram of Secret Key Encryption

(Diagram from Foundations of Computer Science by


Behrouz A. Forouzan, Brooks/Cole, 2003, p. 308)
10

Data Encryption Standard (DES)


• Secret key encryption has been used for more
than 2000 years
• At first the algorithms were simple, and the keys
were easy to guess
• Today, the algorithms are very sophisticated
• The most common method nowadays is the Data
Encryption Standard (DES), developed in the
1970s (essentially by IBM)
• The method, in which data is scrambled in a very
complicated fashion, is used widely, particularly
in banking 11

DES (continued)
• In DES, the data is transformed into a string of
bits (e.g. use ASCII code), which is broken into
segments of 64 bits
• Each segment is then encrypted in a many-stage
process that uses a 56-bit key
• The DES method is a monoalphabetic cipher,
since, for a given key, each particular 64-bit
plaintext segment is always encrypted as the
same 64-bit ciphertext string
12

4
Discrete Mathematics 2002 Lecture 35, 17-October-2002

Secret Key Algorithms


• Secret key algorithms are usually efficient – they
take less time to implement than the alternative
public key algorithms we’ll discuss shortly
• So secret key encryption is especially useful for
long messages
• However, there are 2 disadvantages
• Firstly, each pair of users must have a secret key
– so, if n people are to use secret key encryption,
there must be n × (n – 1)/2 secret keys
• Thus, for 1 million people to communicate, there
needs to be about half-a-trillion secret keys!
13

Disadvantages of Secret Key


Encryption
• So the first disadvantage of secret key encryption
relates to the management of the secret keys.
That is, how can so many keys be kept secret?
• The second disadvantage is associated with the
distribution of the keys – i.e. how does the sender
securely inform the receiver what the key is?
• These 2 disadvantages of secret key encryption
are addressed in public key encryption, which
we’ll introduce in the next lecture 14

S-ar putea să vă placă și