# Cryptography
## What is Cryptography
Cryptography is the science and practice of techniques for secure communication in the presence of adversaries. The word comes from the Greek words meaning hidden and writing. Modern cryptography uses mathematical algorithms to transform readable data, called plaintext, into an unreadable form, called ciphertext, that can only be read by someone who has the correct key to decrypt it. Cryptography provides the foundation for securing communications, protecting stored data, authenticating identities, and ensuring data integrity in computer networks and information systems.
## Goals of Cryptography
Confidentiality ensures that information can only be read by the intended recipient. Even if an attacker intercepts encrypted data, they cannot understand it without the decryption key. Authentication verifies the identity of communication parties, ensuring that messages genuinely came from who they claim to be from. Integrity ensures that data has not been modified during transmission or storage. Cryptographic hash functions allow any modification to be detected. Non-repudiation prevents a sender from later denying having sent a message, which is important for legal and business purposes. Digital signatures provide non-repudiation.
## Historical Cryptography
The Caesar cipher is one of the simplest and oldest encryption techniques. Julius Caesar is said to have used it to communicate with his generals. Each letter in the plaintext is shifted by a fixed number of positions in the alphabet. A shift of three would encode A as D, B as E, and so on. The Vigenere cipher uses a keyword to apply different shifts to different letters, making frequency analysis more difficult. The Enigma machine used by Nazi Germany during World War Two used electromechanical rotors to implement a polyalphabetic substitution cipher. Breaking the Enigma cipher was a major allied achievement of the war.
## Modern Cryptography
Modern cryptography is based on mathematical problems that are computationally infeasible to solve without the correct key. Symmetric cryptography uses the same key for both encryption and decryption. Asymmetric cryptography uses a pair of mathematically related keys, a public key for encryption and a private key for decryption. Hash functions transform data into a fixed-size digest that cannot be reversed. These building blocks are combined to create secure communication protocols.
## Cryptographic Keys
The security of modern cryptography relies on the secrecy of keys rather than the secrecy of algorithms. A well-designed algorithm can be made public, and security depends entirely on key secrecy. Key length determines the security level. Longer keys provide more security but require more computation. AES with 128-bit keys is considered secure for most purposes today. RSA requires much longer keys, typically 2048 or 4096 bits, to achieve comparable security because the underlying mathematical problem is easier to attack than the symmetric key problem.Back to Subject