chore(i8n,learn): processed translations
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
15047f2d90
commit
e5c44a3ae5
@ -1,21 +1,35 @@
|
||||
---
|
||||
id: 5900f3a81000cf542c50feba
|
||||
title: 问题59:XOR解密
|
||||
title: 'Problem 59: XOR decryption'
|
||||
challengeType: 5
|
||||
videoUrl: ''
|
||||
forumTopicId: 302170
|
||||
dashedName: problem-59-xor-decryption
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
计算机上的每个字符都分配有唯一的代码,首选标准是ASCII(美国信息交换标准代码)。例如,大写A = 65,星号(\*)= 42,小写k = 107.现代加密方法是获取文本文件,将字节转换为ASCII,然后使用给定值对每个字节进行异或,取自密钥。 XOR功能的优点是在密文上使用相同的加密密钥,恢复纯文本;例如,65 XOR 42 = 107,然后107 XOR 42 = 65.对于不可破解的加密,密钥与纯文本消息的长度相同,密钥由随机字节组成。用户将加密的消息和加密密钥保持在不同的位置,并且没有两个“一半”,就不可能解密该消息。不幸的是,这种方法对大多数用户来说是不切实际的,因此修改后的方法是使用密码作为密钥。如果密码短于可能的消息,则密钥在整个消息中循环重复。此方法的余额是使用足够长的密码密钥来保证安全性,但又要足够短,以便令人难忘。您的任务变得简单,因为加密密钥由三个小写字符组成。使用cipher.txt(右键单击并“保存链接/目标为...”),包含加密的ASCII代码的文件,以及纯文本必须包含常用英语单词的知识,解密消息并找到总和原始文本中的ASCII值。
|
||||
Each character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For example, uppercase A = 65, asterisk (\*) = 42, and lowercase k = 107.
|
||||
|
||||
A modern encryption method is to take a text file, convert the bytes to ASCII, then XOR each byte with a given value, taken from a secret key. The advantage with the XOR function is that using the same encryption key on the cipher text, restores the plain text; for example, 65 XOR 42 = 107, then 107 XOR 42 = 65.
|
||||
|
||||
For unbreakable encryption, the key is the same length as the plain text message, and the key is made up of random bytes. The user would keep the encrypted message and the encryption key in different locations, and without both "halves", it is impossible to decrypt the message.
|
||||
|
||||
Unfortunately, this method is impractical for most users, so the modified method is to use a password as a key. If the password is shorter than the message, which is likely, the key is repeated cyclically throughout the message. The balance for this method is using a sufficiently long password key for security, but short enough to be memorable.
|
||||
|
||||
Your task has been made easy, as the encryption key consists of three lower case characters. Using `cipher`, an array containing the encrypted ASCII codes, and the knowledge that the plain text must contain common English words, decrypt the message and find the sum of the ASCII values in the original text.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler59()`应返回107359。
|
||||
`XORDecryption(cipher)` should return a number.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler59(), 107359);
|
||||
assert(typeof XORDecryption(cipher) === 'number');
|
||||
```
|
||||
|
||||
`XORDecryption(cipher)` should return 129448.
|
||||
|
||||
```js
|
||||
assert.strictEqual(XORDecryption(cipher), 129448);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
Reference in New Issue
Block a user