ecb_crypt - Linux


ecb_crypt is a command-line tool that uses an Electronic Code Book (ECB) mode to encrypt and decrypt data using a supplied key. It’s primarily used for secure data handling, protecting sensitive information at rest or in transit.


ecb_crypt -[e|d] [-i <input-file>] [-o <output-file>] [-k <key-file>] [-s <key-size>] [-l <log-level>]


  • -e: Encrypt the input data
  • -d: Decrypt the input data
  • -i: Specify the input file. Default is standard input
  • -o: Specify the output file. Default is standard output
  • -k: Specify the file containing the encryption key
  • -s: Specify the key size in bits (128, 192, or 256). Default is 128
  • -l: Set the logging level (0-3) for debugging purposes


Encrypt a file:

ecb_crypt -e -i input.txt -o encrypted.bin -k key.txt

Decrypt a file:

ecb_crypt -d -i encrypted.bin -o output.txt -k key.txt

Common Issues

  • Invalid key: Ensure that the key file is accessible and contains a valid key of the specified size.
  • File I/O errors: Check if the input and output files are accessible and have the appropriate permissions.


ecb_crypt can be integrated with other Linux commands for advanced tasks:

  • Pipe input data from a command: cat file.txt | ecb_crypt -e -k key.txt
  • Send encrypted output to another command: ecb_crypt -e -i input.txt -k key.txt | other_command

Related Commands

  • openssl: A general-purpose cryptography library and command-line interface
  • gpg: OpenPGP implementation for encrypting and signing data
  • base64: Encode/decode data into and out of Base64 representation