Lecture 1
Lecture 1
Lecture 1
UNIT 1 Lecture – 01
• a hash function, H,
• a value, id (which we call the puzzle-ID),
chosen from a high minentropy distribution, and
• a target set Y.
A solution to this puzzle is a value, x, such that
The intuition is this: if H has an n-bit output, then
it can take any of 2n values. Solving the puzzle
requires finding an input such that the output
falls within the set Y, which is typically much
smaller than the set of all outputs.
The size of Y determines how hard the puzzle is.
If Y is the set of all n-bit strings, then the puzzle
is trivial, whereas if Y has only one element,
then the puzzle is maximally hard
That the puzzle ID has high min-entropy
ensures that there are no shortcuts. On the
contrary, if a particular value of the ID were
likely, then someone could cheat, say, by
precomputing a solution to the puzzle with that
ID.
The Merkle-Damgård transform is quite simple.
Suppose that the compression function takes
inputs of length m and produces an output of a
smaller length n.
The input to the hash function, which can be of
any size, is divided into blocks of length m – n.
The construction works as follows: pass each
block together with the output of the previous
block into the compression function.
Notice that input length will then be (m – n) + n =
m, which is the input length to the compression
function. For the first block, to which there is no
previous block output, we instead use an
initialization vector (IV in Figure 1.3)
This number is reused for every call to the
hash function, and in practice you can just look it
up in a standards document. The last block’s
output is the result that you return.
SHA-256 hash function (simplified). SHA-256
uses the Merkle-Damgård transform to turn a
fixed-length collision-resistant compression
function into a hash function that accepts
arbitrary-length inputs. The input is padded, so
that its length is a multiple of 512 bits. IV stands
for initialization vector.