Basic Cryptography Final
Basic Cryptography Final
• Classical Cryptography
• Public Key Cryptography
• Cryptographic Checksums
– Hash functions
Selects the key that is as long as the
plaintext.
It works on binary bits than letters
Ci=pi X-OR ki
Where ith cipher bit is equal to ith
plaintext bit X-OR with ith key bit.
• One-Time Pad
• A Vigenère cipher with a random key at least
as long as the message
• Example: (letter numbers from 0 to 25)
• Plain Text: H O W A R E Y O U
• 7 14 22 0 17 4 24 14 20
• One time pad N C B T Z Q A R X
• 13 2 1 19 25 16 0 17 23
• Initial total 16 23 19 42 20 24 31 43
• Substract 26 20 16 23 19 16 20 24 5 17
• ( if > 25)
• Cipher text UQXTQUYFR
LSH LSH
PC-2 K1
C1 D1
LSH LSH
PC-2 K16
IP
L0 R0
f K1
L1 = R0 R1 = L0 f(R0 , K1)
IPŠ1
output
S1 S2 S3 S4 S5 S6 S7 S8
32 bits
• init. vector • m1 • m2 • …
• DES • DES • …
• c1 • c2 • …
• sent • sent
• init. vector • c1 • c2 • …
• DES • DES • …
• m1 • m2 • …
Definition: A digital signature is a construct that authenticates both the
origin and contents of a message in a manner that is provable to a
disinterested third party.
RSA Digital signature:
suppose Alice is sending Bob her signature on a confidential contract m.
She enciphers it first and then signs it.
C= (meBob mod nBob )dAlice mod nAlice
• El Gamal Digital Signature
Similar
to Diffie-Hellman scheme and relies on the solving
of discrete log problem.
Choose a prime p and two random numbers g and d both
less than p.
Compute y= g d mod p ;
Public key is (y,g,p) , private key is d.
Supose Alice wants to send Bob a signed contract m.
Alice selects a number k that is relatively prime to p-1.
Computes a =g k mod p and find b using m=(da+kb) mod
p-1.
The pair (a,b) is the signature.
To verify the signature, check that; yaab mod p = g m
mod p
• El Gamal: Example
Alice chooses p=29 , g=3, and dAlice=6, yielding y =4.
She wants to send Bob the signed contract X(23).
She choose k=5, which is relatively prime to 28.
She computes a= 35 mod29=11. Solve for b using.
23=(6*11+5*b) mod 28. yields b= 25.
Alice send Bob m=23 and the signature (11, 25)
Bob wants to verify the signature, so he computes,
yaab mod p = 411 *1125 mod 29 =8, and
gm
mod p =323 mod 29 =8
Because the two match, Alice signed the message.
• Key Points
• Two main types of cryptosystems: classical
and public key
• Classical cryptosystems encipher and
decipher using the same key
– Or one key is easily derived from the other
• Public key cryptosystems encipher and decipher
using different keys
– Computationally infeasible to derive one from the other
• Cryptographic checksums provide a check on
integrity