📚 Data Transmission: Types, Error Detection & Encryption | 数据传输:类型、错误检测与加密
Data transmission is the foundation of all computer communication. Whether you are sending an email, streaming a video, or submitting an online exam answer, your data must travel from one device to another in a structured and reliable way. In this article, we will explore the different types of data transmission, how errors are detected and corrected, and how encryption keeps transmitted data secure.
数据传输是所有计算机通信的基础。无论是发送电子邮件、播放视频,还是提交在线考试答案,数据都必须以结构化且可靠的方式从一台设备传输到另一台设备。在本文中,我们将探讨数据传输的不同类型、错误检测与纠正的方法,以及加密如何保证传输数据的安全。
1. Types of Data Transmission | 数据传输的类型
Data can be transmitted in two fundamental ways: serial transmission and parallel transmission. The choice between them depends on the distance, speed, and cost requirements of the communication system.
数据传输有两种基本方式:串行传输和并行传输。选择哪种方式取决于通信系统的距离、速度和成本要求。
Serial transmission sends data one bit at a time over a single wire or channel. Because only one bit travels at a time, it is slower in theory, but it is more reliable over long distances and uses fewer wires. Serial transmission is used in USB, Ethernet, and fibre-optic communication.
串行传输通过单根导线或信道一次发送一位数据。由于每次只传输一位,理论上速度较慢,但在长距离传输中更加可靠,并且使用的导线更少。串行传输用于 USB、以太网和光纤通信。
Parallel transmission sends multiple bits simultaneously over multiple wires. For example, an 8-bit parallel link can send an entire byte in one clock cycle. This makes parallel transmission faster over short distances, but it suffers from timing skew and signal interference over long distances. It is commonly used inside computers to connect the CPU to RAM or on printer cables.
并行传输通过多条导线同时发送多个位。例如,一条 8 位并行链路可以在一个时钟周期内发送整个字节。这使得并行传输在短距离内速度更快,但在长距离传输中会出现时序偏移和信号干扰问题。并行传输常用于计算机内部连接 CPU 与内存,或用于打印机电缆。
| Feature | Serial | Parallel |
| Speed | Slower per cycle, but higher stable clock rates possible | Faster per cycle over short distances |
| Distance | Suitable for long distances | Only suitable for short distances |
| Cost | Lower cost, fewer wires | Higher cost, many wires |
| Interference | Less crosstalk | High crosstalk between wires |
Within each of these categories, transmission can also be classified as simplex, half-duplex, or full-duplex.
在上述每种类型中,传输还可以分为单工、半双工和全双工。
Simplex transmission allows data to flow in only one direction. A keyboard sends data to the computer but never receives data from it. Half-duplex allows data to flow in both directions, but only one direction at a time, like a walkie-talkie. Full-duplex allows simultaneous two-way communication, like a telephone call, where both parties can speak and listen at the same time.
单工传输只允许数据沿一个方向流动。键盘向计算机发送数据,但从不从计算机接收数据。半双工允许数据双向流动,但同一时间只能沿一个方向,就像对讲机。全双工允许同时双向通信,就像电话通话,双方可以同时说话和听。
2. Synchronous and Asynchronous Transmission | 同步与异步传输
For serial transmission, the sender and receiver must agree on how the bits are grouped and timed. Two common methods are synchronous and asynchronous transmission.
对于串行传输,发送方和接收方必须就位的分组方式和时序达成一致。两种常见方法是同步传输和异步传输。
In asynchronous transmission, data is sent one character or byte at a time. Each byte is wrapped with a start bit and one or more stop bits. The start bit tells the receiver that a new byte is coming, and the stop bit indicates the end of the byte. This method is simple and cheap, but it has high overhead because every byte carries extra control bits. It is used for low-speed devices such as keyboards and old modems.
在异步传输中,数据一次发送一个字符或字节。每个字节都包裹一个起始位和一个或多个停止位。起始位告诉接收方一个新字节即将到来,停止位表示该字节的结束。这种方法简单且廉价,但由于每个字节都附带额外控制位,因此开销较高。它用于键盘和旧式调制解调器等低速设备。
In synchronous transmission, data is sent as a continuous stream of bits or blocks, with no start and stop bits between individual bytes. The sender and receiver are synchronised by a shared clock signal or by embedded clock information in the data stream. This method has lower overhead and higher throughput, but it requires more complex hardware. It is used in high-speed network connections and in transferring large files between computer systems.
在同步传输中,数据作为连续的位流或块发送,字节之间没有起始位和停止位。发送方和接收方通过共享的时钟信号或数据流中嵌入的时钟信息进行同步。这种方法开销更低、吞吐量更高,但需要更复杂的硬件。它用于高速网络连接以及在计算机系统之间传输大文件。
Asynchronous: [START][8 data bits][STOP][START][8 data bits][STOP]
Synchronous: [header][data block][CRC][header][data block][CRC]
3. Bandwidth and Bit Rate | 带宽与比特率
Bandwidth and bit rate are two closely related concepts that describe the capacity and actual speed of a transmission channel.
带宽和比特率是两个密切相关的概念,分别描述传输信道的容量和实际速度。
Bandwidth is the range of frequencies available for data transmission, measured in hertz (Hz) or bits per second (bps). In digital systems, bandwidth is often expressed as the maximum number of bits that can be transmitted per second. Bit rate is the actual number of bits transmitted per second over the channel.
带宽是可用于数据传输的频率范围,以赫兹(Hz)或比特每秒(bps)为单位。在数字系统中,带宽通常表示为每秒可传输的最大位数。比特率是信道上每秒实际传输的位数。
The relationship between bandwidth, bit rate, and data size is straightforward. To calculate the time required to transmit a file, divide the file size by the bit rate. For example, if a file is 10 megabits and the bit rate is 2 Mbps, the transmission time is 5 seconds.
带宽、比特率和数据大小之间的关系很简单。要计算传输文件所需的时间,可将文件大小除以比特率。例如,如果文件为 10 兆位,比特率为 2 Mbps,则传输时间为 5 秒。
Transmission time = File size / Bit rate
Students often confuse bandwidth with speed. Bandwidth is the theoretical maximum capacity, while bit rate is the actual usage. In the CIE syllabus, you should also understand that increasing bandwidth does not always guarantee a proportional increase in bit rate, because the actual bit rate is limited by the quality of the channel, noise, and the hardware used.
学生常将带宽与速度混淆。带宽是理论上的最大容量,而比特率是实际使用量。在 CIE 考纲中,你还应理解增加带宽并不总是保证比特率的比例增长,因为实际比特率受信道质量、噪声和所用硬件的限制。
4. Error Detection: Parity Checking | 错误检测:奇偶校验
When data travels through a transmission medium, electrical noise, interference, or physical defects can cause bits to flip from 0 to 1 or from 1 to 0. Error detection methods help the receiver identify when such corruption has occurred.
当数据在传输介质中传输时,电噪声、干扰或物理缺陷可能导致位从 0 翻转为 1 或从 1 翻转为 0。错误检测方法帮助接收方识别是否发生了此类损坏。
Parity checking is one of the simplest error detection methods. A single parity bit is added to a block of data. In even parity, the parity bit is chosen so that the total number of 1s in the data plus the parity bit is even. In odd parity, the total number of 1s is odd.
奇偶校验是最简单的错误检测方法之一。在一个数据块中添加一个奇偶校验位。在偶校验中,选择校验位使数据中 1 的总数加上校验位后为偶数。在奇校验中,1 的总数为奇数。
For example, suppose the original data is 101101 and even parity is used. The data contains four 1s, which is already even, so the parity bit is 0. The transmitted byte is 1011010. If a single bit flips during transmission, the receiver will count the number of 1s, see an odd total, and know an error has occurred.
例如,假设原始数据为 101101,并使用偶校验。数据包含四个 1,已经是偶数,因此校验位为 0。传输的字节为 1011010。如果传输过程中某一位发生翻转,接收方将计算 1 的个数,看到总和为奇数,便会知道发生了错误。
However, parity checking has a major limitation. If two bits flip, the total number of 1s remains even, and the error goes undetected. Parity checking can only detect an odd number of bit errors. It also cannot identify which bit is wrong, so it provides no error correction.
然而,奇偶校验有一个重大限制。如果两个位翻转,1 的总数仍为偶数,错误将无法被检测到。奇偶校验只能检测奇数个位错误。它也无法识别哪一位出错,因此不提供错误纠正。
5. Error Detection: Checksum | 错误检测:校验和
A checksum is a more robust error detection method than parity checking. It works by dividing data into blocks and calculating a numerical value based on the sum (or other arithmetic operation) of those blocks. This value is then transmitted along with the data.
校验和是一种比奇偶校验更可靠的错误检测方法。其原理是将数据分成若干块,并基于这些块的总和(或其他算术运算)计算出一个数值。该数值随后与数据一起传输。
For example, consider the following data divided into 8-bit blocks:
例如,考虑将以下数据分成 8 位块:
Block 1: 10110010
Block 2: 11001101
Block 3: 01111001
Block 4: 10011011
If these blocks are added together, the sum will produce a value. The checksum is often taken as the sum modulo 256, meaning only the last 8 bits of the sum are kept. The receiver performs the same addition on the received data and compares the result with the transmitted checksum. If they do not match, an error is detected.
如果将这些块相加,总和将产生一个值。校验和通常取总和对 256 取模,即只保留总和的后 8 位。接收方对接收到的数据执行相同的加法,并将结果与传输的校验和进行比较。如果不匹配,则检测到错误。
Checksums can detect many more errors than parity checks, including some cases where multiple bits flip in different blocks. However, checksums are not infallible. If one block decreases by 1 and another block increases by 1, the total sum remains unchanged, and the error would escape detection.
校验和能比奇偶校验检测到更多的错误,包括某些在多个块中发生多位翻转的情况。然而,校验和并非万无一失。如果一块减少 1 而另一块增加 1,总和保持不变,错误将逃过检测。
6. Error Detection: Check Digit | 错误检测:校验位
A check digit is a special type of checksum used primarily for identifying errors in numbers such as bank account numbers, national identification numbers, and Universal Product Codes (UPCs). It is always a single digit appended to the original number.
校验位是一种特殊类型的校验和,主要用于检测银行账号、国民身份号码和通用产品代码(UPC)等数字中的错误。它总是附加在原始数字之后的单个数字。
The International Standard Book Number (ISBN) system uses a check digit for books. In the international standard ISO 2108, a 13-digit ISBN has the following structure: the first 12 digits are the actual book identifier, and the 13th digit is the check digit.
国际标准书号(ISBN)系统使用校验位来标识图书。在国际标准 ISO 2108 中,13 位 ISBN 的结构如下:前 12 位是实际图书标识符,第 13 位是校验位。
The calculation for the ISBN-13 check digit is as follows. Starting from the left, multiply every first digit by 1 and every second digit by 3, alternating. Then add all 12 products together. The check digit is the smallest number that, when added to this total, gives a sum divisible by 10.
ISBN-13 校验位的计算如下。从左边开始,将每个第 1 位数字乘以 1,每个第 2 位数字乘以 3,交替进行。然后将所有 12 个乘积相加。校验位是使总和加上它之后能被 10 整除的最小数。
Check digit = (10 − (sum mod 10)) mod 10
For example, take the first 12 digits 9780007339118. Multiply each digit alternately by 1 and 3: 9×1 + 7×3 + 8×1 + 0×3 + 0×1 + 0×3 + 7×1 + 3×3 + 3×1 + 9×3 + 1×1 + 1×3 = 93. The sum is 93. Since 93 mod 10 = 3, the check digit is 10 − 3 = 7. The full ISBN is 9780007339117.
例如,取前 12 位数字 9780007339118。将每个数字交替乘以 1 和 3:9×1 + 7×3 + 8×1 + 0×3 + 0×1 + 0×3 + 7×1 + 3×3 + 3×1 + 9×3 + 1×1 + 1×3 = 93。总和为 93。由于 93 mod 10 = 3,校验位为 10 − 3 = 7。完整 ISBN 为 9780007339117。
Check digits detect single digit errors and most transposition errors, where two adjacent digits are swapped.
校验位可以检测单个数字错误以及大多数换位错误,即两个相邻数字交换位置的错误。
7. Error Correction | 错误纠正
Detecting an error is only half the battle. Once an error is detected, the system must decide how to respond. Some systems simply request a retransmission, while others can automatically correct the error without resending.
检测到错误只是完成了一半工作。一旦检测到错误,系统必须决定如何响应。有些系统简单地请求重新传输,而另一些系统会自动纠正错误,无需重新发送。
Automatic Repeat reQuest (ARQ) is a protocol where the receiver uses an acknowledgment (ACK) or a negative acknowledgment (NAK) to tell the sender whether data was received correctly. If the sender receives a NAK or no acknowledgment within a timeout period, it retransmits the data. This method is simple and reliable, but it consumes bandwidth because of retransmissions and acknowledgment signals.
自动重传请求(ARQ)是一种协议,接收方使用确认(ACK)或否定确认(NAK)告知发送方数据是否正确接收。如果发送方收到 NAK 或在超时时间内未收到确认,则重新传输数据。这种方法简单可靠,但由于重传和确认信号会消耗带宽。
Forward Error Correction (FEC) allows the receiver to detect and correct errors without retransmission. FEC uses redundant information, such as Hamming codes, to reconstruct the original data from a corrupted version. FEC is useful in real-time applications like satellite communication and live video streaming, where retransmission is impractical due to delay.
前向纠错(FEC)允许接收方无需重传即可检测和纠正错误。FEC 使用冗余信息(如汉明码)从损坏的版本重建原始数据。FEC 适用于卫星通信和实时视频流等实时应用,因为在这些场景中,重传会带来不可接受的延迟。
In the CIE syllabus, a classic example of FEC is the use of a parity block. Data is arranged in a grid, with parity bits calculated for each row and column. This allows the receiver to locate the exact position of a single-bit error: the row of the error is given by the failing row parity, and the column is given by the failing column parity. The receiver can then flip the bit back to its original value.
在 CIE 考纲中,FEC 的一个经典例子是使用奇偶校验块。数据排列成网格,为每行和每列计算奇偶校验位。这使得接收方能够定位单个位错误的确切位置:错误的行由失败的行校验给出,错误的列由失败的列校验给出。然后接收方可以将该位翻转回原始值。
8. Encryption: Symmetric Key | 加密:对称密钥
Encryption is the process of converting plaintext into ciphertext so that unauthorised parties cannot read the data. The two main types of encryption are symmetric and asymmetric encryption.
加密是将明文转换为密文的过程,使未经授权的方无法读取数据。两种主要加密类型是对称加密和非对称加密。
In symmetric encryption, the same key is used both to encrypt and to decrypt the data. This is like a simple locked box: whoever has the key can both lock and unlock the box. Because the algorithm is relatively simple, symmetric encryption is fast and efficient for large volumes of data.
在对称加密中,同一个密钥既用于加密数据,也用于解密数据。这就像一个简单的锁箱:谁拥有钥匙,谁就能锁上和打开箱子。由于算法相对简单,对称加密在处理大量数据时快速高效。
A simple example is a substitution cipher. Suppose the key is “shift by 3” in the Caesar cipher. The plaintext “HELLO” becomes “KHOOR”. Anyone who knows the key of 3 can reverse the shift to recover “HELLO”. Anyone without the key only sees meaningless letters.
一个简单的例子是替换密码。假设密钥是凯撒密码中的”位移 3″。明文 “HELLO” 变成 “KHOOR”。任何知道密钥 3 的人都可以反向位移恢复 “HELLO”。没有密钥的人只能看到无意义的字母。
The main weakness of symmetric encryption is key distribution. Both sender and receiver must have the same key, and the key must be transmitted securely. If an attacker intercepts the key during transmission, all encrypted data becomes readable. This is sometimes called the “key exchange problem”.
对称加密的主要弱点是密钥分发。发送方和接收方必须拥有相同的密钥,并且密钥必须安全传输。如果攻击者在传输过程中截获密钥,所有加密数据都将变得可读。这有时被称为”密钥交换问题”。
Well-known symmetric algorithms include DES, AES, and Blowfish. AES (Advanced Encryption Standard) is widely used today.
知名的对称算法包括 DES、AES 和 Blowfish。AES(高级加密标准)目前被广泛使用。
9. Encryption: Asymmetric Key | 加密:非对称密钥
In asymmetric encryption (also called public-key cryptography), two different but mathematically related keys are used: a public key and a private key. The public key is freely distributed to anyone, while the private key is kept secret by the owner.
在非对称加密(也称为公钥密码学)中,使用两个不同但在数学上相关的密钥:公钥和私钥。公钥可以自由分发给任何人,而私钥由所有者保密。
When Alice wants to send a confidential message to Bob, she encrypts the message using Bob’s public key. The resulting ciphertext can only be decrypted with Bob’s private key. Because the private key never leaves Bob’s control, the security of the system does not depend on securely exchanging a shared key. This solves the key exchange problem of symmetric encryption.
当 Alice 想向 Bob 发送机密消息时,她使用 Bob 的公钥加密消息。生成的密文只能用 Bob 的私钥解密。由于私钥永远不会离开 Bob 的控制,系统的安全性不依赖于安全地交换共享密钥。这解决了对称加密中的密钥交换问题。
A simple analogy is a mailbox. Anyone can drop a letter into the mailbox (encrypt with the public key), but only the person who owns the mailbox key (private key) can open it and read the letter.
一个简单的类比是邮箱。任何人都可以将信件投入邮箱(使用公钥加密),但只有拥有邮箱钥匙(私钥)的人才能打开并阅读信件。
Asymmetric encryption is mathematically more complex and slower than symmetric encryption. In practice, systems often combine both methods: asymmetric encryption is used to securely exchange a session key, and then symmetric encryption is used for the bulk data transfer. This hybrid approach is used in protocols such as HTTPS/TLS.
非对称加密在数学上比对称加密更复杂且速度更慢。在实际应用中,系统通常结合两种方法:使用非对称加密安全地交换会话密钥,然后使用对称加密进行批量数据传输。这种混合方法用于 HTTPS/TLS 等协议中。
10. Digital Signatures | 数字签名
Encryption ensures confidentiality, but it does not guarantee authenticity or integrity. A digital signature provides these additional properties by using asymmetric encryption in reverse.
加密保证了机密性,但不能保证真实性和完整性。数字签名通过反向使用非对称加密来提供这些额外属性。
To sign a message, the sender uses their own private key to encrypt a hash of the message. The receiver uses the sender’s public key to decrypt the signature, and then compares the decrypted hash with a newly calculated hash of the received message. If the two match, the receiver knows the message was not altered and that it genuinely came from the sender.
要签署消息,发送方使用自己的私钥加密消息的哈希值。接收方使用发送方的公钥解密签名,然后将解密后的哈希值与对接收到的消息重新计算的哈希值进行比较。如果两者匹配,接收方就知道消息未被篡改,并且确实来自发送方。
This works because only the sender possesses the private key. If the sender later denies sending the message, the receiver can present the digital signature as proof. This property is called non-repudiation.
之所以有效,是因为只有发送方才拥有私钥。如果发送方后来否认发送过该消息,接收方可以出示数字签名作为证据。这一特性称为不可否认性。
In the CIE syllabus, you should distinguish between encryption for confidentiality and digital signatures for authenticity. Encryption with the public key ensures secrecy; encryption with the private key ensures authenticity.
在 CIE 考纲中,你应该区分用于机密性的加密和用于真实性的数字签名。使用公钥加密确保保密性;使用私钥加密确保真实性。
11. Sample Exam Question | 考试例题解析
Let us work through a typical CIE-style examination question involving error detection.
让我们解答一道典型的 CIE 风格考试题,涉及错误检测。
Question: A computer transmits the byte 11010011 using even parity. State the parity bit that must be added and explain how the receiver would detect a single-bit error.
题目:计算机使用偶校验传输字节 11010011。写出必须添加的校验位,并解释接收方如何检测单位错误。
Solution: The byte 11010011 contains five 1s. Since the number of 1s is odd, an even-parity system requires a parity bit of 1 to make the total number of 1s equal to six, which is even. The full transmitted unit is 110100111. If a single bit is flipped during transmission, the receiver counts the number of 1s in the received unit. The total will be odd, indicating an error has occurred.
解答:字节 11010011 包含五个 1。由于 1 的个数为奇数,偶校验系统需要校验位为 1,使 1 的总数等于六,即为偶数。完整传输单元为 110100111。如果传输过程中某一位被翻转,接收方统计接收单元中 1 的个数,总数为奇数,表明发生了错误。
Now consider the same data using a two-dimensional parity check. If the data bits are arranged in a 4×2 grid and an extra row and column of parity bits is added, a single-bit error changes both the row parity and the column parity at the intersection. The receiver can identify the exact bit position and correct it automatically.
现在考虑使用二维奇偶校验的相同数据。如果数据位排列成 4×2 网格,并添加额外一行和一列校验位,单个位错误将同时改变相交处的行校验和列校验。接收方可以识别出确切的位位置并自动纠正。
12. Common Pitfalls and Exam Tips | 常见误区与考试技巧
Many students lose marks on transmission topics due to small but avoidable mistakes. Here are the most common pitfalls and how to avoid them.
许多学生在传输主题上因小而可避免的错误而失分。以下是最常见的误区和避免方法。
- Confusing serial and parallel: Remember that parallel is faster over short distances, but serial is preferred for long distances due to lower cost and less interference.
- 混淆串行和并行:记住并行在短距离内更快,但由于成本更低、干扰更少,长距离优先选择串行。
- Forgetting the parity purpose: Parity detects odd numbers of bit errors only. If the question says “two bits flipped,” the answer is that parity might not detect it.
- 忘记校验奇偶的目的:奇偶校验只能检测奇数个位错误。如果题目说”两个位翻转”,答案是奇偶校验可能无法检测到。
- Missing the 10−mod step in checksums: For ISBN-13, the check digit is always the number that makes the total divisible by 10, not simply the remainder.
- 在校验和中遗漏 10−mod 步骤:对于 ISBN-13,校验位是使总和能被 10 整除的数,而不是简单的余数。
- Wrong key in encryption questions: In asymmetric encryption, the public key encrypts and the private key decrypts. In digital signatures, the private key signs and the public key verifies.
- 在加密题中用错密钥:在非对称加密中,公钥加密、私钥解密。在数字签名中,私钥签名、公钥验证。
Always read the question carefully. If it asks for a “method to detect errors,” do not write about encryption. If it asks for “two different types of transmission by direction,” answer simplex, half-duplex, or full-duplex, not serial and parallel.
始终仔细阅读题目。如果问”检测错误的方法”,不要写加密。如果问”按方向划分的两种传输类型”,应回答单工、半双工或全双工,而不是串行和并行。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导