In this problem, you are required to write a program that reads words from a tex
ID: 3755610 • Letter: I
Question
In this problem, you are required to write a program that reads words from a text file into a “dictionary”. Each time a word is encountered in the text file for the first time, it should be added to the dictionary and a counter associated with the word should be initialized to 1. Each time the word is subsequently encountered in the text file, the counter should be incremented by 1. One of primary tasks here is to differentiate strings from words. A string is a contiguous sequence of characters, not containing any space characters, that is followed by a space character. A word is a string containing only alphabetic characters. For example, in the line of text “These strings are all words ”, each string is a word. However, in the line of text “These $trings are ! a11 words” The string “$trings” is not a word because ‘$’ is not an alphabetic character. The string “!” is not a word because ‘!’ is not an alphabetic character. The string “a11” is not a word because ‘1’ is not an alphabetic character. The string “words” is not a word because it is not terminated by a space character.
After the dictionary is built, your program should output the words in alphabetical order along with their associated counters. An example is shown below.
(a,127) (after,1) (begin,22) (cat,1) ... (yankee, 2) (zebra, 1)
Then, your program should delete all words whose count is greater than 1 and output the remaining words in alphabetical order along with their associated counters. An example is shown below.
(after,1) (cat,1) ... (zebra, 1)
Explanation / Answer
Suppose y = MD5(x). A "preimage attack" on MD5 says "given y, find some x' such that MD5(x') = y." The value x' is called a "preimage." Note that x' may be different than x. In fact, because MD5 maps an arbitrary length input to a finite length output, there exist infinitely many input values that map to a particular output. It's just difficult to find such preimages from the output alone.
A "second preimage attack" is an attack where the adversary is given both x and y = MD5(x), then the adversary is challenged to come up with an x' such that MD5(x') = MD5(x) = y, and x' != x. This gives more power to the adversary because it is allowed to see one preimage of the desired target value before the adversary is challenged to come up with another preimage.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.