Java代写 | CUS 1185 Data Security and Cryptography

CUS 1185 Data Security and Cryptography

Description of activity: In this exercise I would like you to attempt an implementation of the substitution cipher, just as we will see in class. Your scheme should implement all the 3 algorithms namely key-generation, encryption, decryption. Ultimately you will use this programming exercise to play a mental game with yourself, where you play part of the sender (Alice), recipient (Bob) and malicious attacker (Eve).
Key-generation step:
Your interface can vary. For example, you do NOT have to manually pick the letter pairing, you can opt to have it randomly assigned. The most important thing is to realize that the key-generation algorithm selects randomly an element from the keyspace K. In my example, I’ve chosen the following element:

Thus the key here is the paring a->b, b->e, c->c,…,z->i as shown above.

Recall from lecture, that once a key is generated, in the symmetric key setting (substitution cipher is one such type), the key k, must be securely shared between the two parties. So, the mental game would be to think that this key k must be distributed between the sender/receiver in a secure manner. Generally, the sender generates it, so we assume here you are under the Alice’s setting.

Encryption step:
Once the key is generated (pairs of plaintext letters<->ciphertext letters are assigned), allow the user to “encrypt” plaintext words using this particular key. In other words, your interface should allow you or someone to enter into standard input and “encrypt” the plaintext. You can define what legal plaintext is, but I suggest something easy such as just lower-case English characters.

Ultimately your interface should allow someone to encrypt at will similar to the following.

Here you are simulating Alice’s setting of encryption. You simply utilize your key k to encrypt any messages of your choice. For example, you might have encrypted some text whose ciphertext is shown below:

Decryption step:
Here you will be simulating Bob’s view i.e.; you are the recipient. As a recipient in the symmetric key setting you have securely shared the key k with your sender, namely with Alice. In other words, you have possession of the previously generated key shown in the key-generation step. Recall the 2 inputs to an encryption algorithm, namely (i) plaintext and (ii). Assuming that you are simulating Alice’s view, you are now ready to decrypt, by feeding to your decryption algorithm the key k and the text jsfbmmampwfcsaqup. This is trivial to decrypt; all you have to do have the key k represented as a lookup table.


Ciphertext-only attack (passive attacker):
Another part of the exercise is to allow you to think from a perspective of a passive attacker (Eve). As we explained in class, Eve is given, due to Kerckhoff’s principle, our key-generation, encryption, decryption algorithm. Eve is also able to observe ciphertexts as they go through the “wire”. For example, Eve has access to the encrypted ciphertext jsfbmmampwfcsaqup and many more.

Here you will simulate Eve’s letter frequency cryptoanalysis by allowing your Encryption algorithm to encrypt a very large body of text using the same key you chose to encrypt jsfbmmampwfcsaqup

You can realize this by feeding into your Encryption algorithm a very large plaintext dictionary. A good place where to start looking for large corpora of English text is here or you can just Google for them.

Finally, within the Eve’s view, you would have to further up on your attempt to “decrypt” a particular encrypted string by using letter frequency analysis based on the corpus of English text you’ve found online.

Assuming you’ve found yourself a good corpus of English text, you as Eve, would simply run a letter frequency analysis on the encrypted corpus. Recall, your Encryption algorithm can do this, under the same key you would be using to encrypt during your session. In my sample example, the letter frequency shows me the following: jsfbmmampwfcsaqup


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:itcsdx