Skip to main content

Symmetric Encryption

Symmetric encryption is a cryptographic method where the same key is used for both encryption and decryption of data. It is fast and efficient, making it ideal for encrypting large amounts of data.

In system design, symmetric encryption is used to secure sensitive data like:

  • Stored files and database records (data at rest)
  • Network communication (data in transit)
  • Cached session data
  • API keys or tokens

Key Concepts of Symmetric Encryption

TermDescription
PlaintextOriginal data before encryption
CiphertextEncrypted data
Encryption KeySecret key used to encrypt and decrypt data
Block CipherEncrypts data in fixed-size blocks (e.g., AES)
Stream CipherEncrypts data bit-by-bit or byte-by-byte (e.g., RC4)

Common Symmetric Encryption Algorithms

AlgorithmDescription
AES (Advanced Encryption Standard)Most widely used, supports 128, 192, and 256-bit keys
DES (Data Encryption Standard)Older, less secure
3DES (Triple DES)DES applied three times; still slower and largely deprecated
ChaCha20Modern, fast stream cipher, good for mobile/low-power devices

Example using AES

Scenario: You are designing a healthcare app that stores users’ medical records in a database. These records must be encrypted to meet compliance requirements (like HIPAA or GDPR).

User Enters Data


[Backend API Server]

├── Encrypt Data using AES-256 and a secure key (K)


[Encrypted Data Stored in Database]

Later...



[Backend Decrypts Data using same key (K)]


User Sees Decrypted Medical Record

Symmetric vs Asymmetric

FeatureSymmetricAsymmetric
Key TypeSingle secret keyPublic/Private key pair
SpeedVery fastSlower
Use CasesEncrypting data, files, sessionsKey exchange, TLS handshakes, digital signatures
ExampleAES, ChaCha20RSA, ECC