Number Theory
#Math213
Basic
Division 整除
注意带余除法的计算复杂度通过位运算简化可实现
整数进制表示
Algorithm for Integer Operations
Multiplication
Binary Modular Exponentiation
质数
最大公约数 (GCD) 与最小公倍数 (LCM)
辗转相除求 GCD: 直接写出辗转相除的过程,然后将中间量一步步向前代换,得到 gcd 作为两数线性表示的最小值
注意:可以利用裴蜀定理得出 gcd 的线性表示确定不定方程的解集
线性同余
逆:
注意 CRT 解的构造过程:
记
对于每一个
最终若有
Crytography
Pseudorandom Number Generators
Hash Functions
Common Solution
直接利用同余函数进行映射
避免同余后的结果映射到相同位置 ->Assign Free Location following the occupied memory location assigned by the hashing function(即将对应的映射结果向后递推)
Cryptography
Shift Ciphers
Private/Public Key Cryptosystem
RSA Cryptosystem
公钥:(n,e)
私钥:(d)
注意核心的大素数一定需要保密
- 关注原根的概念:素数的原根即为其最小生成整个 modp 完系的生成元