1.1 Cryptographic Hash Functions - kimschles/schlesinger-knowledge GitHub Wiki
Cryptographic Hash Functions
A hash function must be able to:
- takes a string as input
- generate output that is a fixed size
- generate the output quickly
In order to be secure, a cryptographic hash function must be:
- collision-free
H(x) != H(y)
- The hash of
x
cannot equal the hash ofy
- There are no hash functions that are collision free, but for the best out there, the probability of collisions is low
- hiding property
- if you're given the output of the
H(x)
function, it's impossible to findx
H(r | x)
: ifH(r)
is concatenated withx
, it's infeasible to findx
.- Envelope metaphor: the message is sealed in an envelope and hidden by the paper on the outside
- if you're given the output of the
- puzzle-friendly
- given an id (from high min-entropy distribution*) and a target set
Y
- No solving strategy is any better than trying random values for
x
- given an id (from high min-entropy distribution*) and a target set
*
Chosen from a set of numbers that has a large distribution. Lots of different possibilities that are spread out from one another.
- Bitcoin uses the SHA-256 hash function
- Breaks the input into blocks, smashes something on the end, and creates a has. It does this 3 times (?)