https://cryptobook.nakov.com/cryptography-overview
According to cryptobook:
Cryptography is the science of providing security and protection of information.
According to Wikipedia: Cryptography:
Cryptography, or cryptology (from Ancient Greek: ... kryptós "hidden, secret"; and graphein, "to write", or -logia, "study", respectively), is the practice and study of techniques for secure communication in the presence of adversarial behavior. More generally, cryptography is about constructing and analyzing protocols that prevent third parties or the public from reading private messages.[3]
Important types of cryptography
Hashing
hashes
key derivation functions
PBKDF2 bcrypt scrypt
key exchange
post-quantum cryptography
It seems that there are plenty of quantum-safe cryptographic alogrithms. One class of quantum-unsafe protocols/algorithms are key exchange algos, like Diffie-Hellman Key Exchange, however, already there is a quantum-safe protocol, CECPQ2 that has been released in Chrome Canary and Cloudflare.
The core problem with modern cryptography algorithms in the Post-quantum cryptography era is that the "hard maths" that they rely on are solvable with large quantum computers. These "hard maths" problems are: integer factorization, and the discrete logarithm problem
Older notes
This is a walkthrough of some parts of public key cryptography: Public Key Cryptography.
Older Notes on XOR
Given a string of text, it is common to refer to the unencrypted text as plaintext and the encrypted text as ciphertext.
XOR encryption
One method of simply encryption is to select a key or password text. Then, XOR the plaintext against the key (the key text can be repeated until it matches the length of the plaintext).
Given the two ciphertexts, we can XOR them. Properties of XOR include commutativity and the zeroing of identical strings (see XOR#Implications and properties). These properties would cancel out the keys.
Let Cn be ciphertext, Pn be plaintext, and K be the key
1. C1 = P1xK
2. C2 = P2xK
3. C1xC2 = P1xKxP2xK
4. By commutation, P1xKxP2xK = P1xP2xKxK
5. By zeroing, P1xP2xKxK = P1xP2
6. Therefore, C1xC2 = P1xP2
On Unicode's UTF-8 & ASCII
English characters are encoded into bytes serially, meaning their bit representations are very similar. For example, a b c = 01100001 01100010 01100011
.
Therefore, if I computed the Hamming Distance of two english sentences, I would end up with a low number, relative to the hamming distance of two random bit arrays. The hamming distance of two random bit arrays is approximately 50% of the length of the bit arrays. For english text it is closer to 30% of the length of the text.
One implication of these observations is that if you calculate the Hamming Distance of two ciphertexts, the result would be equivalent to calculating the Hamming Distance of their plaintexts, and it would be a low number if UTF8 encoded.