← Cryptography guide

K006 / Symmetric ciphers (block and stream)

Serpent

Serpent cipher · Survey date 2026-12-05

Serpent is a 128-bit block cipher developed by Ross Anderson and others; it was an AES competition candidate.

CRYPTOGRAPHY LAB / K006

Cryptography Lab · Serpent

Run real computations and inspect intermediate states step by step.

Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.

Scope: Standard operation

Serpent (32 rounds)

See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.

Open lab →

Definition and overview
Serpent is a 128-bit block cipher developed by Ross Anderson and others; it was an AES competition candidate. Source document ↗
Classification and reversibility
A symmetric block cipher; reversible when the key is available. Source document ↗
Key or secret requirements
Requires a secret symmetric key and supports 128-, 192- and 256-bit keys. Source document ↗
Operating principle and structure
A 32-round SP network processing four 32-bit words (128 bits). Source document ↗
Key size, block size and parameters
128-bit block size with 128-, 192- and 256-bit keys. Source document ↗
Security strength and recommendation
It has a large security margin, but AES is preferred for performance; Serpent is mentioned as an alternative when high security is needed. Source document ↗
Known attacks and vulnerabilities
The survey excerpt specifies no cryptographic vulnerability; slower performance than AES is mentioned as the main weakness. Source document ↗
Standards and certification
One of five finalists in the NIST AES competition. Source document ↗
Typical uses
Used for storage encryption, such as XTS mode for opening VeraCrypt volumes. Source document ↗
Implementations, libraries and tools
Implementations include Python pyserpent. Source document ↗
Decryption or decoding
Decrypt with the same key, matching implementation parameters such as mode, IV and padding. Source document ↗
Advantages
The designers provided a large security margin by using twice as many rounds as known attacks required. Source document ↗
Limitations and cautions
Relatively slower than other AES finalists. Source document ↗
Distinguishing encryption, encoding and hashing
Serpent is a keyed symmetric block cipher; do not confuse it with Base64/hex encoding or hashing. Source document ↗

Practical examples

Examples are illustrative; they are not execution-tested implementations or operational recommendations.

Example

Prepare plaintext and a key, produce ciphertext using the chosen mode, IV and padding, then decrypt with the same key and parameters. Flow: plaintext → key/IV setup → encryption → ciphertext (hex or Base64) → decryption → plaintext. Actual secret keys are not included.

Procedure

Encryption: generate/store key, choose mode and IV/nonce, apply padding, encrypt, represent ciphertext as hex/Base64. Decryption: use the same key, mode, IV/nonce and padding; verify integrity when necessary. Encoding/decoding converts representations such as hex and bytes without a key; hashes cannot be decrypted.

Scenario

Use if Serpent-XTS is required for existing volumes or compatible systems such as VeraCrypt. For new services, default to standard AEAD and adopt Serpent after reviewing specifications and interoperability.

Pitfalls and alternatives

Avoid ECB alone, IV/nonce reuse, padding oracles and hardcoded keys. Serpent is not an AES standard substitute; prioritize vetted AEAD such as AES-GCM or ChaCha20-Poly1305 for new systems, limiting Serpent to compatibility or special requirements. Do not mistake hex/Base64 for encryption.

References