Skip to content

Commit e69f714

Browse files
committed
Clean up README
1 parent f60bb67 commit e69f714

File tree

1 file changed

+29
-36
lines changed

1 file changed

+29
-36
lines changed

assign1/README.md

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Assignment 1: Cryptography
2-
**Due: Midnight, Tuesday of Week 5 (Febuary 3, 2019)**
2+
**Due: Midnight, Tuesday of Week 5 (Febuary 4, 2020)**
33

44
## Overview
55
In this assignment, you will build a cryptography suite that implements two or three different cryptosystems - Caesar cipher, Vigenere cipher, and (optionally) the Merkle-Hellman Knapsack Cryptosystem. This handout will walk you through the details of building this text-based cryptography tool. We want to instill good Pythonic practices from the beginning - so we encourage you to think critically about writing clean Python code.
@@ -32,6 +32,21 @@ res/mh-plain.txt and res/mh-cipher.txt
3232
```
3333

3434
# Cryptography Suite
35+
## General Tips
36+
37+
You'll be modifying a lot of strings in this assignment. The `string` module exports some useful values:
38+
39+
```
40+
>>> import string
41+
>>> string.ascii_letters
42+
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
43+
>>> string.ascii_uppercase
44+
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
45+
>>> string.ascii_lowercase
46+
'abcdefghijklmnopqrstuvwxyz'
47+
>>> string.punctuation
48+
'!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
49+
```
3550

3651
## Building the Ciphers
3752
In this section, you will build cipher functions to encrypt and decrypt messages. We'll give a brief overview of each cipher and give some pointers on how it fits it into the starter files.
@@ -142,16 +157,7 @@ These functions take two arguments, a message to encrypt (or decrypt) and a keyw
142157

143158
Notes:
144159

145-
- You can assume that all characters in the plaintext, ciphertext, and keyword will be alphabetic (i.e no spaces, numbers, or punctuation).
146-
- However, the text of `not_a_secret_message.txt` contains spaces, numbers, and punctuation, so if you want to decrypt that, you'll need to write code that handles non-alphabetic characters. Non-alphabetic characters will not be encrypted, and do not use up any of the characters from the key. For example:
147-
148-
```
149-
ATTACK AT DAWN!
150-
+ LEMONL EM ONLE
151-
-----------------
152-
LXFOPV EF RNHR!
153-
```
154-
160+
- You can assume that all characters in the plaintext, ciphertext, and keyword will be alphabetic (i.e no spaces, numbers, or punctuation).
155161
- You can assume that all of the characters will be provided in uppercase.
156162
- You can assume that keyword will have at least one letter in it.
157163

@@ -173,7 +179,15 @@ Another list of non-exhaustive tests are available at `tests/vigenere-tests.txt`
173179

174180
You can use the functions `ord` and `chr` which convert strings of length one to and from their ASCII numerical equivalents. For example, `ord('A') == 65`, `ord('B') == 66`, ..., `ord('Z') == 90`, and `chr(65) == 'A'`, `chr(66) == 'B'`, ..., `chr(90) == 'Z'`. For an extra challenge, try to implement these functions purely functionally.
175181

176-
Intrigued? Take a look in `not_a_secret_message.txt`. One possible extension is to try to decrypt this message (or any encrypted message!) despite not knowing what the key is. For this encryption, ignore non-alphabetic characters entirely.
182+
Intrigued? Take a look in `not_a_secret_message.txt`. One possible extension is to try to decrypt this message (or any encrypted message!) despite not knowing what the key is. For this encryption, ignore non-alphabetic characters entirely. In particular, non-alphabetic characters do not use up any of the characters from the key. For example:
183+
184+
```
185+
ATTACK AT DAWN!
186+
+ LEMONL EM ONLE
187+
-----------------
188+
LXFOPV EF RNHR!
189+
```
190+
177191

178192
## Console Menu
179193

@@ -240,36 +254,15 @@ Stylistically, you will be evaluated on your general program design (a la 106 se
240254

241255
You can find a tool to help format your code [online](http://pep8online.com/). If you have any questions, please don't hesitate to let us know. Think about the [Zen of Python](https://www.python.org/dev/peps/pep-0020/) when making design decisions.
242256

243-
## Deliverables
257+
## Submitting
258+
259+
Submit the following files:
244260

245261
1. Your modified `crypto.py`
246262
2. The `design.txt` file documenting your design decisions
247263

248-
## Submitting
249-
250264
See the [submission instructions](https://github.com/stanfordpython/python-handouts/blob/master/submitting-assignments.md) on the course website.
251265

252-
## General Tips
253-
254-
The `string` module exports some useful values:
255-
256-
```
257-
>>> import string
258-
>>> string.ascii_letters
259-
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
260-
>>> string.ascii_uppercase
261-
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
262-
>>> string.ascii_lowercase
263-
'abcdefghijklmnopqrstuvwxyz'
264-
>>> string.punctuation
265-
'!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
266-
```
267-
268-
Think back to what we know about data structures. How can we efficiently create and manipulate lists and dicts?
269-
270-
Check back here for more tips as they come up!
271-
272-
273266
## Merkle-Hellman Knapsack Cryptosystem (optional)
274267

275268
Public-key cryptography is essential to modern society. You may have heard of RSA - one of the most popular public-key cryptosystems. Less well known, however, is the Merkle-Hellman Knapsack Cryptosystem, one of the earliest public-key cryptosystems (invented in 1978!), which relies on the NP-complete subset sum problem. Although it has been since been broken, it illustrates several important concepts in public-key cryptography and gives you lots of practice with the Pythonic constructs we've discussed in this class.

0 commit comments

Comments
 (0)