当前位置:网站首页>關於RSA加密解密原理
關於RSA加密解密原理
2022-06-13 08:39:00 【Array_new】
前言:
隨著我們的學習的不斷深入,信息的安全也愈加重要,我們發布的代碼中可能含有我們的私密信息,比如對接支付寶沙箱api,下載一些專業軟件時就需要我們輸入公鑰和私鑰以此來驗證我們的身份信息,就相當於用鑰匙去開鎖一樣,公鑰代錶著鎖,私鑰代錶著開鎖的鑰匙,而公鑰與私鑰也是可以互換的,理解完這點,下面就詳細說一下他們的原理。
RSA密鑰的分發:
首先取倆個質數(p,q),N=pq
然後求他們的歐拉函數 T = (p-1)(q-1)
取出公鑰E 它的規則是1.是一個質數。
2.1<公鑰<T ;
3.不是T的因子
選出完公鑰E後計算出私鑰D (D*E)%T=1
這樣關於公鑰和私鑰的分發就完成了
例如p=3,q=11 N=pq=33
T=(3-1)(11-1)=20
隨機選出一個公鑰E=3那麼密鑰可取D=7
公鑰E(3,33)私鑰D(7,33)
根據下邊的加密公式對對1 2 3加密成
1,29,9
根據下邊的解密公式可以解出原來的數字為
1,2,3
密鑰加密:(明文^E)%N=密文
密鑰解密:(密文^E)%N=明文
RSA公開密鑰密碼體制的原理是:根據數論,尋求兩個大素數比較簡單,而將它們的乘積進行因式分解卻極其困難,因此可以將乘積公開作為加密密鑰
結果:
边栏推荐
- Logstash configuration reference article
- Dest0g3 520 orientation
- [leetcode weekly race record] record of the 80th biweekly race
- Request alarm: refer policy: strict origin when cross origin or reference site policy: no refer when downgrade
- Format_ String_ Server
- PHP PNG to webp
- JS - print 99 multiplication table of the for cycle case
- Start from scratch - implement the jpetstore website -1- establish the project framework and project introduction
- Tmall product details interface, tmall product coupon interface, tmall API interface, tmall price monitoring interface, tmall price comparison interface, brand rights protection interface, tmall sales
- Notes on development experience: TP5 exp query, SQL analysis, JQ, applet, right-click menu, Linux skills, shell skills, mysql, etc
猜你喜欢
How to use annotations in word
How can the small and medium-sized lighting industry make use of the digital transformation to stand out from the encirclement?
VS安装VAssistX插件导致WPF-XAML文件输入中文出现乱码问题解决方案
HCIP_ MGRE comprehensive experiment
MySQL queries difference sets (missing data) by linking tables based on an associated field
[pychart pit stepping record] prompt after configuring remote operation, [errno 2] no such file or directory
When submitting the laravel admin form and using the required verification, an error is reported when the value is 0
Disk management and disk partition operation
学习记录4: einops // cudnn.benchamark=true // hook
Format_ String_ Server
随机推荐
情绪处理技巧
JS ask for the day of the year
JS - set countdown for Date object case
Invalid flex layout setting width
Gtk+ programming example on page 115 - simplest progress bar 2 with steps to write GTK program using anjuta
How to use annotations in word
Bidirectional retransmission step experiment
【Pycharm踩坑记录】配置远程运行后提示,[Errno 2] No such file or directory
Form exercise 2
centos 安装mysql及设置远程访问
Namespace in TS (2)
d3.js&nvd3. JS - how to set the y-axis range - d3 js & nvd3. js — How to set y-axis range
JS - for cycle case: Horse grain
0. Quelques doutes au sujet de SolidWorks
MySQL sorts according to the specified order of the specified fields
Call to undefined function think\captcha\imagettftext()
HCIP_ MGRE comprehensive experiment
Guidance process and service control
Container concept and cloud native
Taobao commodity historical price interface / commodity historical price trend interface code docking and sharing