SlideShare ist ein Scribd-Unternehmen logo
1 von 64
Network Security
CS-3-4
By: Prof. Ganesh Ingle
Session 2 objective
CS -3 Introduction Previous Session revision
CS -3 Random Number and its Types
CS -3 TRNG, PRNG, CHPRNG and Review of BBS
CS -3 Stream Ciphering, RC4 algorithm
CS-4 Basic Number Theory,Extended Euclidean Algorithm
CS-4 Polynomial Arithmetic
SUMMARY
3
Random Number and its Types
4
Random Number and its Types
5
Random Number and its Types
 True Random number generator
 Pseudo Random number generator
 Case Study: Linux Random Number Generator
 Feedback shift registers.
 Lagged Fibonacci generator.
 Linear congruential generator.
 Case Study: RSA Key Generation
 Nuclear decay
6
 A sequence of random numbers R1, R2, …, must have two important
statistical properties:
 Uniformity
 Independence.
 Random Number, Ri, must be independently drawn from a uniform
distribution with pdf: pdf for random
numbers


 

otherwise,0
10,1
)(
x
xf
2
1
2
)(
1
0
21
0
 
x
xdxRE
  
12
1
4
1
3
1
2
1
3
)(
21
0
3
21
0
2






 
x
REdxxRV
Properties of Random Numbers
7
 Uniformity: If the interval [0,1] is divided into n
classes, or subintervals of equal length, the expected
number of observations in each interval is N/n, where
N is the total number of observations
 Independence: The probability of observing a value in
a particular interval is independent of the previous
value drawn
Properties of Random Numbers
8
Random Number and its Types
9
Random Number and its Types
10
Random Number and its Types
11
Random Number and its Types
12
Random Number and its Types
13
Random Number and its Types
14
Random Number and its Types
15
Random Number and its Types
16
Random Number Generator
17
Random Number Generator
18
Random Number Generator
19
Random Number Generator
20
Random Number Generator
21
Random Number Generator
22
Random Number Generator
23
Random Number Generator
24
Random Number Generator
25
Random Number Generator
26
Stream Cipher and properties
27
RC4
28
RC4
29
RC4
 Encryption
 Array initialization
 KSA (Shuffle)
 The PRGA(Shuffle)
 Encrypt Using RC4 (run
KSA+PRGA)
 Decryption
 XOR
 (A xor B) xor( B)= A
 A XOR B :
30
RC4
31
RC4
32
RC4
33
RC4
34
Sources
 The Basics of Abstract Algebra, Paul E. Bland, Freeman
 Introduction to Cryptography with Java Applets, David Bishop, Jones
& Bartlett
 Practical Cryptography, Niels Ferguson and Bruce Schneier, Wiley
 Concrete Mathematics, Graham, Knuth, and Patashnik, Addison-
Wesley
 Network Security: Private Communications in a Public World, Second
Edition Charlie Kaufman, Radia Perlman, Mike Speciner, Prentice-Hall
 Applied Cryptography: Protocols, Algorithms and Source Code in C,
Second Edition, Bruce Schneier, Wiley
 Cryptography and Network Security: Principles and Practices, William
Stallings, Prentice-Hall
 and a number of web sites...
Basic Number Theory
35
NUMBERS
 PRIME NUMBRE
 COMPOSITE NUMBER
 EVEN NUMBER ODD NUMBER
 SPECIAL NUMBER
 ADAM NUMBER
 N NARCISTIC NUMBER
 MAGIC NUMBER
 PERFECT NUMBER

Basic Number Theory
 Program
implementation
demo to be shown
 Calculating GCD
36
NUMBERS
 PRIME NUMBRE :
 Any number having only two factors is PRIME
 Any number is either a prime or product of prime
Basic Number Theory
37
PRIME NUMBERS
Basic Number Theory
Extended Euclid Algorithm
Extended Euclid Algorithm
 Given K=20, in Domain=73
 K-1 = ?????
 GCD(20,73)=1 then and only then multiplicative inverse of k is possible
 To calculate t=t1-(q*t2)
K-1 for K=20 thin the domain 73 is 11
q r1 r2 r
3 73 20 13
1 20 13 7
1 13 7 6
1 7 6 1
6 6 1 0
1 0
t1 t1 t
0 1 -3
1 -3 4
-3 4 -7
4 -7 11
-7 11 -73
11 -73
40
 Modular Arithmetic is one of the main tools provided
by number theory
 The quotient of n divided by m is , where m and n are
positive integers
 The remainder of this division is called 'n mod m‘
 So, the following holds:
where the first term is the quotient and the second the
remainder.
 mn /
  mnmnmn mod/ 
Basic Number Theory
Modular Arithmetic : Solving example
41
 Another way of putting this is:
 Given any positive integer n and any integer m, if we divide m
by n, we get an integer quotient, q, and integer remainder, r,
that obey the following relationship:
 The remainder, r, is often referred to as a residue of m
modulo n, and is the smallest non-negative integer that
differs from m by a multiple of n.
For example,
 )/;0( nmqnrrqnm 
337)2(11;7;11
447111;7;11


rnm
rnm
Basic Number Theory
Modular Arithmetic
42
 Two integers, a and b are said to be congruent (denoted by )
if:
that is, "a is congruent to b modulo m"
 Alternatively, in arithmetic modulo m, a and b are equivalent
if their difference, (a - b), is a multiple of m; that is, m | (a - b)
 The set of integers Zm = {0,1, ... m - 1} form the complete set
of residues modulo m -- there are only m different integers,
mod m
 The operation a mod m denotes the residue of a, such that the
residue is some integer from 0 to m - 1. This operation is known
as a modular reduction.
 Example:
mbmamba modmod)(mod 

)210(|4because)4(mod210 
Basic Number Theory
Modular Arithmetic
43
 Congruence is an equivalence relation --
that is, it satisfies:
 Finding the smallest non-negative integer to
which k is congruent modulo n is called
reducing k modulo n
cacba
abba
aa



:The3)
:The2)
:The1)
lawtransitive
lawsymmetric
lawreflexive
Basic Number Theory
Modular Arithmetic
44
 We can also add and subtract congruent
elements without losing congruence:
 Multiplication also works:
)(mod
)(modand
mdbca
mdbcadcba


b, cmbdacdcba integersfor,)(modand 
Basic Number Theory
Modular Arithmetic
45
 Modular arithmetic is like ordinary arithmetic. It
is:
 commutative (for addition and multiplication)
a + b = b + a
 associative
(a + b) + c = a + (b + c)
and
 distributive
a(b + c) = (ab) + (ac)
and
(b + c)a = (ba) + (ca)
Basic Number Theory
Modular Arithmetic
46
Modular Arithmetic
 A very important property of modular arithmetic is:
 Reducing each intermediate result modulo m yields the
same result as doing the entire calculation, and then
reducing the result to modulo m:
 This means that we can do modular arithmetic without
worrying about whether we will exceed some large
arithmetic bound -- so such calculations can be done on
computers, even for large integer values.
mmcambamcba
mmbmamba
mmbmamba
mmbmamba
mod))mod)(()mod)(((mod))((
mod))mod()mod((mod)(
mod))mod()mod((mod)(
mod))mod()mod((mod)(




Basic Number Theory
47
 Here are the possible values of (a + b)
mod 8:
and (a·b) mod 8:
Try a Java applet which
demonstrates modular
arithmetic
Basic Number Theory
Modular Arithmetic
48
 Recall that exponentiation is defined:
 In ordinary arithmetic, exponentiation rapidly produces very
large numbers
 However, because of the important property of modular
arithmetic that intermediate results can be computed mod m,
then is is possible in mod m arithmetic to do powerful
exponentiation without producing very large numbers
 Remember, in cryptography, we'll be dealing with very large
values of m, so this is important.
aa'a'a
n-aaaa
ea
n-n
n
ofinversetheiswhere,)(
times)1applied(i.e.
elementidentitythe,0




Basic Number Theory
Modular Arithmetic
Exponentiation
49
Modular Arithmetic: Exponentiation
 For example, instead of performing the calculation:
we can instead perform fewer multiplications and use
intermediate modular reductions.
 Let's take a specific case of a8 mod n. We can calculate it:
 Similarly:
)(mod aaaaaman
 
mmmama mod)mod)mod((mod 2228

mammmmamama
mmmmama
mod))mod)mod)mod)mod))mod(((((((mod
mod)mod)mod)mod(((mod
222225
222216


Basic Number Theory
50
Modular Arithmetic: Division
 So far, for mod m arithmetic, we have addition, subtraction (defined
through an additive inverse), and multiplication.
 What about division?
 Division is defined through a multiplicative inverse.
 In regular arithmetic:
 The multiplicative inverse of 5 is 1/5, because 5·1/5 = 1
 In modular arithmetic, things are not so easy:
which is equivalent to finding an x and a k (both integers) such that:
5x = 7k + 1
 The general problem is to find x such that:
)7(mod15where,Find  xx
)(mod
:or
mod)(1
1
mxa
mxa



Basic Number TheoryBasic Number Theory
Basic Number Theory
Modular Arithmetic: Division
Basic Number Theory
52
Modular Arithmetic: Multiplicative Inverse
 Sometimes the modular multiplicative
inverse has a solution, and sometimes it
doesn't:
 The inverse of 5, mod 14, is 3
5*3 mod 14 = 1
 The inverse of 2, mod 14, doesn't exist.
Look at the row for 2, at right;
It does not contain a value 1
 It turns out that has
a solution iff a and n are relatively
prime.
 For example, look at the rows to the right.
 The only rows that contain a 1 are for
values that are relatively prime to 14:
1, 3, 5, 9, 11, 13
)(mod1
mxa 
The mod 14 multiplication
table.
Basic Number Theory
53
Modular Arithmetic: Multiplicative Inverse
 One way of finding the inverse of a modulo m is to extend
Euclid's greatest common divisor algorithm:
 The Extended Euclidean Algorithm:
 While computing gcd(a, m), we can also find two integers u and
v such that:
gcd(a, m) = ua + vm
 If a and m are relatively prime, then the gcd(a, m) = 1, and:
1 = ua + vm = ua (mod m) (performing a reduction mod m)
and then, multiplying both sides by a-1:
a-1 = ua·a-1 = u
 So, if gcd(a, m) = 1, then u is the multiplicative inverse of a mod m;
otherwise, there is no multiplicative inverse
Basic Number Theory
54
Finite, or Galois Fields
 A finite field (also known as a Galois* Field) is a field
with a finite number of elements. Finite fields are
critical to the success of many cryptographic
algorithms.
 The finite fields are completely known:
 It can be shown that the order of a finite field (number of elements in the
field) must be a power of a prime, pn, where n is a positive integer.
 For a given prime, p, the finite field of order p, GF(p) is
defined as the set Zp of integers {0, 1, ... , p - 1}, together
with the arithmetic operations modulo p.
*Evariste Galois (1811-1832), French
mathematician
Basic Number Theory
55
Modular Arithmetic
 Here are the values for (a + b) mod 2:
and (a·b) mod 2:
Notice anything?
baba
baba
2mod)(
2mod)(
AND
XOR


Try a Java applet which demonstrates modular
arithmetic
Basic Number Theory
56
Modular Arithmetic
 Another useful feature of arithmetic mod
2 is:
 In the field Z2, ({0, 1}), there is only one inversion
possible:
1/1 = 1
so division is the same operation as multiplication!
 Not surprisingly, the field Z2 is an
important tool to analyze certain
cryptographic algorithms by computer.
Basic Number Theory
57
Modular Arithmetic
 Cryptography uses modular arithmetic a great deal, because:
 Calculating discrete logarithms and square roots mod n can be
hard problems.
 It's easier to work with on computers, because it restricts the
range of all intermediate values and results
 For a k-bit modulus, n, the intermediate results of any addition, subtraction, or
multiplication will not exceed 2k bits in length.
 We can perform modular exponentiation without generating huge intermediate results
 Arithmetic operations, mod 2, are natural for computers, because of the equivalence of
addition with XOR, and multiplication with AND, etc.
Basic Number Theory
58
Zn*
 Z is the set of all integers
 We've seen that Zn is the set of integers mod n
 Z10 = {0,1,2,3,4,5,6,7,8,9}
 Zn* is defined as the set of mod n integers that are
relatively prime to n
 Z10* = {1,3,7,9} (0 is missing because gcd(0, 10)
= 10)
Basic Number Theory
59
Zn*
 The multiplication table for Z10* provides some
surprises:
 Notice anything?
1 3 7 9
1 1 3 7 9
3 3 9 1 7
7 7 1 9 3
9 9 7 3 1
• Every element in Z10* is present in the table, and no
other elements other than those are present.
Furthermore, every element in Z10* is present in every
row of the table.
What does this mean for Z10*?
• It turns out that this is true for all n:
Zn* is closed under multiplication mod n
Basic Number Theory
60
Fermat's Little Theorem
 *Fermat's Little Theorem states:
 If p is prime and a is a positive integer not divisible by p,
then:
 If we multiply both sides by a, we can come up with an
alternative form:
*Pierre de Fermat (1601 - 1665), French mathematician most
famous for Fermat's Last Theorem, which was considered one of
mathematics' most difficult theorems, and has only recently
been finally proven. His Little Theorem has nothing to do with
his Last Theorem.
pap
mod11

paaaa pp
mod1

Basic Number Theory
61
Euler's Totient Function
 An important quantity in number theory is *Euler's
Totient Function:
 The number of positive integers less than n, that are
relatively prime to n.
 It is written :
 In other words, Euler's Totient Function is the
number of elements in Zn*
composite)(for1)(φ
prime)(for1)(φ
1)1(φ
mmm
ppp



)(φ n
*Leonhard Euler (1707 - 1783), Swiss mathematician
)(φ n
Basic Number Theory
62
Euler's Totient Function
 Assume we have two distinct prime numbers, p and q,
and an integer n = pq
 Then:
 The set of residues in Zn i s{0,1,...,(pq - 1)}
 The residues that are not relatively prime to n are:
 The set {p, 2p, ... ,(q - 1)p}, the set {q, 2q, ... ,(p - 1)q}, and
0
 So:
)1()1()(φ)(φ)(φ)(φ  qpqppqn
)(φ)(φ
)1()1(
1)(
]1)1()1[()(φ
qp
qp
qppq
pqpqn




Basic Number Theory
63
Euler's Totient Function
Euler Totient Function
0
5
10
15
20
25
30
35
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
n
Totient(n)
• Here is what the Euler Totient Function values look like for
small values of n. (The dotted red line is the line f(n) = n - 1)
Basic Number Theory
Thank you
Image Source
searchenterpriseai.techtarget.com
wikipedia

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Programming with matlab session 6
Programming with matlab session 6Programming with matlab session 6
Programming with matlab session 6
 
Ch8a
Ch8aCh8a
Ch8a
 
Ijarcet vol-2-issue-7-2323-2327
Ijarcet vol-2-issue-7-2323-2327Ijarcet vol-2-issue-7-2323-2327
Ijarcet vol-2-issue-7-2323-2327
 
Database Management System-session 3-4-5
Database Management System-session 3-4-5Database Management System-session 3-4-5
Database Management System-session 3-4-5
 
C programming & data structure [arrays & pointers]
C programming & data structure   [arrays & pointers]C programming & data structure   [arrays & pointers]
C programming & data structure [arrays & pointers]
 
Recursion | C++ | DSA
Recursion | C++ | DSARecursion | C++ | DSA
Recursion | C++ | DSA
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generation
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generation
 
Ch8b
Ch8bCh8b
Ch8b
 
Interm codegen
Interm codegenInterm codegen
Interm codegen
 
Primality
PrimalityPrimality
Primality
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1
 
10. Recursion
10. Recursion10. Recursion
10. Recursion
 
100 c interview questions answers
100 c interview questions answers100 c interview questions answers
100 c interview questions answers
 
Recursion
RecursionRecursion
Recursion
 
Intermediate code
Intermediate codeIntermediate code
Intermediate code
 
RSA-W7(rsa) d1-d2
RSA-W7(rsa) d1-d2RSA-W7(rsa) d1-d2
RSA-W7(rsa) d1-d2
 
Lecture 12 intermediate code generation
Lecture 12 intermediate code generationLecture 12 intermediate code generation
Lecture 12 intermediate code generation
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)   Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)
 

Ähnlich wie Network Security CS3-4

Modular Arithmetic and congruence of integers.ppt
Modular Arithmetic and congruence of integers.pptModular Arithmetic and congruence of integers.ppt
Modular Arithmetic and congruence of integers.pptJayLagman3
 
Modular Arithmetic concept in mathematics
Modular Arithmetic concept in mathematicsModular Arithmetic concept in mathematics
Modular Arithmetic concept in mathematicsIdcIdk1
 
DAA - UNIT 4 - Engineering.pptx
DAA - UNIT 4 - Engineering.pptxDAA - UNIT 4 - Engineering.pptx
DAA - UNIT 4 - Engineering.pptxvaishnavi339314
 
Justification of Montgomery Modular Reduction
Justification of Montgomery Modular ReductionJustification of Montgomery Modular Reduction
Justification of Montgomery Modular Reductionacijjournal
 
A study on number theory and its applications
A study on number theory and its applicationsA study on number theory and its applications
A study on number theory and its applicationsItishree Dash
 
Algorithm chapter 1
Algorithm chapter 1Algorithm chapter 1
Algorithm chapter 1chidabdu
 
1.02.Mathematical_background.pptx
1.02.Mathematical_background.pptx1.02.Mathematical_background.pptx
1.02.Mathematical_background.pptxPrachiDawer1
 
01 - DAA - PPT.pptx
01 - DAA - PPT.pptx01 - DAA - PPT.pptx
01 - DAA - PPT.pptxKokilaK25
 
Backtracking based integer factorisation, primality testing and square root c...
Backtracking based integer factorisation, primality testing and square root c...Backtracking based integer factorisation, primality testing and square root c...
Backtracking based integer factorisation, primality testing and square root c...csandit
 
Modeling and quantification of uncertainties in numerical aerodynamics
Modeling and quantification of uncertainties in numerical aerodynamicsModeling and quantification of uncertainties in numerical aerodynamics
Modeling and quantification of uncertainties in numerical aerodynamicsAlexander Litvinenko
 
Sample0 mtechcs06
Sample0 mtechcs06Sample0 mtechcs06
Sample0 mtechcs06bikram ...
 
Sample0 mtechcs06
Sample0 mtechcs06Sample0 mtechcs06
Sample0 mtechcs06bikram ...
 
How to invent a new cryptosystem.pdf
How to invent a new cryptosystem.pdfHow to invent a new cryptosystem.pdf
How to invent a new cryptosystem.pdfMihailIulianPlea1
 
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxCSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxmydrynan
 
Sienna 1 intro
Sienna 1 introSienna 1 intro
Sienna 1 introchidabdu
 

Ähnlich wie Network Security CS3-4 (20)

Modular Arithmetic and congruence of integers.ppt
Modular Arithmetic and congruence of integers.pptModular Arithmetic and congruence of integers.ppt
Modular Arithmetic and congruence of integers.ppt
 
Modular Arithmetic concept in mathematics
Modular Arithmetic concept in mathematicsModular Arithmetic concept in mathematics
Modular Arithmetic concept in mathematics
 
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
 
DAA - UNIT 4 - Engineering.pptx
DAA - UNIT 4 - Engineering.pptxDAA - UNIT 4 - Engineering.pptx
DAA - UNIT 4 - Engineering.pptx
 
Justification of Montgomery Modular Reduction
Justification of Montgomery Modular ReductionJustification of Montgomery Modular Reduction
Justification of Montgomery Modular Reduction
 
A study on number theory and its applications
A study on number theory and its applicationsA study on number theory and its applications
A study on number theory and its applications
 
Algorithm chapter 1
Algorithm chapter 1Algorithm chapter 1
Algorithm chapter 1
 
Subquad multi ff
Subquad multi ffSubquad multi ff
Subquad multi ff
 
1.02.Mathematical_background.pptx
1.02.Mathematical_background.pptx1.02.Mathematical_background.pptx
1.02.Mathematical_background.pptx
 
Cmb part3
Cmb part3Cmb part3
Cmb part3
 
01 - DAA - PPT.pptx
01 - DAA - PPT.pptx01 - DAA - PPT.pptx
01 - DAA - PPT.pptx
 
Backtracking based integer factorisation, primality testing and square root c...
Backtracking based integer factorisation, primality testing and square root c...Backtracking based integer factorisation, primality testing and square root c...
Backtracking based integer factorisation, primality testing and square root c...
 
ADA complete notes
ADA complete notesADA complete notes
ADA complete notes
 
Modeling and quantification of uncertainties in numerical aerodynamics
Modeling and quantification of uncertainties in numerical aerodynamicsModeling and quantification of uncertainties in numerical aerodynamics
Modeling and quantification of uncertainties in numerical aerodynamics
 
Sample0 mtechcs06
Sample0 mtechcs06Sample0 mtechcs06
Sample0 mtechcs06
 
Sample0 mtechcs06
Sample0 mtechcs06Sample0 mtechcs06
Sample0 mtechcs06
 
How to invent a new cryptosystem.pdf
How to invent a new cryptosystem.pdfHow to invent a new cryptosystem.pdf
How to invent a new cryptosystem.pdf
 
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxCSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
 
Sienna 1 intro
Sienna 1 introSienna 1 intro
Sienna 1 intro
 
Mtc ssample05
Mtc ssample05Mtc ssample05
Mtc ssample05
 

Mehr von Infinity Tech Solutions

Mehr von Infinity Tech Solutions (20)

Database management system session 6
Database management system session 6Database management system session 6
Database management system session 6
 
Database management system session 5
Database management system session 5Database management system session 5
Database management system session 5
 
Database Management System-session1-2
Database Management System-session1-2Database Management System-session1-2
Database Management System-session1-2
 
E commerce
E commerce E commerce
E commerce
 
E commerce
E commerceE commerce
E commerce
 
Bds session 13 14
Bds session 13 14Bds session 13 14
Bds session 13 14
 
Computer memory, Types of programming languages
Computer memory, Types of programming languagesComputer memory, Types of programming languages
Computer memory, Types of programming languages
 
Basic hardware familiarization
Basic hardware familiarizationBasic hardware familiarization
Basic hardware familiarization
 
User defined functions in matlab
User defined functions in  matlabUser defined functions in  matlab
User defined functions in matlab
 
Programming with matlab session 3 notes
Programming with matlab session 3 notesProgramming with matlab session 3 notes
Programming with matlab session 3 notes
 
AI/ML/DL/BCT A Revolution in Maritime Sector
AI/ML/DL/BCT A Revolution in Maritime SectorAI/ML/DL/BCT A Revolution in Maritime Sector
AI/ML/DL/BCT A Revolution in Maritime Sector
 
Programming with matlab session 5 looping
Programming with matlab session 5 loopingProgramming with matlab session 5 looping
Programming with matlab session 5 looping
 
BIG DATA Session 7 8
BIG DATA Session 7 8BIG DATA Session 7 8
BIG DATA Session 7 8
 
BIG DATA Session 6
BIG DATA Session 6BIG DATA Session 6
BIG DATA Session 6
 
MS word
MS word MS word
MS word
 
DBMS CS 4-5
DBMS CS 4-5DBMS CS 4-5
DBMS CS 4-5
 
DBMS CS3
DBMS CS3DBMS CS3
DBMS CS3
 
DBMS CS2
DBMS CS2DBMS CS2
DBMS CS2
 
DBMS CS1-2
DBMS  CS1-2DBMS  CS1-2
DBMS CS1-2
 
Programming with matlab session 4
Programming with matlab session 4Programming with matlab session 4
Programming with matlab session 4
 

Kürzlich hochgeladen

Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 

Kürzlich hochgeladen (20)

Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 

Network Security CS3-4

  • 2. Session 2 objective CS -3 Introduction Previous Session revision CS -3 Random Number and its Types CS -3 TRNG, PRNG, CHPRNG and Review of BBS CS -3 Stream Ciphering, RC4 algorithm CS-4 Basic Number Theory,Extended Euclidean Algorithm CS-4 Polynomial Arithmetic SUMMARY
  • 5. 5 Random Number and its Types  True Random number generator  Pseudo Random number generator  Case Study: Linux Random Number Generator  Feedback shift registers.  Lagged Fibonacci generator.  Linear congruential generator.  Case Study: RSA Key Generation  Nuclear decay
  • 6. 6  A sequence of random numbers R1, R2, …, must have two important statistical properties:  Uniformity  Independence.  Random Number, Ri, must be independently drawn from a uniform distribution with pdf: pdf for random numbers      otherwise,0 10,1 )( x xf 2 1 2 )( 1 0 21 0   x xdxRE    12 1 4 1 3 1 2 1 3 )( 21 0 3 21 0 2         x REdxxRV Properties of Random Numbers
  • 7. 7  Uniformity: If the interval [0,1] is divided into n classes, or subintervals of equal length, the expected number of observations in each interval is N/n, where N is the total number of observations  Independence: The probability of observing a value in a particular interval is independent of the previous value drawn Properties of Random Numbers
  • 10. 10 Random Number and its Types
  • 11. 11 Random Number and its Types
  • 12. 12 Random Number and its Types
  • 13. 13 Random Number and its Types
  • 14. 14 Random Number and its Types
  • 15. 15 Random Number and its Types
  • 26. 26 Stream Cipher and properties
  • 29. 29 RC4  Encryption  Array initialization  KSA (Shuffle)  The PRGA(Shuffle)  Encrypt Using RC4 (run KSA+PRGA)  Decryption  XOR  (A xor B) xor( B)= A  A XOR B :
  • 34. 34 Sources  The Basics of Abstract Algebra, Paul E. Bland, Freeman  Introduction to Cryptography with Java Applets, David Bishop, Jones & Bartlett  Practical Cryptography, Niels Ferguson and Bruce Schneier, Wiley  Concrete Mathematics, Graham, Knuth, and Patashnik, Addison- Wesley  Network Security: Private Communications in a Public World, Second Edition Charlie Kaufman, Radia Perlman, Mike Speciner, Prentice-Hall  Applied Cryptography: Protocols, Algorithms and Source Code in C, Second Edition, Bruce Schneier, Wiley  Cryptography and Network Security: Principles and Practices, William Stallings, Prentice-Hall  and a number of web sites... Basic Number Theory
  • 35. 35 NUMBERS  PRIME NUMBRE  COMPOSITE NUMBER  EVEN NUMBER ODD NUMBER  SPECIAL NUMBER  ADAM NUMBER  N NARCISTIC NUMBER  MAGIC NUMBER  PERFECT NUMBER  Basic Number Theory  Program implementation demo to be shown  Calculating GCD
  • 36. 36 NUMBERS  PRIME NUMBRE :  Any number having only two factors is PRIME  Any number is either a prime or product of prime Basic Number Theory
  • 39. Extended Euclid Algorithm  Given K=20, in Domain=73  K-1 = ?????  GCD(20,73)=1 then and only then multiplicative inverse of k is possible  To calculate t=t1-(q*t2) K-1 for K=20 thin the domain 73 is 11 q r1 r2 r 3 73 20 13 1 20 13 7 1 13 7 6 1 7 6 1 6 6 1 0 1 0 t1 t1 t 0 1 -3 1 -3 4 -3 4 -7 4 -7 11 -7 11 -73 11 -73
  • 40. 40  Modular Arithmetic is one of the main tools provided by number theory  The quotient of n divided by m is , where m and n are positive integers  The remainder of this division is called 'n mod m‘  So, the following holds: where the first term is the quotient and the second the remainder.  mn /   mnmnmn mod/  Basic Number Theory Modular Arithmetic : Solving example
  • 41. 41  Another way of putting this is:  Given any positive integer n and any integer m, if we divide m by n, we get an integer quotient, q, and integer remainder, r, that obey the following relationship:  The remainder, r, is often referred to as a residue of m modulo n, and is the smallest non-negative integer that differs from m by a multiple of n. For example,  )/;0( nmqnrrqnm  337)2(11;7;11 447111;7;11   rnm rnm Basic Number Theory Modular Arithmetic
  • 42. 42  Two integers, a and b are said to be congruent (denoted by ) if: that is, "a is congruent to b modulo m"  Alternatively, in arithmetic modulo m, a and b are equivalent if their difference, (a - b), is a multiple of m; that is, m | (a - b)  The set of integers Zm = {0,1, ... m - 1} form the complete set of residues modulo m -- there are only m different integers, mod m  The operation a mod m denotes the residue of a, such that the residue is some integer from 0 to m - 1. This operation is known as a modular reduction.  Example: mbmamba modmod)(mod   )210(|4because)4(mod210  Basic Number Theory Modular Arithmetic
  • 43. 43  Congruence is an equivalence relation -- that is, it satisfies:  Finding the smallest non-negative integer to which k is congruent modulo n is called reducing k modulo n cacba abba aa    :The3) :The2) :The1) lawtransitive lawsymmetric lawreflexive Basic Number Theory Modular Arithmetic
  • 44. 44  We can also add and subtract congruent elements without losing congruence:  Multiplication also works: )(mod )(modand mdbca mdbcadcba   b, cmbdacdcba integersfor,)(modand  Basic Number Theory Modular Arithmetic
  • 45. 45  Modular arithmetic is like ordinary arithmetic. It is:  commutative (for addition and multiplication) a + b = b + a  associative (a + b) + c = a + (b + c) and  distributive a(b + c) = (ab) + (ac) and (b + c)a = (ba) + (ca) Basic Number Theory Modular Arithmetic
  • 46. 46 Modular Arithmetic  A very important property of modular arithmetic is:  Reducing each intermediate result modulo m yields the same result as doing the entire calculation, and then reducing the result to modulo m:  This means that we can do modular arithmetic without worrying about whether we will exceed some large arithmetic bound -- so such calculations can be done on computers, even for large integer values. mmcambamcba mmbmamba mmbmamba mmbmamba mod))mod)(()mod)(((mod))(( mod))mod()mod((mod)( mod))mod()mod((mod)( mod))mod()mod((mod)(     Basic Number Theory
  • 47. 47  Here are the possible values of (a + b) mod 8: and (a·b) mod 8: Try a Java applet which demonstrates modular arithmetic Basic Number Theory Modular Arithmetic
  • 48. 48  Recall that exponentiation is defined:  In ordinary arithmetic, exponentiation rapidly produces very large numbers  However, because of the important property of modular arithmetic that intermediate results can be computed mod m, then is is possible in mod m arithmetic to do powerful exponentiation without producing very large numbers  Remember, in cryptography, we'll be dealing with very large values of m, so this is important. aa'a'a n-aaaa ea n-n n ofinversetheiswhere,)( times)1applied(i.e. elementidentitythe,0     Basic Number Theory Modular Arithmetic Exponentiation
  • 49. 49 Modular Arithmetic: Exponentiation  For example, instead of performing the calculation: we can instead perform fewer multiplications and use intermediate modular reductions.  Let's take a specific case of a8 mod n. We can calculate it:  Similarly: )(mod aaaaaman   mmmama mod)mod)mod((mod 2228  mammmmamama mmmmama mod))mod)mod)mod)mod))mod(((((((mod mod)mod)mod)mod(((mod 222225 222216   Basic Number Theory
  • 50. 50 Modular Arithmetic: Division  So far, for mod m arithmetic, we have addition, subtraction (defined through an additive inverse), and multiplication.  What about division?  Division is defined through a multiplicative inverse.  In regular arithmetic:  The multiplicative inverse of 5 is 1/5, because 5·1/5 = 1  In modular arithmetic, things are not so easy: which is equivalent to finding an x and a k (both integers) such that: 5x = 7k + 1  The general problem is to find x such that: )7(mod15where,Find  xx )(mod :or mod)(1 1 mxa mxa    Basic Number TheoryBasic Number Theory
  • 51. Basic Number Theory Modular Arithmetic: Division Basic Number Theory
  • 52. 52 Modular Arithmetic: Multiplicative Inverse  Sometimes the modular multiplicative inverse has a solution, and sometimes it doesn't:  The inverse of 5, mod 14, is 3 5*3 mod 14 = 1  The inverse of 2, mod 14, doesn't exist. Look at the row for 2, at right; It does not contain a value 1  It turns out that has a solution iff a and n are relatively prime.  For example, look at the rows to the right.  The only rows that contain a 1 are for values that are relatively prime to 14: 1, 3, 5, 9, 11, 13 )(mod1 mxa  The mod 14 multiplication table. Basic Number Theory
  • 53. 53 Modular Arithmetic: Multiplicative Inverse  One way of finding the inverse of a modulo m is to extend Euclid's greatest common divisor algorithm:  The Extended Euclidean Algorithm:  While computing gcd(a, m), we can also find two integers u and v such that: gcd(a, m) = ua + vm  If a and m are relatively prime, then the gcd(a, m) = 1, and: 1 = ua + vm = ua (mod m) (performing a reduction mod m) and then, multiplying both sides by a-1: a-1 = ua·a-1 = u  So, if gcd(a, m) = 1, then u is the multiplicative inverse of a mod m; otherwise, there is no multiplicative inverse Basic Number Theory
  • 54. 54 Finite, or Galois Fields  A finite field (also known as a Galois* Field) is a field with a finite number of elements. Finite fields are critical to the success of many cryptographic algorithms.  The finite fields are completely known:  It can be shown that the order of a finite field (number of elements in the field) must be a power of a prime, pn, where n is a positive integer.  For a given prime, p, the finite field of order p, GF(p) is defined as the set Zp of integers {0, 1, ... , p - 1}, together with the arithmetic operations modulo p. *Evariste Galois (1811-1832), French mathematician Basic Number Theory
  • 55. 55 Modular Arithmetic  Here are the values for (a + b) mod 2: and (a·b) mod 2: Notice anything? baba baba 2mod)( 2mod)( AND XOR   Try a Java applet which demonstrates modular arithmetic Basic Number Theory
  • 56. 56 Modular Arithmetic  Another useful feature of arithmetic mod 2 is:  In the field Z2, ({0, 1}), there is only one inversion possible: 1/1 = 1 so division is the same operation as multiplication!  Not surprisingly, the field Z2 is an important tool to analyze certain cryptographic algorithms by computer. Basic Number Theory
  • 57. 57 Modular Arithmetic  Cryptography uses modular arithmetic a great deal, because:  Calculating discrete logarithms and square roots mod n can be hard problems.  It's easier to work with on computers, because it restricts the range of all intermediate values and results  For a k-bit modulus, n, the intermediate results of any addition, subtraction, or multiplication will not exceed 2k bits in length.  We can perform modular exponentiation without generating huge intermediate results  Arithmetic operations, mod 2, are natural for computers, because of the equivalence of addition with XOR, and multiplication with AND, etc. Basic Number Theory
  • 58. 58 Zn*  Z is the set of all integers  We've seen that Zn is the set of integers mod n  Z10 = {0,1,2,3,4,5,6,7,8,9}  Zn* is defined as the set of mod n integers that are relatively prime to n  Z10* = {1,3,7,9} (0 is missing because gcd(0, 10) = 10) Basic Number Theory
  • 59. 59 Zn*  The multiplication table for Z10* provides some surprises:  Notice anything? 1 3 7 9 1 1 3 7 9 3 3 9 1 7 7 7 1 9 3 9 9 7 3 1 • Every element in Z10* is present in the table, and no other elements other than those are present. Furthermore, every element in Z10* is present in every row of the table. What does this mean for Z10*? • It turns out that this is true for all n: Zn* is closed under multiplication mod n Basic Number Theory
  • 60. 60 Fermat's Little Theorem  *Fermat's Little Theorem states:  If p is prime and a is a positive integer not divisible by p, then:  If we multiply both sides by a, we can come up with an alternative form: *Pierre de Fermat (1601 - 1665), French mathematician most famous for Fermat's Last Theorem, which was considered one of mathematics' most difficult theorems, and has only recently been finally proven. His Little Theorem has nothing to do with his Last Theorem. pap mod11  paaaa pp mod1  Basic Number Theory
  • 61. 61 Euler's Totient Function  An important quantity in number theory is *Euler's Totient Function:  The number of positive integers less than n, that are relatively prime to n.  It is written :  In other words, Euler's Totient Function is the number of elements in Zn* composite)(for1)(φ prime)(for1)(φ 1)1(φ mmm ppp    )(φ n *Leonhard Euler (1707 - 1783), Swiss mathematician )(φ n Basic Number Theory
  • 62. 62 Euler's Totient Function  Assume we have two distinct prime numbers, p and q, and an integer n = pq  Then:  The set of residues in Zn i s{0,1,...,(pq - 1)}  The residues that are not relatively prime to n are:  The set {p, 2p, ... ,(q - 1)p}, the set {q, 2q, ... ,(p - 1)q}, and 0  So: )1()1()(φ)(φ)(φ)(φ  qpqppqn )(φ)(φ )1()1( 1)( ]1)1()1[()(φ qp qp qppq pqpqn     Basic Number Theory
  • 63. 63 Euler's Totient Function Euler Totient Function 0 5 10 15 20 25 30 35 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 n Totient(n) • Here is what the Euler Totient Function values look like for small values of n. (The dotted red line is the line f(n) = n - 1) Basic Number Theory