Symmetric block ciphers

By Martin McBride, 2017-04-09
Tags: cryptography encryption decryption symmetric encryption private key block cipher
Categories: cryptography

There are two main types of symmetric encryption algorithms: block ciphers and stream ciphers. The discussion so far applies to both, but for the rest of this chapter we will talk about block ciphers.

A block cipher is a type of cipher which operates on a fixed size block of data. For example, Rijndael can operate on blocks of 128 bits (16 bytes). The cipher uses a secret key, which is also 16 bytes for Rijndael. To encrypt an 16 byte message, you feed the message and the key into the encryption algorithm, and the result is 16 bytes of ciphertext. To decrypt, you feed the ciphertext, together with the same key, into the decryption algorithm, and you get back the original message.

image

Of course, most useful messages are much larger than 16 bytes. In that case, you need to process the message 16 bytes at a time, using the same key to process each block. Also note that it is impossible to encrypt a block which is smaller than the block size - if the final block of the message is not exactly the right size you must add [[Block padding methods|padding]] bytes.

There are many different algorithms, and they use different block and key sizes. It is common for modern algorithms to use sizes of 128 or 256 for blocks and keys. It is not necessary for the block size to be the same as the key size (however, the ciphertext block is always the same size as the plaintext block).

Block ciphers are the most popular type of symmetric encryption, because they are efficient and meet the needs of most applications. Stream ciphers tend to be used only for more specialised applications.

See also

Sign up to the Creative Coding Newletter

Join my newsletter to receive occasional emails when new content is added, using the form below:

Popular tags

555 timer abstract data type abstraction addition algorithm and gate array ascii ascii85 base32 base64 battery binary binary encoding binary search bit block cipher block padding byte canvas colour coming soon computer music condition cryptographic attacks cryptography decomposition decryption deduplication dictionary attack encryption file server flash memory hard drive hashing hexadecimal hmac html image insertion sort ip address key derivation lamp linear search list mac mac address mesh network message authentication code music nand gate network storage none nor gate not gate op-amp or gate pixel private key python quantisation queue raid ram relational operator resources rgb rom search sort sound synthesis ssd star network supercollider svg switch symmetric encryption truth table turtle graphics yenc