Symmetric Encryption & Decryption
flowchart LR
PT1["Plaintext
'Attack at dawn.'"]:::plainNode ENC["Encryption
Algorithm + Key"]:::procNode CT["Ciphertext
8a4f...d12b
(looks random)"]:::cipherNode DEC["Decryption
Algorithm + same Key"]:::procNode PT2["Plaintext
Recovered:
'Attack at dawn.'"]:::plainNode KEY["Shared cryptographic key
(kept secret)"]:::keyNode PT1 --> ENC --> CT --> DEC --> PT2 KEY -. same key .-> ENC KEY -. same key .-> DEC classDef plainNode fill:#ffffff,stroke:#455a64,stroke-width:2px,color:#212529,font-size:15px classDef procNode fill:#1565c0,stroke:#0d47a1,stroke-width:2px,color:#ffffff,font-size:15px classDef cipherNode fill:#455a64,stroke:#263238,stroke-width:2px,color:#ffffff,font-size:15px classDef keyNode fill:#ffa000,stroke:#e65100,stroke-width:2px,color:#212529,font-size:14px linkStyle default stroke:#90a4ae,stroke-width:2px,font-size:13px
'Attack at dawn.'"]:::plainNode ENC["Encryption
Algorithm + Key"]:::procNode CT["Ciphertext
8a4f...d12b
(looks random)"]:::cipherNode DEC["Decryption
Algorithm + same Key"]:::procNode PT2["Plaintext
Recovered:
'Attack at dawn.'"]:::plainNode KEY["Shared cryptographic key
(kept secret)"]:::keyNode PT1 --> ENC --> CT --> DEC --> PT2 KEY -. same key .-> ENC KEY -. same key .-> DEC classDef plainNode fill:#ffffff,stroke:#455a64,stroke-width:2px,color:#212529,font-size:15px classDef procNode fill:#1565c0,stroke:#0d47a1,stroke-width:2px,color:#ffffff,font-size:15px classDef cipherNode fill:#455a64,stroke:#263238,stroke-width:2px,color:#ffffff,font-size:15px classDef keyNode fill:#ffa000,stroke:#e65100,stroke-width:2px,color:#212529,font-size:14px linkStyle default stroke:#90a4ae,stroke-width:2px,font-size:13px
Color Key
Plaintext (readable)
Process (algorithm + key)
Ciphertext (scrambled)
Shared secret key
Kerckhoffs's principle
Algorithm: PUBLIC. The cipher's design is openly known and reviewed.Key: SECRET. All the security rests on keeping the key secret — not the algorithm.
Step Details
Hover or tap a box to see what happens at each step. Notice the same key is used in both directions.