浏览代码

README-en.md edited online with Bitbucket

父节点
当前提交
855036ed63
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      README-en.md

+ 1
- 1
README-en.md 查看文件

@@ -65,7 +65,7 @@ The Caesar Cypher is a substitution encryption technique that is said to have be
65 65
 
66 66
 ###Using the modulo operator
67 67
 
68
-Modular addition is essential for implementing ciphering systems in programming. Let’s say that you map every letter of the (English) alphabet to a number between 0 to 25 (‘A’ is 0, ‘B’ is 1, .., ‘Z’ is 25). To Caesar cipher a letter we convert the letter to its corresponding number in the range [0,25], then add the displacement. We then apply the modulo 26 operation to the total. The letter that corresponds to the result after the modulo is the ciphered letter. The effect of the circular shift is achieved by using the modulo 26 operation because it converts the result of the addition to an integer in the range [0,25]. For instance, if we were to shift the letter ‘Z’ by three positions, this would be performed by adding ( 25 + 3 ) % 26 which equals 2, whose corresponding letter is ‘C’.  
68
+Modular addition is essential for implementing ciphering systems in programming. In the Ceaser Cypher application above we could htink that every letter of the (English) alphabet is assigned a number between 0 and 25 (‘A’ is 0, ‘B’ is 1, .., ‘Z’ is 25). The Caesar Cypher transforms every letter we convert to its corresponding number in the range [0,25], then add the displacement. To do the cyclic displacement, every time our displacement gives us a letter that corresponds to a number gretaer than 25, we take the remainder of the numer divided by 26 and use the letter that corresponds to the remainder. The effect of the circular shift is achieved by using the modulo 26 operation because it converts the result of the addition to an integer in the range [0,25]. For instance, if we were to shift the letter ‘Z’ by three positions, this would be performed by adding ( 25 + 3 ) % 26 which equals 2, whose corresponding letter is ‘C’.  
69 69
 
70 70
 To convert an uppercase letter to a number in the [0,25] range we can apply our knowledge of the ASCII code. The code for the uppercase letters is in the range [65,90]  (‘A’ is 65, ‘Z’ is 90). Thus, to convert an uppercase case to a number in the range [0,25], a simple subtraction by 65 does the trick (i.e. `’A’ - 65 = 0`, `’Z’ - 65 = 25`).  Observe that to go from the [0,25] range to the ASCII code of its corresponding uppercase character we simply add 65 to the number. For instance, number 3 corresponds to the letter whose ASCII code is $3 + 65 = 68$, i.e. letter ‘D’.  
71 71