Transposition and Diffi
Transposition and Diffi
Transposition and Diffi
Cryptographic
Techniques
By:- Jitendra Goyal
1. Rail-fence Technique
2. Simple Columnar transposition
2. Simple Columnar transposition
(with multiple rounds)
2. Simple Columnar transposition
(with multiple rounds)
3. Vernam Cipher (One-Time Pad)
Diffie-Hellman Key Exchange
Symmetric Key
Exchange Algorithm
Diffie-Hellman Key Exchange
• Diffie and Hellman published the first public key algorithm
• Referred to as Diffie-Hellman Key Exchange
• Used in various commercial products.
• Oldest public key system still in use
• Less general than RSA
• It does neither encryption nor signatures
8
Diffie-Hellman Key Exchange
• Diffie-Hellman key exchange depends for its effectiveness on the difficulty of computing
discrete logarithms:
• We define a generator or primitive or primitive root of a prime number p as one whose powers
generate all the integers from 1 to p - 1. So, if a is a primitive root of p, then the numbers:
a mod p, a2 mod p, a3 mod p, ... ap-1 mod p
are distinct and consist of the integers from 1 through p - 1 (in some permutation)
• For any integer b and a generator a of p, we can find a unique exponent i such that:
• The exponent i is referred to as the discrete logarithm (or index) of b for the base a, mod p. It is the
inverse of modular exponentiation, and finding the discrete logarithm i, given b, is known to be a hard
problem. b a i mod p where 0 i ( p - 1)
9
Diffie-Hellman Key Exchange
• Here is what Diffie-Hellman key exchange involves:
• First, Alice and Bob agree on a large prime n, and g, such that g is a generator
mod p. The numbers don't have to be secret.
• Then the protocol goes as follows:
1) Alice chooses a random large integer x and sends Bob
X = gx mod n
2) Bob chooses a random large integer y and sends Alice
Y = gy mod n
3) Alice computes k = Y x mod n = g xy mod n
k = Yx mod n
= X y mod n = k '
4) Bob computes
k' = Xy mod n
10
Diffie-Hellman Key Exchange
• This protocol can also be extended to work with three or more people:
1) Alice chooses a random large 5) Bob sends Carol
integer x and sends Bob
X' = Xy mod n
X = gx mod n
6) Carol sends Alice
2) Bob chooses a random large integer Y' = Yz mod n
y and sends Carol
Y = gy mod n 7) Alice computes
k = Y'x mod n
3) Carol chooses a random large
integer z and sends Alice 8) Bob computes
Z = gz mod n k = Z'y mod n
4) Alice sends Bob 9) Carol computes
Z' = Zx mod n k = X'z mod n
11
Man-in-the-Middle Attack
• One problem with Diffie-Hellman is that there is no
authentication, and so the protocol is subject to a man-in-the-
middle attack:
• Alice generates gx and sends it to "Bob"
• Eve intercepts the message:
• Generates gv, and sends it to Bob in place of Alice's message
• Bob receives gv, generates gy, and sends it to "Alice"
• Eve intercepts the message:
• Generates gw, and sends it to Alice in place of Bob's message
• Alice computes k = (gw)x
• Bob computes k' = (gv)y
• Eve computes k = (gx)w and k' = (gy)v
12
Man-in-the-Middle Attack
• There are a number of techniques to defend against such an attack:
• Each person can have a "somewhat permanent" public and secret number,
instead of creating one for each message exchange. This can be considered to
be a kind of Digital Phonebook.
• If Alice and Bob share some kind of secret which then can use to authenticate
each other, then they can use this secret to verify each other's messages
indeed came from the person they expected.
13
• G1mod p=x1
• G2mod p = x2