← 返回资讯屏轩教育 · 行业资讯

Symmetric and Asymmetric Encryption | 对称加密与非对称加密

2026-08-29 23:03 · 本文部分内容由AI辅助创作

📚 Symmetric and Asymmetric Encryption | 对称加密与非对称加密

Encryption is the process of converting readable information into an unreadable form so that only authorised parties can recover the original message. In the Cambridge IGCSE Computer Science syllabus, you need to understand the difference between symmetric encryption, where the same key is used for both encryption and decryption, and asymmetric encryption, which uses a pair of keys: one public and one private.

加密是将可读信息转换为不可读形式的过程,只有获得授权的各方才能恢复原始消息。在剑桥 IGCSE 计算机科学大纲中,你需要理解对称加密与非对称加密的区别:对称加密使用同一个密钥进行加密和解密,而非对称加密使用一对密钥——一个公钥和一个私钥。


1. What is Encryption? | 什么是加密?

Encryption is the process of scrambling readable data, called plaintext, into an unreadable form called ciphertext. The reverse process, decryption, converts ciphertext back into plaintext. Encryption protects confidentiality so that if data is intercepted, an attacker cannot read it without the correct key.

加密是将可读数据(称为明文)打乱成不可读形式(称为密文)的过程。反向过程称为解密,将密文还原为明文。加密保护机密性,因此即使数据被截获,攻击者没有正确密钥也无法读取。

Encryption is not the same as encoding. Encoding such as Base64 is reversible without a key and is not designed for security. Encryption, by contrast, requires a secret key to reverse the transformation. This distinction is frequently tested in IGCSE exams.

加密与编码不同。Base64 等编码无需密钥即可逆转,并非为安全设计。相反,加密需要秘密密钥才能逆转变换。这一区别在 IGCSE 考试中经常出现。


2. Plaintext and Ciphertext | 明文与密文

Plaintext is the original human-readable message before encryption, for example "Hello". Ciphertext is the output after encryption, which often looks like random characters or numbers. A simple encryption example would turn "HELLO" into "KHOOR" using a Caesar shift of 3.

明文是加密前人类可读的原始消息,例如 "Hello"。密文是加密后的输出,通常看起来像随机字符或数字。一个简单的加密示例是使用凯撒位移 3 将 "HELLO" 变成 "KHOOR"。

In a secure system, ciphertext should not reveal any patterns about the plaintext. If two identical plaintext blocks produce identical ciphertext blocks, an attacker may gain useful information. Strong modern ciphers are designed to avoid this weakness.

在安全系统中,密文不应泄露明文的任何规律。如果两个相同的明文块产生相同的密文块,攻击者可能获得有用信息。强大的现代密码设计会避免这种弱点。


3. Keys in Encryption | 加密中的密钥

A key is a piece of secret information that controls the encryption or decryption process. In modern ciphers, the algorithm is public; only the key is secret. Longer keys give a larger key space, making brute-force attacks harder.

密钥是控制加密或解密过程的秘密信息。在现代密码系统中,算法是公开的,只有密钥是保密的。更长的密钥提供更大的密钥空间,使暴力破解更加困难。

³⁸ combinations. However, key length alone does not guarantee security; the algorithm design matters too. A long key used in a weak algorithm is still unsafe.

例如,128 位密钥有 2¹²⁸ 种可能值,约为 3.4 × 10³⁸ 个组合。然而,仅靠密钥长度并不能保证安全,算法设计也很重要。在弱算法中使用长密钥仍然不安全。


4. Symmetric Encryption: Shared Secret Key | 对称加密:共享密钥

Symmetric encryption uses the same key for both encryption and decryption. The sender encrypts the plaintext with the shared secret key; the receiver decrypts the ciphertext with the same key. Because the same key is used in both directions, the key must be kept secret and shared securely before communication begins.

对称加密使用同一个密钥进行加密和解密。发送方用共享的密钥加密明文;接收方用相同的密钥解密密文。由于双向使用同一密钥,密钥必须保密,并在通信开始前安全共享。

Common symmetric algorithms include AES (Advanced Encryption Standard), DES (Data Encryption Standard) and ChaCha20. AES is widely used because it is fast and secure when a sufficiently long key is chosen, such as 128, 192 or 256 bits.

常见的对称算法包括 AES(高级加密标准)、DES(数据加密标准)和 ChaCha20。AES 被广泛使用,因为在选择足够长密钥(如 128、192 或 256 位)时它既快速又安全。


5. Example: Caesar Cipher as Symmetric Idea | 例子:凯撒密码的对称思想

The Caesar cipher is a very simple symmetric cipher used in the IGCSE syllabus to illustrate key ideas. To encrypt, shift each letter forward by a fixed number K. To decrypt, shift each letter backward by the same K. Both parties must know K, so it is symmetric.

凯撒密码是 IGCSE 大纲中用来说明关键思想的非常简单的对称密码。加密时,将每个字母按固定数字 K 向前位移;解密时按相同的 K 向后位移。双方都必须知道 K,因此它是对称的。

Encrypt: C = (P + K) mod 26 | Decrypt: P = (C − K) mod 26

ecomes E, and HELLO becomes KHOOR. If an attacker knows the shift value, they can decrypt immediately, so Caesar is not secure but useful for learning.

例如,当 K = 3 时,A 变为 D,B 变为 E,HELLO 变为 KHOOR。如果攻击者知道位移值,就能立即解密,因此凯撒密码并不安全,但对学习很有用。


6. Strengths and Weaknesses of Symmetric Encryption | 对称加密的优缺点

The main advantage of symmetric encryption is speed. It uses simpler mathematical operations, so it can encrypt large amounts of data quickly and with low computing power. This makes it suitable for encrypting files, disk storage and live data streams.

对称加密的主要优点是速度快。它使用较简单的数学运算,因此可以快速加密大量数据,计算资源消耗低。这使其适合加密文件、磁盘存储和实时数据流。

The main weakness is the key distribution problem. The same secret key must be delivered to every receiver securely. If the key is intercepted during sharing, the encryption is broken. In a network of n users, each pair needs a unique key, giving n(n−1)÷2 keys, which becomes difficult to manage.

主要弱点是密钥分发问题。同一个密钥必须安全地传递给每个接收方。如果密钥在共享过程中被截获,加密就会被破解。在 n 个用户的网络中,每对用户需要一个唯一密钥,总数为 n(n−1)÷2,管理起来非常困难。


广告 / Sponsored

7. Asymmetric Encryption: Public and Private Keys | 非对称加密:公钥与私钥

Asymmetric encryption, also called public-key cryptography, uses two mathematically related keys: a public key and a private key. The public key can be shared openly with anyone, but the private key must remain secret. The two keys are generated together as a pair.

非对称加密,也称为公钥密码学,使用两个数学上相关的密钥:公钥和私钥。公钥可以公开分享给任何人,但私钥必须保密。这两个密钥是成对一起生成的。

If someone encrypts data with the public key, only the matching private key can decrypt it. Similarly, data encrypted with the private key can be decrypted with the public key. Common algorithms include RSA and elliptic curve cryptography.

如果用公钥加密数据,只有匹配的私钥才能解密。同样,用私钥加密的数据可以用公钥解密。常见算法包括 RSA 和椭圆曲线密码学。


8. How Asymmetric Encryption Works | 非对称加密的工作原理

Suppose Alice wants to send a confidential message to Bob. Alice obtains Bob's public key, which Bob has made available. She encrypts the message using Bob's public key. When Bob receives the ciphertext, he decrypts it with his own private key. An attacker who sees the public key cannot decrypt the message without the private key.

假设 Alice 想给 Bob 发送机密消息。Alice 获取 Bob 已公开的公钥。她用 Bob 的公钥加密消息。Bob 收到密文后,用自己的私钥解密。只看到公钥的攻击者没有私钥就无法解密。

This works because the keys are based on one-way functions: easy to compute in one direction but extremely difficult to reverse without the private key. For example, multiplying two large primes is easy, but factoring the product is very hard. This mathematical difficulty underpins RSA security.

这是可行的,因为密钥基于单向函数:在一个方向上容易计算,但如果没有私钥,反向求解极其困难。例如,将两个大素数相乘很容易,但对该乘积进行因数分解非常困难。这种数学困难是 RSA 安全性的基础。


9. Strengths and Weaknesses of Asymmetric Encryption | 非对称加密的优缺点

The biggest strength of asymmetric encryption is that it solves the key distribution problem. Public keys can be exchanged openly, so there is no need to share a secret key in advance. It also enables digital signatures, which provide authentication and non-repudiation.

非对称加密最大的优点是解决了密钥分发问题。公钥可以公开交换,因此无需提前共享秘密密钥。它还能实现数字签名,提供身份认证和不可否认性。

Its main weakness is performance. Asymmetric algorithms use much larger keys and complex number theory, so they are slower and require more processing power than symmetric encryption. For this reason, they are usually used to exchange symmetric keys or sign small hashes, not to encrypt bulk data.

其主要弱点是性能。非对称算法使用大得多的密钥和复杂的数论运算,因此比对称加密更慢、需要更多处理能力。因此,它们通常用于交换对称密钥或签署较小的哈希值,而不是加密大量数据。


10. Comparing Symmetric and Asymmetric Encryption | 对称与非对称加密对比

The table below summarises the key differences you need to know for the IGCSE exam. Remember that symmetric encryption is fast but has key distribution problems; asymmetric encryption solves key distribution but is slower.

下表总结了 IGCSE 考试中需要了解的关键区别。记住,对称加密快速但存在密钥分发问题;非对称加密解决了密钥分发问题但

Published by TutorHao | IGCSE Science Revision Series | aleveler.com

广告 / Sponsored
华为MateBook Pro S 14.2英寸电脑保护套笔记本内胆包皮质电脑袋轻薄皮套防泼水收纳袋配件手拿包防刮轻便
学习备考用品 · 正版现货 · 学习备考通用
查看详情 / View on Taobao参考价 ¥36.0
广告 / Sponsored
联想来酷斗战者战7000P 2026 16英寸电脑保护套笔记本内胆包皮质电脑袋轻薄皮套防泼水收纳袋配件手拿包轻便
学习备考用品 · 正版现货 · 学习备考通用
查看详情 / View on Taobao参考价 ¥36.0

更多咨询请联系16621398022(同微信)

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao