Ciphers

Block ciphers

DES to Serpent. UTF-8 bytes in and hex out. Published vectors pin every cipher and every mode.

The half with rounds, S-boxes and key schedules. These take the UTF-8 bytes of the whole text and hand back hex, so case, spaces and punctuation are just more bytes. Each one is pinned to published test vectors, from a standard, the original paper or another implementation, and its page says which. They're teaching code though, written to be read and checked, not constant time. Don't guard real data with them, use your platform's crypto for that.

ciphers ciphers --category block20 ciphers · registry order
OptionsKeyspace
AES (ECB)aesSP networkkey2^128, 2^192 or 2^256
AES (CBC)aes-cbcSP networkkey, iv2^128, 2^192 or 2^256
AES (CFB)aes-cfbSP networkkey, iv, segment?2^128, 2^192 or 2^256
AES (OFB)aes-ofbSP networkkey, iv2^128, 2^192 or 2^256
AES (CTR)aes-ctrSP networkkey, iv2^128, 2^192 or 2^256
AES (CCM)aes-ccmSP networkkey, nonce, aad?, tagLength?2^128, 2^192 or 2^256
AES (OCB)aes-ocbSP networkkey, nonce, aad?, tagLength?2^128, 2^192 or 2^256
AES (LRW)aes-lrwSP networkkey, tweak?2^256, 2^320 or 2^384
AES (XTS)aes-xtsSP networkkey, tweak?2^256 or 2^512
AES (CBC-MAC)aes-cbc-macSP networkkey2^128, 2^192 or 2^256
Rijndael (ECB)rijndaelSP networkkey, blockSize?2^128 to 2^256
DES (ECB)desFeistelkey2^56
DESX (ECB)desxFeistelkey2^184
Triple DES (ECB)triple-desFeistelkey2^112 or 2^168
Triple DES (CBC)triple-des-cbcFeistelkey, iv2^112 or 2^168
Blowfish (ECB)blowfishFeistelkey2^32 to 2^448
IDEA (ECB)ideaLai-Masseykey2^128
Lucifer (ECB)luciferFeistelkey2^128
MARS (ECB)marsFeistelkey2^128 to 2^448
Serpent (ECB)serpentSP networkkey2^128, 2^192 or 2^256
read from the registry in your browser / no networka name with ? is optional

Conventions they share

  • The key is hex, and so is every IV, nonce and tweak. Lengths are checked before the first block.
  • ECB, CBC and the MAC pad with PKCS#7. CFB, OFB, CTR, CCM, OCB and XTS need no padding, the ciphertext has as many bytes as the text. CBC-MAC pads with zeros for the tag and returns the text bytes as they are.
  • CCM, OCB and CBC-MAC append a tag. Decoding with a wrong one throws, and no plaintext comes back at all.
  • preserveCase and stripNonAlpha don't apply. There are no letters here, only bytes.

Families

Substitution-permutation is rounds of byte substitution and mixing under a key: AES in every mode here, Rijndael with its wider blocks, and Serpent, which runs its 4-bit S-boxes bitslice. Feistel splits the block in half and runs one half through a keyed function into the other, round after round. DES, DESX and Triple DES build on it, Blowfish grows its S-boxes from the key and pi, Lucifer is the IBM cipher DES was cut down from, and in MARS one of four words drives the other three each round. Lai-Massey splits the block too, but feeds the difference of the two halves through a keyed function and XORs the result into both. Its only member is IDEA, which gets by without a single table.