Authentication Functions and Hash Functions
Authentication Functions and Hash Functions
a) Message
encrypted
b) Message
unencrypted
Hash Functions & Message
Authentication
Symmetric Key
Keyed Hash
a) Message
unencrypted
d) Message
encrypted
Hash Functions & Digital
Signatures - PKCS
Other Hash Function Uses
pseudorandom function (PRF)
Generate session keys, nonces
Produce key from password
Derive keys from master key cooperatively
pseudorandom number generator
(PRNG)
Vernam Cipher/OTP
S/Key, proof of “what you have” via messages
More Hash Function Uses
to create a one-way password file
store hash of password not actual password
e.g., Unix, Windows NT, etc.
salt to deter precomputation attacks
Rainbow tables
for intrusion detection and virus detection
keep & check hash of files on system
e.g., Tripwire
Lamport One-time Passwords
Password safety in distributed system
server compromise does not compromise P
interception of authentication exchange does
not compromise password either
Alice picks Password PA
Hashes password N times, HN(PA)
Server stores (Alice, N, HN(PA))
Attacker can’t get PA from HN(PA)
Lamport One-time Passwords
Protocol
Alice sends “I’m Alice”
Server sends “N-1”
Alice sends “X” where X=HN-1(PA)
Server verifies H(X) = HN(PA)
Server updates to (Alice, N-1, X)
Attacker still can’t get PA or
authenticate as Alice
Two Simple Insecure Hash
Functions
consider two simple insecure hash functions
bit-by-bit exclusive-OR (XOR) of every block
Ci = bi1 xor bi2 xor . . . xor bim
a longitudinal redundancy check
reasonably effective as data integrity check
one-bit circular shift on hash value
for each successive n-bit block
• rotate current hash value to left by1bit and XOR block
good for data integrity but useless for security
Hash Function Requirements
Attacks on Hash Functions
have brute-force attacks and cryptanalysis
a preimage or second preimage attack
find y s.t. H(y) equals a given hash value
collision resistance
find two messages x & y with same hash so
H(x) = H(y)
hence value 2m/2 determines strength of
hash code against brute-force attacks
128-bits inadequate, 160-bits suspect
Birthday Attacks
might think a 64-bit hash is secure
but by Birthday Paradox is not
birthday attack works thus:
given user prepared to sign a valid message x
opponent generates 2m/2 variations x’ of x, all with
essentially the same meaning, and saves them
opponent generates 2m/2 variations y’ of a desired
fraudulent message y
two sets of messages are compared to find pair with
same hash (probability > 0.5 by birthday paradox)
have user sign the valid message, then substitute the
forgery which will have a valid signature
conclusion is that need to use larger MAC/hash
Birthday Attacks
Find i and j
such that y y’1 y’2 … y’j … y’N
H(y’j)=H(x’i)
x ≠ ≠ ≠ ≠ ≠
Table takes x’1 ≠ ≠ ≠ ≠ ≠
O(N2) time x’2 ≠ ≠ ≠ ≠ ≠
Faster … …
x’i ≠ ≠ ≠ = ≠
Sorted lists
take O(NlogN) …
time x’N ≠ ≠ ≠ ≠ ≠
Birthday Attacks
What are chances we get a match?
N distinct values, k randomly chosen ones
P(N,i) = prob(i randomly selected values from
1..N have at least one match)
P(N,2) = 1/N
P(N,i+1) = P(N,i)+(1-P(N,i))(i/N)
For P(N,k)>0.5, need k ≈ N1/2
Need double # bits in hash value
Hash Function Cryptanalysis
cryptanalytic attacks exploit some property
of alg so faster than exhaustive search
hash functions use iterative structure
process message in blocks (incl length)
attacks focus on collisions in function f
Block Ciphers as Hash
Functions
can use block ciphers as hash functions
using H0=0 and zero-pad of final block
compute: Hi = EMi [Hi-1]
and use final block as the hash value
similar to CBC but without a key
resulting hash is too small (64-bit)
both due to direct birthday attack
and to “meet-in-the-middle” attack
other variants also susceptible to attack
Block Ciphers as Hash
Functions H
0