|
@@ -16,7 +16,7 @@ Because there are 26 letters (2×13) in the basic Latin alphabet, ROT13 is its o
|
16
|
16
|
|
17
|
17
|
ROT13 is used in online forums as a means of hiding spoilers, punchlines, puzzle solutions, and offensive materials from the casual glance. ROT13 has been described as the "Usenet equivalent of a magazine printing the answer to a quiz upside down".[2] ROT13 has inspired a variety of letter and word games on-line, and is frequently mentioned in newsgroup conversations.
|
18
|
18
|
|
19
|
|
-Applying ROT13 to a piece of text merely requires examining its alphabetic characters and replacing each one by the letter 13 places further along in the alphabet, wrapping back to the beginning if necessary.[3] A becomes N, B becomes O, and so on up to M, which becomes Z, then the sequence continues at the beginning of the alphabet: N becomes A, O becomes B, and so on to Z, which becomes M. Only those letters which occur in the English alphabet are affected; numbers, symbols, whitespace, and all other characters are left unchanged. Because there are 26 letters in the English alphabet and 26 = 2 × 13, the ROT13 function is its own inverse:[3]
|
|
19
|
+Applying ROT13 to a piece of text merely requires examining its alphabetic characters and replacing each one by the letter 13 places further along in the alphabet, wrapping back to the beginning if necessary.[3] A becomes N, B becomes O, and so on up to M, which becomes Z, then the sequence continues at the beginning of the alphabet: N becomes A, O becomes B, and so on to Z, which becomes M. Only those letters which occur in the English alphabet are affected; numbers, symbols, whitespace, and all other characters are left unchanged.
|
20
|
20
|
|
21
|
21
|
```Java
|
22
|
22
|
String s = "we hold these truths to be self evident"
|
|
@@ -29,8 +29,10 @@ In other words, two successive applications of ROT13 restore the original text (
|
29
|
29
|
|
30
|
30
|
The transformation can be done using a lookup table, such as the following:
|
31
|
31
|
|
|
32
|
+```
|
32
|
33
|
Input ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
33
|
34
|
Output NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm
|
|
35
|
+```
|
34
|
36
|
For example, in the following joke, the punchline has been obscured by ROT13:
|
35
|
37
|
|
36
|
38
|
```
|
|
@@ -42,3 +44,8 @@ Transforming the entire text via ROT13 form, the answer to the joke is revealed:
|
42
|
44
|
Jul qvq gur puvpxra pebff gur ebnq?
|
43
|
45
|
To get to the other side!
|
44
|
46
|
```
|
|
47
|
+
|
|
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.
|