Section 2.2: Affine Ciphers; More Modular Arithmetic - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Section 2.2: Affine Ciphers; More Modular Arithmetic

Description:

Section 2.2: Affine Ciphers; More Modular Arithmetic Shift ciphers use an additive key. To increase security, we can add a multiplicative parameter. – PowerPoint PPT presentation

Number of Views:92
Avg rating:3.0/5.0
Slides: 10
Provided by: rfis4
Category:

less

Transcript and Presenter's Notes

Title: Section 2.2: Affine Ciphers; More Modular Arithmetic


1
Section 2.2 Affine Ciphers More Modular
Arithmetic
  • Shift ciphers use an additive key. To increase
    security, we can add a multiplicative parameter.
  • For affine ciphers we use both a multiplicative
    and an additive parameter

2
Affine Ciphers More Modular Arithmetic
  • Mathematics Background for Affine Ciphers
  • A natural number is a number in the set 1, 2, 3,
    .
  • Any natural number can always be written as the
    product of two other natural numbers.
  • Ex 6 23 20 45 7 17
  • Definition A natural number p is said to be
    prime if p gt 1 and its only divisors are 1 and p.
    A natural number that is not prime is said to be
    composite.
  • Question Are there an infinite number of primes?
    Yes. This can be proven but is not the focus of
    this course. The idea though is to assume not
    and show that this leads to a contradiction.
  • The primes are 2, 3, 5, 7, 11, 13, 17, 19, 23,
    29, where I have listed the first ten.
  • Theorem The Fundamental Theorem of Arithmetic.
    Every natural number larger then 1 is a product
    of primes. This factorization can be done in
    only one way if the order is disregarded.
  • Example 1 Factor 90
  • Answer 2325
  • Example 2 Factor 935
  • Answer 5 11 17

3
Affine Ciphers More Modular Arithmetic
  • The common prime factors of two numbers can be
    used to find the greatest common divisor of two
    numbers (gcd).
  • Definition The gcd of two natural numbers a and
    b, denoted gcd(a, b), is the largest natural
    number that divides both a and b with no
    remainder.
  • Elementary method for computing the gcd of two
    numbers
  • Decompose the two numbers into prime
    factorization.
  • The common factors make up the gcd.
  • If there are no common factors then the gcd 1.
    (The two numbers are said to be relatively prime)
  • Example 3 Find the gcd(20, 30).
  • Answer 10
  • Example 4 Find the gcd(1190, 935).
  • Answer 85
  • Example 5 Find the gcd(15, 26).
  • Answer 1

4
Affine Ciphers More Modular Arithmetic
  • Multiplicative Inverses For a number x in some
    set S, the multiplicative inverse of x is a
    number y, also in S, such that xy 1.
  • In the real numbers, every nonzero number has a
    multiplicative inverse.
  • Consider the set Z (the integers). Only 1 and -1
    have multiplicative inverses.
  • In Zm a number x has a multiplicative inverse if
    there is a number y such that xy mod m 1.
  • Consider the set Z6. The numbers 1, 5 have
    inverses. The inverse of 1 is itself. The
    inverse of 5 is itself.
  • Fact If the gcd(b, m) 1, then b has a
    multiplicative inverse. the inverse of b is
    denoted by b-1.
  • Example 6 In the set R, find the inverses of 2,
    10, a.
  • Answer ½, 1/10,1 / a
  • Example 8 Does 8 have an inverse modulo 26?
  • Answer No. gcd(8, 26) 2.
  • Example 9 Does 9 have an inverse modulo 26?
  • Answer yes. gcd(9, 26) 1.
  • Table of multiplicative inverses modulo 26
  • Example 10 Use the table to find 7-1 MOD 26.
  • Answer 15

5
Affine Ciphers More Modular Arithmetic
  • Multiplicative Property for Modular Arithmetic
    If a b mod m, then for any number k, ka kb
    mod m.
  • Example 11 Solve 11x 1 5 mod 26 (Note the
    inverse of 11 is not 1 / 11. From our table we
    see that 11-1 is 19.
  • Answer x 114 MOD 26 10 MOD 26 10
  • Example 12 Solve (Note -9 17 mod 26)
  • 8a b 18 mod 26
  • 17a b 11 mod 26 (subtract the second equation
    from the first)
  • Answer a 5, b 4 (Note that a 31 and b 30
    are also answers, etc.)

6
Affine Ciphers More Modular Arithmetic
  • Mathematical Description of Affine Ciphers
  • Given a and b in Z26 where gcd(a, 26) 1. We
    encipher a plaintext letter x to obtain a
    ciphertext letter y, by computing y (ax b)
    MOD 26.
  • Example 13 Encipher RADFORD using the affine
    cipher y (5x 4) MOD 26
  • Answer LETDWLE
  • The following example illustrates the need for a
    and b to be relatively prime.
  • Example 14 Encipher AN using the affine cipher
    y (2x 1) mod 26

7
Affine Ciphers More Modular Arithmetic
  • Deciphering an Affine Cipher
  • For an affine cipher y (ax b) mod 26 where
    gcd(a, 26) 1, the decipherment is unique. The
    formula for the decipherment is
  • y ax b
  • y b ax
  • a-1(y b) x
  • x a-1(y b) mod 26
  • Example 15 Decipher the message ARMMVKARER
    which was encrypted using the affine cipher y
    (3x 5) MOD 26

8
Affine Ciphers More Modular Arithmetic
  • Cryptanalysis of Affine Ciphers
  • For an affine cipher to be deciphered the enemy
    must know a and b.
  • There are two methods to decipher an affine
    cipher
  • Brute force or Exhaustion method (Try all
    possible values for a and b). Since there are 12
    values for a and 26 values for b, then there are
    12 26 312 total (a, b) pair tests.
  • Frequency analysis Uses the fact that the most
    frequently occurring letters in ciphertext
    produced by shift cipher has a good chance of
    corresponding to the most frequently occurring
    letters in the standard English alphabet. The
    most frequently occurring letters in English are
    E, T, A, O, I, N, S.
  • Example 16 Frequency Analysis. Suppose that the
    two most frequently occurring letters in a
    ciphertext message are W and H. Assuming that
    these correspond to E and T, find a and b

9
Affine Ciphers More Modular Arithmetic
  • Additional Exercises
  • Factor the following into a product of prime
    numbers 120, 715, 594473
  • Find the following gcd gcd(30, 40), gcd(150,
    500), gcd(187, 455)!
Write a Comment
User Comments (0)
About PowerShow.com