博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
RSA公钥
阅读量:3945 次
发布时间:2019-05-24

本文共 378 字,大约阅读时间需要 1 分钟。

RSA公钥

RSA加解密格式:

密钥生成 n: n=p*q(p和q必须保密)
φ(n):φ(n)=(p-1)*(q-1)
公钥e: gcd(e,φ(n))=1(既 e与φ(n)互素)
私钥d:ed≡1 mod φ(n)
加密算法 c≡m^e(mod n)
解密算法 m≡c^d(mod n)

RSA例子

eg:

假设需要加密的明文信息为m=14,选择:e=3,p=5,q=11,试说明使用RSA算法的加密和解密过程及结果?
解:
n=p * q=55
φ(n)=(p-1)(q-1)=410=40
根据ed≡1 mod φ(n) 又3d mod 40=1 得出d=27
公钥(e,n)=(3,55)得到密文c=m^e mod 55=14^3 mod 55=49
私钥(d,n)=(27,55)得到明文m=c^d mod 55=49^27 mod 55=14

转载地址:http://nwowi.baihongyu.com/

你可能感兴趣的文章
Obtaining the Current Location
查看>>
Displaying the Location Address
查看>>
Connecting to the Network
查看>>
Managing Network Usage
查看>>
Parsing XML Data
查看>>
Optimizing Downloads for Efficient Network Access
查看>>
Minimizing the Effect of Regular Updates
查看>>
Redundant Downloads are Redundant
查看>>
Modifying your Download Patterns Based on the Connectivity Type
查看>>
Supporting Different Screen Sizes支持不同的屏幕尺寸
查看>>
Supporting Different Densities 支持各种屏幕密度
查看>>
Implementing Adaptative UI Flows 实施自适应用户界面流程
查看>>
Crossfading Two Views 淡入淡出的两种观点
查看>>
Using ViewPager for Screen Slides 使用屏幕幻灯片ViewPager
查看>>
Displaying Card Flip Animations 显示卡片翻转动画
查看>>
Zooming a View 缩放视图
查看>>
Animating Layout Changes 动画布局的更改
查看>>
Controlling Your App’s Volume and Playback 控制应用程序的音量和播放
查看>>
Managing Audio Focus 管理音频焦点
查看>>
Dealing with Audio Output Hardware 处理音频输出硬件设备
查看>>