本文将了解:模算术;最大公约数 (GCD) 的重要性;群论;伪随机数;创建用于频率分析的 Python 脚本。
模运算和最大公约数
商余定理指出,对于每个整数 A AA 和正数 B BB,存在不同的整数 Q QQ 和 R RR,使得:A = B ∗ Q + R , 0 = < r = < b A=B^{*} Q+R, 0=<r=<bA=B∗Q+R,0=<r=<b。 当 a = 95 a=95a=95 且 b ⃗ = 10 \vec{b}=10b=10 时,q qq(商)和 r rr(余数)的唯一值是多少? 你发现商等于 9,余数等于 5。
一旦你理解了商余定理,就更容易理解我们的密码数学的第一部分:模运算。
质数(素数)
密码学中的素数对于我们的加密方案的安全性至关重要。 素数分解,也称为整数分解,是一个用于保护公钥加密方案的数学问题。 这是通过使用极大的半素数来实现的,这些半素数是两个素数相乘的结果。 您可能还记得,素数是任何只能被 1 和自身整除的数。 第一个质数是2。
基本群论
在抽象代数和其他数学领域,群论研究称为群的代数结构。 群的概念是抽象代数的核心:其他熟悉的代数结构,如向量空间、环和域,都可以作为具有附加运算和公理的群来执行。 当您探索 Diffie-Hellman 和 RSA 加密系统时,群论开始发挥作用。
模逆
扩展最大公约数
欧拉定律
伪随机性
线性方程组
频率分析
test_str = "We hold these truths to be self-evident, that all men are
created equal, "
test_str += "that they are endowed by their Creator with certain
unalienable Rights, "
test_str += "that among these are Life, "
test_str += "Liberty and the pursuit of Happiness."
all_freq = {}
for i in test_str:
if i in all_freq:
all_freq[i] += 1
else:
all_freq[i] = 1
print()
print ("Count of all characters in the provided text is :\n " + str(all_freq))
from collections import Counter
test_str = "We hold these truths to be self-evident, that all men are created equal, "
test_str += "that they are endowed by their Creator with certain unalienable Rights, "
test_str += "that among these are Life, "
test_str += "Liberty and the pursuit of Happiness."
res = Counter(test_str)
Python密码分析
参阅 -亚图跨际
版权声明:本文为jiyotin原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。