discrete mathematics with applications math236 16.pdf · discrete mathematics with applications...

23
Discrete Mathematics with Applications MATH236 Dr. Hung P. Tong-Viet School of Mathematics, Statistics and Computer Science University of KwaZulu-Natal Pietermaritzburg Campus Semester 1, 2013 Tong-Viet (UKZN) MATH236 Semester 1, 2013 1 / 23

Upload: ngoxuyen

Post on 19-Jul-2018

245 views

Category:

Documents


0 download

TRANSCRIPT

Discrete Mathematics with ApplicationsMATH236

Dr. Hung P. Tong-Viet

School of Mathematics, Statistics and Computer ScienceUniversity of KwaZulu-NatalPietermaritzburg Campus

Semester 1, 2013

Tong-Viet (UKZN) MATH236 Semester 1, 2013 1 / 23

Table of contents

1 Finding generators in Z∗p

2 Review of Chapter 3

3 Chapter 4. Fundamentals of cryptopologyIntroductionMonoalphabetic and Polyalphabetic ciphers

Tong-Viet (UKZN) MATH236 Semester 1, 2013 2 / 23

Finding generators in Z∗p

The multiplicative group

For a positive integer n, the multiplicative group of Zn is

Z∗n = {a ∈ Zn : gcd(a, n) = 1}

The group operation is multiplication modulo n

The identity in Z∗n is the number 1

Every element a ∈ Z∗n has an inverse

The order of Z∗n is hi(n)

If p is a prime, then Z∗p = Zp − {0} = {1, 2, · · · , p − 1}

The order of a ∈ Z∗n is the smallest positive integer k such that

ak = 1. We write |a| = k .

Tong-Viet (UKZN) MATH236 Semester 1, 2013 3 / 23

Finding generators in Z∗p

The multiplicative group

Example

Consider the group Z∗15

We have Z∗15 = {1, 2, 4, 7, 8, 11, 13, 14}

|Z∗15| = 8 = hi(15) = 15(1− 1

3)(1− 15)

Order of 2 ∈ Z∗15

k 2k mod 15

1 22 43 84 1

Thus |2| = 4 in Z∗15.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 4 / 23

Finding generators in Z∗p

Finding generators

Theorem

Suppose that p is a prime and α ∈ Z∗p. Then α is a generator of Z∗

p if andonly if

α(p−1)/q 6≡ 1 (mod p)

for all primes q such that q | (p − 1).

Tong-Viet (UKZN) MATH236 Semester 1, 2013 5 / 23

Finding generators in Z∗p

Finding generators

Example

Consider the group Z∗37. We have 37− 1 = 36 = 22 · 32.

For α ∈ Z∗37, we need to compute

α36/2 (mod 37)α36/3 (mod 37)

If all the results are not trivial, then α is a generator of Z37.

We have 218 ≡ 36 and 212 ≡ 26 (mod 37), so 2 is a generator of Z∗37

However 418 ≡ 1 and 412 ≡ 10 (mod 37), so 4 is NOT a generator ofZ∗37

Is 31 a generator of Z∗37?

Tong-Viet (UKZN) MATH236 Semester 1, 2013 6 / 23

Review of Chapter 3

Elementary number theory

The Division Algorithm: Find gcd(a, b), with a, b ∈ ZThe Extended Division Algorithm: Find s, t ∈ Z such thatgcd(a, b) = as + bt

Study the proofs of Lemma 24 and Theorem 25

Find the multiplicative inverses (using the Extended DivisionAlgorithm)

Study Theorems 26 and 27. (Existence and Uniqueness)

Square and multiply in Zm

Tong-Viet (UKZN) MATH236 Semester 1, 2013 7 / 23

Review of Chapter 3

Elementary number theory (cont.)

Prime numbers

Euler’s hi-function

Definition and how to compute hi(n) for n ∈ ZTheorems 30-32 and Theorem 33 (Formula for hi(n))

Fermat and Euler Theorems

Find remainders and inverses using these theorems

Definition of groups, order of elements and how to find a generatorfor Z∗

p.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 8 / 23

Chapter 4. Fundamentals of cryptopology Introduction

Introduction

Further reading: Handbook of Applied Cryptography by Menezes,Oorschot and Vanstone

Available at www .cacr .math.uwaterloo.ca/hac

The word cryptopology was used for the first time by John Wilkins in1641

This word comes from Greek words krypte: to hide and logos: word

Cryptopology consists of two related disciplines: cryptography(graphein: to write) and cryptanalysis

Cryptography was used by the Egyptians as early as 1900 BC

Classical ciphers are simple substitutions (shift ciphers, block ciphers)with a shared private key

If we know how to encrypt, we can decrypt the message easily.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 9 / 23

Chapter 4. Fundamentals of cryptopology Introduction

Introduction

In modern times, cryptography has been used by the governments,military and now by commercial entities

Public key cryptograph, invented in 1976, is the modern cryptographand the most widely used public key system is the RSA cryptosystem

In RSA crypto system, we encrypt the message using modularexponentiation, where the modulus is the product of two large primes

To decrypt the message, we need to know the prime factors of themodulus. However, the factorisation is a difficult problem.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 10 / 23

Chapter 4. Fundamentals of cryptopology Introduction

Definition of cryptograph

Definition

Cryptography is the study of mathematical techniques to provideinformation security such as

Confidentiality: Ensuring that only the intended recipient of themessage is able to understand it

Data integrity: Preventing the unauthorized alteration of data

Authentication: Providing assurance that both sender and recipientare who they say they are, and that the message comes from where itis supposed to and goes where it is supposed to

Non-repudiation: Preventing parties from denying previously madecommitments

Tong-Viet (UKZN) MATH236 Semester 1, 2013 11 / 23

Chapter 4. Fundamentals of cryptopology Introduction

Definition of cryptanalysis

Definition

Cryptanalysis is the study of mathematical techniques to defeatinformation security.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 12 / 23

Chapter 4. Fundamentals of cryptopology Introduction

Definitions and Terminology

Definition

plaintext (message) M is a finite string of symbols from a finitealphabet Σ (Latin alphabet, binary alphabet)

M is converted, by the process of encryption (enciphering) into anenciphered text called the ciphertext (cryptogram) C

The person who enciphered M is called the sender or encipherer.

He used a set of rules or algorithm to encrypt M

The sender sends the ciphertext C to the intended recipient (receiver)

The algorithm involves the use of a key K which is known to bothsender and receiver

Tong-Viet (UKZN) MATH236 Semester 1, 2013 13 / 23

Chapter 4. Fundamentals of cryptopology Introduction

Definitions and Terminology

Definition

The receiver uses an algorithm (involving the key) to obtain M fromC . This is known as decryption (deciphering)

The ciphered text C and the key K must determine the plaintext Muniquely.

The plaintext will be written in lowercase and ciphertext in uppercase

Any person who intercepts the message is called an inceptor

The methods used in the encryption/decryption above form thesubject of cryptography

The methods used by the inceptor to derive M from C withouthaving access to the key are studies in cryptanalysis.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 14 / 23

Chapter 4. Fundamentals of cryptopology Introduction

Principle of Cryptography

Tong-Viet (UKZN) MATH236 Semester 1, 2013 15 / 23

Chapter 4. Fundamentals of cryptopology Monoalphabetic and Polyalphabetic ciphers

Encryption schemes

There are two classes of encryption schemes

Monoalphabetic cipher:

each letter in the plaintext alphabet is always encrypted as the sameletter in the ciphertext alphabet.

Polyalphabetic cipher:

a letter in the plaintext alphabet might be encrypted as severaldifferent letters in the ciphertext.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 16 / 23

Chapter 4. Fundamentals of cryptopology Monoalphabetic and Polyalphabetic ciphers

Monoalphabetic ciphers

Simple substitution ciphers: we replace each letter of the alphabetby another. In other words, a simple substitution cipher is apermutation of the letters of the alphabet

Shift ciphers: (used by Julius Caesar) each of the letters a, b, · · · z isreplaced by the letter which occurs three places after it in thealphabet.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 17 / 23

Chapter 4. Fundamentals of cryptopology Monoalphabetic and Polyalphabetic ciphers

Simple substitution ciphers

Example

Suppose that the following key is used:Plaintext a b c d e f · · · t u v w · · ·

Ciphertext D X W E G A · · · B F R C · · ·Both the encipherer and decipherer have a copy of this key

The plaintext ‘fat’ is enciphered as ‘ADB’

The ciphertext ‘WDB’ is deciphered as ‘cat’

The reordered alphabet (DXWEGA · · ·BFRC · · · ) is called thesubstitution alphabet

This is a very poor system. It is easy to cryptanalyze. Memorizing thekey is difficult. If the key is kept, it can be lost or stolen.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 18 / 23

Chapter 4. Fundamentals of cryptopology Monoalphabetic and Polyalphabetic ciphers

Shift ciphers

Example

The key of Caesar shift cipher is represented by the followingpermutation

Plaintext a b c d e f · · · w x y zCiphertext D E F G H I · · · Z A B C

We call this a shifter cipher, or additive cipher or translation cipherwith shift (or key) 3

In general, we can use a shift cipher with key d

This is a special case of simple substitution cipher

The key is easily remember but the cipher is insecure

Tong-Viet (UKZN) MATH236 Semester 1, 2013 19 / 23

Chapter 4. Fundamentals of cryptopology Monoalphabetic and Polyalphabetic ciphers

Polyalphabetic ciphers

a specific ciphertext letter can represent more than one plaintext

each plaintext letter can be encrypted in more than one way

There are several ways to do this but we must be sure that whateverwe do, we can still decipher the message.

We will look at ‘n-gram substitution’ and ‘permutation cipher’

Tong-Viet (UKZN) MATH236 Semester 1, 2013 20 / 23

Chapter 4. Fundamentals of cryptopology Monoalphabetic and Polyalphabetic ciphers

n-gram substitution

an n-gram is a sequence of n letters

A single letter is a 1-gram; a sequence of two letters is a 2-gram ordigram and a sequence of three letters is a 3-gram or trigram

In n-gram substitution, we replace each n-gram of plaintext with ann-gram of ciphertext

Tong-Viet (UKZN) MATH236 Semester 1, 2013 21 / 23

Chapter 4. Fundamentals of cryptopology Monoalphabetic and Polyalphabetic ciphers

n-gram substitution

Suppose part of the key for a digram encryption scheme is

a b · · · x y z...c MZ BQ JA DD FKd IA DT TB AT ZSe LP SX AM EO BR...k BA AC QP MN LAl WF EH GO BJ RE

m CT MB CW HP IS...

Then the word ‘lady’ would be encrypted as ‘WFAT’

The ciphertext ‘MZAT’ is deciphered as ‘cady’

Tong-Viet (UKZN) MATH236 Semester 1, 2013 22 / 23

Chapter 4. Fundamentals of cryptopology Monoalphabetic and Polyalphabetic ciphers

Permutation ciphers

A block cipher is an encryption scheme in which the plaintextmessage is broken up into blocks of fixed length d

each of which is then encrypted separately

In a digram substitution scheme, each block has length d = 2

Tong-Viet (UKZN) MATH236 Semester 1, 2013 23 / 23