Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed GM算法中二次非剩余条件判断 Update readme.md #117

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions MS04_ProbEncryption/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def generate_keys():
q = next(primerange(10000, 11000))
n = p * q
x = 2
while is_quad_residue(x, p) and is_quad_residue(x, q):
while not (is_quad_residue(x, p) == False and is_quad_residue(x, q) == False):
x += 1
return (n, x), (p, q)

Expand Down Expand Up @@ -118,10 +118,10 @@ print("密文:", encrypted_message)
print("解密消息:", decrypted_message)

## 输出样例
# 公钥 (N, x): (10097063, 5)
# 公钥 (N, x): (10097063, 17)
# 私钥 (p, q): (1009, 10007)
# 原始消息明文: 1010
# 密文: [4261321, 8377247, 969148, 6082662]
# 密文: [7768272, 4772911, 6227949, 799047]
# 解密消息: 1010
```

Expand All @@ -131,4 +131,4 @@ print("解密消息:", decrypted_message)

## 4. 总结

这一讲,我们介绍了 Goldwasser-Micali(GM)加密算法,它在理论上非常重要。它是第一个引入概率性加密和密文不可区分性的加密算法,启发了 Elgamal 算法,影响了零知识证明的发展(Goldwasser,Micali和Rackoff在3年后的研究中提出了零知识证明)。
这一讲,我们介绍了 Goldwasser-Micali(GM)加密算法,它在理论上非常重要。它是第一个引入概率性加密和密文不可区分性的加密算法,启发了 Elgamal 算法,影响了零知识证明的发展(Goldwasser,Micali和Rackoff在3年后的研究中提出了零知识证明)。