← QCE Digital Solutions Unit 4

Twofish

A symmetric block cipher and Blowfish's successor. It encrypts 128-bit blocks with keys up to 256 bits and was a finalist in the competition that chose AES.

Understanding Twofish in QCE Digital Solutions Unit 4

What it does: The list shows Twofish as an AES competition finalist, alongside the algorithm (Rijndael) that was chosen as AES. The same key is used in both encrypt() and decrypt(), which is how symmetric ciphers like Twofish work. Twofish uses 128-bit blocks. Blowfish, its predecessor, used 64-bit blocks. Twofish accepts keys up to 256 bits. A 56-bit key is the weak size used by DES. Twofish is symmetric, so sender and receiver share one secret key. This is why key sharing is the main risk. This is a wrong value for the block size. It should be 128 because Twofish encrypts 128-bit blocks.

Common mistakes: Twofish encrypts 128-bit blocks. 64-bit blocks belong to older ciphers such as Blowfish and DES. The line should be block_bits = 128. Twofish keys can be up to 256 bits, not 512. The line should be max_bits = 256.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 17–88) and word search (Modules 17–125).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Twofish is a symmetric block cipher.
True: one shared key encrypts and decrypts fixed-size blocksFalse: it uses a public key and a private key
Matches
twofish_block_size = 64
↓
Twofish uses 128-bit blocks, not 64-bit. The 64-bit block size belongs to Blowfish, its predecessor.
Applying
Meanings
Term
Twofish
Meaning
A symmetric block cipher and Blowfish's successor. It encrypts 128-bit blocks with keys up to 256 bits and was a finalist in the competition that chose AES.
Practice
cipher ← "Twofish"
Testing
Gaps
blockBits =
Check Answer
Spots
1cipher = 'Twofish'
2block_bits = 64

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Gazelle' badge — Tuple Sprinter, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Twofish is a symmetric block cipher.
A. False: it uses a public key and a private key
B. True: one shared key encrypts and decrypts fixed-size blocks ✓
Twofish is symmetric, so the same secret key locks and unlocks the data. Asymmetric ciphers like RSA use a key pair.
2. How big is the block that Twofish encrypts at a time?
A. 128 bits ✓
B. 64 bits
Twofish uses 128-bit blocks. Blowfish, its predecessor, used 64-bit blocks.
3. What is the largest key size Twofish supports?
A. 256 bits ✓
B. 56 bits
Twofish accepts keys up to 256 bits. A 56-bit key is the weak size used by DES.
4. Which statement about Twofish's history is correct?
A. It was a finalist in the competition that chose AES ✓
B. It was the winner of the competition and became AES
Twofish was an AES finalist but did not win. Rijndael won and became AES.
5. Which cipher is Twofish the successor of?
A. RSA
B. Blowfish ✓
Twofish followed Blowfish, and both are symmetric block ciphers. RSA is asymmetric and unrelated to this family.

Match the Pairs

block_size = 128 → Twofish encrypts data in 128-bit blocks, double the 64-bit block size of Blowfish
max_key_bits = 256 → Twofish accepts keys of up to 256 bits, so a longer key means a bigger keyspace for an attacker to search
Twofish was one of the finalists in the competition to choose AES, but it did not win → aes_finalists = ["Twofish", "Rijndael"]
Twofish is symmetric, so the same key encrypts and decrypts the data → plain = decrypt(encrypt(plain, key), key)
twofish_block_size = 64 → Twofish uses 128-bit blocks, not 64-bit. The 64-bit block size belongs to Blowfish, its predecessor.
encrypt(data, public_key) # Twofish → Twofish is symmetric, so it uses one shared secret key, not a public key. Public keys belong to asymmetric ciphers like RSA.

Key Term

Twofish
A symmetric block cipher and Blowfish's successor. It encrypts 128-bit blocks with keys up to 256 bits and was a finalist in the competition that chose AES.

Fill in the Blanks

1. blockBits = 128
Hint: Type the number of bits in each block that Twofish encrypts at a time.
2. maxKeyBits = 256
Hint: Type the largest key size in bits that Twofish supports.
3. IF keyBits <= 256 THEN OUTPUT "Valid Twofish key size" END IF
Hint: Type the comparison operator that lets any key up to the maximum size pass the check.
4. cipher = "Twofish" ciphertext = encrypt(plaintext, key)
Hint: Type the function name that turns plaintext into ciphertext using the shared key.
5. cipher = "Twofish" isAesFinalist = True
Hint: Type the Python Boolean value showing Twofish was a finalist in the AES competition.

Spot the Error

Question 1
A cipher = 'Twofish'
B block_bits = 64
C max_key_bits = 256
D print(cipher, block_bits)
Line B — Twofish encrypts 128-bit blocks. 64-bit blocks belong to older ciphers such as Blowfish and DES. The line should be block_bits = 128.
Question 2
A cipher = 'Twofish'
B max_bits = 512
C key_bits = 192
D print(key_bits <= max_bits)
Line B — Twofish keys can be up to 256 bits, not 512. The line should be max_bits = 256.
Question 3
A cipher = 'Twofish'
B type = 'symmetric'
C predecessor = 'AES'
D print(cipher, predecessor)
Line C — Twofish is the successor of Blowfish, so Blowfish is its predecessor. AES was a rival finalist and not Twofish's predecessor. The line should be predecessor = 'Blowfish'.
Question 4
A cipher = 'Twofish'
B aes_finalist = False
C if aes_finalist:
D print('AES contest')
Line B — Twofish was a finalist in the competition that chose AES, so the value should be True. It was not the winner, but it was a finalist.
Question 5
A shared_key = 'k3y'
B message = 'hello'
C tf = Twofish(shared_key)
D secret = tf.decrypt(message)
Line D — The plaintext message is being turned into ciphertext, so it must be encrypted. The line should be secret = tf.encrypt(message).

Student with a class code? Join your class →