- Cryptography defined: Cryptography is the practice and study of techniques for secure communication in the presence of adversaries. It encompasses encryption, decryption, and integrity checks.
- Historical ciphers: Early examples include the Caesar cipher and the Vigenere cipher. These substitution ciphers demonstrate core principles like key-dependent transformation and frequency analysis vulnerability.
- Kerckhoffs principle: A cryptosystem should be secure even if everything about the system, except the key, is public knowledge. This principle underpins modern designs where algorithms are openly known.
- Threat model: Understanding the adversary's capabilities is essential. Common models include ciphertext-only, known-plaintext, chosen-plaintext, and chosen-ciphertext attacks.
- Confidentiality: Ensures that information is not disclosed to unauthorized parties. Achieved through encryption algorithms that transform plaintext into ciphertext.
- Integrity: Guarantees that data has not been altered in transit. Hash functions and message authentication codes provide integrity verification.
- Authentication: Verifies the identity of communicating parties. Digital signatures and certificate-based mechanisms enable this property.
- Non-repudiation: Prevents a party from denying their involvement in a communication. Digital signatures provide evidence of origin.
- Symmetric vs. asymmetric encryption: Symmetric encryption uses a single shared key for both encryption and decryption, making it fast but requiring secure key exchange. Asymmetric encryption uses a public private key pair, enabling secure key distribution but with higher computational cost.
- Key exchange protocols: Securely sharing keys over an insecure channel is a fundamental problem. Protocols like Diffie Hellman allow two parties to agree on a shared secret without transmitting it directly, leveraging modular arithmetic and discrete logarithms.
- Hash functions: A cryptographic hash function maps data of arbitrary size to a fixed length output, or digest. Key properties include preimage resistance, second preimage resistance, and collision resistance, which make them essential for integrity checks and digital signatures.
- Digital signatures: A digital signature provides authentication, integrity, and non repudiation. The signer uses their private key to sign a message hash, and the verifier uses the corresponding public key to confirm the signature and trust the message origin.
- Cryptographic protocols: Protocols like TLS (Transport Layer Security) combine multiple cryptographic primitives to secure network communications. TLS uses asymmetric encryption for key exchange and symmetric encryption for bulk data transfer, along with certificates for server authentication.
def caesar_encrypt(text, shift):
result = ''
for char in text:
if char.isalpha():
ascii_offset = ord('A') if char.isupper() else ord('a')
shifted = (ord(char) - ascii_offset + shift) % 26
result += chr(ascii_offset + shifted)
else:
result += char
return result
print(caesar_encrypt('Hello', 3)) # Outputs 'Khoor'This Python function implements the Caesar cipher with a given shift. It demonstrates the basic substitution principle but is not secure for real use.
- Cryptography provides confidentiality, integrity, authentication, and non-repudiation.
- Kerckhoff principle states algorithms can be public; only the key must be secret.
- Historical ciphers like Caesar illustrate key concepts but are weak against frequency analysis.