CoderTools

CAST5 (CAST-128) Encryption/Decryption

Secure symmetric block cipher with variable key length (40-128 bits)

Security Warning

This tool is for educational and testing purposes. For production environments requiring high security, consider using AES-256 or other modern encryption algorithms. Never share your encryption keys.

CAST5 supports variable key length: 40-128 bits (5-16 bytes). 128-bit key recommended for maximum security.
Format Options

About CAST5 (CAST-128) Encryption

CAST5, also known as CAST-128, is a symmetric block cipher designed by Carlisle Adams and Stafford Tavares in 1996. It was published as RFC 2144 and became widely used in the PGP (Pretty Good Privacy) encryption software.

CAST5 uses a 64-bit block size and supports variable key lengths from 40 to 128 bits. The algorithm consists of 12 or 16 rounds depending on the key size. CAST5 was designed to be resistant to differential and linear cryptanalysis.

Key Features

  • Variable key length: 40-128 bits (5-16 bytes)
  • 64-bit block size for efficient processing
  • 12 rounds for keys ≤80 bits, 16 rounds for larger keys
  • Royalty-free algorithm with no patent restrictions

Encryption Modes

  • CBC: Cipher Block Chaining - Each block is XORed with the previous ciphertext block before encryption. Requires IV. Recommended for most use cases.
  • ECB: Electronic Codebook - Each block is encrypted independently. No IV required. Not recommended for encrypting large amounts of data due to pattern leakage.
  • CTR: Counter - Converts block cipher to stream cipher, allows parallel processing
  • CFB: Cipher Feedback - Stream cipher mode, no padding required
  • OFB: Output Feedback - Stream cipher mode, error propagation resistant
  • RAW: Single Block - Direct encryption without chaining, for single 8-byte block only

Algorithm Comparison

Algorithm Key Length Block Size Security Speed
CAST5 (CAST-128) 40-128 bits 64 bits Good Fast
Blowfish 32-448 bits 64 bits Good Fast
AES 128/192/256 bits 128 bits Excellent Fast
Twofish 128/192/256 bits 128 bits Excellent Fast

Security Considerations

  • Use 128-bit keys for maximum security
  • Always use CBC mode with unique IVs for each encryption
  • Generate cryptographically secure random keys and IVs
  • For highly sensitive data, consider modern alternatives like AES-256

Common Use Cases

  • PGP/OpenPGP email encryption compatibility
  • Legacy system interoperability
  • File encryption for moderate security requirements
  • VPN and secure communication protocols

References