Cryptographic algorithms perform a variety of essential functions, including for crypto. As the key building block, they are important (and fascinating) to understand. From the Caesar Cipher to ECDSA, here are the basics.
is the study of the techniques for securing communication and data in the presence of adversaries.
Together with cryptanalysis (the study of decryption), it forms the larger discipline of cryptology
Various algorithms referred to as ciphers and a secret key transform input data (plaintext) into encrypted output (ciphertext).
Cryptography can be bifurcated into symmetric cryptography, asymmetric cryptography, and hashing functions.
Let's discuss each in turn
uses the same secret key for encryption of the plaintext and decryption of the ciphertext
+: simple, less computation/faster -: requires a way to securely share the secret key btwn sender & receiver; requires a separate secret key for each user pair. Egs:
the letters of the plaintext are mapped to ciphertext letters based on a single alphabetic key. Caesar Cipher shifts each letter of plaintext a fixed number of positions down the alphabet to create the ciphertext, with the fixed number the secret key
eg. for a secret key of 2, A=C, B=D, C=E
plaintext of "BAT" is encrypted to ciphertext of "DCV"
The recipient knowing the secret key can simply shift each letter back two spots to decrypt
But, this can be decrypted simply by trying all possible shifts
instead of a simple alphabetic shift, insert a keywork at the beginning of the mapped substitution alphabet before continuing on at the end of the keyword & skipping any letters already used. Eg. if keyword is "cipher", substitution alphabet is "CIPHERABDFGJKL..."
plaintext of "BAT" is encrypted to ciphertext of "ICT"
This is more secure than a Caesar Cipher, but is prone to frequency analysis, where a frequently occurring letter in the ciphertext is more likely to map to a common letter like e, t, or a, which can be used to help decrypt
Rather than use a single, constant alphabetic key, this uses multiple substitution alphabets, varying the mapping of plaintext letters to the substitution alphabet (a letter will map to various letters). The Vigenere Cipher is most well known
aka public-key cryptography, utilizes mathematically linked public and private keys to eliminate the need to share a secret key
+: No need to share secret key, better for large & expanding networks -: more computationally intensive
enables 2 unrelated parties to establish a mutual secret over a public communications channel by using large prime numbers and modulo arithmetic. Forms the basis for SSL & TSL, and is often conceptually described using paint
relies on the fact that every number greater than 1 can be represented uniquely as the product of prime numbers or its unique prime factorization.
It’s easy to multiply large prime numbers together, but v hard to determine that number’s unique prime factorization
Elliptic Curve Digital Signature Algorithm (ECDSA)
a user selects a random private key and runs elliptic curve operations on it to generate a mathematically linked public key that can’t be used to infer the private key that created it. Bitcoin uses the secp256k1 elliptic curve
transform arbitrary data into a numeric, fixed length string, is that data's digital fingerprint, & is one way, deterministic, easy to compute. Improve efficiency & data verification w/o revealing underlying data. Bitcoin uses SHA-256
CRYPTOGRAPHY & BITCOIN
uses ECDSA to verify transaction authenticity uses SHA-256 to link blocks together by including a hash of the previous block header: time-orders blocks, makes tamper-evident uses SHA-256 in PoW mining puzzle uses SHA-256 in Merkle Trees for data efficiency
this twitter thread.