Modular_exponentiation模幂运算
https://en.wikipedia.org/wiki/Modular_exponentiation
蒙哥马利(Montgomery)幂模运算是快速计算a^b%k的一种算法,是RSA加密算法的核心之一。
Modular exponentiation is a type of exponentiation取幂,求幂;乘方 performed over a modulus模数,系数.
It is useful in computer science, especially in the field of public-key cryptography.
The operation of modular exponentiation calculates the remainder when an integer b 底数(the base) raised to the eth power (the exponent指数), be, is divided by a positive integer m (the modulus).
In symbols, given base b, exponent e, and modulus m, the modular exponentiation c is: c ≡ be (mod m). //c=b的e次方 %m
For example, given b = 5, e = 3 and m = 13, the solution c = 8 is the remainder of dividing 53 = 125 by 13. //c=5^3%13=125%13 因为125=13*9+8 ,所以125对13求余,结果是8
Given integers b and e, and a positive integer m, a unique solution c exists with the property 0 ≤ c < m.
Modular exponentiation can be performed with a negative exponent e by finding the modular multiplicative inverse d of b modulo m using the extended Euclidean algorithm. That is:
- c ≡ be ≡ d−e mod m where e < 0 and b ⋅ d ≡ 1 mod m.
Modular exponentiation similar to the one described above are considered easy to compute, even when the numbers involved are enormous巨大的.
On the other hand, computing the discrete logarithm离散对数 – that is, the task of finding the exponente when given b, c, and m – is believed to be difficult.
This one-way function behavior makes modular exponentiation a candidate for use in cryptographic algorithms.
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2015-03-23 通过代码来调用log4net写日志