For even more info I recommend Martin Mareš's notes or boards.
birthday
better with parameterized messages
memory saving with hare, tortoise, and turtle technique (constant memory)
collision between good and bad messages
used when there is someone who signs only good messages
multiple collisions in M.D.
when the compression function is not collision-resistant
it is possible to find a collision for the first block,
then given it find a collision for the second block, and so on.
This yields 2k messages where k is the number of blocks.
Allows us to attack efficiently the following when one of the
hashes is M.D.
It is easy because we only need to bruteforce the second hash
after we find multicollisions in the first.
h(x)=h1(x)∣∣h2(x)
Davies-Meyer construction from a block cipher
Use block cipher to create compression function as
f(x,y)=Ey(x)⊕y
XOR is needed otherwise we could get
f(x,y)=Ey(x)=Ez(Dz(Ey(x)))=f(z,Dz(Ey(x)))
Also, note that using this construction with arbitrary
cipher is dangerous.
For example, DES’s complementarity property makes creating collisions easy.
MD5 (Rivest)
The result has 128b,
due to birthday paradox the security level is 64b which is weak.
Since 2004 we are able to produce collisions easily
but it is not yet invertible.
The structure is Merkle-Damgard.
SHA-1 (NSA)
160b output.
The structure is Merkle-Damgard.
We can produce collisions but it is not that easy (Google was needed to do it).
SHA-2 (NSA)
family of functions. Similar to SHA-1 but stronger and slower.
No serious weaknesses were found at the time of writing this.
SHA-224, 256, 384, 512.
SHA-3 (NIST competition)
family of functions
Sponge construction
security level is min(r/2,c/2) due to the inner collision attack.
inner collision attack
you feed in zeros and wait till the “lower” (capacity)
part repeats (2c/2 steps needed).
This gives us messages when one is a prefix of the other.
The last block of the longer message si then set so
that the “upper” (rate) part is the same as the “upper” part for the prefix message.
based on Keccak 1600 bit permutation.
SHA-3
2561152 (r) 512 (c)
512576 (r) 1024 (c)
SHAKE can be used as PRNG
1281344 (r) 256 (c)
2561088 (r) 512 (c)
Merkle trees
A convenient way to hash databases or anything
where some part of the data changes often.
The structure of the tree must be hashed to output,
otherwise, some extension or truncation attacks are possible.
Message Authentication Codes (MACs)
functions to generate and verify signatures.
Security
can be defined like this: the attacker possesses a signing
oracle and wants to produce a correct signature on
a message that was not presented to the oracle
HMAC
today pretty much THE way to do MACs.
h(x)=h(a⊕k∣∣h(b⊕k∣∣x))
basically three keys but a,b are some fixed constants.
Combining with encryption
MAC and encrypt
MACs are the same for the same messages
no matter what we do in encryption, horrible.
MAC then encrypt
used to be believed to be the best but there are
a lot of padding oracle attacks.
Some workarounds use stream cipher to avoid timing attacks.
Encrypt then MAC
The best approach today.
CBCMac
The last block is used as a signature.
Needs a fixed IV, otherwise one could flip bits in
the first block of the cipher.
Not very popular.
This construction is secure when the cipher is
ideal and the message length is fixed.
Also, we can’t use the same key for MAC and encryption.
Using CBCMac and CBC encryption with the same key is a lot of fun.
Shanon-secure MACs
Given a known pair of x and sign(x) all
signatures of x’ different from x are equally probable for a random key.
one-time key
requires keys 2 times the size of the message, so unusable in practice.