莫尔斯电码对照表
This began as a thought experiment while waiting for patches to install on my system.
这是在等待补丁程序安装到我的系统上时进行的一次思想实验。
The Morse Code is an effective means with which to change ASCII data into binary bits. We assume that a "dot" is a zero and a "dash" is a one. Translating an ASCII character into its binary value is accomplished with a lookup table.
莫尔斯电码是将ASCII数据转换为二进制位的有效手段。 我们假设“点”为零,“破折号”为一。 使用查找表可以将ASCII字符转换为二进制值。
It is not enough to convert from ASCII to binary; we must further convert from binary into hexadecimal. This reduces the length of the encoded string, and effectively hides the content of the original plaintext.
从ASCII转换为二进制是不够的。 我们必须进一步从二进制转换为十六进制。 这减少了编码字符串的长度,并有效地隐藏了原始明文的内容。
This is still not enough. We need a means of converting from a string of hexadecimal digits back to the original plaintext. This adds overhead to the final encoded string, but experience has shown this makes the encoding that much more formidable.
这还不够。 我们需要一种将十六进制数字字符串转换回原始明文的方法。 这增加了最终编码字符串的开销,但是经验表明,这使编码更加困难。
We could have used SHA-1 and AES for true encryption, but that would be overkill.
我们本来可以使用SHA-1和AES进行真正的加密,但是那太过分了。
I am the only person I know who uses JavaScript on both the client and the server. All of the script for the Morse Encoder is written in JavaScript, so if you wish to use PHP, Perl or some other server-side language, you will have to translate it from JavaScript.
我是唯一认识到在客户端和服务器上都使用JavaScript的人。 Morse编码器的所有脚本都是用JavaScript编写的,因此,如果您希望使用PHP,Perl或其他服务器端语言,则必须从JavaScript进行翻译。
1.工作原理 (1. How It Works)
本次讨论使用了我心爱的猫Phoebe的名字作为纯文本。 我们从编码过程的结果开始。It may seem odd to start with an encoded string, but this allows us to explain how we arrived at a given point. The complete code is included, but we will refrain from showing code during this segment.
以编码字符串开头似乎很奇怪,但这使我们能够解释如何到达给定点。 完整的代码已包括在内,但在此部分中我们将避免显示代码。
Morse Encoding "Phoebe" results in:
Morse编码“ Phoebe”导致:
DF 49 CE 69 68 06 E4 88 25 D0
DF 49 CE 69 68 06 E4 88 25 D0
Phoebe is hiding in there, but she is not readily visible. Let's find out why.
菲比躲在那儿,但是她不容易被看见。 让我们找出原因。
In order to make the components of the encoding visible, we convert from hexadecimal into binary:
为了使编码的组件可见,我们将十六进制转换为二进制:
11011111010010011100111001
11011111010010011100111001 1010010110 1000000001 1011100100 1000100000 1001011101 0000
While we find this beautiful, it hard to fathom. Let's add some meaning to the (apparent) chaos:
虽然我们发现它很漂亮,但很难理解。 让我们为(表面上的)混乱添加一些含义:
Checksum
| Align bytes:7
| Type | Pad each character:0=no
| | | | LSB Len:6 MSB Len:0
| | | | | [------------------------ Plaintext -----------------------] |
| | | | | Len:4 Len:4 Len:3 Len:1 Len:4 Len:1 Align |
+--------------+ | | | | | Ucase | Lcase | Lcase | Lcase | Lcase | Lcase Padding |
+---------+ | | | | | | | | | | | | | | | | | | |
+----+ | | | | | | | | P | | h | | o | | e | | b | | e | |
|___ |___ |___ |___ |___ |__ | |___ |__ | |___ |__ | |___ |__ | |__ |__ | | |__ | |__ |__ | | |______ ___|
1101 1111 0100 1001 1100 111 0 0110 100 1 0110 100 0 0000 011 0 111 001 0 0 100 0 1000 001 0 0 1011101 0000
kkkk kkkk kkkk kkkk tttt aaa p oooo bbb c dddd bbb c dddd bbb c ddd bbb c d bbb c dddd bbb c d eeeeeee xxxx
Where:
k ... FCS-16 checksum (4 bytes)
t ... Encryption type (always '1100')
a ... # pad bytes (the number of binary digits must be a multiple of 4; this is the number of padding bits to ensure this)
p ... Pad each character (0 = no, 1 = yes) *** This example does not pad the individual characters ***
o ... Plaintext length (LSB)
b ... Length of encoded character
c ... Case (0 = lowercase, 1 = UPPERCASE)
d ... Binary-encoded Morse code character (optionally padded to 7 chars)
e ... Word boundary pad chars
x ... Plaintext length (MSB)
Combining all of the binary digits yields our binary string, shown here in 4-bit chunks:
组合所有二进制数字将产生我们的二进制字符串,如以下4位块所示:
1101 1111 0100 1001 1100 1110 0110 1001 0110 1000 0000 0110 1110 0100 1000 1000 0010 0101 1101 0000
1101 1111 0100 1001 1100 1110 0110 1001 0110 1000 0000 0110 1110 0100 1000 1000 0010 0101 1101 0000
Further converting this into hexadecimal, we return to the final result:
进一步将其转换为十六进制&#