CO-1 PPT 1
CO-1 PPT 1
COURSE TITLE:
INTRODUCTION TO BLOCKCHAIN &
CRYPTO CURRENCIES
COURSE CODE:
23CS3045RB
AIM OF THE
SESSION
To familiarize students with the basic concepts of Cryptography
INSTRUCTIONAL
OBJECTIVES
This Session is designed to:
Demonstrate Principles of Symmetric and Asymmetric Cryptography
LEARNING OUTCOMES
• Structure of cryptosystem
• Symmetric key cryptography
• Asymmetric key cryptography
• Caesar cipher
• Affine cipher
• Euclidean Algorithm for finding GCD(A,B)
• Miller–Rabin primality test
• Rabin Cryptosystem
THE LANGUAGE OF
CRYPTOGRAPHY
SYMMETRIC KEY VS. ASYMMETRIC KEY
Encryption Decryption
Same key
(shared secret)
PUBLIC KEY CRYPTOGRAPHY
PUBLIC KEY CRYPTOGRAPHY
Clear-text Input Cipher-text Clear-text Output
“The quick brown “Py75c%bn&*)9| “The quick brown fox
fox jumps over the fDe^bDFaq#xzjFr@g5=&n jumps over the lazy
lazy dog” mdFg$5knvMd’rkvegMs” dog”
Encryption Decryption
Different keys
private
public
In monoalphabetic
substitution, the relationship
between a symbol in the
plaintext to a symbol in the
ciphertext is always one-to-
one.
Additive Cipher
The simplest monoalphabetic cipher is the
additive cipher. This cipher is sometimes
called a shift cipher and sometimes a Caesar
cipher, but the term additive cipher better
reveals its mathematical nature.
Solution
We apply the encryption algorithm to the plaintext, character
by character:
Example 4
Solution
The ciphertext is
HOW DO YOU CALCULATE A GCD?
gcd Fact 1
If are positive integers, then gcd( = gcd()
gcd Fact 2
Let be a positive integer: gcd(
public int X(int m, int n){
if(m<n){
int temp = m;
m=n;
n=temp;
}
while(n != 0) {
int rem = m % n;
m=n;
n=rem;
}
return m;
}
EUCLID’S ALGORITHM
• gcd(660,126) while(n != 0) {
int rem = m % n;
m=n;
n=rem;
}
EUCLID’S ALGORITHM
• gcd(660,126)
Bézout’s Theorem
If and are positive integers, then there exist
integers and such that
gcd(a,b)
EXTENDED EUCLIDIAN ALGORITHM
gcd(35,27)
EXTENDED EUCLIDIAN ALGORITHM
The Rabin
cryptosystem is not
deterministic:
Decryption creates
four plaintexts.
Here is a very trivial example to show the idea.
1. Bob selects p = 23 and q = 7. Note that both are
congruent to 3 mod 4.
2. Bob calculates n = p × q = 161.
3. Bob announces n publicly; he keeps p and q private.
4. Alice wants to send the plaintext P = 24. Note that 161 and 24 are
relatively prime; 24 is in Z161*. She calculates C = 242 = 93 mod 161, and
sends the ciphertext 93 to Bob.
5. Bob receives 93 and calculates four values:
a1 = +(93 (23+1)/4) mod 23 = 1 mod 23
a2 = −(93 (23+1)/4) mod 23 = 22 mod 23
b1 = +(93 (7+1)/4) mod 7 = 4 mod 7
b2 = −(93 (7+1)/4) mod 7 = 3 mod 7
6. Bob takes four possible answers, (a1, b1), (a1, b2), (a2, b1), and (a2, b2), and uses
the Chinese remainder theorem to find four possible plaintexts: 116, 24, 137,
and 45. Note that only the second answer is Alice’s plaintext.
Netbeans 8.2
https://netbeans-ide.informer.com/8.2/
Thanks