wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Cryptography_midterm

Total questions: 18

Worksheet time: 22mins

Name
Class
Date
1.

What is the basic principle the shift cipher?

a)

Splitting the plaintext into fixed-size blocks and replacing each block with a different symbol

b)

Rearranging the letters of the plaintext according to a pre-defined pattern

c)

Replacing each letter of the plaintext with a different letter from a pre-defined key

d)

Replacing each letter of the plaintext with the letter that comes a fixed number of positions later in the alphabet

2.

Calculate GCD(60, 36)

a)

12

b)

11

c)

10

d)

9

3.

Calculate s with Extended Eucleadian algorithm for GCD(65, 40) where t is equal to 5:

Formula: as + bt = GCD(a, b)

a)

5

b)

0

c)

3

d)

-3

4.

Calculate the task below:

2⁸ mod 13

a)

12

b)

11

c)

10

d)

9

5.

By using Diffie-Hellman key exchange algorithm, Alice chose her private variable x = 2, and Bob as y = 4. Generator g is equal to 3, and n = 5.

What is the K equal to?

a)

0

b)

1

c)

2

d)

3

6.

What is the multiplicative inverse of 11 modulo 26?

a)

8

b)

7

c)

9

d)

6

7.

In which cipher the code below may be used?

def some_function(data, key = 'string', encode = False, decode= False):

from itertools import izip, cycle

import base64

if decode:

data = base64.decodestring(data)

d = ' '.join(chr(ord(x) ^ ord(y)) for (x,y) in izip(data, cycle(key)))

if encode:

return base64.encodestring(d).strip()

return d

a)

Stream cipher

b)

Hill cipher

c)

XOR cipher

d)

Vigenere cipher

8.

Which of the following best describes a stream cipher?

a)

Cipher that generates a stream of key bits that are combined with the plaintext to produce ciphertext

b)

Cipher that involves rearranging the letters of the plaintext according to pre-defined pattern

c)

Cipher that replaces each plaintext letter with another letter using a pre-defined key

d)

Cipher that operates on fixed-size block of plaintext and ciphertext

9.

From which cipher this formula is used?

M - letter of a message

K - letter of a key

E × (M + K) mod 26

a)

Caeser cipher

b)

Vigenere cipher

c)

Affine cipher

d)

Hill cipher

10.

Which encryption technique is represented in the code below?

def encrypt(text, key):

result = ' '

for i in range(len(text)):

char = text[i]

if(char.isupper()):

result += chr((ord(char) + key - 65) % 26 + 65)

else:

result += chr((ord(char) + key - 97) % 26 + 97)

return result

a)

Caeser cipher

b)

Vigenere cipher

c)

Affine cipher

d)

Hill cipher

11.

What is the definition of cryptography?

a)

The study of secret writing and the practice of secure communication techniques

b)

The study of secret languages and the practice of linguistics

c)

The study of secret societies and the practice of clandestine operations

d)

The study of the art of writing secret messages

12.

What is formula used by the Affine Cipher to decrypt a letter in the plaintext?

a)

new_index = (index - a) % n

b)

new_index = (a × index + b) % n

c)

new_index = (a × index - b) % n

d)

new_index = (index + a) % n

13.

Which of the following best describes the figure below?

a)

Encryption system

b)

Communication channel

c)

Decryption sytem

d)

Key exchange algorithm

14.

Which encryption technique is used in the code below?

def some_function(seq, length):

return [seq[i : i + length] for i in range(0, len(seq), length)]

def encode(key, plaintext):

order = {

int(val): num for num, val in enumerate(key)

}

ciphertext = ' '

for index in sorted(order.keys()):

for part in some_function(plaintext, len(key)):

try:

ciphertext += part[order[index]]

except IndexError:

continue

return ciphertext

a)

Permutation

b)

Transposition

c)

Stream

d)

Hill

15.

By using a stream cipher to encrypt message: 010111001010 with a key stream: 1010

What will be the ciphertext?

a)

11001100000

b)

111011000000

c)

11011010000

d)

111001100000

16.

What is the cipher name that the code below might be implemented?

result = " "

for letter in text:

if letter.lower() is alphabet:

result += key[alphabet.find(letter.lower())]

else:

result += letter

a)

Permutation

b)

Transpostion

c)

Substitution

d)

Affine

17.

Which cipher this code is part of?

def init(self):

pass

def encryptChar(self, char):

K1, K2 kI = self.KEY

return chr((K1 × ord(char) + K2) % self.d)

def encrypt(self, string):

return " ".join(map(self.encryptChar, string))

a)

Caeser

b)

Vigenere

c)

Hill

d)

Affine

18.

Calculate multiplicative inverse modulo of a matrix below

[[5, 2], [6, 7]]

a)

[2, 7], [15, 18]

b)

None of them

c)

Matrix is not invertible

d)

I don't know :(