Modular Arithmetic Several important cryptosystems make use of modular arithmetic. This is when the answer to a calculation is always in the range 0 –

Slides:



Advertisements
Similar presentations
Chapter 8 Introduction to Number Theory. 2 Contents Prime Numbers Fermats and Eulers Theorems.
Advertisements

Factoring Polynomials of Higher Degree
Advanced Piloting Cruise Plot.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
ALGEBRA Number Walls
Algebraic Expressions
Factors, Primes & Composite Numbers
and 6.855J Cycle Canceling Algorithm. 2 A minimum cost flow problem , $4 20, $1 20, $2 25, $2 25, $5 20, $6 30, $
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
Section 2.3 Polynomial and Synthetic Division
Properties of Real Numbers CommutativeAssociativeDistributive Identity + × Inverse + ×
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
Multiplying binomials You will have 20 seconds to answer each of the following multiplication problems. If you get hung up, go to the next problem when.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
MULTIPLICATION EQUATIONS 1. SOLVE FOR X 3. WHAT EVER YOU DO TO ONE SIDE YOU HAVE TO DO TO THE OTHER 2. DIVIDE BY THE NUMBER IN FRONT OF THE VARIABLE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
Year 6 mental test 5 second questions
RSA.
1 Computational Complexity Size Matters!. 2 Suppose there are several algorithms which can all be used to perform the same task. We need some way to judge.
Zabin Visram Room CS115 CS126 Searching
School Shop. Welcome to my shop. You have 10p How much change will you get? 7p 3p change.
Around the World AdditionSubtraction MultiplicationDivision AdditionSubtraction MultiplicationDivision.
Multiplication and Division
HOW TO MULTIPLY FRACTIONS
Copyright 2012, 2008, 2004, 2000 Pearson Education, Inc.
Solve Multi-step Equations
ORDER OF OPERATIONS Parentheses 2. Exponents 3. Multiplication or division (in order from left to right) 4. Addition or subtraction (in order.
Copyright 2012, 2008, 2004, 2000 Pearson Education, Inc.
Columbus State Community College
Copyright © Cengage Learning. All rights reserved.
ABC Technology Project
DIVISIBILITY, FACTORS & MULTIPLES
Hash Tables.
Using the TI 83 Plus Calculator
Copyright © 2013, 2009, 2005 Pearson Education, Inc.
Introduction Recall that the imaginary unit i is equal to. A fraction with i in the denominator does not have a rational denominator, since is not a rational.
VOORBLAD.
Factors, Prime Numbers & Composite Numbers
How to convert a left linear grammar to a right linear grammar
Rational numbers, irrational numbers
Solve by Substitution: Isolate one variable in an equation
8 2.
Adding Up In Chunks.
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
1 Chapter 4 The while loop and boolean operators Samuel Marateck ©2010.
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
The Fundamental Theorem of Algebra
Factors Terminology: 3  4 =12
Week 1.
We will resume in: 25 Minutes.
Algebra Solving Equations October 2006 ©RSH.
PSSA Preparation.
Columbus State Community College
Columbus State Community College
Public Key Cryptosystems - RSA Receiver Sender Eavesdroppe r p q p q p q p and q prime.
Mathematics of Cryptography Part I: Modular Arithmetic
CSE 311: Foundations of Computing Fall 2014 Lecture 12: Primes, GCD.
Division Using multiplication and repeated subtraction.
Modular Arithmetic Warmup. Computing powers What is 3 2 (mod 7)? 3 2 = 9 = 2 (mod 7) What is 3 25 (mod 7)? 3 25 = (3 12 ) 2 × = (3 6 ) = (3.
Fermat’s Little Theorem The RSA Cryptosystem will require exponentiation to decrypt messages. Exponentiation Notation Example 1: Compute Exponentials Example.
Discrete Math for CS CMPSC 360 LECTURE 12 Last time: Stable matching
Presentation transcript:

Modular Arithmetic Several important cryptosystems make use of modular arithmetic. This is when the answer to a calculation is always in the range 0 – m where m is the modulus. To calculate the value of n mod m, you take away as many multiples of m as possible until you are left with an answer between 0 and m.

If n is a negative number then you add as many multiples of m as necessary to get an answer in the range 0 – m. Examples 17 mod 5 = 27 mod 11 = 7 20 mod 3 = 211 mod 11 = 0 -3 mod 11 = 8-1 mod 11 = mod 5 = 0-11 mod 11 = 0

Two numbers r and s are said to becongruent mod m if r mod m = s mod m In this case we write r s mod m The difference between r and s will be a multiple of m So r-s = km for some value of k E.g mod 5

A good thing about modular arithmetic is that the numbers you are working with will be kept relatively small. At each stage of an algorithm, the mod function should be applied. Thus to multiply 39 * 15 mod 11 we first take mods to get 39 mod 11 = 6 and 15 mod 11= 4 The multiplication required is now 6*4 mod 11 = 24 mod 11 = 2

The computational complexity of calculating a mod is O(b 2 ) Therefore the computational complexity of performing a multiplication mod m is O(b 2 ) And the complexity of calculating x n mod m is O(b 3 ) where b is the size of n. Thus using modular arithmetic does not in general increase the complexity of algorithms.

Algorithm for modular exponentiation To Compute x n mod m Initialise y=1, u=x mod m Repeat if n mod 2=1 then y=(y*u) mod m n=n div 2 u=(u*u) mod m Until n=0 Output y

Modular Division What is 5 ÷ 3 mod 11? We need to multiply 5 by the inverse of 3 mod 11 When you multiply a number by its inverse, the answer is 1. Thus the inverse of 2 is ½ since 2* ½ = 1 The inverse of 3 mod 11 is 4 since 3*4=1 mod 11 Thus 5 ÷ 3 mod 11 = 5*4 mod 11 = 9 mod 11

It is relatively easy to find the inverse of x mod m using Euclids algorithm which has computational complexity O(b 3 ) where b is the size of m. Note however that x does not have an inverse mod m unless x and m are co-prime (have no factors in common).