CoderTools

Twofish Encryption/Decryption

AES Finalist - 128-bit Block Cipher with up to 256-bit Key

Security Notice

This tool processes all data locally in your browser. Never share your encryption keys. Use strong, randomly generated keys for production use.

Twofish supports fixed key lengths: 128-bit (16 bytes), 192-bit (24 bytes), or 256-bit (32 bytes). Block size is always 128 bits (16 bytes).
Format Options

About Twofish

Twofish is a symmetric key block cipher designed by Bruce Schneier's team, and was one of the five finalists of the Advanced Encryption Standard (AES) competition. Although Rijndael was ultimately selected as AES, Twofish remains a highly secure and widely respected encryption algorithm.

Twofish uses a 128-bit block size and supports key lengths of 128, 192, and 256 bits. It employs a Feistel network structure with 16 rounds of encryption, utilizing key-dependent S-boxes for enhanced security.

Key Features

  • 128-bit block size with 128/192/256-bit key support
  • 16-round Feistel network structure
  • Key-dependent S-boxes for improved security
  • Royalty-free and unpatented - free for any use

Encryption Modes

  • CBC: Cipher Block Chaining - Each block is XORed with the previous ciphertext block before encryption. Recommended for most use cases.
  • ECB: Electronic Codebook - Each block is encrypted independently. Not recommended for sensitive data as patterns may be visible.
  • CFB: Cipher Feedback - Converts block cipher into a stream cipher. Self-synchronizing and error-propagating.
  • OFB: Output Feedback - Similar to CFB but generates keystream independently. No error propagation.

Algorithm Comparison

Algorithm Key Length Block Size Security Speed
Twofish 128/192/256 bits 128 bits Excellent Fast
AES 128/192/256 bits 128 bits Excellent Fast
Blowfish 32-448 bits 64 bits Good Fast
3DES 112/168 bits 64 bits Medium Slow

Security Considerations

  • No known practical attacks exist against Twofish
  • The algorithm has been extensively analyzed by cryptographers worldwide
  • Use CBC, CFB, or OFB modes - avoid ECB for sensitive data
  • Always use cryptographically secure random number generators for keys and IVs

Use Cases

  • Secure file and disk encryption
  • VPN and secure communication protocols
  • Database encryption for sensitive information
  • Password manager and credential storage applications

References