📚 Encryption Revision for IGCSE WJEC Computer Science | IGCSE WJEC 计算机:加密 考点精讲
Encryption is the process of converting readable data (plaintext) into an unreadable form (ciphertext) to prevent unauthorised access. In the WJEC IGCSE Computer Science specification, you are expected to understand how encryption works, the difference between symmetric and asymmetric methods, common algorithms, and how encryption protects data in modern systems. This article walks you through every key concept with clear examples and bilingual explanations.
加密是将可读数据(明文)转换为不可读形式(密文)以防止未经授权访问的过程。在 WJEC IGCSE 计算机科学考试大纲中,你需要理解加密的工作原理、对称与非对称方法的区别、常见算法,以及加密如何保护现代系统中的数据。本文将通过清晰的示例和双语讲解,带你逐一掌握每个核心概念。
1. What is Encryption? | 什么是加密?
Encryption is the mathematical scrambling of data so that only someone with the correct key can unscramble and read it. The original message is called plaintext, and the scrambled output is called ciphertext. Encryption has been used for centuries to keep messages secret.
加密是对数据进行数学扰乱,使得只有拥有正确密钥的人才能解扰并读取。原始消息称为明文,扰乱后的输出称为密文。加密技术已经使用了几个世纪,用于保持消息的秘密。
The process of turning plaintext into ciphertext is carried out by an encryption algorithm and a key. Decryption reverses the process using a corresponding decryption algorithm and key.
将明文转换为密文的过程由加密算法和密钥执行。解密则使用对应的解密算法和密钥逆转该过程。
2. Why is Encryption Important? | 加密为何重要?
Encryption protects data confidentiality during storage and transmission. In a modern digital world, sensitive information such as passwords, banking details, medical records, and personal messages must be kept private. Encryption ensures that even if data is intercepted, it cannot be understood without the correct key.
加密保护数据在存储和传输过程中的机密性。在现代数字世界中,密码、银行详细信息、医疗记录和个人消息等敏感信息必须保持私密。加密确保即使数据被截获,没有正确的密钥也无法理解。
In addition to confidentiality, encryption can also support data integrity and authentication when combined with hashing and digital signatures. This makes it a cornerstone of cybersecurity.
除了机密性之外,加密在与哈希和数字签名结合使用时,还可以支持数据完整性和身份验证。这使其成为网络安全的基石。
3. Symmetric Encryption and the Caesar Cipher | 对称加密与凯撒密码
Symmetric encryption uses the same key for both encryption and decryption. This means the sender and receiver must both have a copy of the secret key, and it must be kept secure. The simplest historical example is the Caesar Cipher, which shifts each letter by a fixed number of positions in the alphabet.
对称加密使用相同的密钥进行加密和解密。这意味着发送方和接收方都必须拥有秘密密钥的副本,并且必须保证其安全。最简单的历史示例是凯撒密码,它将每个字母在字母表中移动固定数量的位置。
For example, with a shift key of 3, ‘HELLO’ becomes ‘KHOOR’. Decryption shifts back by the same amount. While easy to understand, the Caesar cipher is extremely weak because there are only 25 possible keys and it can be broken using frequency analysis.
例如,使用位移密钥 3 时,“HELLO” 变成 “KHOOR”。解密则向回移动相同的量。虽然易于理解,但凯撒密码非常脆弱,因为只有 25 种可能的密钥,并且可以通过频率分析破解。
4. The Vigenère Cipher | 维吉尼亚密码
The Vigenère cipher improves on the Caesar cipher by using multiple shift values based on a keyword. Each letter of the keyword determines the shift for the corresponding plaintext letter. If the keyword is shorter than the message, it is repeated.
维吉尼亚密码通过基于关键字使用多个位移值来改进凯撒密码。关键字的每个字母决定对应明文字母的位移量。如果关键字短于消息,则重复使用。
Using the keyword ‘KEY’, the plaintext ‘ATTACK’ would be encrypted by adding the keyword shifts K(10), E(4), Y(24) repeatedly. This makes frequency analysis much harder because the same plaintext letter can be encrypted differently depending on its position.
使用关键字 “KEY” 时,明文 “ATTACK” 将通过重复添加关键字位移 K(10)、E(4)、Y(24) 进行加密。这使得频率分析更加困难,因为同一个明文字母根据其位置可能被加密成不同的形式。
However, once the keyword length is discovered (e.g. via the Kasiski examination), the cipher can be broken into several Caesar shifts, making it still not secure by modern standards.
然而,一旦发现关键字长度(例如通过卡西斯基测试),该密码就可以分解为多个凯撒位移,因此按现代标准它仍然不安全。
5. Modern Symmetric Encryption: AES | 现代对称加密:AES
Modern symmetric encryption uses complex algorithms and large keys to provide strong security. The Advanced Encryption Standard (AES) is widely used worldwide. AES operates on fixed-size blocks of data (128 bits) and uses key sizes of 128, 192, or 256 bits.
现代对称加密使用复杂的算法和大密钥以提供强大的安全性。高级加密标准(AES)在全球广泛使用。AES 对固定大小(128 位)的数据块进行操作,并使用 128、192 或 256 位的密钥大小。
The large key space makes brute-force attacks impractical. For example, a 128-bit key has 2¹²⁸ possible combinations, which would take billions of years to try with current computing power. Symmetric encryption is very fast, which makes it suitable for encrypting large amounts of data in real time.
巨大的密钥空间使得暴力破解变得不可行。例如,一个 128 位密钥有 2¹²⁸ 种可能的组合,以目前的计算能力需要数十亿年才能试完。对称加密非常快,这使得它适用于实时加密大量数据。
6. Asymmetric Encryption and Public/Private Keys | 非对称加密与公钥/私钥
Asymmetric encryption uses a pair of mathematically related keys: a public key and a private key. The public key can be shared openly, while the private key is kept secret. Data encrypted with the public key can only be decrypted by the matching private key, and vice versa.
非对称加密使用一对数学上相关的密钥:公钥和私钥。公钥可以公开分享,而私钥则保密。用公钥加密的数据只能用匹配的私钥解密,反之亦然。
This solves the key distribution problem of symmetric encryption, because the public key does not need to be kept secret. A common asymmetric algorithm is RSA, which relies on the difficulty of factoring the product of two large prime numbers.
这解决了对称加密的密钥分发问题,因为公钥不需要保密。常见的非对称算法是 RSA,它依赖于分解两个大素数乘积的困难性。
Asymmetric encryption is much slower than symmetric encryption and is therefore typically used to securely exchange a symmetric session key rather than encrypt a large message directly.
非对称加密比对称加密慢得多,因此通常用于安全地交换对称会话密钥,而不是直接加密大量消息。
7. Hybrid Encryption: Combining Symmetric and Asymmetric | 混合加密:结合对称与非对称
Most real-world systems use hybrid encryption. A random symmetric session key is generated for each communication session. This session key is then encrypted with the recipient’s public key and sent along with the symmetrically encrypted data.
大多数实际系统使用混合加密。每次通信会话生成一个随机的对称会话密钥。然后用接收者的公钥加密该会话密钥,并与对称加密的数据一起发送。
The recipient uses their private key to decrypt the session key, then uses that session key to decrypt the bulk data. This provides both the speed of symmetric encryption and the secure key exchange of asymmetric encryption. HTTPS uses this method.
接收者使用自己的私钥解密会话密钥,然后使用该会话密钥解密大量数据。这同时提供了对称加密的速度和非对称加密的安全密钥交换。HTTPS 就使用了这种方法。
8. Hash Functions and Integrity | 哈希函数与完整性
A hash function takes an input (or message) and returns a fixed-size string of bytes, typically a digest that appears random. The same input always produces the same hash, but even a tiny change in the input completely changes the hash. Common hash functions include SHA-256 and MD5 (now considered broken).
哈希函数接受一个输入(或消息)并返回一个固定大小的字节串,通常是看起来随机的摘要。相同的输入总是产生相同的哈希,但即使输入发生微小变化,哈希也会完全改变。常见的哈希函数包括 SHA-256 和 MD5(现在被认为已破解)。
Hashes are used to verify data integrity. For example, a downloaded file’s hash can be compared with the published hash to ensure it was not corrupted. Hashes are also used for password storage: systems store the hash of a password, not the password itself, so a database leak does not reveal plaintext passwords.
哈希用于验证数据完整性。例如,可以将下载文件的哈希与发布的哈希进行比较,以确保文件未损坏。哈希还用于密码存储:系统存储密码的哈希而不是密码本身,这样即使数据库泄漏也不会泄露明文密码。
9. Digital Signatures | 数字签名
A digital signature provides proof that a message was created by a known sender and was not altered. It is created by encrypting a hash of the message with the sender’s private key. The recipient can verify the signature by decrypting it with the sender’s public key and comparing the hash with one they generate from the received message.
数字签名提供证据,证明消息是由已知发件人创建且未被篡改。它通过使用发件人的私钥加密消息的哈希来创建。收件人可以通过使用发件人的公钥解密签名,并将其与从接收到的消息生成的哈希进行比较,从而验证签名。
If the two hashes match, the message is authentic and intact. Digital signatures provide non-repudiation, meaning the sender cannot later deny having sent the message, because only they possess the private key that created the valid signature.
如果两个哈希匹配,则消息真实且完整。数字签名提供了不可否认性,这意味着发件人事后不能否认发送了该消息,因为只有他们拥有创建有效签名的私钥。
10. Practical Application: SSL/TLS and HTTPS | 实际应用:SSL/TLS 与 HTTPS
Secure Sockets Layer (SSL) and its successor Transport Layer Security (TLS) are protocols that use encryption to secure communication over a network. When you see HTTPS in a web browser, the connection is protected by TLS. The server presents a digital certificate containing its public key, signed by a trusted Certificate Authority (CA).
安全套接字层(SSL)及其后继传输层安全(TLS)是使用加密保护网络通信的协议。当你在网页浏览器中看到 HTTPS 时,连接就受到 TLS 保护。服务器出示包含其公钥的数字证书,该证书由受信任的证书颁发机构(CA)签名。
The browser verifies the certificate, then uses asymmetric encryption to establish a secure session key-exchange. Symmetric encryption then encrypts all subsequent data. This ensures confidentiality, integrity, and authentication for web traffic, online banking, and e-commerce.
浏览器验证证书,然后使用非对称加密建立安全的会话密钥交换。此后,所有后续数据都由对称加密保护。这为网络流量、网上银行和电子商务提供了机密性、完整性和身份验证。
11. Vulnerabilities, Attacks, and Limitations | 漏洞、攻击与局限性
No encryption is perfectly secure forever. Weaknesses include brute-force attacks where every possible key is tried, implementation flaws, and side-channel attacks that leak information through power consumption or timing. Outdated algorithms like DES and MD5 are vulnerable to attacks due to advances in computing power.
没有哪种加密是永远完全安全的。弱点包括暴力破解攻击(尝试每一个可能的密钥)、实现缺陷,以及通过功耗或时序泄露信息的侧信道攻击。由于计算能力的进步,像 DES 和 MD5 这样的过时算法容易受到攻击。
Quantum computing poses a future threat because algorithms like Shor’s algorithm could break widely used asymmetric encryption. This drives research into post-quantum cryptography. In the IGCSE context, you simply need to recognise that encryption strength depends on key length, algorithm robustness, and correct implementation.
量子计算构成了未来的威胁,因为像 Shor 算法这样的算法可以破解广泛使用的非对称加密。这推动了对后量子密码学的研究。在 IGCSE 情境中,你只需要认识到加密强度取决于密钥长度、算法稳健性和正确实现。
12. Ethical and Legal Issues of Encryption | 加密的伦理与法律问题
Encryption enables privacy and protects human rights, but it can also be used to hide illegal activities. Governments sometimes request backdoors to law enforcement, but security experts warn that any backdoor weakens security for everyone and can be exploited by criminals.
加密可以实现隐私并保护人权,但也可以用于隐藏非法活动。政府有时会要求为执法机构留后门,但安全专家警告说,任何后门都会削弱所有人的安全性,并可能被犯罪分子利用。
Laws vary by country: some mandate encryption for protecting personal data (e.g., GDPR), while others restrict strong encryption. Students should be aware that there is an ongoing debate about balancing privacy with law enforcement needs, and encryption is at the centre of this debate.
各国法律各不相同:一些国家强制要求加密以保护个人数据(例如 GDPR),而另一些国家则限制强加密。学生应该意识到,关于平衡隐私与执法需求的持续辩论,而加密正处于这场辩论的中心。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导