Hashing and Signatures
- A practical guide to two of the most important cryptographic primatives!
What is a cryptographic hash?
- data (preimage) => hash function => unique output (hash)
- Given the output of a hash function (hash) you cannot determine the input data to that hash function (preimage)
2nd Preimage Resistance (aka Collision Resistance):
- A hash cannot have more than 1 preimage - each piece of data produces a unique hash
- A hash has no statistical correlation to the input data that created it (aka it looks like random data)
What is a cryptographic signature?
- A mathematical way to prove that a signer signed something
- Public key is like an address/username
- Private key is like a password/signature
- Allows you to sign stuff with your keys
- This also allows other people to verify that you did or did not sign something
- If you have a hash you can check that against a message (data), message signature, and public key of the signer to determine if that key signed that message. This is used to prove that X person signed Y document. If someone tries to change the document or the signature, the hash will be completely different.
Crptographic Hash Functions
- SHA256 Hash App - Whatever you type into the box is instantly hashed via the SHA256 algorithm.
- Wikipedia - Everything you could ever want to know about hash functions.
- Anders Brownworth's blockchain demos - Videos explaining (and showing) hash functions and signatures in more detail.
- Wikipedia - Everything you could ever want to know about digital (and cryptographic) signatures.