Hash Functions: - Dr. Sanjay H A
Hash Functions: - Dr. Sanjay H A
Hash Functions: - Dr. Sanjay H A
- Dr. SANJAY H A
Cryptographic primitives
Stream
Plaintext
=
Ciphertext
Example of Stream Decryption
Key
Stream
Ciphertext
=
Plaintext
Block ciphers
Encryption algorithms that break up a text to be encrypted (plain
text) into blocks of fixed length
Apply encryption block by block.
Block ciphers are usually built using a design strategy known as
Fiestel cipher.
Block ciphers
Cryptographic hashes
Hash functions are basically used to compress a message to a fixed
length digest.
In this mode, block ciphers are used as a compression function to
produce a hash of plain text.
Electronic code book
This is a basic mode of operation in which the encrypted data is
produced as a result of applying the encryption algorithm one by
one separately to each block of plain text.
This is the simplest mode but should not be used in practice as it is
insecure and can reveal information:
Block encryption modes
Counter mode
The CTR mode effectively uses a block cipher as a
stream cipher.
In this case, a unique nonce is supplied that is
concatenated with the counter value in order to produce
a key stream:
Counter mode
Data Encryption Standard (DES)
Figure 6.4
A round in DES
(encryption site)
6.22
DES Function
The heart of DES is the DES function. The DES function
applies a 48-bit key to the rightmost 32 bits to produce a
32-bit output.
Figure 6.5
DES function
Triple DES (3DES), which proposed the usage of a 168-bit key
using three 56-bit keys and the same number of executions of the
DES algorithm
thus making brute force attacks almost impossible.
Slow performance and 64-bit block size, are not desirable.
Advanced Encryption Standard (AES)
Elliptic curves
This is based on the discrete logarithm problem, but in the context of
elliptic curves.
Elliptic curve is an algebraic cubic curve over a field
RSA
RSA was invented in 1977 by Ron Rivest, Adi Shamir, and Leonard
Adelman
This is based on the integer factorization problem, where the
multiplication of two large prime numbers is easy but difficult to
factor it back to the two original numbers.
Modulus generation:
Select p and q very large primes
Multiply p and q , n=p.q to generate modulus n
Generate co-prime:
Number should satisfy certain conditions, that is, it should be
greater than 1 and less than (p-1) (q-1). I
e must be such a number that no number other than 1 can be
divided into e and (p-1) (q-1). This is called co-prime, that is, e is
the co-prime of (p-1)(q-1).
Generate public key:
Modulus generated in step 1 and e generated in step 2 is pair that,
together, is a public key.
This part is the public part that can be shared with anyone;
p and q need to be kept secret.
Generate private key:
Private key called d here and is calculated from p, q and e.
Private key is basically the inverse of e modulo (p-1)(q-1).
Encryption and decryption using RSA
Plain text P is raised to e number of times and then reduced to
modulo n.
Receiver who has a public key pair (n, e) can decipher the data by
raising C to the value of the private key d and reducing to modulo n
Definition of Elliptic curves
An elliptic curve over a field K is a nonsingular
cubic curve in two variables, f(x,y) =0 with a rational
point (which may be a point at infinity).
The field K is usually taken to be the complex
numbers, reals, rationals, algebraic extensions of
rationals, p-adic numbers, or a finite field.
Elliptic curves groups for cryptography are examined
with the underlying fields of Fp (where p>3 is a
prime) and F2m (a binary representation with 2m
elements).
What is Elliptic Curve Cryptography?
Hash functions, due to their very nature, will always have some
collisions
That is where two different messages hash to the same output
But they should be computationally infeasible to find.
A concept known as avalanche effect is desirable in all hash
functions.
Avalanche effect specifies that a small change, even a single
character change in the input text, will result in a totally different
hash output.
Hash functions
Hash functions are usually designed by following iterated hash functions
approach.
The input message is compressed in multiple rounds on a block-by-
block basis to produce the compressed output.
A popular type of iterated hash function is Merkle- Damgard
construction.
This construction is based on the idea of dividing the input data into
equal sizes of blocks and then feeding them through the
compression functions in an iterative manner.
The collision resistance of the property of compression functions
ensures that the hash output is also collision-resistant.
Compression functions can be built using block ciphers.
59 Internals of a Hash Function
Merkle-Damgard construction:
A fixed-size “compression function”.
Each iteration mixes an input block with the prev. output.
m=
x1
yi-1
m x2 compression H(m)
. . . xi fnc. yi yn
xn yi-1||xi
Hash Table
data structure that maps “keys” to “values”
essential building block in software systems
Interface
insert(key, value)
lookup(key)
Distributed hash tables (DHTs)
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
DHT: basic idea
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
insert(K1,V1)
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
insert(K1,V1)
(K1,V1) K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
K V
retrieve (K1)
Distributed application
put(key, data) get (key) data
Distributed hash table (DHash)
lookup(key) node IP address
Lookup service (Chord)
112 of 32
Example 1: Private Search
(Google does not know the key, cannot “see” the query)
113 of 32
Example 2: Private Cloud Computing
Encrypt x
Enc(x), P → Enc(P(x))
(Input: x) (Program: P)
114 of 32
115
Fully Homomorphic Encryption
of 32
[Rivest-Adleman-Dertouzos’78]
Knows
nothing of x.
Enc(x)
x Function
f
Unique Unsigncryptability
Efficiency