Deck 8: Cryptanalysis: Advanced Dictionaries and Lists, Regular Expressions

Full screen (f)
exit full mode
Question
One of the most secure algorithms for encryption today is called:

A) brute force.
B) RSA.
C) the Turing cipher.
D) the rail fence cipher.
Use Space or
up arrow
down arrow
to flip the card.
Question
Manually trying every possible combination of letters to decode a message is called:

A) breaking.
B) cryptomania.
C) brute force.
D) encryption.
Question
The rail-fence cipher with a rail size of ___ breaks the plaintext into strings consisting of characters with odd and even numbered indexes.

A) 1
B) 2
C) 3
D) 4
Question
Case Study 1:
1. def railBreak(cipherText):
2. wordDict = createWordDict('wordlist.txt')
3. cipherLen = len(cipherText)
4. maxGoodSoFar = 0
5. bestGuess = "No words found in dictionary"
6. for i in range(2, cipherLen + 1):
7. words = railDecrypt(cipherText, i)
8. goodCount = 0
9. for w in words:
10. if w in wordDict:
11. goodCount = goodCount + 1
12. if goodCount > maxGoodSoFar:
13. maxGoodSoFar = goodCount
14. bestGuess = " ".join(words)
15. return bestGuess
-Refer to the session in the accompanying Case Study 1. What pattern is used on lines 12-14?

A) Minmax
B) Rail break
C) Cryptology
D) Brute force
Question
Case Study 1:
1. def railBreak(cipherText):
2. wordDict = createWordDict('wordlist.txt')
3. cipherLen = len(cipherText)
4. maxGoodSoFar = 0
5. bestGuess = "No words found in dictionary"
6. for i in range(2, cipherLen + 1):
7. words = railDecrypt(cipherText, i)
8. goodCount = 0
9. for w in words:
10. if w in wordDict:
11. goodCount = goodCount + 1
12. if goodCount > maxGoodSoFar:
13. maxGoodSoFar = goodCount
14. bestGuess = " ".join(words)
15. return bestGuess
-Refer to the session in the accompanying case study. What is the function of
" ")join(words) on line 14?

A) It glues together all of the strings in the list words separating them using the space character.
B) It creates a dictionary of all the words in the list words.
C) It separates each word in the list words into a range.
D) It sets all of the values in words to a single space.
Question
____ order takes the first row of the table and stores all the values on that row one after the other, followed by the second row and the third, and so on.

A) Column major
B) Row major
C) Encrypted
D) Rail post
Question
What of the following is one of the most frequently occurring letters in the English language?

A) B
B) E
C) U
D) S
Question
What method sorts a list of values from largest to smallest?

A) reverse
B) reversesort
C) sort(reverse = True)
D) sort('descending')
Question
What is the value of myList after the following statement?
MyList = myList.sort().

A) None
B) The original list, sorted in ascending order
C) The original list, sorted in descending order
D) An empty list
Question
Case Study 2:
1. def maybeAdd(ch, toList):
2. if ch in 'abcdefghijklmnopqrstuvwxyz'
and ch not in toList:
3. toList.append (ch)
-Refer to the session in the accompanying Case Study 2. What is the value of myList after the following code is executed?
>>> myList = []
>>> maybeAdd('a', myList)

A) []
B) ['a']
C) ['abcdefghijklmnopqrstuvwxyz']
D) None
Question
Case Study 2:
1. def maybeAdd(ch, toList):
2. if ch in 'abcdefghijklmnopqrstuvwxyz'
and ch not in toList:
3. toList.append (ch)
-Refer to the session in the accompanying Case Study 2. What is the value of myList after the following code is executed?
>>> myList
['a', 'b']
>>> maybeAdd('a', myList)

A) ['a', 'a', 'b']
B) ['a', 'b']
C) ['abcdefghijklmnopqrstuvwxyz']
D) None
Question
What three-letter word appears most often in War of the Worlds?

A) The
B) And
C) Was
D) Had
Question
In Python, regular expressions are available through the ____ module.

A) pattern
B) wildcard
C) regex
D) re
Question
In a regular expression, a part of the expression surrounded by () is called a(n):

A) capture group.
B) cluster.
C) object.
D) wildcard.
Question
Some of the first computer scientists were deeply involved in cryptanalysis.
Question
When decrypting using the rail fence cipher, one can easily see how many rails were used and encrypt the message by simply examining the encoded message.
Question
If we want to store a two-dimensional table in a computer's memory, we need to map from the row, column coordinates, which correspond to a cell in the table, to a location in memory.
Question
One effective way to ignore non-letter characters is to add them to the string before we start counting.
Question
Using the setDefault pattern is efficient for adding values to a dictionary.
Question
Match each definition with its term.
-Allows us to match strings using patterns.

A) Regular expression
B) Cryptanalysis
C) Capture group
D) Brute force
Question
Match each definition with its term.
-Refers to the field of code breaking.

A) Regular expression
B) Cryptanalysis
C) Capture group
D) Brute force
Question
Match each definition with its term.
-Allow us to determine what characters in a target word match letters in different
Parts of a given pattern.

A) Regular expression
B) Cryptanalysis
C) Capture group
D) Brute force
Question
Match each definition with its term.
-Refers to trying all possible solutions.

A) Regular expression
B) Cryptanalysis
C) Capture group
D) Brute force
Question
Describe the use of brute force to decrypt encrypted messages.
Question
How can a dictionary be used to improve upon a brute force approach to decrypting a rail fence cipher?
Question
What are the benefits of using a dictionary over a list when looking up values?
Question
Describe the use of the join method.
Question
What is the difference between row major order and column major order?
Question
Briefly describe how to crack a substitution cipher.
Question
Describe the two keyword parameters to the sort method.
Question
Explain how to identify the difference between vowels and consonants in the English language.
Question
Describe the function of regular expressions and explain how to use them in Python.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/32
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 8: Cryptanalysis: Advanced Dictionaries and Lists, Regular Expressions
1
One of the most secure algorithms for encryption today is called:

A) brute force.
B) RSA.
C) the Turing cipher.
D) the rail fence cipher.
B
2
Manually trying every possible combination of letters to decode a message is called:

A) breaking.
B) cryptomania.
C) brute force.
D) encryption.
C
3
The rail-fence cipher with a rail size of ___ breaks the plaintext into strings consisting of characters with odd and even numbered indexes.

A) 1
B) 2
C) 3
D) 4
B
4
Case Study 1:
1. def railBreak(cipherText):
2. wordDict = createWordDict('wordlist.txt')
3. cipherLen = len(cipherText)
4. maxGoodSoFar = 0
5. bestGuess = "No words found in dictionary"
6. for i in range(2, cipherLen + 1):
7. words = railDecrypt(cipherText, i)
8. goodCount = 0
9. for w in words:
10. if w in wordDict:
11. goodCount = goodCount + 1
12. if goodCount > maxGoodSoFar:
13. maxGoodSoFar = goodCount
14. bestGuess = " ".join(words)
15. return bestGuess
-Refer to the session in the accompanying Case Study 1. What pattern is used on lines 12-14?

A) Minmax
B) Rail break
C) Cryptology
D) Brute force
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
5
Case Study 1:
1. def railBreak(cipherText):
2. wordDict = createWordDict('wordlist.txt')
3. cipherLen = len(cipherText)
4. maxGoodSoFar = 0
5. bestGuess = "No words found in dictionary"
6. for i in range(2, cipherLen + 1):
7. words = railDecrypt(cipherText, i)
8. goodCount = 0
9. for w in words:
10. if w in wordDict:
11. goodCount = goodCount + 1
12. if goodCount > maxGoodSoFar:
13. maxGoodSoFar = goodCount
14. bestGuess = " ".join(words)
15. return bestGuess
-Refer to the session in the accompanying case study. What is the function of
" ")join(words) on line 14?

A) It glues together all of the strings in the list words separating them using the space character.
B) It creates a dictionary of all the words in the list words.
C) It separates each word in the list words into a range.
D) It sets all of the values in words to a single space.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
6
____ order takes the first row of the table and stores all the values on that row one after the other, followed by the second row and the third, and so on.

A) Column major
B) Row major
C) Encrypted
D) Rail post
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
7
What of the following is one of the most frequently occurring letters in the English language?

A) B
B) E
C) U
D) S
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
8
What method sorts a list of values from largest to smallest?

A) reverse
B) reversesort
C) sort(reverse = True)
D) sort('descending')
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
9
What is the value of myList after the following statement?
MyList = myList.sort().

A) None
B) The original list, sorted in ascending order
C) The original list, sorted in descending order
D) An empty list
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
10
Case Study 2:
1. def maybeAdd(ch, toList):
2. if ch in 'abcdefghijklmnopqrstuvwxyz'
and ch not in toList:
3. toList.append (ch)
-Refer to the session in the accompanying Case Study 2. What is the value of myList after the following code is executed?
>>> myList = []
>>> maybeAdd('a', myList)

A) []
B) ['a']
C) ['abcdefghijklmnopqrstuvwxyz']
D) None
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
11
Case Study 2:
1. def maybeAdd(ch, toList):
2. if ch in 'abcdefghijklmnopqrstuvwxyz'
and ch not in toList:
3. toList.append (ch)
-Refer to the session in the accompanying Case Study 2. What is the value of myList after the following code is executed?
>>> myList
['a', 'b']
>>> maybeAdd('a', myList)

A) ['a', 'a', 'b']
B) ['a', 'b']
C) ['abcdefghijklmnopqrstuvwxyz']
D) None
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
12
What three-letter word appears most often in War of the Worlds?

A) The
B) And
C) Was
D) Had
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
13
In Python, regular expressions are available through the ____ module.

A) pattern
B) wildcard
C) regex
D) re
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
14
In a regular expression, a part of the expression surrounded by () is called a(n):

A) capture group.
B) cluster.
C) object.
D) wildcard.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
15
Some of the first computer scientists were deeply involved in cryptanalysis.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
16
When decrypting using the rail fence cipher, one can easily see how many rails were used and encrypt the message by simply examining the encoded message.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
17
If we want to store a two-dimensional table in a computer's memory, we need to map from the row, column coordinates, which correspond to a cell in the table, to a location in memory.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
18
One effective way to ignore non-letter characters is to add them to the string before we start counting.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
19
Using the setDefault pattern is efficient for adding values to a dictionary.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
20
Match each definition with its term.
-Allows us to match strings using patterns.

A) Regular expression
B) Cryptanalysis
C) Capture group
D) Brute force
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
21
Match each definition with its term.
-Refers to the field of code breaking.

A) Regular expression
B) Cryptanalysis
C) Capture group
D) Brute force
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
22
Match each definition with its term.
-Allow us to determine what characters in a target word match letters in different
Parts of a given pattern.

A) Regular expression
B) Cryptanalysis
C) Capture group
D) Brute force
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
23
Match each definition with its term.
-Refers to trying all possible solutions.

A) Regular expression
B) Cryptanalysis
C) Capture group
D) Brute force
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
24
Describe the use of brute force to decrypt encrypted messages.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
25
How can a dictionary be used to improve upon a brute force approach to decrypting a rail fence cipher?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
26
What are the benefits of using a dictionary over a list when looking up values?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
27
Describe the use of the join method.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
28
What is the difference between row major order and column major order?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
29
Briefly describe how to crack a substitution cipher.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
30
Describe the two keyword parameters to the sort method.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
31
Explain how to identify the difference between vowels and consonants in the English language.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
32
Describe the function of regular expressions and explain how to use them in Python.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 32 flashcards in this deck.