0% found this document useful (0 votes)
6 views62 pages

null (9)

Uploaded by

Kalpana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views62 pages

null (9)

Uploaded by

Kalpana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 62

cryptography and network

security- 18ITE008T
Unit-I

UNIT I 26/12/2024 1
Unit-I
Services, Mechanisms and attacks, the OSI security
architecture, Network security model- Classical Encryption
techniques- Finite Fields and Number Theory : Groups, Rings,
Fields - Modular arithmetic-Euclid's algorithm-Finite fields-
Prime Numbers-Fermat's and Euler's theorem- The Chinese
remainder theorem
INTRODUCTION

UNIT I 26/12/2024 3
OSI SECURITY ARCHITECTURE
 To assess effectively the security needs of an organization
and to evaluate and choose various security products and
policies.
 systematic way of defining the requirements for security

and characterizing the approaches to satisfying those


requirements.
 The OSI security architecture was developed in the context

of the OSI protocol architecture.


 The OSI security architecture focuses on security attacks,

mechanisms, and services

UNIT I 26/12/2024 4
OSI SECURITY ARCHITECTURE
 Cryptography can reformat and transform our data, making
it safer on its trip between computers.
 The technology is based on the essentials of secret codes,

augmented by modern mathematics that protects our data


in powerful ways.
 Computer Security - generic name for the collection of tools designed
to protect data and to thwart hackers
 Network Security - measures to protect data during their transmission
 Internet Security - measures to protect data during their transmission
over a collection of interconnected networks

UNIT I 26/12/2024 5
Threats and Attacks (RFC 2828)

Threat
 A potential for violation of security, which exists when there is

a circumstance, capability, action, or event that could breach


security and cause harm.
 That is, a threat is a possible danger that might exploit a

vulnerability.
Attack
 An assault on system security that derives from an intelligent

threat;
 An intelligent act that is a deliberate attempt to evade

security services and violate the security policy of a system.


UNIT I 26/12/2024 6
 Security Attacks, Services And Mechanisms

 To assess the security needs of an organization


effectively, the manager responsible for security needs.
 some systematic way of defining the requirements for

security and characterization of approaches are needed


to satisfy those requirements.
 One approach is to consider three aspects of information

security:

UNIT I 26/12/2024 7
 Security attack – Any action that compromises the
security of information owned by an organization.
Passive Attacks and Active Attacks

 Security mechanism – A mechanism that is designed to


detect, prevent or recover from a security attack.

 Security service – A service that enhances the security


of the data processing systems and the information
transfers of an organization.
The services are intended to counter security attacks
and they make use of one or more security mechanisms
to provide the service

UNIT I 26/12/2024 8
SECURITY SERVICES

 The classification of security services are as follows:


*Confidentiality: Ensures that the information in a computer system and
transmitted information are accessible only for reading by authorized parties.
Eg., printing, displaying and other forms of disclosure
 Authentication: Ensures that the origin of a message or electronic document is
correctly identified, with an assurance that the identity is not false.
 Integrity: Ensures that only authorized parties are able to modify computer
system assets and transmitted information. Modification includes writing, changing
status, deleting, creating and delaying or replaying of transmitted messages.
 Non repudiation: Requires that neither the sender nor the receiver of a message
be able to deny the transmission.
 Access control: Requires that access to information resources may be controlled
by or the target system.
 Availability: Requires that computer system assets be available to authorized

parties when needed

UNIT I 26/12/2024 9
Security Services (X.800)
 AUTHENTICATION
◦ The assurance that the communicating entity is the one that it
claims to be.
 Peer Entity Authentication
◦ Used in association with a logical connection to provide confidence
in the identity of the entities connected.
 Data Origin Authentication
◦ In a connectionless transfer, provides assurance that the source of
received data is as claimed.

UNIT I 26/12/2024 10
Security Services (X.800)
 ACCESS CONTROL
◦ The prevention of unauthorized use of a resource (i.e., this
service controls who can have access to a resource, under what
conditions access can occur, and what those accessing the
resource are allowed to do).
 DATA CONFIDENTIALITY
◦ The protection of data from unauthorized disclosure.
 Connection Confidentiality
◦ The protection of all user data on a connection.
 Connectionless Confidentiality
◦ The protection of all user data in a single data block

UNIT I 26/12/2024 11
Security Services (X.800)
AUTHENTICATION
 The confidentiality of selected fields within the user data

on a connection or in a single data block.


◦ Traffic Flow Confidentiality
The protection of the information that might be
derived from observation of traffic flows.
◦ Connection Integrity with Recovery
Provides for the integrity of all user data on a
connection and detects any modification, insertion,
deletion, or replay of any data within an entire data
sequence, with recovery attempted.
◦ Connection Integrity without Recovery
As above, but provides only detection without recovery.
UNIT I 26/12/2024 12
Security Services (X.800)
◦ Selective-Field Connection Integrity
 Provides for the integrity of selected fields within the user data
of a data block transferred over a connection and takes the
form of determination of whether the selected fields have been
modified, inserted, deleted, or replayed.
◦ Connectionless Integrity
 Provides for the integrity of a single connectionless data block
and may take the form of detection of data modification.
Additionally, a limited form of replay detection may be
provided.
◦ Selective-Field Connectionless Integrity
 Provides for the integrity of selected fields within a single
connectionless data block; takes the form of determination of
whether the selected fields have been modified.
UNIT I 26/12/2024 13
Security Services (X.800)
 NONREPUDIATION
◦ Provides protection against denial by one of the entities involved
in a communication of having participated in all or part of the
communication.
 Nonrepudiation, Origin
◦ Proof that the message was sent by the specified party.
 Nonrepudiation, Destination
Proof that the message was received by the specified party.

UNIT I 26/12/2024 14
SECURITY MECHANISMS

 One of the most specific security mechanisms in use is


cryptographic techniques.
 Encryption or encryption-like transformations of

information are the most common means of providing


security.
 Some of the mechanisms are:
 Encipherment
 Digital Signature
 Access Control

UNIT I 26/12/2024 15
SECURITY ATTACKS

 There are four general categories of attack which are listed below: Interruption, Interception,
Modification and Fabrication.

 Interruption
 An asset of the system is destroyed or becomes unavailable or unusable. This is an attack on availability.
 e.g., destruction of piece of hardware, cutting of a communication line or disabling of file management
system.

Sender Receive
 Interception
 An unauthorized party gains access to an asset. This is an attack on confidentiality. Unauthorized party could
be a person, a program or a computer.
 e.g., wire tapping to capture data in the network, illicit copying of files .

UNIT I 26/12/2024 16
Modification
An unauthorized party not only gains access to but tampers with an asset. This is an attack on integrity.
e.g., changing values in data file, altering a program, modifying the contents of messages being transmitted in a
network.

Sender R eceiver
Eavesdropper or forger
Fabrication

An unauthorized party inserts counterfeit objects into the system. This is an attack on
authenticity.

Sender

Eavesdropper or forger

e.g., insertion of spurious message in a network or addition of records to a file.

A useful categorization of these attacks is in terms of UNIT I 26/12/2024 17


SECURITY ATTACKS
 Passive attack
 Passive attacks are in the nature of eavesdropping on, or monitoring of,

transmissions. The goal of the opponent is to obtain information that is


being transmitted.
 Passive attacks are of two types:
 Release of message contents: A telephone conversation, an e-mail message and a transferred
file may contain sensitive or confidential information. We would like to prevent the opponent
from learning the contents of these transmissions.

 Traffic analysis: If we had encryption protection in place, an opponent might still be able to
observe the pattern of the message. The opponent could determine the location and identity of
communication hosts and could observe the frequency and length of messages being
exchanged. This information might be useful in guessing the nature of communication that
was taking place.

UNIT I 26/12/2024 18
SECURITY ATTACKS
 Active attacks
 These attacks involve some modification of the data stream or the
creation of a false stream.
 These attacks can be classified in to four categories:
 Masquerade – One entity pretends to be a different entity.
 Replay – involves passive capture of a data unit and its subsequent transmission to produce
an unauthorized effect.
 Modification of messages – Some portion of message is altered or the messages are
delayed or recorded, to produce an unauthorized effect.
 Denial of service – Prevents or inhibits the normal use or
management of communication facilities. Another form of service
denial is the disruption of an entire network, either by disabling the
network or overloading it with messages so as to degrade performance

UNIT I 26/12/2024 19
Network security model

UNIT I 26/12/2024 20
Classical Encryptions
techniques
 Symmetric and public key algorithms
 Encryption/Decryption methods fall into two categories.
 Symmetric key
 Public key

 In symmetric key algorithms, the encryption and decryption keys are known both to
sender and receiver. The encryption key is shared and the decryption key is easily
calculated from it. In many cases, the encryption and decryption keys are the same.

 In public key cryptography, encryption key is made public, but it is computationally


infeasible to find the decryption key without the information known to the receiver.

UNIT I 26/12/2024 21
CLASSICAL CRYPTO SYSTEMS

CONVENTIONAL ENCRYPTION
 referred conventional / private-key / single-key
 sender and recipient share a common key
 all classical encryption algorithms are private-key
 was only type prior to invention of public-key in 1970
 plaintext - the original message

Some basic terminologies used :

 cipher text - the coded message


 cipher - algorithm for transforming plaintext to cipher text
 key - info used in cipher known only to sender/receiver
 encipher (encrypt) - converting plaintext to cipher text
 decipher (decrypt) - recovering cipher text from plaintext
 cryptography - study of encryption principles/methods
 cryptanalysis (code breaking) - the study of principles/ methods of deciphering cipher text
 with out knowing key
 cryptology - the field of both cryptography and cryptanalysis

UNIT I 26/12/2024 22
Symmetric Encryption

UNIT I 26/12/2024 23
Symmetric Encryption
◦ Two requirements for secure use of symmetric encryption:
 a strong encryption algorithm
 a secret key known only to sender / receiver
 Y = EK(X) symmetric cryptosystem
 X = DK(Y)

UNIT I 26/12/2024 24
Cryptography
 Cryptographic systems are generally classified along 3 independent dimensions:
◦ Type of operations used for transforming plain text to cipher text

 All the encryption algorithms are abased on two general principles: substitution, in which each
element in the plaintext is mapped into another element, and transposition, in which elements in the
plaintext are rearranged.
◦ The number of keys used

 If the sender and receiver uses same key then it is said to be symmetric key (or) single key (or)
conventional encryption.

 If the sender and receiver use different keys then it is said to be public key encryption.
◦ The way in which the plain text is processed

 A block cipher processes the input and block of elements at a time, producing output block for each
input block.

 A stream cipher processes the input elements continuously, producing output element one at a time,
as it goes along.
UNIT I 26/12/2024 25
Cryptanalysis
 The process of attempting to discover X or K or both is known as cryptanalysis.
The strategy used by the cryptanalysis depends on the nature of the encryption
scheme and the information available to the cryptanalyst.

 There are various types of cryptanalytic attacks based on the amount of


information known to the cryptanalyst.
◦ Cipher text only – A copy of cipher text alone is known to the cryptanalyst.
◦ Known plaintext – The cryptanalyst has a copy of the cipher text and the corresponding
plaintext.

◦ Chosen plaintext – The cryptanalysts gains temporary access to the encryption machine.
They cannot open it to find the key, however; they can encrypt a large number of suitably
chosen plaintexts and try to use the resulting cipher texts to deduce the key.

◦ Chosen cipher text – The cryptanalyst obtains temporary access to the decryption machine,
uses it to decrypt several string of symbols, and tries to use the results to deduce the key.
UNIT I 26/12/2024 26
Brute- force attack
 The attacker tries every possible key on a piece of cipher
text until an intelligible translation into plaintext is
obtained.
 On average ,half of all possible keys must be tried to

achieve success.

UNIT I 26/12/2024 27
CLASSICAL ENCRYPTION TECHNIQUES (SUBSTITUTION
TECHNIQUES )
There are two basic building blocks of all encryption techniques: substitution and
transposition.
SUBSTITUTION TECHNIQUES
 A substitution technique is one in which the letters of plaintext are replaced by other
letters or by numbers or symbols.
 If the plaintext is viewed as a sequence of bits, then substitution involves replacing

plaintext bit patterns with cipher text bit patterns.


Caesar cipher (or) shift cipher
 The earliest known use of a substitution cipher and the simplest was by Julius

Caesar. The Caesar cipher involves replacing each letter of the alphabet with the
letter standing 3 places further down the alphabet.
 e.g., Plain text : pay more money

 Cipher text: SDB PRUH PRQHB

UNIT I 26/12/2024 28
Problem

UNIT I 26/12/2024 29
Playfair cipher
Playfair cipher
The best known multiple letter encryption cipher is the playfair, which treats diagrams in the plaintext as
single units and translates these units into cipher text digrams.

The playfair algorithm is based on the use of 5x5 matrix of letters constructed using a keyword. Let the
keyword be „monarchy‟. The matrix is constructed by filling in the letters of the keyword (minus
duplicates) from left to right and from top to bottom, and then filling in the remainder of the matrix with
the remaining letters in alphabetical order.

The letter i and j count as one letter. Plaintext is encrypted two letters at a time according to the following
rules:
Repeating plaintext letters that would fall in the same pair are separated with a filler letter such as „x‟.

Plaintext letters that fall in the same row of the matrix are each replaced by the letter to the right, with the first element
of the row following the last.

Plaintext letters that fall in the same column are replaced by the letter beneath, with the top element of the column
following the last.

Otherwise, each plaintext letter is replaced by the letter that lies in its own row and the column occupied by the other
plaintext letter. UNIT I 26/12/2024 30
Playfair cipher  Plaintext = meet me at the school
M O N A R house

C H Y B D  Splitting two letters as a unit => me et


me at th es ch ox ol ho us ex
E F G I/J K  Corresponding cipher text => CL KL
CL RS PD IL HY AV MP HF XL IU
L P Q S T 

 Strength of playfair cipher


U V W X Z
◦ Playfair cipher is a great advance over
simple mono alphabetic ciphers.

◦ Since there are 26 letters, 26x26 = 676


diagrams are possible, so identification of
individual digram is more difficult.

◦ Frequency analysis is much more difficult.



UNIT I 26/12/2024 31
problem

UNIT I 26/12/2024 32
Polyalphabetic ciphers

 Another way to improve on the simple mono alphabetic technique is to


use different mono alphabetic substitutions as one proceeds through the
plaintext message.
 The general name for this approach is polyalphabetic cipher. All the

techniques have the following features in common.

◦ A set of related mono alphabetic substitution rules are used


◦ A key determines which particular rule is chosen for a given transformation.

UNIT I 26/12/2024 33
Vigenere cipher
 In this scheme, the set of related mono alphabetic substitution rules consisting of 26
caesar ciphers with shifts of 0 through 25. Each cipher is denoted by a key letter. e.g.,

 Caesar cipher with a shift of 3 is denoted by the key value 'd‟ (since a=0, b=1, c=2 and
so on). To aid in understanding the scheme, a matrix known as vigenere tableau is
constructed.

 Each of the 26 ciphers is laid out horizontally, with the key letter for each cipher to its
left. A normal alphabet for the plaintext runs across the top. The process of encryption is
simple: Given a key letter X and a plaintext letter y, the cipher text is at the intersection
of the row labeled x and the column labeled y; in this case, the ciphertext is V.

 To encrypt a message, a key is needed that is as long as the message. Usually, the key is
a repeating keyword.

UNIT I 26/12/2024 34
Vigenere cipher
 Strength of Vigenere cipher
 There are multiple cipher text letters for each plaintext letter
 Letter frequency inforamiton is obscured.

 One Time Pad Cipher


 It is an unbreakable cryptosystem. It represents the message as a sequence of 0s and 1s. this can be accomplished by writing all
numbers in binary, for example, or by using ASCII. The key is a random sequence of 0‟s and 1‟s of same length as the
message.
 Once a key is used, it is discarded and never used again. The system can be expressed as follows: C i = Pi Ki
 Ci - ith binary digit of cipher text Pi - ith binary digit of plaintext Ki - ith binary digit of key – exclusive OR opearaiton
 Thus the cipher text is generated by performing the bitwise XOR of the plaintext and the key. Decryption uses the same key.
Because of the properties of XOR, decryption simply involves the same bitwise operation:
 Pi = Ci Ki

 e.g., plaintext = 0 0 1 0 1 0 0 1
 Key =10101100

 ciphertext = 1 0 0 0 0 1 0 1

UNIT I 26/12/2024 35
Vigenere cipher
 Advantage:
◦ Encryption method is completely unbreakable for a ciphertext only attack.
 Disadvantages
◦ It requires a very long key which is expensive to produce and expensive to transmit.
◦ Once a key is used, it is dangerous to reuse it for a second message; any knowledge on the first message
would give knowledge of the second.

UNIT I 26/12/2024 36
Vigenere cipher - problem

UNIT I 26/12/2024 37
Cond.,

UNIT I 26/12/2024 38
Vigenere cipher method 2

UNIT I 26/12/2024 39
UNIT I 26/12/2024 40
UNIT I 26/12/2024 41
TRANSPOSITION TECHNIQUES

 All the techniques examined so far involve the substitution of a cipher text
symbol for a plaintext symbol. A very different kind of mapping is achieved by
performing some sort of permutation on the plaintext letters. This technique is
referred to as a transposition cipher.
1.Rail fence
 Rail fence is simplest of such cipher, in which the plaintext is written down as

a sequence of diagonals and then read off as a sequence of rows.


 Plaintext = meet at the school house
 To encipher this message with a rail fence of depth 2, we write the message as

follows:
 meat eco lo s
 e t th sHohue
 The encrypted message is
 MEATECOLOSETTHSHOHUE
UNIT I 26/12/2024 42
Row Transposition Ciphers
 2.Row Transposition Ciphers-A more complex scheme is
to write the message in a rectangle, row by row, and read the
message off, column by column, but permute the order of
the columns. The order of columns then becomes
Key = 4 3
the
1
key
2 5
of6 7
the algorithm. PT = m e e t a t t
 e.g., plaintext = meet at the school house h e s c h o o
 CT = ESOTCUEEHMHLAHSTOETO l h o u s e
 A pure transposition cipher is easily recognized because it
has the same letter frequencies as the original plaintext. The
transposition cipher can be made significantly more secure
by performing more than one stage of transposition. The
result is more complex permutation that is not easily
reconstructed.
UNIT I 26/12/2024 43
INTRODUCTION TO NUMBER THEORY

Primality Testing and RSA


 The first stage of key-generation for RSA involves finding two
large primes p, q
 Because of the size of numbers used, must find primes by
trial and error
 Modern primality tests utilize properties of primes eg:
 an-1 = 1 mod n where GCD(a,n)=1
 all primes numbers 'n' will satisfy this equation
 some composite numbers will also satisfy the equation, and
are called pseudo- primes.
 Most modern tests guess at a prime number 'n', then take a
large number (eg 100) of numbers 'a', and apply this test to
each.
 If it fails the number is composite, otherwise it is is probably
prime.
There are a number of stronger tests which will accept fewer composites as prime than
the above test
 RSA Implementation in Practice
 Software implementations
 generally perform at 1-10 bits/second on block sizes
of 256-512 bits
 two main types of implementations:
 - on micros as part of a key exchange mechanism
in a hybrid scheme
 - on larger machines as components of a secure
mail system
 Harware Implementations
 generally perform 100-10000 bits/sec on blocks
sizes of 256-512 bits
 all known implementations are large bit length
conventional ALU units
 Euler Totient Function [[phi]](n)
 if consider arithmetic modulo n, then a reduced set of residues is a subset of
the complete set of residues modulo n which are relatively prime to n
 eg for n=10,
 the complete set of residues is {0,1,2,3,4,5,6,7,8,9}
 the reduced set of residues is {1,3,7,9}
 the number of elements in the reduced set of residues is called the Euler
Totient function [[phi]](n)
 there is no single formula for [[phi]](n) but for various cases count how many
elements are excluded:
 p (p prime) [[phi]](p) =p-1
 pr (p prime) [[phi]](p) =pr-1(p-1)
 p.q (p,q prime) [[phi]](p.q) =(p-1)(q-1) several important

results based on [[phi]](n) are:


 Theorem (Euler's Generalization)
 let gcd(a,n)=1 then

a[[phi]](n) mod n=1


 Fermat's Theorem
 let p be a prime and gcd(a,p)=1 then
 ap-1 mod p = 1
 Algorithms to find Inverses a-1 mod n
 search 1,...,n-1 until an a-1 is found with a.a-1 mod n
 if [[phi]](n) is known, then from Euler's Generalization

a-1 = a[[phi]](n)-1 mod n


 otherwise use Extended Euclid's algorithm for inverse
 Computing with Polynomials in GF(qn)
 have seen arithmetic modulo a prime number GF(p)
 also can do arithmetic modulo q over polynomials of degree n, which also
form a Galois Field GF(qn)
 its elements are polynomials of degree (n-1) or lower
 o a(x)=an-1xn-1+an-2xn-2+...+a1x+a0
 have residues for polynomials just as for integers
 p(x)=q(x)d(x)+r(x)
 and this is unique if deg[r(x)]<deg[d(x)]
 if r(x)=0, then d(x) divides p(x), or is a factor of p(x)
 addition in GF(qn) just involves summing equivalent terms in the polynomial
modulo q (XOR if q=2)
 o a(x)+b(x)=(an-1+bn-1)xn-1+...+(a1+b1)x+(a0+b0)
 Multiplication with Polynomials in GF(qn)
 multiplication in GF(qn) involves
 multiplying the two polynomials together (cf longhand multiplication; here use
shifts & XORs if q=2)
 then finding the residue modulo a given irreducible polynomial of degree n
 an irreducible polynomial d(x) is a 'prime' polynomial, it has no polynomial
divisors other than itself and 1
 modulo reduction of p(x) consists of finding some r(x) st: p(x)=q(x)d(x)+r(x)
 nb. in GF(2n) with d(x)=x3+x+1 can do simply by replacing x3 with x+1
 eg in GF(23) there are 8 elements:

o 0, 1, x, x+1, x2, x2+1, x2+x, x2+x+1
 with irreducible polynomial d(x)=x3+x+1* arithmetic in this field can be
summarised as:
 can adapt GCD, Inverse, and CRT algorithms for GF(qn)
 [[phi]](p(x)) = 2n-1 since every poly except 0 is relatively prime to p(x)
 arithmetic in GF(qn) can be much faster than integer arithmetic, especially if
the irreducible polynomial is carefully chosen
 eg a fast implementation of GF(2127) exists
 RSA and the Chinese Remainder Theorem
 a significant improvement in decryption speed for RSA can be obtained by
using the Chinese Remainder theorem to work modulo p and q respectively
 since p,q are only half the size of R=p.q and thus the arithmetic is much faster
 CRT is used in RSA by creating two equations from the decryption
calculation:
 M = Cd mod R as follows:
 M1 = M mod p = (C mod p)d mod (p-1) M2 = M mod q =
(C mod q)d mod (q-1)
 then the pair of equations
 M = M1 mod p M = M2 mod q has a unique solution by
the CRT, given by:
 M = [((M2 +q - M1)u mod q] p + M1
 where
 p.u mod q = 1
FINITE FIELDS

 Groups, Rings and Field:


 Group: A set of elements that is closed with respect to some operation.
 Closed-> The result of the operation is also in the set
 The operation obeys:
 Obeys associative law: (a.b).c = a.(b.c)
 Has identity e: e.a = a.e = a
 Has inverses a-1: a.a-1 = e
 Abelian Group: The operation is commutative
 a.b = b.a
 Example: Z8, + modular addition, identity =0
 Cyclic Group
 Exponentiation: Repeated application of operator
 example: a3 = a.a.a
 Cyclic Group: Every element is a power of some fixed element, i.e., b = ak
 for some a and every b in group a is said to be a
generator of the group
 Example: {1, 2, 4, 8} with mod 12 multiplication, the generator is 2.
 20=1, 21=2, 22=4, 23=8, 24=4, 25=8
 Ring:
 A group with two operations: addition and multiplication
 The group is abelian with respect to addition: a+b=b+a
 Multiplication and additions are both associative:
 a+(b+c)=(a+b)+c a.(b.c)=(a.b).c
 Multiplication distributes over addition, a.(b+c)=a.b+a.c
 Commutative Ring: Multiplication is commutative, i.e., a.b = b.a
 Integral Domain: Multiplication operation has an identity and no zero
divisors
 Field:
 An integral domain in which each element has a

multiplicative inverse
 Modular Arithmetic
 modular arithmetic is 'clock arithmetic'
 a congruence a = b mod n says when divided by n that a and b have the
same remainder

100 = 34 mod 11
o
 usually have 0<=b<=n-1
 -12mod7 = -5mod7 = 2mod7 = 9mod7
 b is called the residue of a mod n
 can do arithmetic with integers modulo n with all results between 0 and n
 Addition
 a+b mod n
 Subtraction
 a-b mod n = a+(-b)
 Multiplication
 a.b mod n
 derived from repeated addition
 can get a.b=0 where neither a,b=0

◦ eg 2.5 mod 10
 mod n
 Division
 a/b mod n
 is multiplication by inverse of b: a/b = a.b -1 mod n
 if n is prime b-1 mod n exists s.t b.b-1 = 1 mod n
 o eg 2.3=1 mod 5 hence 4/2=4.3=2 mod 5
 integers modulo n with addition and multiplication form a

commutative ring with the laws of


 Associativity : (a+b)+c = a+(b+c) mod n
Commutativity : a+b = b+a mod n Distributivity :
(a+b).c = (a.c)+(b.c) mod n
 also can chose whether to do an operation and then

reduce modulo n, or reduce then do the operation, since


reduction is a homomorphism from the ring of integers to
the ring of integers modulo n
◦ a+/-b mod n = [a mod n +/- b mod n] mod n
◦ (the above laws also hold for multiplication)
 if n is constrained to be a prime number p then this
forms a Galois Field modulo p
 denoted GF(p) and all the normal laws associated with

integer arithmetic work


 Greatest Common Divisor
 the greatest common divisor (a,b) of a and b is the largest number that divides evenly into
both a and b
 Euclid's Algorithm is used to find the Greatest Common Divisor (GCD) of two numbers a
and n, a<n

o use fact if a and b have divisor d so does a-b, a-2b GCD (a,n) is
given by:
 let g0=n g1=a
 gi+1 = gi-1 mod gi
 when gi=0 then (a,n) = gi-1 eg find (56,98)
 g0=98 g1=56
 g2 = 98 mod 56 = 42
 g3 = 56 mod 42 = 14
 g4 = 42 mod 14 = 0
 hence (56,98)=14
 Finite Fields or Galois Fields
 Finite Field: A field with finite number of elements
 Also known as Galois Field
 The number of elements is always a power of a
prime number. Hence, denoted as GF(pn)
 GF(p) is the set of integers {0,1, …, p-1} with
arithmetic operations modulo prime p
 Can do addition, subtraction, multiplication, and
division without leaving the field GF(p)
 GF(2) = Mod 2 arithmetic GF(8) = Mod 8 arithmetic
 There is no GF(6) since 6 is not a power of a prime
 Polynomial Arithmetic
 f(x) = a xn + a xn-1
+ …+ a x + a = Σ a xi
n n-1 1 0 i
 Ordinary polynomial arithmetic:
◦ Add, subtract, multiply, divide polynomials,
◦ Find remainders, quotient.
◦ Some polynomials have no factors and are prime.
 Polynomial arithmetic with mod p coefficients
 Polynomial arithmetic with mod p coefficients and mod

m(x) operations
 Polynomial Arithmetic with Mod 2 Coefficients
◦ All coefficients are 0 or 1, e.g.,
 let f(x) = x3 + x2 and g(x) = x2 + x + 1
 f(x) + g(x) = x3 + x + 1
 f(x) x g(x) = x5 + x2

◦ Polynomial Division: f(x) = q(x) g(x) + r(x)


◦ can interpret r(x) as being a remainder
◦ r(x) = f(x) mod g(x)
◦ if no remainder, say g(x) divides f(x)
◦ if g(x) has no divisors other than itself & 1 say it is irreducible (or
prime) polynomial
◦ Arithmetic modulo an irreducible polynomial forms a finite field
 Can use Euclid‟s algorithm to find gcd and inverses.

You might also like