Notes on Cryptography
Some notes on cryptography.

Some rough notes on cryptography.
Hashing Function Design
- Fast to compute
- Produce unique output values
- Produce the same output given the same input
- Difficult to reverse out the original input
- Storing data without knowing the value
- Used for comparison purposes
MD5 -> SHA256 -> ARGON2 -> ARGON2ID
Rainbow Tables
Pre-compute the hash of common passwords, faster to lookup by hash than to brute force.
HMAC
A hash that requires a password, so the person must have the password to create the key. Hash based message authentication code - the password is an input to the hash creation, so if you use two different passwords to hash a message you'll get two different outputs.
Message Signing
The sender of the message uses their private key to obtain a signature of the original message. Attach the signature to the original message. The recipient uses the public key to validate the authenticity of the message and that it hasn't been tampered with.
Symmetric and Asymmetric Encryption
Allowing people to know the value of the data as long as they have the key to decrypt it correctly.
Encrypt some message using a password. How does the recipient know how to decrypt it? Sharing the password is risky as it could be intercepted. This is what asymmetric encryption looks to solve. We generate pairs of public and private keys which are intrinsically linked but can not be derived from one another.
We can then encrypt data using the public key and it can only be decrypted with the associated private key. This means you can share your public key, and as long as you have the private key, you can decrypt any ciphertext which has been encrypted using the associated shareable public key.
The security of asymmetric encryption therefore relies on the ability to protect your own private key in order to protect messages which you are receiving (not sending).

Head tattoos were once one of the ways we hid information
Private Key Encryption - Symmetric
The same key is used in both the encryption and decryption of data.
Easy to use, but has problems - how do you get the key to the party with whom you're sharing data? If the PK is used for 2 way communication and the key is compromised then both sides of the communication channel become compromised.
