Repository navigation
Cryptography Notes
Encryption: Mainly used to protect confidentiality of data, but also used for data integrity and authentication.
Cryptography: The process of turning plaintext into ciphertext. Encryption and decryption is done using math algorithms and digital keys.
Types of Ciphers
Transposition: Bits/Bytes/Characters moved to another location
Substitution: Bits/Bytes/Characters swapped for other bits/bytes/characters
Most modern algorithms use both transposition and substitution.
The Three Main Types of Algorithms
Asymmetric: Uses two different keys; one public and one private. The public one can be shared with anyone, but the private one needs to be kept secret. Once one key encrypts the data, then the other key can decrypt it. Messages are encrypted with the recipients public key, and signed with their private key. Some popular algorithms are Diffie-Hellman, RSA, and DSA. Some advantages of asymmetric encryption are that there are only two different but mathematically related keys and the private key is impossible to reverse engineer or uncover using the public key.
Symmetric: Uses a single key for encryption and decryption. Ex: caesar cipher- the the key is the amount of times a letter shifts. Symmetric encryption has two modes; stream and block. Stream encryption encrypts data bit by bit, while block encryption encrypts data block by block. Block encryption usually uses fixed size blocks, such as 128 or 256 bit blocks. RC4 is one of the most popular stream ciphers, and some popular block ciphers are DES, 3DES, AES, IDEA, RC5, and BLOWFISH. The issue with symmetric encryption is if the key is compromised, then all the attached data is also compromised, the solution to this is using a Key Distribution Center (KDC).
Hash Functions: The sender takes the data they want to send and runs it through a hash function which then generates a hash value, the hash value and data is then sent to the receiver. The receiver then runs the data through the same hash function and compares the two hash values. If they match, then the data hasn't been tampered with. Some popular hash functions are MD5, SHA, and MAC.
Digital Certificates are used to guarantee website identities and the certificate can be seen on any website.
Cryptanalysis:
Ciphertext-only: Attacker has only ciphertext and tries to obtain the key
Known-plaintext: Attacker has some plaintext and uses it to get the key
Chosen-plaintext: Attacker uses own plaintext, encrypts it, and compares it to other ciphertext to determine the key