Encryption Methods Using Python

Overview

Encryption methods can be broadly categorized into symmetric, asymmetric, and hashing (non-reversible transformations).

🔐 1. Symmetric Key Encryption

  • Single key used for both encryption and decryption.

  • Fast and suitable for bulk data encryption.

  • Key must be securely shared between parties.

Examples:

  • AES (Advanced Encryption Standard): Block cipher, 128-bit block size, supports 128/192/256-bit keys; widely used (e.g., SSL/TLS, disk encryption).

  • DES (Data Encryption Standard): 56-bit key; now obsolete due to brute-force vulnerabilities.

  • 3DES (Triple DES): Applies DES three times (Encrypt-Decrypt-Encrypt); more secure than DES, but slower.

  • RC4/RC5/RC6: Variable key-length ciphers; RC4 is stream-based (deprecated due to vulnerabilities).

  • ChaCha20: Stream cipher used in modern TLS (faster than AES on some platforms).


🔑 2. Asymmetric Key Encryption

  • Uses a key pair: a public key (encryption) and a private key (decryption).

  • Ensures confidentiality and supports digital signatures.

  • Computationally intensive; usually used for key exchange or small data payloads.

Examples:

  • RSA (Rivest–Shamir–Adleman): Based on factoring large primes; key sizes 2048–4096 bits common.

  • ECC (Elliptic Curve Cryptography): Smaller keys, high security (e.g., ECDSA, ECDH); used in mobile devices.

  • ElGamal: Based on discrete logarithms; supports encryption and key exchange.

  • Diffie-Hellman (DH): Key exchange protocol (not encryption by itself); vulnerable without authentication.


🔄 3. Hybrid Encryption

  • Combines symmetric and asymmetric encryption.

  • Asymmetric encryption secures the symmetric session key; symmetric encryption handles data payload.

Example:

  • TLS/SSL: Uses RSA/ECDH for key exchange, AES/ChaCha20 for actual data encryption.


🧮 4. Hash Functions (One-Way Encryption)

  • Not technically encryption, but used for data integrity and authentication.

  • Irreversible: output (digest) cannot be converted back to input.

Examples:

  • MD5: 128-bit output; deprecated (collision attacks).

  • SHA-1: 160-bit output; deprecated.

  • SHA-2: Includes SHA-224, SHA-256, SHA-384, SHA-512.

  • SHA-3: Keccak-based hash standard.

  • HMAC (Hash-based Message Authentication Code): Combines a secret key with a hash function.


📦 5. Other/Legacy/Lightweight Methods

  • XOR Cipher: Basic symmetric cipher; insecure alone.

  • Caesar Cipher: Shift cipher (classical); easily broken.

  • Vigenère Cipher: Poly-alphabetic cipher; classical, insecure today.

Output

Description

  • 01-05-2025