Twofish

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Twofish

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

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
2. How big is the block that Twofish encrypts at a time?
A 128 bits
B 64 bits
3. What is the largest key size Twofish supports?
A 256 bits
B 56 bits
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
5. Which cipher is Twofish the successor of?
A RSA
B Blowfish

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

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

Definitions

Twofish

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
blockBits = ___
2.
maxKeyBits = ___
3.
IF keyBits __ 256 THEN OUTPUT "Valid Twofish key size" END IF
4.
cipher = "Twofish" ciphertext = _______(plaintext, key)
5.
cipher = "Twofish" isAesFinalist = ____

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A cipher = 'Twofish'
B block_bits = 64
C max_key_bits = 256
D print(cipher, block_bits)
Question 2
A cipher = 'Twofish'
B max_bits = 512
C key_bits = 192
D print(key_bits <= max_bits)
Question 3
A cipher = 'Twofish'
B type = 'symmetric'
C predecessor = 'AES'
D print(cipher, predecessor)
Question 4
A cipher = 'Twofish'
B aes_finalist = False
C if aes_finalist:
D print('AES contest')
Question 5
A shared_key = 'k3y'
B message = 'hello'
C tf = Twofish(shared_key)
D secret = tf.decrypt(message)

Answer Key

Twofish
Section A: Quick Questions
Q1
B — True: one shared key encrypts and decrypts fixed-size blocks
Q2
A — 128 bits
Q3
A — 256 bits
Q4
A — It was a finalist in the competition that chose AES
Q5
B — Blowfish
Section B: Match the Pairs
Q1
block_size = 128 → Twofish encrypts data in 128-bit blocks, double the 64-bit block size of Blowfish
Q2
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
Q3
Twofish was one of the finalists in the competition to choose AES, but it did not win → aes_finalists = ["Twofish", "Rijndael"]
Q4
Twofish is symmetric, so the same key encrypts and decrypts the data → plain = decrypt(encrypt(plain, key), key)
Q5
twofish_block_size = 64 → Twofish uses 128-bit blocks, not 64-bit. The 64-bit block size belongs to Blowfish, its predecessor.
Q6
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.
Section C: Definitions
Q1
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.
Section D: Fill in the Blanks
Q1
blockBits = 128
Q2
maxKeyBits = 256
Q3
IF keyBits <= 256 THEN OUTPUT "Valid Twofish key size" END IF
Q4
cipher = "Twofish" ciphertext = encrypt(plaintext, key)
Q5
cipher = "Twofish" isAesFinalist = True
Section E: Spot the Error
Q1
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.
Q2
B — Twofish keys can be up to 256 bits, not 512. The line should be max_bits = 256.
Q3
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'.
Q4
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.
Q5
D — The plaintext message is being turned into ciphertext, so it must be encrypted. The line should be secret = tf.encrypt(message).