Classic ciphers and bitwise operations.
Operations are listed alphabetically.
Every string flag has a
--<flag>-filecompanion that reads the value from a file, keeping keys and passphrases out of shell history — see Reading argument values from files.
| Operation | Subcommand | Reference |
|---|---|---|
| A1Z26 Cipher Decode | a1z26-cipher-decode |
Letter-number cipher |
| A1Z26 Cipher Encode | a1z26-cipher-encode |
Letter-number cipher |
| ADD | add |
Bitwise operation |
| AES Decrypt | aes-decrypt |
Advanced Encryption Standard |
| AES Encrypt | aes-encrypt |
Advanced Encryption Standard |
| AES Key Unwrap | aes-key-unwrap |
Key wrap |
| AES Key Wrap | aes-key-wrap |
Key wrap |
| Affine Cipher Decode | affine-cipher-decode |
Affine cipher |
| Affine Cipher Encode | affine-cipher-encode |
Affine cipher |
| AND | and |
Bitwise AND |
| Ascon Decrypt | ascon-decrypt |
Ascon (cipher) |
| Ascon Encrypt | ascon-encrypt |
Ascon (cipher) |
| Atbash Cipher | atbash-cipher |
Atbash |
| Bacon Cipher Decode | bacon-cipher-decode |
Bacon's cipher |
| Bacon Cipher Encode | bacon-cipher-encode |
Bacon's cipher |
| Bcrypt | bcrypt |
Bcrypt |
| Bifid Cipher Decode | bifid-cipher-decode |
Bifid cipher |
| Bifid Cipher Encode | bifid-cipher-encode |
Bifid cipher |
| Bit shift left | bit-shift-left |
Bit shifts |
| Bit shift right | bit-shift-right |
Bit shifts |
| Blowfish Decrypt | blowfish-decrypt |
Blowfish |
| Blowfish Encrypt | blowfish-encrypt |
Blowfish |
| Bombe | bombe |
Bombe |
| Caesar Box Cipher | caesar-box-cipher |
Caesar Box |
| Cetacean Cipher Decode | cetacean-cipher-decode |
Dolphins |
| Cetacean Cipher Encode | cetacean-cipher-encode |
Dolphins |
| ChaCha | chacha |
ChaCha variant |
| CipherSaber2 Decrypt | ciphersaber2-decrypt |
CipherSaber |
| CipherSaber2 Encrypt | ciphersaber2-encrypt |
CipherSaber |
| Citrix CTX1 Decode | citrix-ctx1-decode |
Citrix CTX1 |
| Citrix CTX1 Encode | citrix-ctx1-encode |
Citrix CTX1 |
| Colossus | colossus |
Colossus computer |
| Derive EVP key | derive-evp-key |
Key derivation function |
| Derive HKDF key | derive-hkdf-key |
HKDF |
| Derive PBKDF2 key | derive-pbkdf2-key |
PBKDF2 |
| DES Decrypt | des-decrypt |
Data Encryption Standard |
| DES Encrypt | des-encrypt |
Data Encryption Standard |
| Enigma | enigma |
Enigma machine |
| Fernet Decrypt | fernet-decrypt |
Fernet |
| Fernet Encrypt | fernet-encrypt |
Fernet |
| Flask Session Decode | flask-session-decode |
Flask sessions |
| Flask Session Sign | flask-session-sign |
Flask sessions |
| Flask Session Verify | flask-session-verify |
Flask sessions |
| From Morse Code | from-morse-code |
Morse code |
| GOST Decrypt | gost-decrypt |
GOST (block cipher) |
| GOST Encrypt | gost-encrypt |
GOST (block cipher) |
| GOST Key Unwrap | gost-key-unwrap |
GOST (block cipher) |
| GOST Key Wrap | gost-key-wrap |
GOST (block cipher) |
| GOST Sign | gost-sign |
GOST (block cipher) |
| GOST Verify | gost-verify |
GOST (block cipher) |
| JWT Decode | jwt-decode |
JSON Web Token |
| JWT Sign | jwt-sign |
JSON Web Token |
| JWT Verify | jwt-verify |
JSON Web Token |
| LS47 Decrypt | ls47-decrypt |
LS47 |
| LS47 Encrypt | ls47-encrypt |
LS47 |
| Lorenz | lorenz |
Lorenz cipher |
| Multiple Bombe | multiple-bombe |
Bombe |
| NOT | not |
Bitwise NOT |
| OR | or |
Bitwise OR |
| PRESENT Decrypt | present-decrypt |
PRESENT (cipher) |
| PRESENT Encrypt | present-encrypt |
PRESENT (cipher) |
| RC2 Decrypt | rc2-decrypt |
RC2 |
| RC2 Encrypt | rc2-encrypt |
RC2 |
| RC4 | rc4 |
RC4 |
| Pseudo-Random Prime Generator | pseudo-random-prime-generator |
Miller-Rabin primality test |
| RC4 Drop | rc4-drop |
RC4 |
| RC6 Decrypt | rc6-decrypt |
RC6 |
| RC6 Encrypt | rc6-encrypt |
RC6 |
| ROR13 | ror13 |
Circular shift |
| ROT13 | rot13 |
ROT13 |
| ROT13 Brute Force | rot13-brute-force |
ROT13 |
| ROT47 | rot47 |
ROT13 variants |
| ROT47 Brute Force | rot47-brute-force |
ROT13 variants |
| ROT8000 | rot8000 |
ROT8000 |
| Rabbit | rabbit |
Rabbit (cipher) |
| Rail Fence Cipher Decode | rail-fence-cipher-decode |
Rail fence cipher |
| Rail Fence Cipher Encode | rail-fence-cipher-encode |
Rail fence cipher |
| Rotate left | rotate-left |
Bit shifts |
| Rotate right | rotate-right |
Bit shifts |
| SIGABA | sigaba |
SIGABA |
| SM4 Decrypt | sm4-decrypt |
SM4 (cipher) |
| SM4 Encrypt | sm4-encrypt |
SM4 (cipher) |
| SUB | sub |
Bitwise operation |
| Salsa20 | salsa20 |
Salsa20 |
| Scrypt | scrypt |
Scrypt |
| Substitute | substitute |
Substitution cipher |
| TEA Decrypt | tea-decrypt |
Tiny Encryption Algorithm |
| TEA Encrypt | tea-encrypt |
Tiny Encryption Algorithm |
| To Morse Code | to-morse-code |
Morse code |
| Triple DES Decrypt | triple-des-decrypt |
Triple DES |
| Triple DES Encrypt | triple-des-encrypt |
Triple DES |
| Twofish Decrypt | twofish-decrypt |
Twofish |
| Twofish Encrypt | twofish-encrypt |
Twofish |
| Typex | typex |
Typex |
| Vigenère Decode | vigenere-decode |
Vigenère cipher |
| Vigenère Encode | vigenere-encode |
Vigenère cipher |
| XOR | xor |
XOR |
| XOR Brute Force | xor-brute-force |
Exclusive or |
| XSalsa20 | xsalsa20 |
XSalsa20 |
| XTEA Decrypt | xtea-decrypt |
XTEA |
| XTEA Encrypt | xtea-encrypt |
XTEA |
| XXTEA Decrypt | xxtea-decrypt |
XXTEA |
| XXTEA Encrypt | xxtea-encrypt |
XXTEA |
The bitwise key operations (add, and, or, sub, xor) all take a --key
whose encoding is chosen with --key-type (Hex, Decimal, Binary, Base64,
UTF8, Latin1). The key repeats to cover the input; an empty key is treated as
a single zero byte (the identity). They produce raw bytes, so the examples pipe
through to-hex to make the output readable.
Decimal / Binary keys. Matching CyberChef, a
Decimalkey uses only the first integer in the string (82 226→ the single byte82), and aBinarykey has its whitespace stripped and is read as fixed 8-bit groups.
Converts alphabet order numbers back into their corresponding letters (1 → a,
26 → z). Every number must be between 1 and 26, or the operation errors.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--delimiter |
option | Space |
Separator between numbers: Space, Comma, Semi-colon, Colon, Line feed, CRLF. |
Simple example
cchef a1z26-cipher-decode -i '8 5 12 12 15'Output:
hello
Comma delimiter
cchef a1z26-cipher-decode -i '8,5,12,12,15' --delimiter CommaOutput:
hello
Converts alphabet characters into their corresponding alphabet order number
(a → 1, b → 2). Input is lowercased first, and non-alphabet characters
are dropped.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--delimiter |
option | Space |
Separator between numbers: Space, Comma, Semi-colon, Colon, Line feed, CRLF. |
Simple example
cchef a1z26-cipher-encode -i 'Hello, World!'Output:
8 5 12 12 15 23 15 18 12 4
Comma delimiter
cchef a1z26-cipher-encode -i 'Hello, World!' --delimiter CommaOutput:
8,5,12,12,15,23,15,18,12,4
Adds the key to each byte of the input, modulo 256.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | The key value, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, Decimal, Binary, Base64, UTF8, Latin1. |
Simple example
printf 'hello' | cchef add --key 01 --key-type Hex | cchef to-hex --delimiter NoneOutput:
69666d6d70
Repeating multi-byte key
printf 'hello' | cchef add --key '01 02' --key-type Hex | cchef to-hex --delimiter NoneOutput:
69676d6e70
Reference: Advanced Encryption Standard
Decrypts AES ciphertext. The key length selects the algorithm (16 bytes =
AES-128, 24 = AES-192, 32 = AES-256). In CBC and ECB mode PKCS#7 padding is
removed unless a NoPadding mode is chosen; in GCM mode the --gcm-tag is
verified and decryption fails if it does not authenticate.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | Decryption key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | (empty) | Initialization vector; empty defaults to 16 null bytes. |
--iv-type |
option | Hex |
IV encoding: Hex, UTF8, Latin1, Base64. |
--iv-length |
number | 16 |
IV length in bytes when taken from the input. |
--mode |
option | CBC |
Mode: CBC, CFB, OFB, CTR, GCM, ECB, CBC/NoPadding, ECB/NoPadding. |
--input-format |
option | Hex |
How to read the input: Hex or Raw bytes. |
--output-format |
option | Raw |
How to render the output: Raw bytes or Hex. |
--gcm-tag |
string | (empty) | Authentication tag (GCM mode only). |
--gcm-tag-type |
option | Hex |
Tag encoding: Hex, UTF8, Latin1, Base64. |
--aad |
string | (empty) | AAD (GCM mode only). |
--aad-type |
option | Hex |
AAD encoding: Hex, UTF8, Latin1, Base64. |
--iv-from-input |
option | Off |
Take the IV from the input: Off, From start, From end. |
Simple example
cchef aes-decrypt -i '2ef6c3fdb1314b5c2c326a2087fe1a82d5e73bf605ec8431d73e847187fc1c8fbbe969c177df1ecdf8c13f2f505f9498' --key 00112233445566778899aabbccddeeff --iv 00000000000000000000000000000000 --mode CBC --input-format Hex --output-format RawOutput:
The quick brown fox jumps over the lazy dog.
Keeping the key out of shell history
The same decryption with the key read from a file (see Reading argument values from files):
printf '00112233445566778899aabbccddeeff' > aes.key
cchef aes-decrypt -i '2ef6c3fdb1314b5c2c326a2087fe1a82d5e73bf605ec8431d73e847187fc1c8fbbe969c177df1ecdf8c13f2f505f9498' --key-file aes.key --iv 00000000000000000000000000000000 --mode CBC --input-format Hex --output-format RawOutput:
The quick brown fox jumps over the lazy dog.
Reference: Advanced Encryption Standard
Encrypts input with AES. The key length selects the algorithm (16 bytes = AES-128, 24 = AES-192, 32 = AES-256). CBC and ECB use PKCS#7 padding; GCM appends the authentication tag to the output. An empty IV defaults to 16 null bytes.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | Encryption key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | (empty) | Initialization vector; empty defaults to 16 null bytes. |
--iv-type |
option | Hex |
IV encoding: Hex, UTF8, Latin1, Base64. |
--mode |
option | CBC |
Mode: CBC, CFB, OFB, CTR, GCM, ECB, CBC/NoPadding, ECB/NoPadding. |
--input-format |
option | Raw |
How to read the input: Raw bytes or Hex. |
--output-format |
option | Hex |
How to render the output: Hex or Raw bytes. |
--aad |
string | (empty) | AAD (GCM mode only). |
--aad-type |
option | Hex |
AAD encoding: Hex, UTF8, Latin1, Base64. |
--include-iv-in-output |
option | Off |
Add the IV to the output: Off, Prepend, Append. |
Simple example
cchef aes-encrypt -i 'The quick brown fox jumps over the lazy dog.' --key 00112233445566778899aabbccddeeff --iv 00000000000000000000000000000000 --mode CBCOutput:
2ef6c3fdb1314b5c2c326a2087fe1a82d5e73bf605ec8431d73e847187fc1c8fbbe969c177df1ecdf8c13f2f505f9498
GCM with additional authenticated data
In GCM mode the authentication tag is appended after the ciphertext.
cchef aes-encrypt -i 'The quick brown fox jumps over the lazy dog.' --key 00112233445566778899aabbccddeeff --iv ffeeddccbbaa99887766554433221100 --mode GCM --aad 'additional data' --aad-type UTF8Output:
daa58faa056c52756aa488aeafbd265b6effcf4eca58220a97b0005b1a9b1e1c9e7a6725d35f5f79b9493de7
Tag: 3b5378917f67b0aade9891fc6c291646
Reference: Key wrap
Reverses AES Key Wrap (RFC 3394): decrypts wrapped 64-bit blocks with a
key-encryption key (KEK) and verifies the 64-bit integrity IV, failing with
IV mismatch if the wrapped data is corrupt.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key-kek |
string | (empty) | Key-encryption key; 16, 24 or 32 bytes. |
--key-kek-type |
option | Hex |
KEK encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | a6a6a6a6a6a6a6a6 |
64-bit integrity IV. |
--iv-type |
option | Hex |
IV encoding: Hex, UTF8, Latin1, Base64. |
--input-format |
option | Hex |
Input encoding: Hex or Raw bytes. |
--output-format |
option | Hex |
Output encoding: Hex or Raw bytes. |
Simple example
cchef aes-key-unwrap -i '1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5' --key-kek 000102030405060708090a0b0c0d0e0fOutput:
00112233445566778899aabbccddeeff
Reference: Key wrap
Wraps key material using the RFC 3394 AES key-wrap algorithm: a key-encryption key (KEK) and a 64-bit integrity IV protect 64-bit blocks. The input must be a multiple of 8 bytes and at least 16 bytes.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key-kek |
string | (empty) | Key-encryption key; 16, 24 or 32 bytes. |
--key-kek-type |
option | Hex |
KEK encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | a6a6a6a6a6a6a6a6 |
64-bit integrity IV. |
--iv-type |
option | Hex |
IV encoding: Hex, UTF8, Latin1, Base64. |
--input-format |
option | Hex |
Input encoding: Hex or Raw bytes. |
--output-format |
option | Hex |
Output encoding: Hex or Raw bytes. |
Simple example
cchef aes-key-wrap -i '00112233445566778899aabbccddeeff' --key-kek 000102030405060708090a0b0c0d0e0fOutput:
1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5
Reference: Affine cipher
Decrypts text enciphered with the Affine cipher. Each letter is mapped to its
position in the alphabet and transformed by (y - b) * a⁻¹ % 26, where a⁻¹ is
the modular inverse of a modulo 26. Case is preserved and non-alphabetic
characters pass through unchanged. a and b must be non-negative integers and
a must be coprime to 26 (the same keys used to encode).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--a |
number | 1 |
The multiplier a; must be coprime to 26. |
--b |
number | 0 |
The additive constant b. |
Simple example
cchef affine-cipher-decode -i "Rclla, Oaplx!" --a 5 --b 8Output:
Hello, World!
Reference: Affine cipher
Enciphers text with the Affine cipher, a monoalphabetic substitution where each
letter is mapped to its position in the alphabet and transformed by
(ax + b) % 26. Case is preserved and non-alphabetic characters pass through
unchanged. a and b must be non-negative integers and a must be coprime to
26; with a = 1, b = 0 the input is unchanged.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--a |
number | 1 |
The multiplier a; must be coprime to 26. |
--b |
number | 0 |
The additive constant b. |
Simple example
cchef affine-cipher-encode -i "Hello, World!" --a 5 --b 8Output:
Rclla, Oaplx!
Complex example
cchef affine-cipher-encode -i "some keys are shaped as locks. index[me]" --a 23 --b 23Output:
vhnl tldv xyl vcxelo xv qhrtv. zkolg[nl]
ANDs each byte of the input with the repeating key.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | The key value, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, Decimal, Binary, Base64, UTF8, Latin1. |
Simple example
printf 'hello' | cchef and --key 0f --key-type Hex | cchef to-hex --delimiter NoneOutput:
08050c0c0f
Reference: Ascon (cipher)
Ascon-AEAD128 authenticated decryption (NIST SP 800-232). Decrypts the ciphertext (with its trailing 128-bit tag) and verifies authenticity: the key, nonce and associated data must match those used to encrypt, or decryption fails. The key and nonce must each be exactly 16 bytes.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | 16-byte key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--nonce |
string | (empty) | 16-byte nonce, interpreted per --nonce-type. |
--nonce-type |
option | Hex |
Nonce encoding: Hex, UTF8, Latin1, Base64. |
--associated-data |
string | (empty) | Associated data, interpreted per --associated-data-type. |
--associated-data-type |
option | Hex |
AD encoding: Hex, UTF8, Latin1, Base64. |
--input-format |
option | Hex |
How to read the ciphertext: Hex or Raw bytes. |
--output-format |
option | Raw |
How to render the plaintext: Raw bytes or Hex. |
Simple example
cchef ascon-decrypt -i af14bce6b9b6588c3aa63f9ddc5a0cf5f565f358b0 --key 000102030405060708090a0b0c0d0e0f --nonce 000102030405060708090a0b0c0d0e0fOutput:
Hello
With associated data
The associated data must match what was used at encryption time, or authentication fails.
cchef ascon-decrypt -i c5f46fb2c8f14b1d1006a0230236f4163573a24c5f30 --key 000102030405060708090a0b0c0d0e0f --nonce 101112131415161718191a1b1c1d1e1f --associated-data hdr-v1 --associated-data-type UTF8Output:
Secret
Reference: Ascon (cipher)
Ascon-AEAD128 authenticated encryption (NIST SP 800-232), a lightweight AEAD scheme designed for constrained devices. The output is the ciphertext followed by a 128-bit authentication tag. The key and nonce must each be exactly 16 bytes; never reuse a nonce with the same key. Associated data is authenticated but not encrypted.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | 16-byte key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--nonce |
string | (empty) | 16-byte nonce, interpreted per --nonce-type. |
--nonce-type |
option | Hex |
Nonce encoding: Hex, UTF8, Latin1, Base64. |
--associated-data |
string | (empty) | Associated data, interpreted per --associated-data-type. |
--associated-data-type |
option | Hex |
AD encoding: Hex, UTF8, Latin1, Base64. |
--input-format |
option | Raw |
How to read the input: Raw bytes or Hex. |
--output-format |
option | Hex |
How to render the output: Hex or Raw bytes. |
Simple example
cchef ascon-encrypt -i 'Hello' --key 000102030405060708090a0b0c0d0e0f --nonce 000102030405060708090a0b0c0d0e0fOutput:
af14bce6b9b6588c3aa63f9ddc5a0cf5f565f358b0
With associated data
Associated data (e.g. a header) is authenticated alongside the ciphertext; the same value is required to decrypt.
cchef ascon-encrypt -i 'Secret' --key 000102030405060708090a0b0c0d0e0f --nonce 101112131415161718191a1b1c1d1e1f --associated-data hdr-v1 --associated-data-type UTF8Output:
c5f46fb2c8f14b1d1006a0230236f4163573a24c5f30
Reference: Atbash
A mono-alphabetic substitution cipher that maps each letter to its mirror in the
alphabet (a<->z, b<->y, …). Case is preserved and non-alphabetic
characters pass through unchanged. Atbash takes no options and is its own
inverse, so running it a second time restores the original text.
Simple example
cchef atbash-cipher -i "The quick brown fox."Output:
Gsv jfrxp yildm ulc.
Reference: Bacon's cipher
Recovers a message concealed with the Baconian cipher, where each letter is
represented by five symbols. Invalid characters are stripped, the remaining
symbols are grouped into fives, and each group is looked up in the alphabet;
groups with no letter become ?.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--alphabet |
option | Standard (I=J and U=V) |
Standard (I=J and U=V) (24 letters) or Complete (26 letters). |
--translation |
option | 0/1 |
How the two symbols are represented: 0/1, A/B, Case (upper=1, lower=0), or A-M/N-Z first letter (each word's first letter). |
--invert-translation |
boolean | false |
Swap the two symbols before decoding. |
Simple example
cchef bacon-cipher-decode -i "00111 00100 01010 01010 01101"Output:
HELLO
Case translation
Upper-case letters are ones and lower-case letters are zeroes; everything else is ignored.
cchef bacon-cipher-decode -i "hELLo wORLd" --translation CaseOutput:
PP
Reference: Bacon's cipher
Conceals a message with the Baconian cipher, encoding each letter as five binary
digits (or A/B). By default non-letters are dropped and the output is grouped
into fives; "keep extra characters" instead preserves them inline.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--alphabet |
option | Standard (I=J and U=V) |
Standard (I=J and U=V) (24 letters) or Complete (26 letters). |
--translation |
option | 0/1 |
Symbols to emit: 0/1 or A/B. |
--keep-extra-characters |
boolean | false |
Keep non-letters inline instead of dropping them and grouping into fives. |
--invert-translation |
boolean | false |
Swap the two symbols in the output. |
Simple example
cchef bacon-cipher-encode -i "HELLO"Output:
00111 00100 01010 01010 01101
A/B, keeping extra characters
cchef bacon-cipher-encode -i "Hi!" --translation A/B --keep-extra-charactersOutput:
AABBBABAAA!
Reference: Bcrypt
Hashes the input password with bcrypt, an adaptive password-hashing function
built on the Blowfish cipher. A random salt is generated each run, so the output
differs every time (verify a password with Bcrypt compare). The cost must be
in bcrypt's 4–31 range and the output uses the $2b$ version.
This operation is also listed under Hashing.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--rounds |
number | 10 |
Cost (log2 of the iteration count), 4 to 31. |
Simple example
Because the salt is random, each invocation yields a different hash:
cchef bcrypt -i "hunter2" --rounds 8Output:
$2b$08$S6G81rTdmnLNORA5WFAWIOqCFDmyB0Jpq3KI7m1eSFwV5hKocZmB6
Reference: Bifid cipher
Deciphers text enciphered with the Bifid cipher using the same keyword. The keyword builds a 5×5 Polybius square (J is folded onto I); letter case is preserved and non-alphabetic characters pass through unchanged. An empty keyword uses the plain alphabet.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--keyword |
string | (empty) | Alphabet keyword (letters only); must match the one used to encode. |
Simple example
cchef bifid-cipher-decode -i "Kqhknw rm grsn" --keyword "Schrodinger"Output:
Attack at dawn
Reference: Bifid cipher
Enciphers text with the Bifid cipher, which fractionates each letter's coordinates in a keyword-seeded 5×5 Polybius square and transposes them. J is folded onto I, letter case is preserved, and non-alphabetic characters pass through unchanged.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--keyword |
string | (empty) | Alphabet keyword (letters only); an empty keyword uses the plain alphabet. |
Simple example
cchef bifid-cipher-encode -i "Attack at dawn" --keyword "Schrodinger"Output:
Kqhknw rm grsn
Without a keyword
cchef bifid-cipher-encode -i "Hello, World!"Output:
Fnpol, Parrd!
Shifts the bits in each byte left by a fixed amount (bits shifted past the top of the byte are dropped).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--amount |
number | 1 |
Number of bits to shift (0–7). |
Simple example
printf 'Hi' | cchef bit-shift-left --amount 1 | cchef to-hex --delimiter NoneOutput:
90d2
Shifts the bits in each byte right by a fixed amount. A logical shift fills the vacated top bits with zeros; an arithmetic shift preserves the most significant (sign) bit of the original byte.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--amount |
number | 1 |
Number of bits to shift. |
--type |
option | Logical shift |
Logical shift or Arithmetic shift. |
Simple example
printf 'Hi' | cchef bit-shift-right --amount 1 --type 'Logical shift' | cchef to-hex --delimiter NoneOutput:
2434
Logical vs. arithmetic shift
With the high bit set (0x80, 0xff), the arithmetic shift keeps the sign bit
while the logical shift clears it:
printf '80ff' | cchef from-hex | cchef bit-shift-right --amount 1 --type 'Logical shift' | cchef to-hex --delimiter NoneOutput:
407f
printf '80ff' | cchef from-hex | cchef bit-shift-right --amount 1 --type 'Arithmetic shift' | cchef to-hex --delimiter NoneOutput:
c0ff
Reference: Blowfish
Decrypts Blowfish ciphertext. The key must be 4–56 bytes and, for every mode except ECB, the IV must be exactly 8 bytes. CBC and ECB expect PKCS#7-padded, block-aligned input; decryption fails if the padding or length is invalid.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | Key (4–56 bytes), interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | (empty) | 8-byte IV (ignored for ECB), interpreted per --iv-type. |
--iv-type |
option | Hex |
IV encoding: Hex, UTF8, Latin1, Base64. |
--mode |
option | CBC |
Mode: CBC, CFB, OFB, CTR, ECB. |
--input-format |
option | Hex |
How to read the ciphertext: Hex or Raw bytes. |
--output-format |
option | Raw |
How to render the plaintext: Raw bytes or Hex. |
Simple example
cchef blowfish-decrypt -i 398433f39e938286a35fc240521435b6972f3fe96846b54ab9351aa5fa9e10a6a94074e883d1cb36cb9657c817274b60 --key 0011223344556677 --iv ffeeddccbbaa9988 --mode CBCOutput:
The quick brown fox jumps over the lazy dog.
Reference: Blowfish
Encrypts input with the Blowfish block cipher (64-bit block). The key must be 4–56 bytes and, for every mode except ECB, the IV must be exactly 8 bytes. CBC and ECB apply PKCS#7 padding; CFB, OFB and CTR are streaming and leave the length unchanged.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | Key (4–56 bytes), interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | (empty) | 8-byte IV (ignored for ECB), interpreted per --iv-type. |
--iv-type |
option | Hex |
IV encoding: Hex, UTF8, Latin1, Base64. |
--mode |
option | CBC |
Mode: CBC, CFB, OFB, CTR, ECB. |
--input-format |
option | Raw |
How to read the input: Raw bytes or Hex. |
--output-format |
option | Hex |
How to render the output: Hex or Raw bytes. |
Simple example
cchef blowfish-encrypt -i "The quick brown fox jumps over the lazy dog." --key 0011223344556677 --iv ffeeddccbbaa9988 --mode CBCOutput:
398433f39e938286a35fc240521435b6972f3fe96846b54ab9351aa5fa9e10a6a94074e883d1cb36cb9657c817274b60
Streaming mode (CTR)
CTR leaves the length unchanged (no padding):
cchef blowfish-encrypt -i "secret" --key 0011223344556677 --iv 0000000000000000 --mode CTROutput:
c5a8e6a22ed5
Reference: Bombe
Emulation of the Bombe machine used at Bletchley Park to attack Enigma. Given the ciphertext, a crib (known plaintext for part of it) and the rotors used, it suggests Enigma configurations — each a set of rotor start positions (left to right), the plugboard pairs it could determine, and a decryption preview. Choose a crib whose menu has loops (2+ is desirable); the checking machine discards stops that fail verification. Output is an HTML table.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--model |
option | 3-rotor |
3-rotor or 4-rotor. |
--left-most-4th-rotor |
string | Beta wiring | 4th-slot rotor wiring (4-rotor only). |
--left-hand-rotor / --middle-rotor / --right-hand-rotor |
string | I / II / III | Rotor wirings (stepping is ignored). |
--reflector |
string | reflector B | Reflector pairs. |
--crib |
string | (empty) | Known plaintext to match against the ciphertext. |
--crib-offset |
number | 0 |
Offset into the ciphertext where the crib begins. |
--use-checking-machine |
boolean | true |
Verify each stop and discard failures. |
Simple example
cchef bombe -i "BBYFLTHHYIJQAYBBYS" --crib "THISISATESTMESSAGE"Output:
Bombe run on menu with 6 loops (2+ desirable). Note: Rotor positions are listed left to right and start at the beginning of the crib, and ignore stepping and the ring setting. Some plugboard settings are determined. A decryption preview starting at the beginning of the crib and ignoring stepping is also provided.
<table class='table table-hover table-sm table-bordered table-nonfluid'><tr><th>Rotor stops</th> <th>Partial plugboard</th> <th>Decryption preview</th></tr>
<tr><td>LGA</td> <td>SS AG BO CL EK FF HH II JJ TT YY</td> <td>THISISATESTMESSAGE</td></tr>
</table>
(The default rotors are I/II/III with reflector B, so they can be omitted here.)
Reference: Caesar Box
A transposition cipher: the message (with spaces removed) is written row by row
into a box Box Height rows tall, then read back column by column. Encryption and
decryption are the same operation with complementary heights — a message encoded
with height h into a box of width w is decoded by re-running it with height w.
| Option | Description |
|---|---|
--box-height |
The number of rows in the box. |
Example — encode with a box three rows tall:
cchef caesar-box-cipher --box-height 3 -i "Hello World!"Output:
Hlodeor!lWl
Decoding reverses it. Hello World! (11 letters after stripping the space) fills a
3×4 box, so the inverse height is 4:
cchef caesar-box-cipher --box-height 4 -i "Hlodeor!lWl"Output:
HelloWorld!
Reference: Dolphins
Decodes Cetacean Cipher text back to the original message. Each run of e/E
characters is read in groups of sixteen as a 16-bit character code (e is a 1
bit, E a 0 bit); a literal space stands for a space character.
This operation takes no arguments.
cchef cetacean-cipher-decode -i "EEEEEEEEEeeEeEEEEEEEEEEEEeeEeEEe"Output:
hi
Reference: Dolphins
Converts any input into Cetacean Cipher: each character is written as its 16-bit
code, with e for a 1 bit and E for a 0 bit. Spaces are passed through
unchanged, so words stay separated.
This operation takes no arguments.
cchef cetacean-cipher-encode -i "hi"Output:
EEEEEEEEEeeEeEEEEEEEEEEEEeeEeEEe
Reference: ChaCha variant
ChaCha is Daniel J. Bernstein's stream cipher (a Salsa20 variant). This is a parameterised implementation covering both the original construction and the RFC-8439 variant. As a stream cipher, encryption and decryption are the same operation: re-running the ciphertext with the same key, nonce and counter returns the plaintext.
| Option | Description |
|---|---|
--key |
16- or 32-byte key (128 or 256 bits), given as Hex, UTF8, Latin1 or Base64. |
--nonce |
8- or 12-byte nonce, as Hex/UTF8/Latin1/Base64, or an integer (which becomes a 12-byte nonce). The nonce and counter together must total 16 bytes. |
--counter |
Starting block counter (default 0); incremented every 64 bytes of keystream. |
--rounds |
Number of rounds: 20, 12 or 8. |
--input-format |
How to read the input: Hex or Raw. |
--output-format |
How to write the output: Raw or Hex. |
Encrypt a message (256-bit key, 12-byte nonce, 20 rounds, raw text in, hex out):
cchef chacha --key 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \
--nonce 000000000000004a00000000 --counter 1 --rounds 20 \
--input-format Raw --output-format Hex -i "Hello, ChaCha!"Output:
6a 2a 3d 9f 2f 37 f9 a2 47 bf 64 07 d9 42
Decrypt by feeding that ciphertext back in with the same parameters:
cchef chacha --key 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \
--nonce 000000000000004a00000000 --counter 1 --rounds 20 \
--input-format Hex --output-format Raw -i "6a 2a 3d 9f 2f 37 f9 a2 47 bf 64 07 d9 42"Output:
Hello, ChaCha!
An 8-round keystream with a 128-bit key and an 8-byte nonce (so the counter is 8 bytes) — the draft-strombergson TC7.1 test vector:
cchef chacha --key 00112233445566778899aabbccddeeff --nonce 0f1e2d3c4b5a6978 \
--counter 0 --rounds 8 --input-format Hex --output-format Hex \
-i "00 00 00 00 00 00 00 00"Output:
29 56 0d 28 0b 45 28 40
Reference: CipherSaber
Decrypts CipherSaber-2 ciphertext. The first 10 bytes of the input are the initialization vector and the rest is the message, keyed with the RC4 stream cipher mixed over the given number of rounds. Use the same key and round count that were used to encrypt.
| Option | Description |
|---|---|
--key |
The shared key, as Hex, UTF8, Latin1 or Base64. |
--rounds |
Number of key-scheduling rounds (20 for CipherSaber-2; 1 is classic CipherSaber/RC4). |
The classic worked example (key asdfg, 1 round), reading the raw ciphertext
bytes on stdin:
printf '\x6f\x6d\x0b\xab\xf3\xaa\x67\x19\x03\x15\x30\xed\xb6\x77\xca\x74\xe0\x08\x9d\xd0\xe7\xb8\x85\x43\x56\xbb\x14\x48\xe3\x7c\xdb\xef\xe7\xf3\xa8\x4f\x4f\x5f\xb3\xfd' \
| cchef ciphersaber2-decrypt --key asdfg --key-type Latin1 --rounds 1Output:
This is a test of CipherSaber.
Reference: CipherSaber
Encrypts with CipherSaber-2. A fresh random 10-byte initialization vector is generated and prepended to the output, so the ciphertext is always 10 bytes longer than the input and differs on each run. Decrypt with the same key and round count.
| Option | Description |
|---|---|
--key |
The shared key, as Hex, UTF8, Latin1 or Base64. |
--rounds |
Number of key-scheduling rounds (20 for CipherSaber-2; 1 is classic CipherSaber/RC4). |
Because the IV is random, encryption is shown here round-tripped back through decryption with the same key and rounds:
printf 'Meet at dawn.' \
| cchef ciphersaber2-encrypt --key hunter2 --key-type Latin1 --rounds 20 \
| cchef ciphersaber2-decrypt --key hunter2 --key-type Latin1 --rounds 20Output:
Meet at dawn.
Reference: Citrix CTX1
Decodes a Citrix CTX1 password hash back to plaintext. The input length must be a
multiple of four (each source character encodes to four A–P characters);
otherwise the operation errors with Incorrect hash length.
This operation takes no arguments.
cchef citrix-ctx1-decode -i "NFHALEBBMHGCLEBBMDGGKMAJNOHLLKBP"Output:
password
Reference: Citrix CTX1
Encodes a string to the Citrix CTX1 password format. The text is UTF-16LE
encoded, folded through a running XOR chain, and emitted as pairs of A–P
characters (one per nibble).
This operation takes no arguments.
cchef citrix-ctx1-encode -i "password"Output:
NFHALEBBMHGCLEBBMDGGKMAJNOHLLKBP
Reference: Colossus computer
Emulates Colossus, the WW2 codebreaking computer built to attack the Lorenz
cipher. It runs the ciphertext tape repeatedly against the Chi/Psi/Motor wheel
patterns, programmed via the "K rack" of Q-bus switches, and counts how often a
condition holds — the statistical test cryptanalysts used to recover wheel
settings. Input is ITA2 text (A–Z, 3–9, + - . /); output is a JSON
object with the printer output, the five counters and the run count.
This operation has ~57 arguments mirroring the physical machine's controls;
cchef colossus --help lists them all. The most useful are below. The simplest
way to drive it is --k-rack-option "Select Program" with a preset
--program-to-run.
Key options
| Flag | Type | Default | Description |
|---|---|---|---|
--pattern |
option | KH Pattern |
Wheel pattern: KH Pattern, ZMUG Pattern or BREAM Pattern. |
--qbusz / --qbus-2 / --qbus-3 |
option | (empty) | Q-bus inputs: Z (cipher), Χ (chi) and Ψ (psi), each blank, direct or delta (Δ). |
--limitation |
option | None |
Motor limitation (Χ2, Χ2 + P5, X2 + Ψ1, …). |
--k-rack-option |
option | Select Program |
Select Program runs a preset; the others expose the raw switches. |
--program-to-run |
option | (empty) | Preset: Letter Count, 1+2=., 4=5=/1=2, /,5,U. |
--set-total |
number | 0 |
Only print counter lines above this threshold. |
--fast-step / --slow-step |
option | (empty) | Wheels stepped between runs (X1–X5, M37, M61, S1–S5). |
--start-1 … |
number | 1 |
Per-wheel start positions (Χ, Ψ and motor wheels). |
Simple example
The "Letter Count" program counts every character on the tape (here 30):
cchef colossus -i "CTBKJUVXHZ-H3L4QV+YEZUK+SXOZ/N" \
--k-rack-option "Select Program" --program-to-run "Letter Count" --qbusz ZOutput:
{"printout":" \n00 00 : a30 \n","counters":[30,0,0,0,0],"runcount":2}
Stepping a wheel
Setting a fast step runs the tape once per position of that wheel, printing a line per run:
cchef colossus -i "CTBKJUVXHZ-H3L4QV+YEZUK+SXOZ/N" \
--k-rack-option "Select Program" --program-to-run "Letter Count" \
--qbusz Z --fast-step X1Output:
{"printout":"X1 \n01 00 : a30 \n02 00 : a30 \n03 00 : a30 \n...41 00 : a30 \n","counters":[30,0,0,0,0],"runcount":42}
Reference: Key derivation function
Runs the OpenSSL EVP_BytesToKey password-based key derivation function (as used
by crypto-js). It repeatedly hashes the passphrase and salt to produce key
material of the requested size, returned as a lowercase hex string. The operation
input is ignored — the passphrase and salt come from the arguments.
Despite the description text (inherited from CyberChef), this operation does not generate a random salt: the salt is exactly the decoded salt argument, so an empty salt means no salt. That makes the output fully deterministic.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--passphrase / --passphrase-type |
toggleString | (empty) / UTF8 |
The passphrase and how to decode it (UTF8, Latin1, Hex, Base64). |
--key-size |
number | 128 |
Derived key size in bits, up to 8192. |
--iterations |
number | 1 |
Hash iterations per block, up to 10000000. |
--hashing-function |
option | SHA1 |
SHA1, SHA256, SHA384, SHA512 or MD5. |
--salt / --salt-type |
toggleString | (empty) / Hex |
The salt and how to decode it (Hex, UTF8, Latin1, Base64). |
Simple example
Derive a 128-bit key from a passphrase and a hex salt with SHA1:
cchef derive-evp-key --passphrase password --salt 73616c74 --salt-type HexOutput:
c88e9c67041a74e0357befdff93f87dd
Complex example
A 256-bit key with SHA256, 3 iterations and a UTF8 salt:
cchef derive-evp-key --passphrase password --key-size 256 --iterations 3 \
--hashing-function SHA256 --salt salt --salt-type UTF8Output:
cc19a87959d70ba1d9d2979b5fc2323e0d62a40fb2545492e9ec4d57ce79956d
Reference: HKDF
Runs the HMAC-based key derivation function of RFC 5869 (extract-then-expand)
over the input keying material (IKM, taken from the operation input). The result
is a lowercase hex string of L octets.
All twenty hash functions CyberChef offers are supported, including the less common MD2, SHA0, RIPEMD-128/256/320, HAS-160, Whirlpool/-0/-T and Snefru.
Extract mode selects how the pseudorandom key (PRK) is derived: with salt
uses the salt argument, no salt uses a string of HashLen zero bytes, and
skip treats the IKM directly as the PRK (skipping extraction).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--salt / --salt-type |
toggleString | (empty) / Hex |
Optional salt (Hex, Decimal, Base64, UTF8, Latin1). |
--info / --info-type |
toggleString | (empty) / Hex |
Optional context/application info. |
--hashing-function |
option | SHA256 |
Any of the 20 supported hashes (MD2 … Snefru). |
--extract-mode |
option | with salt |
with salt, no salt or skip. |
--l-number-of-output-octets |
number | 16 |
Output length L in bytes (max 255 × HashLen). |
Simple example
RFC 5869 test case 1 (SHA-256):
echo -n 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b | cchef from-hex --delimiter None \
| cchef derive-hkdf-key --salt 000102030405060708090a0b0c \
--info f0f1f2f3f4f5f6f7f8f9 --hashing-function SHA256 --l-number-of-output-octets 42Output:
3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865
With a less common hash (Whirlpool)
echo -n message | cchef derive-hkdf-key --hashing-function Whirlpool --l-number-of-output-octets 32Output:
db80ec2d94398636778bfa845d251a32a643c53d17b1c6b159c15190badaf90c
Reference: PBKDF2
Runs the PBKDF2 password-based key derivation function (PKCS #5 v2.0 / RFC 2898) over a passphrase and salt, returning the derived key as a lowercase hex string. The operation input is ignored — the passphrase and salt come from the arguments.
The key size is given in bits and the output is key-size / 8 bytes. Matching
CyberChef's browser behavior (pure-JS forge), a key size that is not a multiple
of 8 is floored to the whole byte, and a key size of zero or below yields an empty
key.
If the salt argument is left empty, a random salt (of key-size bytes) is
generated, making the output non-deterministic; supply a salt for reproducible
results.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--passphrase / --passphrase-type |
toggleString | (empty) / UTF8 |
The passphrase and how to decode it (UTF8, Latin1, Hex, Base64). |
--key-size |
number | 128 |
Derived key size in bits, up to 8192. |
--iterations |
number | 1 |
PBKDF2 iteration count, up to 10000000. |
--hashing-function |
option | SHA1 |
PRF hash: SHA1, SHA256, SHA384, SHA512 or MD5. |
--salt / --salt-type |
toggleString | (empty) / Hex |
The salt and how to decode it (Hex, UTF8, Latin1, Base64); empty means a random salt. |
Simple example
Derive a 128-bit key from a passphrase and a hex salt with SHA1:
cchef derive-pbkdf2-key --passphrase password --salt 73616c74 --salt-type HexOutput:
0c60c80f961f0e71f3a9b524af601206
Complex example
A 256-bit key with SHA256, 4 iterations and a UTF8 salt:
cchef derive-pbkdf2-key --passphrase password --key-size 256 --iterations 4 \
--hashing-function SHA256 --salt salt --salt-type UTF8Output:
cd7b203e3aef28a773613de46901d9a5d621228b3b3de8de24cea5b788459c8a
Reference: Data Encryption Standard
Decrypts DES ciphertext. The key must be exactly 8 bytes (64 bits) and, for every
mode except ECB, the IV must be exactly 8 bytes. CBC and ECB expect PKCS#7-padded,
block-aligned input; decryption fails if the length or padding is invalid. The
CBC/NoPadding and ECB/NoPadding modes skip the unpadding step and return the
raw padded blocks.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | 8-byte key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | (empty) | 8-byte IV (ignored for ECB), interpreted per --iv-type. |
--iv-type |
option | Hex |
IV encoding: Hex, UTF8, Latin1, Base64. |
--mode |
option | CBC |
Mode: CBC, CFB, OFB, CTR, ECB, CBC/NoPadding, ECB/NoPadding. |
--input-format |
option | Hex |
How to read the ciphertext: Hex or Raw bytes. |
--output-format |
option | Raw |
How to render the plaintext: Raw bytes or Hex. |
Simple example
cchef des-decrypt -i 340b6473dbd121662ce8e0c7a690b77bca334636056d85f9 --key 0123456789abcdef --iv 0011223344556677 --mode CBCOutput:
The quick brown fox
Reference: Data Encryption Standard
Encrypts input with the DES block cipher (64-bit block). The key must be exactly 8 bytes (64 bits) and, for every mode except ECB, the IV must be exactly 8 bytes. CBC and ECB apply PKCS#7 padding; CFB, OFB and CTR are streaming and leave the length unchanged. (DES is insecure and is provided for interoperability, not protection.)
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | 8-byte key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | (empty) | 8-byte IV (ignored for ECB), interpreted per --iv-type. |
--iv-type |
option | Hex |
IV encoding: Hex, UTF8, Latin1, Base64. |
--mode |
option | CBC |
Mode: CBC, CFB, OFB, CTR, ECB. |
--input-format |
option | Raw |
How to read the input: Raw bytes or Hex. |
--output-format |
option | Hex |
How to render the output: Hex or Raw bytes. |
Simple example
cchef des-encrypt -i "The quick brown fox" --key 0123456789abcdef --iv 0011223344556677 --mode CBCOutput:
340b6473dbd121662ce8e0c7a690b77bca334636056d85f9
Streaming mode (CTR)
CTR leaves the length unchanged (no padding):
cchef des-encrypt -i "secret" --key 0123456789abcdef --iv 0000000000000000 --mode CTROutput:
a6b12c85451c
Reference: Enigma machine
Enciphers/deciphers with the WW2 Enigma machine. The standard German military rotors (I–VIII, Beta, Gamma) and reflectors (B, C, and the thin variants) are built in. Enigma is its own inverse: decrypt by running the ciphertext through a machine set up the same way. Because this is a substitution machine, encryption and decryption are the same operation.
Rotors are given as the 26-letter wiring the rotor maps A→Z onto, optionally
followed by < and the stepping points (e.g. EKMFLGDQVZNTOWYHXUSPAIBRCJ<R);
reflectors and the plugboard are whitespace-separated letter pairs
(e.g. AB CD EF).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--model |
option | 3-rotor |
3-rotor or 4-rotor (the 4th slot uses a thin rotor/reflector). |
--left-most-4th-rotor |
string | Beta wiring | 4th-slot rotor wiring (4-rotor only). |
--left-most-rotor-ring-setting / --left-most-rotor-initial-value |
option | A |
Ring setting and start position of the 4th rotor. |
--left-hand-rotor |
string | rotor I | Left rotor wiring (wiring<steps). |
--left-hand-rotor-ring-setting / --left-hand-rotor-initial-value |
option | A |
Ring setting and start position of the left rotor. |
--middle-rotor |
string | rotor II | Middle rotor wiring. |
--middle-rotor-ring-setting / --middle-rotor-initial-value |
option | A |
Ring setting and start position of the middle rotor. |
--right-hand-rotor |
string | rotor III | Right rotor wiring. |
--right-hand-rotor-ring-setting / --right-hand-rotor-initial-value |
option | A |
Ring setting and start position of the right rotor. |
--reflector |
string | reflector B | Reflector pairs (13 pairs covering every letter). |
--plugboard |
string | (empty) | Plugboard pairs, e.g. AB CD. |
--strict-output |
boolean | true |
Drop non-letters and group the output into blocks of five. |
Simple example
With the default rotors (I, II, III at position A) --strict-output groups the
output into fives:
cchef enigma -i "HELLOWORLD"Output:
ILBDA AMTAZ
Round trip
The same settings decrypt it (Enigma is self-inverse):
cchef enigma -i "ILBDAAMTAZ"Output:
HELLO WORLD
With a plugboard and rotor start positions
cchef enigma -i "ATTACKATDAWN" --left-hand-rotor-initial-value Q --middle-rotor-initial-value E --right-hand-rotor-initial-value V --plugboard "AB CD"Output:
UQKUK TOKGQ CB
Reference: Fernet
Decrypts a Fernet token (the input) with a Base64-encoded key, returning the original message. Fernet is 128-bit AES-CBC with PKCS#7 padding, authenticated by HMAC-SHA256; the HMAC is verified before decryption and a mismatch is rejected. As in CyberChef, the token's timestamp is not checked (no TTL).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | The 32-byte key, Base64-encoded (standard or URL-safe). |
Simple example
cchef fernet-decrypt --key VGhpc0lzVGhpcnR5VHdvQ2hhcmFjdGVyc0xvbmdLZXk= \
-i 'gAAAAABce-Tycae8klRxhDX2uenJ-uwV8-A1XZ2HRnfOXlNzkKKfRxviNLlgtemhT_fd1Fw5P_zFUAjd69zaJBQyWppAxVV00SExe77ql8c5n62HYJOnoIU='Output:
This is a secret message.
Reference: Fernet
Encrypts the input into a Fernet token with a Base64-encoded key. Each call uses a fresh random IV and the current timestamp, so the output is different every time (but always decrypts back with the same key).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | The 32-byte key, Base64-encoded (standard or URL-safe). |
Simple example
Because the IV is random, encrypt and decrypt in one pipeline to see a stable result:
cchef fernet-encrypt --key cw_0x689RpI-jtRR7oE8h_eQsKImvJapLeSbXpwF4e4= -i "Secret" \
| cchef fernet-decrypt --key cw_0x689RpI-jtRR7oE8h_eQsKImvJapLeSbXpwF4e4=Output:
Secret
Reference: Flask sessions
Decodes the JSON payload of a Flask session cookie (payload.timestamp.signature,
as produced by itsdangerous) without verifying its signature. With
--view-timestamp the output also includes the cookie's Unix timestamp. Note the
compression Flask applies to large cookies (a leading .) is not handled.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--view-timestamp |
boolean | false |
Wrap the output as {payload, timestamp}. |
Simple example
cchef flask-session-decode -i 'eyJyb2xlIjoic3VwZXJ1c2VyIiwidXNlciI6ImFkbWluIn0.aZ-KEw.E_x6bOhA4GU9t72pMinJUjN-O3I'Output:
{
"role": "superuser",
"user": "admin"
}
Reference: Flask sessions
Signs a JSON payload (the input) into a Flask session cookie using the
itsdangerous HMAC scheme: a per-salt key is derived as HMAC(secret, salt) and
the message payload.timestamp is signed with HMAC(derivedKey, …). The
timestamp is the current time, so the output changes on each run.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | (empty) / Hex |
The secret key and how to decode it (Hex, Decimal, Binary, Base64, UTF8, Latin1). A key is required. |
--salt / --salt-type |
toggleString | cookie-session / UTF8 |
The signing salt and how to decode it. |
--algorithm |
option | sha1 |
HMAC hash: sha1 or sha256. |
Simple example
Because the timestamp is fresh each run, sign and verify in one pipeline:
printf '{"user":"admin","role":"editor"}' \
| cchef flask-session-sign --key s3cr3t --key-type UTF8 \
| cchef flask-session-verify --key s3cr3t --key-type UTF8 --view-timestamp=falseOutput:
{
"valid": true,
"payload": {
"user": "admin",
"role": "editor"
}
}
Reference: Flask sessions
Verifies the HMAC signature of a Flask session cookie and returns its payload.
An incorrect key or salt (or a tampered token) fails with Invalid signature!.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | (empty) / Hex |
The secret key and how to decode it. Required. |
--salt / --salt-type |
toggleString | cookie-session / UTF8 |
The signing salt and how to decode it. |
--algorithm |
option | sha1 |
HMAC hash: sha1 or sha256. |
--view-timestamp |
boolean | true |
Include the cookie's Unix timestamp in the output. |
Simple example
cchef flask-session-verify --key mysecretkey --key-type UTF8 --view-timestamp=false \
-i 'eyJyb2xlIjoic3VwZXJ1c2VyIiwidXNlciI6ImFkbWluIn0.aZ-KEw.E_x6bOhA4GU9t72pMinJUjN-O3I'Output:
{
"valid": true,
"payload": {
"role": "superuser",
"user": "admin"
}
}
Reference: Morse code
Translates International Morse Code back into upper-case text. Dashes (-, and
the Unicode hyphen/minus/en-dash/em-dash/underscore variants, or the word dash)
and dots (., ·, or the word dot) are all recognized. Signals are separated
by the letter delimiter and words by the word delimiter; unknown signals are
dropped.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--letter-delimiter |
option | Space |
Delimiter between letters: Space, Line feed, CRLF, Forward slash, Backslash, Comma, Semi-colon, Colon. |
--word-delimiter |
option | Line feed |
Delimiter between words (same set, minus Space). |
Simple example
cchef from-morse-code -i '... --- ...'Output:
SOS
Reference: GOST (block cipher)
Decrypts input with a GOST block cipher — GOST 28147-89 / GOST R 34.12-2015 "Magma" (64-bit block) or "Kuznyechik" (128-bit block). This reverses GOST Encrypt; the same key, IV, algorithm, S-box, block mode, key-meshing and padding must be supplied. Keys are 256 bits (shorter keys are zero-extended). ZERO/PKCS5 padding is not stripped on decryption, so trailing padding bytes remain in the output.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | 256-bit key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | (empty) | IV (block size; block size / 2 for CTR-2015). Defaults to zeros. |
--iv-type |
option | Hex |
IV encoding. |
--input-type |
option | Hex |
Read the input as Hex or Raw bytes. |
--output-type |
option | Raw |
Render the output as Raw bytes or Hex. |
--algorithm |
option | GOST 28147 (1989) |
GOST 28147 (1989), GOST R 34.12 (Magma, 2015), GOST R 34.12 (Kuznyechik, 2015). |
--sbox |
option | E-TEST |
Paramset S-box (GOST 28147-89 only): E-TEST, E-A…E-Z, D-TEST, D-A, D-SC. |
--block-mode |
option | ECB |
ECB, CFB, OFB, CTR, CBC. |
--key-meshing-mode |
option | NO |
NO or CP (CryptoPro key meshing, every 1024 bytes). |
--padding |
option | NO |
NO, PKCS5, ZERO, RANDOM, BIT (NO/PKCS5/ZERO are all zero-padding). |
Simple example
cchef gost-decrypt -i "813f92e29526d2a2cd4115136759a05fda0657" --key 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff --iv 0011223344556677 --algorithm "GOST 28147 (1989)" --sbox E-A --block-mode CFBOutput:
The quick brown fox
Reference: GOST (block cipher)
Encrypts input with a GOST block cipher. GOST 28147-89 (RFC 5830) and its
GOST R 34.12-2015 successor "Magma" use a 64-bit block; the 2015 standard also
defines the 128-bit "Kuznyechik" cipher. The 1989 algorithm additionally selects
a paramset S-box; the 2015 algorithms use fixed transforms (the --sbox flag is
ignored). ECB and CBC pad the input (ZERO by default — NO, PKCS5 and ZERO
all zero-pad in this implementation, matching CyberChef); CFB, OFB and CTR are
streaming. CryptoPro key meshing re-keys every 1024 bytes.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | 256-bit key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | (empty) | IV (block size; block size / 2 for CTR-2015). Defaults to zeros. |
--iv-type |
option | Hex |
IV encoding. |
--input-type |
option | Raw |
Read the input as Raw bytes or Hex. |
--output-type |
option | Hex |
Render the output as Hex or Raw bytes. |
--algorithm |
option | GOST 28147 (1989) |
GOST 28147 (1989), GOST R 34.12 (Magma, 2015), GOST R 34.12 (Kuznyechik, 2015). |
--sbox |
option | E-TEST |
Paramset S-box (GOST 28147-89 only). |
--block-mode |
option | ECB |
ECB, CFB, OFB, CTR, CBC. |
--key-meshing-mode |
option | NO |
NO or CP. |
--padding |
option | NO |
NO, PKCS5, ZERO, RANDOM, BIT. |
Simple example
cchef gost-encrypt -i "The quick brown fox" --key 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff --iv 0011223344556677 --algorithm "GOST 28147 (1989)" --sbox E-A --block-mode CFBOutput:
813f92e29526d2a2cd4115136759a05fda0657
Kuznyechik (128-bit, CBC with PKCS5 padding)
cchef gost-encrypt -i "The quick brown fox" --key 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff --iv 00112233445566778899aabbccddeeff --algorithm "GOST R 34.12 (Kuznyechik, 2015)" --sbox E-A --block-mode CBC --padding PKCS5Output:
c3ceeac2ac997bcf0d2f27d07ff44f5f3021ec5e87f053c370a50cf033dd51b6
Reference: GOST (block cipher)
Reverses GOST Key Wrap, recovering a content-encryption key
from a wrapped blob. The same key-encryption key (KEK), User Key Material (UKM)
and wrapping mode must be supplied; the embedded MAC is verified and an error is
returned if it does not match. CP (CryptoPro) wrapping is only defined for the
64-bit algorithms.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | Key-encryption key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding. |
--user-key-material |
string | (empty) | UKM (block size); required for NO/CP. |
--user-key-material-type |
option | Hex |
UKM encoding. |
--input-type |
option | Hex |
Read the wrapped input as Hex or Raw bytes. |
--output-type |
option | Raw |
Render the recovered key as Raw bytes or Hex. |
--algorithm |
option | GOST 28147 (1989) |
Block-cipher variant. |
--sbox |
option | E-TEST |
Paramset S-box (GOST 28147-89 only). |
--key-wrapping |
option | NO |
NO (RFC 4357 6.1), CP (CryptoPro), SC (SignalCom). |
Simple example
cchef gost-key-unwrap -i "e0241d25cac43b42867d22580e9c01cbe0241d25cac43b42867d22580e9c01cbb8ed2bf5" --key 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff --user-key-material 0011223344556677 --algorithm "GOST 28147 (1989)" --sbox E-A --key-wrapping CPOutput:
0123456789abcdef0123456789abcdef
Reference: GOST (block cipher)
Wraps a content-encryption key for storage in untrusted locations using a GOST
block cipher (RFC 4357). The output is the encrypted key followed by a MAC. Three
wrapping modes are supported: NO (plain GOST 28147-89 key wrap), CP
(CryptoPro, which diversifies the KEK with the UKM), and SC (SignalCom). The
UKM must be the block size in length. Wrap a full 256-bit key for a clean
round-trip (shorter inputs are zero-filled to the key size before the MAC).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | Key-encryption key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding. |
--user-key-material |
string | (empty) | UKM (block size); required for NO/CP. |
--user-key-material-type |
option | Hex |
UKM encoding. |
--input-type |
option | Raw |
Read the key to wrap as Raw bytes or Hex. |
--output-type |
option | Hex |
Render the wrapped key as Hex or Raw bytes. |
--algorithm |
option | GOST 28147 (1989) |
Block-cipher variant (CP is 64-bit only). |
--sbox |
option | E-TEST |
Paramset S-box (GOST 28147-89 only). |
--key-wrapping |
option | NO |
NO, CP, SC. |
Simple example
cchef gost-key-wrap -i "0123456789abcdef0123456789abcdef" --key 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff --user-key-material 0011223344556677 --algorithm "GOST 28147 (1989)" --sbox E-A --key-wrapping CPOutput (the CryptoGost encoder wraps the hex at 32 bytes with a CRLF):
e0241d25cac43b42867d22580e9c01cbe0241d25cac43b42867d22580e9c01cb
b8ed2bf5
Reference: GOST (block cipher)
Computes a message authentication code (imitovstavka) over the input using a GOST block cipher in MAC mode. The MAC length is configurable from 8 to 64 bits (in 8-bit steps). Verify a MAC with GOST Verify.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | 256-bit key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding. |
--iv |
string | (empty) | IV (block size). Defaults to zeros. |
--iv-type |
option | Hex |
IV encoding. |
--input-type |
option | Raw |
Read the input as Raw bytes or Hex. |
--output-type |
option | Hex |
Render the MAC as Hex or Raw bytes. |
--algorithm |
option | GOST 28147 (1989) |
Block-cipher variant. |
--sbox |
option | E-TEST |
Paramset S-box (GOST 28147-89 only). |
--mac-length |
number | 32 |
MAC length in bits (8–64, multiples of 8). |
Simple example
cchef gost-sign -i "The quick brown fox" --key 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff --iv 0011223344556677 --algorithm "GOST 28147 (1989)" --sbox E-A --mac-length 32Output:
ccd815bc
Reference: GOST (block cipher)
Verifies a GOST block-cipher MAC (from GOST Sign) against the
input. Enter the signature in the --mac field; the MAC length is taken from
its length. Reports whether the signature matches.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | 256-bit key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding. |
--iv |
string | (empty) | IV (block size). Defaults to zeros. |
--iv-type |
option | Hex |
IV encoding. |
--mac |
string | (empty) | The MAC to verify, interpreted per --mac-type. |
--mac-type |
option | Hex |
MAC encoding. |
--input-type |
option | Raw |
Read the input as Raw bytes or Hex. |
--algorithm |
option | GOST 28147 (1989) |
Block-cipher variant. |
--sbox |
option | E-TEST |
Paramset S-box (GOST 28147-89 only). |
Simple example
cchef gost-verify -i "The quick brown fox" --key 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff --iv 0011223344556677 --mac ccd815bc --algorithm "GOST 28147 (1989)" --sbox E-AOutput:
The signature matches
Reference: JSON Web Token
Decodes a JSON Web Token and returns its payload without verifying the signature. Use JWT Verify to check the signature as well. Takes no options.
Simple example
cchef jwt-decode -i "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.0ha6-j4FwvEIKPVZ-hf3S_R9Hy_UtXzq4dnedXcUrXk"Output:
{
"String": "SomeString",
"Number": 42,
"iat": 1
}
Reference: JSON Web Token
Signs a JSON object as a JSON Web Token. The key is the shared secret for the
HMAC (HS*) algorithms, or a PEM-encoded private key for the RSA (RS*) and
ECDSA (ES*) algorithms; None produces an unsigned token. When the payload has
no iat claim, the current Unix time is added as one (matching CyberChef), so
tokens for the same input vary over time unless you supply iat yourself.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--privatesecret-key |
string | secret |
HMAC secret or PEM-encoded private key. |
--signing-algorithm |
option | HS256 |
One of HS256/384/512, RS256/384/512, ES256/384/512, None. |
--header |
string | {} |
Extra JWT header fields, as a JSON object. |
Simple example
cchef jwt-sign -i '{"user":"admin","iat":1}' --privatesecret-key secret_catOutput:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiYWRtaW4iLCJpYXQiOjF9.3GOQ7aWeGeTJEkIRMXuErxG55jgXsvTQW-RZQRc5n_E
Complex example — HS512 with a custom kid header field:
cchef jwt-sign -i '{"user":"admin","iat":1}' --privatesecret-key secret_cat --signing-algorithm HS512 --header '{"kid":"key-1"}'Output:
eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCIsImtpZCI6ImtleS0xIn0.eyJ1c2VyIjoiYWRtaW4iLCJpYXQiOjF9.UyxlWcBvMBa_PCnytzP0ZYP1hdh11zR5uy1wdgy6kGjdfkDiXvLsIDxS_-3TxtGyiN37QSr_IIoNDQXE7Ja44Q
Reference: JSON Web Token
Verifies that a JSON Web Token is valid and was signed with the provided key,
then returns its payload. The key is the shared secret for HMAC algorithms or a
PEM-encoded public key for RSA and ECDSA. Verification fails if the signature does
not match or the token has expired (exp) or is not yet active (nbf).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--publicsecret-key |
string | secret |
HMAC secret or PEM-encoded public key. |
Simple example
cchef jwt-verify -i "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.0ha6-j4FwvEIKPVZ-hf3S_R9Hy_UtXzq4dnedXcUrXk" --publicsecret-key secret_catOutput:
{
"String": "SomeString",
"Number": 42,
"iat": 1
}
Reference: LS47
Decrypts an LS47 ciphertext. LS47 is an improvement of the ElsieFour (LC4) cipher
that uses a 7x7 grid of the 49-character alphabet
_abcdefghijklmnopqrstuvwxyz.0123456789,-+*/:?!'(). The password is expanded into
a grid key, and Padding leading characters (which LS47 Encrypt
prepends at random) are stripped from the recovered text. The decrypted output
still contains the --- separator and any signature that was appended.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--password |
string | (empty) | Password expanded into the grid key. |
--padding |
number | 10 |
Number of leading padding characters to drop. |
Simple example
cchef ls47-decrypt -i "(,t74ci78cp/8trx*yesu:alp1wqy" --password helloworld --padding 0Output:
thequickbrownfoxjumped---test
Reference: LS47
Encrypts with the LS47 cipher, an improvement of the ElsieFour (LC4) cipher that
uses a 7x7 grid of the 49-character alphabet
_abcdefghijklmnopqrstuvwxyz.0123456789,-+*/:?!'(). The password is expanded into
a grid key. Before encryption, Padding random characters are prepended and the
Signature is appended after a --- separator; only the alphabet characters may
appear in the input, password, or signature. With a non-zero Padding the output
is randomized each run (decryption removes the padding); use Padding 0 for a
deterministic result.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--password |
string | (empty) | Password expanded into the grid key. |
--padding |
number | 10 |
Number of random characters to prepend. |
--signature |
string | (empty) | Text appended after a --- separator. |
Simple example
cchef ls47-encrypt -i "thequickbrownfoxjumped" --password helloworld --padding 0 --signature testOutput:
(,t74ci78cp/8trx*yesu:alp1wqy
Reference: Lorenz cipher
Enciphers/deciphers with the Lorenz SZ40/42 cipher attachment — a twelve-wheel
Vernam machine that XORs the plaintext (in ITA2) with a key stream from five chi
wheels, five psi wheels and two motor wheels. Three models (SZ40, SZ42a,
SZ42b) and three historical wheel patterns (KH, ZMUG, BREAM) are built in, plus
a Custom pattern that reads twelve lug strings (./x).
Set --mode Send to encipher and --mode Receive to decipher. Plaintext is
converted to/from ITA2 with figure/letter shifts; --input-type ITA2 /
--output-type ITA2 skip that conversion. The full per-wheel start and lug flags
are listed by cchef lorenz --help.
Key options
| Flag | Type | Default | Description |
|---|---|---|---|
--model |
option | SZ40 |
SZ40, SZ42a or SZ42b (the SZ42 models add limitations). |
--wheel-pattern |
option | KH Pattern |
KH Pattern, ZMUG Pattern, BREAM Pattern, No Pattern or Custom. |
--kt-schalter |
boolean | false |
KT-Schalter limitation (SZ42a/b). |
--mode |
option | Send |
Send to encipher, Receive to decipher. |
--input-type / --output-type |
option | Plaintext |
Plaintext or ITA2. |
--ita2-format |
option | 5/8/9 |
Represent figure-shift/letter-shift/space as 5/8/9 or +/-/.. |
--<wheel>-start-… |
number | 1 |
Start position of each Ψ/Μ/Χ wheel. |
--<wheel>-lugs-… |
string | pattern | Custom lug strings (used when --wheel-pattern Custom). |
Simple example
Encipher plaintext with the KH pattern (ITA2 output, 9 = space):
cchef lorenz -i "HELLO WORLD, THIS IS A TEST MESSAGE." --model SZ40 --wheel-pattern "KH Pattern" --mode SendOutput:
VIC3TS/CUJA/3II9W9JWDI5DAFXT4SOIF3999IZD9T
Round trip
The same settings in Receive mode recover the plaintext:
cchef lorenz -i "VIC3TS/CUJA/3II9W9JWDI5DAFXT4SOIF3999IZD9T" --model SZ40 --wheel-pattern "KH Pattern" --mode Receive --output-type PlaintextOutput:
HELLO WORLD, THIS IS A TEST MESSAGE.
Reference: Bombe
Like Bombe, but runs the attack over many rotor configurations when the rotors are unknown. Supply candidate rotors (one wiring per line) and reflectors; it tries every ordering and reports the configurations that produce stops. Test your crib with the single Bombe first — a 4-rotor search is very slow.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--main-rotors |
string | (empty) | Candidate rotor wirings, one per line (3+ required). |
--4th-rotor |
string | (empty) | Candidate 4th-slot rotors, one per line (optional). |
--reflectors |
string | (empty) | Candidate reflectors, one per line. |
--crib |
string | (empty) | Known plaintext to match against the ciphertext. |
--crib-offset |
number | 0 |
Offset into the ciphertext where the crib begins. |
--use-checking-machine |
boolean | true |
Verify each stop and discard failures. |
Simple example
cchef multiple-bombe -i "BBYFLTHHYIJQAYBBYS" --main-rotors "$(printf 'EKMFLGDQVZNTOWYHXUSPAIBRCJ\nAJDKSIRUXBLHWTMCQGZNPYFVOE\nBDFHJLCPRTXVZNYEIWGAKMUSQO')" --reflectors "AY BR CU DH EQ FS GL IP JX KN MO TZ VW" --crib "THISISATESTMESSAGE"Output:
Bombe run on menu with 6 loops (2+ desirable). Note: Rotors and rotor positions are listed left to right, ignore stepping and the ring setting, and positions start at the beginning of the crib. Some plugboard settings are determined. A decryption preview starting at the beginning of the crib and ignoring stepping is also provided.
Rotors: EKMFLGDQVZNTOWYHXUSPAIBRCJ, AJDKSIRUXBLHWTMCQGZNPYFVOE, BDFHJLCPRTXVZNYEIWGAKMUSQO
Reflector: AY BR CU DH EQ FS GL IP JX KN MO TZ VW
<table class='table table-hover table-sm table-bordered table-nonfluid'><tr><th>Rotor stops</th> <th>Partial plugboard</th> <th>Decryption preview</th></tr>
<tr><td>LGA</td> <td>SS AG BO CL EK FF HH II JJ TT YY</td> <td>THISISATESTMESSAGE</td></tr>
</table>
Returns the inverse (bitwise complement) of each byte.
Simple example
printf 'hello' | cchef not | cchef to-hex --delimiter NoneOutput:
979a939390
ORs each byte of the input with the repeating key.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | The key value, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, Decimal, Binary, Base64, UTF8, Latin1. |
Simple example
printf 'hello' | cchef or --key 80 --key-type Hex | cchef to-hex --delimiter NoneOutput:
e8e5ececef
Reference: PRESENT (cipher)
Decrypts PRESENT Encrypt ciphertext. PRESENT is an
ultra-lightweight 64-bit block cipher (ISO/IEC 29192-2:2019) with 80-bit or
128-bit keys. The key and IV are entered in the encoding selected by their type
toggle; the IV is required (8 bytes) for CBC mode. The padding must match what was
used to encrypt — note that NO, ZERO and RANDOM padding cannot be stripped,
so their bytes remain in the output.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
Key: 10 bytes (80-bit) or 16 bytes (128-bit). |
--iv / --iv-type |
toggleString | Hex |
8-byte IV (CBC only). |
--mode |
option | CBC |
Block mode: CBC or ECB. |
--input-format |
option | Hex |
Read the ciphertext as Hex or Raw. |
--output-format |
option | Raw |
Emit the plaintext as Raw or Hex. |
--padding |
option | PKCS5 |
PKCS5, NO, ZERO, RANDOM or BIT. |
Simple example — decrypt the official 80-bit zero-key test vector:
cchef present-decrypt -i "5579c1387b228445" --key 00000000000000000000 --mode ECB --input-format Hex --output-format Hex --padding NOOutput:
0000000000000000
Reference: PRESENT (cipher)
Encrypts with the PRESENT cipher, an ultra-lightweight 64-bit block cipher
(ISO/IEC 29192-2:2019) designed for constrained environments such as RFID tags.
It supports 80-bit (10-byte) or 128-bit (16-byte) keys with 31 rounds. The key
and IV are entered in the encoding selected by their type toggle; the IV is
required (8 bytes) for CBC mode. PKCS5 padding adds a full extra block when the
input is already block-aligned.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
Key: 10 bytes (80-bit) or 16 bytes (128-bit). |
--iv / --iv-type |
toggleString | Hex |
8-byte IV (CBC only). |
--mode |
option | CBC |
Block mode: CBC or ECB. |
--input-format |
option | Raw |
Read the plaintext as Raw or Hex. |
--output-format |
option | Hex |
Emit the ciphertext as Hex or Raw. |
--padding |
option | PKCS5 |
PKCS5, NO, ZERO, RANDOM or BIT. |
Simple example — the official 80-bit zero-key test vector:
cchef present-encrypt -i "0000000000000000" --key 00000000000000000000 --mode ECB --input-format Hex --output-format Hex --padding NOOutput:
5579c1387b228445
Complex example — CBC mode with a 128-bit key, IV and PKCS5 padding:
cchef present-encrypt -i "Hello, PRESENT!" --key 00112233445566778899aabbccddeeff --iv 0011223344556677 --mode CBC --input-format Raw --output-format Hex --padding PKCS5Output:
24923642d2ce04d577ae12bb2a619dad
Reference: RC2
Decrypts RC2 Encrypt ciphertext. RC2 is a 64-bit block cipher with a variable-length key (used here with 128 effective key bits). Leave the IV blank for ECB mode, or supply an 8-byte IV for CBC. As in CyberChef, decryption is lenient: it strips PKCS#7 padding only when the input is a whole number of blocks and the trailing count is valid, otherwise it returns the decrypted blocks unchanged rather than erroring.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
Variable-length key. |
--iv / --iv-type |
toggleString | Hex |
Blank for ECB, or 8 bytes for CBC. |
--input-format |
option | Hex |
Read the ciphertext as Hex or Raw. |
--output-format |
option | Raw |
Emit the plaintext as Raw or Hex. |
Simple example
cchef rc2-decrypt -i "abfd24cbb7706c69d00ae132c70b3df8" --key 0123456789abcdef --input-format Hex --output-format RawOutput:
Attack at dawn!
Reference: RC2
Encrypts with the RC2 (ARC2) block cipher, designed by Ron Rivest in 1987. It operates on 64-bit blocks with a variable-length key (used here with 128 effective key bits) and PKCS#7 padding. Leave the IV blank for ECB mode, or supply an 8-byte IV for CBC.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
Variable-length key. |
--iv / --iv-type |
toggleString | Hex |
Blank for ECB, or 8 bytes for CBC. |
--input-format |
option | Raw |
Read the plaintext as Raw or Hex. |
--output-format |
option | Hex |
Emit the ciphertext as Hex or Raw. |
Simple example
cchef rc2-encrypt -i "Attack at dawn!" --key 0123456789abcdef --input-format Raw --output-format HexOutput:
abfd24cbb7706c69d00ae132c70b3df8
Complex example — CBC mode with an 8-byte IV:
cchef rc2-encrypt -i "Attack at dawn!" --key 0123456789abcdef --iv 0011223344556677 --input-format Raw --output-format HexOutput:
fed01cb7381c9e20ee87aa826eb75428
Reference: RC4
Applies the RC4 stream cipher. Because RC4 XORs the input with a keystream, the
same operation both encrypts and decrypts. The passphrase and the input/output are
each read/written in a selectable format (Latin1, UTF8, UTF16, UTF16LE,
UTF16BE, Hex or Base64). The passphrase is used as a raw key (there is no
password-based key derivation).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--passphrase / --passphrase-type |
toggleString | UTF8 |
Key, parsed in the chosen format. |
--input-format |
option | Latin1 |
How to read the input. |
--output-format |
option | Latin1 |
How to write the output. |
Note:
UTF8output errors if the ciphertext is not valid UTF-8 (matching CryptoJS).UTF16*output is exact only for representable code units — the lone surrogates CryptoJS can emit become U+FFFD; useHexorBase64for binary output.
Simple example — encrypt (the classic "Secret"/"Attack at dawn" vector):
cchef rc4 -i "Attack at dawn" --passphrase Secret --passphrase-type Latin1 --input-format Latin1 --output-format HexOutput:
45a01f645fc35b383552544b9bf5
Complex example — decrypt the ciphertext back (Hex input, Latin1 output):
cchef rc4 -i "45a01f645fc35b383552544b9bf5" --passphrase Secret --passphrase-type Latin1 --input-format Hex --output-format Latin1Output:
Attack at dawn
Generates a random probable prime of a given size, tested with Miller-Rabin. The input is ignored.
| Option | Type | Default | Notes |
|---|---|---|---|
--bit-length |
number | 512 | From 2 to 4096. |
--crypto-grade |
boolean | false | Test more thoroughly: forty rounds rather than seven. |
--output-format |
option | Decimal |
Or Hexadecimal, written with an 0x prefix. |
One departure from CyberChef, fixing a fault in its version (also logged upstream): it sets a bit to stop the number being too short but never clears the ones above it, so it only returns the length asked for when that length is a whole number of bytes — ask it for 17 bits and you may get 24. cchef returns exactly the number of bits asked for.
cchef pseudo-random-prime-generator --bit-length 64Output (a different number each time):
10307556471115595143
Reference: RC4
Applies RC4 after discarding the initial portion of the keystream (the "drop"), which defends against the Fluhrer–Mantin–Shamir weakness in RC4's first output bytes. The drop is measured in 32-bit dwords (4 keystream bytes each); a drop of 0 is identical to plain RC4. Formats work exactly as for RC4.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--passphrase / --passphrase-type |
toggleString | UTF8 |
Key, parsed in the chosen format. |
--input-format |
option | Latin1 |
How to read the input. |
--output-format |
option | Latin1 |
How to write the output. |
--number-of-dwords-to-drop |
number | 192 |
Keystream dwords (×4 bytes) to discard. |
Simple example — with the default 192-dword drop:
cchef rc4-drop -i "Attack at dawn" --passphrase Secret --passphrase-type Latin1 --input-format Latin1 --output-format Hex --number-of-dwords-to-drop 192Output:
0500fe98fe4c9c49eb5ae08e95b1
Reference: RC6
Decrypts RC6 Encrypt ciphertext. The Word Size and Rounds must
match those used to encrypt, and RC6's block size is 4 × wordSize/8 bytes (16
bytes for the standard w=32). Leave the IV blank for ECB, or supply a full-block
IV for the other modes. As in CyberChef, ECB/CBC use PKCS#7 padding by default.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
Variable-length key. |
--iv / --iv-type |
toggleString | Hex |
Block-size IV (blank ⇒ null bytes; unused for ECB). |
--mode |
option | CBC |
CBC, CFB, OFB, CTR or ECB. |
--input-format |
option | Hex |
Read the ciphertext as Hex or Raw. |
--output-format |
option | Raw |
Emit the plaintext as Raw or Hex. |
--padding |
option | PKCS5 |
PKCS5, NO, ZERO, RANDOM or BIT. |
--word-size |
number | 32 |
Word size in bits (multiple of 8, 8–256). |
--rounds |
number | 20 |
Number of rounds (1–255). |
Simple example — the IETF RC6-32/20/16 test vector:
cchef rc6-decrypt -i "3a96f9c7f6755cfe46f00e3dcd5d2a3c" --key 000102030405060708090a0b0c0d0e0f --mode ECB --input-format Hex --output-format Hex --padding NO --word-size 32 --rounds 20Output:
000102030405060708090a0b0c0d0e0f
Reference: RC6
Encrypts with the RC6 block cipher, an AES-competition finalist derived from RC5.
RC6 is parameterised as RC6-w/r/b: Word Size w (a multiple of 8 from 8 to 256;
32 is standard), Rounds r (1–255; 20 is standard), and the key length b. The
block size is 4 × w/8 bytes. Leave the IV blank for ECB, or supply a full-block
IV for the other modes; ECB/CBC use PKCS#7 padding by default.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
Variable-length key. |
--iv / --iv-type |
toggleString | Hex |
Block-size IV (blank ⇒ null bytes; unused for ECB). |
--mode |
option | CBC |
CBC, CFB, OFB, CTR or ECB. |
--input-format |
option | Raw |
Read the plaintext as Raw or Hex. |
--output-format |
option | Hex |
Emit the ciphertext as Hex or Raw. |
--padding |
option | PKCS5 |
PKCS5, NO, ZERO, RANDOM or BIT. |
--word-size |
number | 32 |
Word size in bits (multiple of 8, 8–256). |
--rounds |
number | 20 |
Number of rounds (1–255). |
Simple example — the IETF RC6-32/20/16 test vector (ECB, no padding):
cchef rc6-encrypt -i "000102030405060708090a0b0c0d0e0f" --key 000102030405060708090a0b0c0d0e0f --mode ECB --input-format Hex --output-format Hex --padding NO --word-size 32 --rounds 20Output:
3a96f9c7f6755cfe46f00e3dcd5d2a3c
Complex example — CBC mode with an IV and PKCS#7 padding:
cchef rc6-encrypt -i "Attack at dawn" --key 00112233445566778899aabbccddeeff --iv 000102030405060708090a0b0c0d0e0f --mode CBC --input-format Raw --output-format Hex --padding PKCS5 --word-size 32 --rounds 20Output:
7e29a72dd5a5ac89128230c10689d948
Computes the ROR13 hash of the input: the 32-bit accumulator is rotated right 13
bits and each byte added in turn, and the result is emitted as 0x-prefixed,
8-digit uppercase hex. This is the API-name hashing convention used by some
Windows shellcode to resolve exports without embedding their names.
Simple example
cchef ror13 -i 'LoadLibraryA'Output:
0xEC0E4E8E
A Caesar substitution cipher that rotates alphabet characters (and optionally digits) by a configurable amount.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--rotate-lower-case-chars |
bool | true |
Rotate a–z. |
--rotate-upper-case-chars |
bool | true |
Rotate A–Z. |
--rotate-numbers |
bool | false |
Also rotate 0–9. |
--amount |
number | 13 |
Rotation amount (negative values rotate backwards). |
Simple example
cchef rot13 -i 'Hello, World!'Output:
Uryyb, Jbeyq!
Also rotate digits
cchef rot13 --rotate-numbers -i 'abc 123'Output:
nop 456
Reference: ROT13
Tries every meaningful ROT13 rotation (amounts 1–25) and prints each result,
optionally filtered to those containing a known-plaintext Crib. You choose which
character classes rotate (lower/upper/digits), and can sample a slice of the input.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--rotate-lower-case-chars |
boolean | true |
Rotate a–z. |
--rotate-upper-case-chars |
boolean | true |
Rotate A–Z. |
--rotate-numbers |
boolean | false |
Rotate 0–9. |
--sample-length |
number | 100 |
Bytes of input to try. |
--sample-offset |
number | 0 |
Offset into the input to sample from. |
--print-amount |
boolean | true |
Prefix each line with Amount = NN:. |
--crib |
string | (empty) | Only show results containing this text. |
Simple example
cchef rot13-brute-force -i "Uryyb Jbeyq" --crib helloOutput:
Amount = 13: Hello World
A variant of the Caesar cipher covering printable ASCII characters from ! (33)
to ~ (126). The default rotation is 47.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--amount |
number | 47 |
Rotation amount (negative values rotate backwards). |
Simple example
cchef rot47 -i 'Hello, World!'Output:
w6==@[ (@C=5P
Reference: ROT13 variants
Tries every meaningful ROT47 rotation (amounts 1–93) over printable ASCII and
prints each result, optionally filtered to those containing a known-plaintext
Crib.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--sample-length |
number | 100 |
Bytes of input to try. |
--sample-offset |
number | 0 |
Offset into the input to sample from. |
--print-amount |
boolean | true |
Prefix each line with Amount = NN:. |
--crib |
string | (empty) | Only show results containing this text. |
Simple example — the crib test matches two rotations:
cchef rot47-brute-force -i "E6DE >6DD286" --crib testOutput:
Amount = 15: TEST MESSAGE
Amount = 47: test message
A Caesar cipher over the valid BMP code points that shifts each character by 0x8000 positions along the (compacted) alphabet, leaving anything outside the mapping unchanged. The shift is exactly half the alphabet, so the operation is its own inverse — running it twice returns the original text.
Simple example
cchef rot8000 -i 'Hi'Output:
籑籲
Round-trip (decrypt)
cchef rot8000 -i 'Hi' | cchef rot8000Output:
Hi
Reference: Rabbit (cipher)
Rabbit is a high-speed stream cipher (RFC 4503) taking a 128-bit key and an
optional 64-bit IV. Because it works by XORing the input with a keystream, the
same operation both encrypts and decrypts — run it again on the ciphertext with
the same key and IV to recover the plaintext. The endianness selects the byte
convention: Big follows RFC 4503, while Little is compatible with Crypto++.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
16-byte (128-bit) key. |
--iv / --iv-type |
toggleString | Hex |
Optional IV: 0 or 8 bytes. |
--endianness |
option | Big |
Big (RFC 4503) or Little (Crypto++). |
--input-format |
option | Raw |
Read the input as Raw or Hex. |
--output-format |
option | Raw |
Emit the output as Raw or Hex. |
Simple example — encrypt some text (run the same command with the output as
Hex input to decrypt):
cchef rabbit -i "Attack at dawn" --key 00112233445566778899aabbccddeeff --input-format Raw --output-format HexOutput:
cc34a7cbed2269c75acfdb4ebb00
Complex example — little-endian (Crypto++-compatible) with an IV:
cchef rabbit -i "Rabbit stream cipher test" --key 23c2731e8b5469fd8dabb5bc592a0f3a --iv 712906405ef03201 --endianness Little --input-format Raw --output-format HexOutput:
1ae2d4edcf9b6063b00fd6fda0b223aded157e77031cf0440b
Reference: Rail fence cipher
Reverses the Rail Fence Cipher Encode transposition,
given the same Key (number of rails) and Offset. The key must be at least 2
and no larger than the input length; the offset must not be negative.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
number | 2 |
Number of rails. |
--offset |
number | 0 |
Starting offset into the zig-zag. |
Simple example
cchef rail-fence-cipher-decode -i "WRIVDETCEAEDSOEE LEA NE CRF O" --key 3Output:
WE ARE DISCOVERED FLEE AT ONCE
Reference: Rail fence cipher
Encodes text with the Rail Fence cipher, a transposition cipher that writes the
characters in a zig-zag across Key rails and reads them off row by row. Offset
shifts the starting position in the zig-zag. The key must be at least 2 and no
larger than the input length; the offset must not be negative.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
number | 2 |
Number of rails. |
--offset |
number | 0 |
Starting offset into the zig-zag. |
Simple example
cchef rail-fence-cipher-encode -i "WE ARE DISCOVERED FLEE AT ONCE" --key 3Output:
WRIVDETCEAEDSOEE LEA NE CRF O
Complex example — with a non-zero offset:
cchef rail-fence-cipher-encode -i "No one expects the spanish Inquisition." --key 3 --offset 2Output:
e n ut.ooeepcstesaihIqiiinNnxthpsnso
Rotates the bits of each byte to the left by a fixed amount. With --carry-through
the bits that fall off the front of a byte are carried into the next byte and the
array is rotated as a whole (wrapping around from the end back to the start).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--amount |
number | 1 |
Number of bit positions to rotate by. |
--carry-through |
bool | false |
Carry excess bits into the neighbouring byte. |
Simple example
printf 'abc' | cchef rotate-left | cchef to-hex --delimiter SpaceOutput:
c2 c4 c6
Carry through
printf 'abc123' | cchef rotate-left --amount 2 --carry-through | cchef to-hex --delimiter SpaceOutput:
85 89 8c c4 c8 cd
Rotates the bits of each byte to the right by a fixed amount. With
--carry-through the bits that fall off the end of a byte are carried into the
next byte and the array is rotated as a whole (wrapping around from the start back
to the end).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--amount |
number | 1 |
Number of bit positions to rotate by. |
--carry-through |
bool | false |
Carry excess bits into the neighbouring byte. |
Simple example
printf 'abc123' | cchef rotate-right | cchef to-hex --delimiter SpaceOutput:
b0 31 b1 98 19 99
Carry through
printf 'abc123' | cchef rotate-right --amount 2 --carry-through | cchef to-hex --delimiter SpaceOutput:
d8 58 98 cc 4c 8c
Reference: SIGABA
Emulates the WW2 SIGABA (ECM Mark II) rotor machine used by the US military. It
has 15 rotors: 5 cipher rotors that encipher the text, plus 5 control and 5 index
rotors that drive the (unusually complex) cipher-rotor stepping. Input is
upper-cased; spaces are preserved. Because enciphering and deciphering differ,
pick the mode with --sigaba-mode.
Each of the 15 rotors is configured by its own flags. A cipher or control rotor
takes a 26-letter wiring (--Nth-…-rotor, e.g. --1st-left-hand-cipher-rotor), a
--…-reversed boolean, and an --…-initial-value letter; an index rotor takes a
10-digit wiring and an initial-value digit. All rotors default to the built-in
"Example 1" wirings (cipher/control SRGWANHPJZFXVIDQCEUKBYOLMT, index
6201348957) at initial value A/0, so a bare invocation is a valid machine.
Run cchef sigaba --help for the full list of 41 flags.
Options (the recurring per-rotor flags)
| Flag | Type | Default | Description |
|---|---|---|---|
--Nth-…-cipher-rotor / --Nth-…-control-rotor |
editableOption | SRGWANHPJZFXVIDQCEUKBYOLMT |
26-letter rotor wiring. |
--Nth-…-rotor-reversed |
boolean | false |
Insert the rotor reversed. |
--Nth-…-rotor-initial-value |
option | A |
Starting letter (A–Z). |
--Nth-…-index-rotor |
editableOption | 6201348957 |
10-digit index-rotor wiring. |
--Nth-…-index-rotor-initial-value |
option | 0 |
Starting digit (0–9). |
--sigaba-mode |
option | Encrypt |
Encrypt or Decrypt. |
Simple example (default rotors)
cchef sigaba -i "HELLO WORLD"Output:
HIPGIQVSFLM
Complex example — deciphering that ciphertext back reproduces the plaintext:
cchef sigaba -i "HIPGIQVSFLM" --sigaba-mode DecryptOutput:
HELLO WORLD
Reference: SM4 (cipher)
Decrypts with the SM4 block cipher (China's GB/T 32907-2016 standard, a 128-bit
block / 128-bit key cipher). The key and IV are 16 bytes. CBC and ECB expect
PKCS#7 padding; the CBC/NoPadding and ECB/NoPadding variants require the input
to already be a multiple of 16 bytes. CFB, OFB and CTR are stream modes and
need no padding. See SM4 Encrypt for the option details; the flags
are identical.
Simple example — decipher a CBC ciphertext back to text:
cchef sm4-decrypt -i "50 f9 7f f9 18 2a 5a c2 b9 a8 65 67 cf 44 e6 2a" --key 0123456789abcdeffedcba9876543210 --iv 000102030405060708090a0b0c0d0e0f --mode CBC --input-format Hex --output-format RawOutput:
Hello, SM4!
Reference: SM4 (cipher)
Encrypts with the SM4 block cipher (China's GB/T 32907-2016 standard). The key and
IV are 16 bytes (128 bits). CBC/ECB apply PKCS#7 padding; the /NoPadding
variants require a block-aligned input; CFB/OFB/CTR are stream modes.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
16-byte key (Hex, UTF8, Latin1 or Base64). |
--iv / --iv-type |
toggleString | Hex |
16-byte IV (unused in ECB modes). |
--mode |
option | CBC |
CBC, CFB, OFB, CTR, ECB, CBC/NoPadding or ECB/NoPadding. |
--input-format |
option | Raw |
Read the input as Raw or Hex. |
--output-format |
option | Hex |
Emit the output as Hex (space-delimited) or Raw. |
Simple example
cchef sm4-encrypt -i "Hello, SM4!" --key 0123456789abcdeffedcba9876543210 --iv 000102030405060708090a0b0c0d0e0f --mode CBCOutput:
50 f9 7f f9 18 2a 5a c2 b9 a8 65 67 cf 44 e6 2a
Subtracts the key from each byte of the input, modulo 256.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | The key value, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, Decimal, Binary, Base64, UTF8, Latin1. |
Simple example
printf 'hello' | cchef sub --key 01 --key-type Hex | cchef to-hex --delimiter NoneOutput:
67646b6b6e
Reference: Salsa20
Applies the Salsa20 stream cipher (Bernstein). Because it XORs the input with a
keystream, the same operation encrypts and decrypts. The key is 16 or 32 bytes and
the nonce is 8 bytes (or an integer, encoded as 8 little-endian bytes). Rounds
selects the full 20 or the reduced Salsa20/12 and Salsa20/8 variants.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
16- or 32-byte key. |
--nonce / --nonce-type |
toggleString | Hex |
8-byte nonce (or an Integer). |
--counter |
number | 0 |
Initial block counter (incremented every 64 bytes). |
--rounds |
option | 20 |
20, 12 or 8. |
--input-format |
option | Hex |
Read the input as Hex or Raw. |
--output-format |
option | Raw |
Emit the output as Raw or Hex (space-delimited). |
Simple example
cchef salsa20 -i "Hello, Salsa20!" --key 00112233445566778899aabbccddeeff --nonce 0011223344556677 --input-format Raw --output-format HexOutput:
99 87 7f 17 e2 4b fd 5c d7 fb a3 1c e2 77 09
Reference: Scrypt
Derives a key from a password using scrypt (RFC 7914), a memory-hard
password-based key derivation function by Colin Percival. Enter the password as
the input; the derived key is returned as lowercase hex. Iterations (N) is the
CPU/memory cost and must be a power of two; r and p tune the block size and
parallelization. This is also listed under Hashing.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--salt / --salt-type |
toggleString | Hex |
Salt, as Hex, Base64, UTF8 or Latin1. |
--iterations-n |
number | 16384 |
CPU/memory cost N (must be a power of two). |
--memory-factor-r |
number | 8 |
Block size factor r. |
--parallelization-factor-p |
number | 1 |
Parallelization factor p. |
--key-length |
number | 64 |
Length of the derived key in bytes, up to 4096. |
Simple example
cchef scrypt -i "password" --salt "salt123" --salt-type UTF8Output:
a69d52172b880bdaf7f6b988e9db14563d564b52ac8cb9e989df772b6ea7bc772a60fcc29fcdbe9d1917f01f709853e068556402ebcc0c8e44e0b557e69801df
Complex example
The scrypt RFC 7914 test vector (P="password", S="NaCl", N=1024, r=8, p=16,
dkLen=64):
cchef scrypt -i "password" --salt "NaCl" --salt-type UTF8 --iterations-n 1024 --memory-factor-r 8 --parallelization-factor-p 16 --key-length 64Output:
fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b3731622eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640
Reference: Substitution cipher
A substitution cipher: each byte listed in Plaintext is replaced by the byte at
the same position in Ciphertext. Any byte value can be mapped (not just letters,
and not necessarily in order), so this generalises Caesar-style ciphers. Byte
ranges use a hyphen (0-9 means 0123456789), and non-printable bytes use string
escapes (\n, \x0a); escape a literal backslash as \\. If the two fields
differ in length, a warning is prepended and only the overlapping mappings apply.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--plaintext |
string | ABCDEFGHIJKLMNOPQRSTUVWXYZ |
Bytes to replace (ranges/escapes allowed). |
--ciphertext |
string | XYZABCDEFGHIJKLMNOPQRSTUVW |
Replacement bytes, positionally matched. |
--ignore-case |
boolean | false |
Match keys case-insensitively, preserving the input's case in the output. |
Simple example — the defaults shift each letter back by three (A→X, B→Y, …):
cchef substitute -i "HELLO"Output:
EBIIL
Complex example — a case-insensitive ROT13 map preserves the input casing:
cchef substitute -i "Attack at dawn" --plaintext "ABCDEFGHIJKLMNOPQRSTUVWXYZ" --ciphertext "NOPQRSTUVWXYZABCDEFGHIJKLM" --ignore-caseOutput:
Nggnpx ng qnja
Reference: Tiny Encryption Algorithm
Decrypts with TEA (Tiny Encryption Algorithm), a 64-bit-block, 128-bit-key Feistel cipher (Wheeler & Needham, 1994). See TEA Encrypt for the option details; the flags are identical.
Simple example — decipher a CBC ciphertext back to text:
cchef tea-decrypt -i "3717df7a5bfb5fb48aeac00daa1304e5" --key 00112233445566778899aabbccddeeff --iv 0001020304050607 --mode CBC --input-format Hex --output-format RawOutput:
Attack at dawn
Reference: Tiny Encryption Algorithm
Encrypts with TEA, a compact 64-bit-block / 128-bit-key Feistel cipher using the
golden-ratio constant 0x9E3779B9 over 32 cycles. The key must be 16 bytes and
the IV 8 bytes (defaulting to null bytes if omitted). CBC/ECB apply the chosen
padding scheme; CFB/OFB/CTR are stream modes needing no padding.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
16-byte key (Hex, UTF8, Latin1 or Base64). |
--iv / --iv-type |
toggleString | Hex |
8-byte IV (unused in ECB). |
--mode |
option | CBC |
CBC, CFB, OFB, CTR or ECB. |
--input-format |
option | Raw |
Read the input as Raw or Hex. |
--output-format |
option | Hex |
Emit the output as Hex (concatenated) or Raw. |
--padding |
option | PKCS5 |
ECB/CBC padding: PKCS5, NO, ZERO, RANDOM or BIT. |
Simple example
cchef tea-encrypt -i "Attack at dawn" --key 00112233445566778899aabbccddeeff --iv 0001020304050607 --mode CBCOutput:
3717df7a5bfb5fb48aeac00daa1304e5
Reference: Morse code
Translates alphanumeric characters (and common punctuation) into International Morse Code. Non-Morse characters are ignored. The dash/dot symbols and the delimiters between letters and words are all configurable.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--format-options |
option | -/. |
Dash/dot rendering: -/., _/., Dash/Dot, DASH/DOT, dash/dot. |
--letter-delimiter |
option | Space |
Delimiter between letters: Space, Line feed, CRLF, Forward slash, Backslash, Comma, Semi-colon, Colon. |
--word-delimiter |
option | Line feed |
Delimiter between words (same set, minus Space). |
Simple example
cchef to-morse-code -i 'SOS'Output:
... --- ...
Complex example
Underscores for dashes, / between words:
cchef to-morse-code -i 'Hello World' --format-options '_/.' --word-delimiter 'Forward slash'Output:
.... . ._.. ._.. ___/.__ ___ ._. ._.. _..
Reference: Triple DES
Decrypts Triple DES (3DES) ciphertext. The key must be 24 bytes (192 bits), or
16 bytes — in which case it is expanded to K1‖K2‖K1. For every mode except ECB
the IV must be exactly 8 bytes. CBC and ECB expect PKCS#7-padded, block-aligned
input; the CBC/NoPadding and ECB/NoPadding modes skip unpadding.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | 16- or 24-byte key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | (empty) | 8-byte IV (ignored for ECB), interpreted per --iv-type. |
--iv-type |
option | Hex |
IV encoding: Hex, UTF8, Latin1, Base64. |
--mode |
option | CBC |
Mode: CBC, CFB, OFB, CTR, ECB, CBC/NoPadding, ECB/NoPadding. |
--input-format |
option | Hex |
How to read the ciphertext: Hex or Raw bytes. |
--output-format |
option | Raw |
How to render the plaintext: Raw bytes or Hex. |
Simple example
cchef triple-des-decrypt -i 6e4f4b9ecdeea4f3757574f02960c9a840a57a0332192c83 \
--key 0123456789abcdeffedcba9876543210a1b2c3d4e5f60718 --iv 0011223344556677 --mode CBCOutput:
The quick brown fox
Reference: Triple DES
Encrypts input with the Triple DES (3DES) block cipher, which applies DES three times per 64-bit block. The key must be 24 bytes (192 bits), or 16 bytes — in which case it is expanded to K1‖K2‖K1. For every mode except ECB the IV must be exactly 8 bytes. CBC and ECB apply PKCS#7 padding; CFB, OFB and CTR are streaming.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | 16- or 24-byte key, interpreted per --key-type. |
--key-type |
option | Hex |
Key encoding: Hex, UTF8, Latin1, Base64. |
--iv |
string | (empty) | 8-byte IV (ignored for ECB), interpreted per --iv-type. |
--iv-type |
option | Hex |
IV encoding: Hex, UTF8, Latin1, Base64. |
--mode |
option | CBC |
Mode: CBC, CFB, OFB, CTR, ECB. |
--input-format |
option | Raw |
How to read the input: Raw bytes or Hex. |
--output-format |
option | Hex |
How to render the output: Hex or Raw bytes. |
Simple example
cchef triple-des-encrypt -i "The quick brown fox" \
--key 0123456789abcdeffedcba9876543210a1b2c3d4e5f60718 --iv 0011223344556677 --mode CBCOutput:
6e4f4b9ecdeea4f3757574f02960c9a840a57a0332192c83
Reference: Twofish
Decrypts with the Twofish block cipher (an AES finalist by Bruce Schneier). The
key is 16, 24 or 32 bytes and the IV is 16 bytes. CBC/ECB expect the padding
scheme the ciphertext was produced with; CFB, OFB and CTR are stream modes.
See Twofish Encrypt for the option details; the flags are
identical apart from the --input-format/--output-format defaults.
Simple example — decipher a CBC ciphertext back to text:
cchef twofish-decrypt -i "d53d64a6fb51288e518e4ae1dae02e9b" --key 0123456789abcdeffedcba9876543210 --iv 000102030405060708090a0b0c0d0e0f --mode CBC --input-format Hex --output-format RawOutput:
Hello, Twofish!
Reference: Twofish
Encrypts with the Twofish block cipher, an AES finalist designed by Bruce
Schneier. It uses 128-bit blocks with a 128-, 192- or 256-bit key over 16 rounds
of a Feistel network. CBC/ECB apply the chosen padding scheme (PKCS#7 by
default); CFB, OFB and CTR are stream modes that need no padding.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
16-, 24- or 32-byte key (Hex, UTF8, Latin1 or Base64). |
--iv / --iv-type |
toggleString | Hex |
16-byte IV (unused in ECB mode). |
--mode |
option | CBC |
CBC, CFB, OFB, CTR or ECB. |
--input-format |
option | Raw |
Read the input as Raw or Hex. |
--output-format |
option | Hex |
Emit the output as Hex or Raw. |
--padding |
option | PKCS5 |
Padding for CBC/ECB: PKCS5, NO, ZERO, RANDOM or BIT. |
Simple example
cchef twofish-encrypt -i "Hello, Twofish!" --key 0123456789abcdeffedcba9876543210 --iv 000102030405060708090a0b0c0d0e0f --mode CBCOutput:
d53d64a6fb51288e518e4ae1dae02e9b
Complex example — a 256-bit key in ECB mode with PKCS#5 padding:
cchef twofish-encrypt -i "The quick brown fox" --key 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f --mode ECB --padding PKCS5Output:
83340180bf5365a5b25bf926d47e85e6b6ed4ed5e8df4839653f0fff236e1ddb
Reference: Typex
Enciphers/deciphers with the WW2 Typex machine, a British development of Enigma using five rotors (the two right-hand ones static) with interchangeable, reversible wiring cores. No genuine Typex rotor wirings are public, so a random example set is built in as the defaults. Like Enigma it is its own inverse, so the same settings decrypt. The reflector is entered as whitespace-separated letter pairs covering every letter; the input plugboard is entered like a rotor (a 26-letter map).
Each rotor takes four settings: its wiring (wiring<steps), a reversed flag, a
ring setting and an initial position. The optional keyboard emulation maps the
Typex keyboard's shifted symbols (digits and punctuation) to letter sequences.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--1st-left-hand-rotor … --5th-right-hand-static-rotor |
string | example rotors | Each rotor's wiring (wiring<steps). |
--Nth-rotor-reversed |
boolean | false |
Run that rotor's core backwards. |
--Nth-rotor-ring-setting / --Nth-rotor-initial-value |
option | A |
Ring setting and start position of each rotor. |
--reflector |
string | example | Reflector pairs (13 pairs covering every letter). |
--plugboard |
string | (empty) | Input plugboard as a 26-letter map (empty = identity). |
--typex-keyboard-emulation |
option | None |
None, Encrypt or Decrypt — handle the keyboard's symbol shifts. |
--strict-output |
boolean | true |
Drop non-alphabet characters and group the output into blocks of five. |
Simple example
With the default rotors at position A, --strict-output groups the output into
fives:
cchef typex -i "HELLOWORLD"Output:
PDEBF ZLGSU
Complex example — keyboard emulation with per-rotor settings and an input plugboard (two rotors reversed):
cchef typex -i "hello world, this is a test message." \
--1st-rotor-ring-setting B --1st-rotor-initial-value C \
--2nd-rotor-ring-setting D --2nd-rotor-initial-value E \
--3rd-rotor-ring-setting F --3rd-rotor-initial-value G \
--4th-rotor-reversed --4th-rotor-ring-setting H --4th-rotor-initial-value I \
--5th-rotor-reversed --5th-rotor-ring-setting J --5th-rotor-initial-value K \
--plugboard EHZTLCVKFRPQSYANBUIWOJXGMD --typex-keyboard-emulation EncryptOutput:
VIXQQ FDJXT WKLDQ DFQOD CNCSK NULBG JKQDD MVGQ
Decrypt by running the ciphertext back through the same settings with
--typex-keyboard-emulation Decrypt, which recovers the spaces and punctuation:
HELLO WORLD, THIS IS A TEST MESSAGE.
Reference: Vigenère cipher
Decrypts a Vigenère cipher: each letter is shifted back by the position of the corresponding key letter (the key repeats over the text). Case is preserved and non-letters pass through unchanged without advancing the key. The key must be non-empty and consist only of letters.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | The keyword (letters only; case-insensitive). |
Simple example
cchef vigenere-decode -i "Rijvs, Uyvjn!" --key keyOutput:
Hello, World!
Reference: Vigenère cipher
Encrypts with the Vigenère cipher, a polyalphabetic substitution that shifts each letter forward by the position of the corresponding key letter (the key repeats over the text). Case is preserved and non-letters pass through unchanged without advancing the key. The key must be non-empty and consist only of letters.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | The keyword (letters only; case-insensitive). |
Simple example
cchef vigenere-encode -i "Hello, World!" --key keyOutput:
Rijvs, Uyvjn!
Complex example — the classic Wikipedia vector:
cchef vigenere-encode -i "ATTACKATDAWN" --key LEMONOutput:
LXFOPVEFRNHR
XORs the input with a repeating key. The key can be supplied in several encodings, and several key-update schemes are available.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key |
string | (empty) | The key value, interpreted according to --key-type. |
--key-type |
option | Hex |
How to interpret the key: Hex, Decimal, Binary, Base64, UTF8, Latin1. |
--scheme |
option | Standard |
Key-update scheme: Standard, Input differential, Output differential, Cascade. |
--null-preserving |
bool | false |
Skip bytes that are 0x00 or equal to the key. |
Simple example
XOR produces raw bytes, so pipe through to-hex to view the result:
cchef xor --key 42 --key-type Hex -i 'Hello' | cchef to-hex --delimiter NoneOutput:
0a272e2e2d
UTF-8 key and round trip
XOR is symmetric — applying the same key twice restores the input:
echo -n 'Secret message' \
| cchef xor --key 'k3y' --key-type UTF8 \
| cchef xor --key 'k3y' --key-type UTF8Output:
Secret message
Enumerates every XOR key up to the given length (max 2) and prints each candidate
plaintext. Supply a crib — a string you expect in the plaintext — to filter
the results; the match is case-insensitive. Input is taken as raw bytes, so pipe
ciphertext in via from-hex (or a file).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key-length |
number | 1 |
Key length in bytes (1–2). |
--sample-length |
number | 100 |
Number of input bytes to test. |
--sample-offset |
number | 0 |
Byte offset to start the sample at. |
--scheme |
option | Standard |
Key-update scheme: Standard, Input differential, Output differential. |
--null-preserving |
bool | false |
Skip bytes that are 0x00 or equal to the key. |
--print-key |
bool | true |
Prefix each line with the key that produced it. |
--output-as-hex |
bool | false |
Print candidates as hex instead of text. |
--crib |
string | (empty) | Only show candidates containing this string. |
Simple example
Recover the key for Hello XORed with 0x42, filtering on the crib hello
(which also matches the case-swapped 0x62 result):
printf '0a272e2e2d' | cchef from-hex --delimiter None \
| cchef xor-brute-force --crib helloOutput:
Key = 42: Hello
Key = 62: hELLO
Hex output
printf '0a272e2e2d' | cchef from-hex --delimiter None \
| cchef xor-brute-force --crib hello --output-as-hexOutput:
Key = 42: 48 65 6c 6c 6f
Key = 62: 68 45 4c 4c 4f
Reference: XSalsa20
Applies the XSalsa20 stream cipher, a variant of Salsa20 that takes a longer 24-byte nonce (it derives a subkey from the first 16 nonce bytes with HSalsa20, then runs Salsa20 with the remaining 8). Like Salsa20 it is symmetric — the same operation encrypts and decrypts — and takes a 16- or 32-byte key.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
16- or 32-byte key. |
--nonce / --nonce-type |
toggleString | Hex |
24-byte nonce. |
--counter |
number | 0 |
Initial block counter (incremented every 64 bytes). |
--rounds |
option | 20 |
20, 12 or 8. |
--input-format |
option | Hex |
Read the input as Hex or Raw. |
--output-format |
option | Raw |
Emit the output as Raw or Hex (space-delimited). |
Simple example
cchef xsalsa20 -i "Hello, XSalsa20!" --key 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f --nonce 000102030405060708090a0b0c0d0e0f1011121314151617 --input-format Raw --output-format HexOutput:
34 d3 0c c3 b2 b2 e6 1e dc 36 b1 1e 45 01 c9 15
Reference: XTEA
Decrypts with XTEA (eXtended TEA), the 1997 successor to TEA with an improved,
sum-dependent key schedule. See XTEA Encrypt for the option
details; the flags are identical. The --rounds value must match the one used to
encrypt.
Simple example — decipher a CBC ciphertext back to text:
cchef xtea-decrypt -i "aac3e90cadce5b0d6b1f46e9955d6a99" --key 00112233445566778899aabbccddeeff --iv 0001020304050607 --mode CBC --rounds 32 --input-format Hex --output-format RawOutput:
Attack at dawn
Reference: XTEA
Encrypts with XTEA, a 64-bit-block / 128-bit-key Feistel cipher. It shares TEA's structure and modes but uses a stronger key schedule and a configurable round count. The key is 16 bytes and the IV 8 bytes (defaulting to null bytes).
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
16-byte key (Hex, UTF8, Latin1 or Base64). |
--iv / --iv-type |
toggleString | Hex |
8-byte IV (unused in ECB). |
--mode |
option | CBC |
CBC, CFB, OFB, CTR or ECB. |
--input-format |
option | Raw |
Read the input as Raw or Hex. |
--output-format |
option | Hex |
Emit the output as Hex (concatenated) or Raw. |
--padding |
option | PKCS5 |
ECB/CBC padding: PKCS5, NO, ZERO, RANDOM or BIT. |
--rounds |
number | 32 |
Number of rounds, an integer in [1, 255] (standard XTEA uses 32). |
Simple example
cchef xtea-encrypt -i "Attack at dawn" --key 00112233445566778899aabbccddeeff --iv 0001020304050607 --mode CBC --rounds 32Output:
aac3e90cadce5b0d6b1f46e9955d6a99
Reference: XXTEA
Decrypts Corrected Block TEA (XXTEA) ciphertext. Input and output are raw bytes;
the key is truncated or zero-padded to 16 bytes. See XXTEA Encrypt
for the option details. If the data is not valid XXTEA ciphertext for the given
key, the operation reports Unable to decrypt using this key.
Simple example — recover a message from its hex ciphertext:
cchef from-hex "088d10311561387126d165c1d0c51d87c022ba9a" | cchef xxtea-decrypt --key 1234567890 --key-type UTF8Output:
Secret message
Reference: XXTEA
Encrypts with Corrected Block TEA (XXTEA), a variable-length block cipher that operates on the whole message as a block of 32-bit words (rather than fixed 64-bit blocks), so no padding or mode is needed. Input and output are raw bytes. The 128-bit key is truncated or zero-padded to 16 bytes.
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--key / --key-type |
toggleString | Hex |
Key, as Hex, UTF8, Latin1 or Base64 (padded/truncated to 16 bytes). |
Simple example — the raw ciphertext is shown as hex via to-hex:
cchef xxtea-encrypt -i "Secret message" --key 1234567890 --key-type UTF8 | cchef to-hex --delimiter NoneOutput:
088d10311561387126d165c1d0c51d87c022ba9a