|
@@ -1,13 +1,22 @@
|
1
|
1
|
# SimpleCrypt
|
2
|
2
|
a simple set of crypt problems.
|
3
|
3
|
|
|
4
|
+### Part 1
|
4
|
5
|
Create a few ciphers. Use String inside of your classes.
|
5
|
6
|
|
6
|
7
|
* ROT13 - take the 26 letters of the alphabet and create a `String <- crypt(String)` method in the ROT13 class
|
7
|
|
-* Make a constructor that takes two arguments to set the cipher correspondence. `ROT13 superSecure = new ROT13("a","j");`
|
|
8
|
+ * crypt("Why did the chicken cross the road?") should produce "Jul qvq gur puvpxra pebff gur ebnq?"
|
|
9
|
+ * crypt("Gb trg gb gur bgure fvqr!") should produce "To get to the other side!"
|
|
10
|
+* Make a constructor that takes two arguments to set the cipher correspondence. `ROT13 superSecure = new ROT13("a","m");`
|
|
11
|
+ * this defines the SHIFT of the two Character arrays.
|
8
|
12
|
* Caesar - make a subclass of ROT13 that implements the famous caesar cipher.
|
9
|
13
|
* Create you own cipher, using a different set of
|
10
|
14
|
|
|
15
|
+### Part 2
|
|
16
|
+
|
|
17
|
+Make a method that reads a textfile (sonnet18.txt), encrypts it, and writes it back out to a different file (sonnet18.enc)
|
|
18
|
+Prove that when you read in (sonnet18.enc), run the same crypt again, and prove that it produces the same original text.
|
|
19
|
+
|
11
|
20
|
## Explanation
|
12
|
21
|
|
13
|
22
|
ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13) is a simple letter substitution cipher that replaces a letter with the 13th letter after it, in the alphabet. ROT13 is a special case of the Caesar cipher, developed in ancient Rome.
|
|
@@ -30,8 +39,13 @@ In other words, two successive applications of ROT13 restore the original text (
|
30
|
39
|
The transformation can be done using a lookup table, such as the following:
|
31
|
40
|
|
32
|
41
|
```
|
33
|
|
-Input ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
34
|
|
-Output NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm
|
|
42
|
+// for ROT13('a'/'m')
|
|
43
|
+Input ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
|
|
44
|
+Output NOPQRSTUVWXYZABCDEFGHIJKLM nopqrstuvwxyzabcdefghijklm
|
|
45
|
+
|
|
46
|
+// for ROT13('a'/'d')
|
|
47
|
+Input ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
|
|
48
|
+Output EFGHIJKLMNOPQRSTUVWXYZABCD efghijklmnopqrstuvwxyzabcd
|
35
|
49
|
```
|
36
|
50
|
For example, in the following joke, the punchline has been obscured by ROT13:
|
37
|
51
|
|
|
@@ -45,7 +59,3 @@ Jul qvq gur puvpxra pebff gur ebnq?
|
45
|
59
|
To get to the other side!
|
46
|
60
|
```
|
47
|
61
|
|
48
|
|
-### Part2
|
49
|
|
-
|
50
|
|
-Make a method that reads a textfile (sonnet18.txt), encrypts it, and writes it back out to a different file (sonnet18.enc)
|
51
|
|
-Prove that when you read in (sonnet18.enc), run the same crypt again, and prove that it produces the same original text.
|