📄 rsa.frm
字号:
VERSION 5.00
Begin VB.Form RSA
BorderStyle = 3 'Fixed Dialog
Caption = "RSA演示程序"
ClientHeight = 3945
ClientLeft = 5430
ClientTop = 2910
ClientWidth = 9555
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3945
ScaleWidth = 9555
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdExit
Caption = "关闭"
Height = 495
Left = 8160
TabIndex = 21
Top = 3240
Width = 1125
End
Begin VB.CommandButton cmdAbout
Caption = "关于"
Height = 495
Left = 6600
TabIndex = 20
Top = 3240
Width = 1125
End
Begin VB.CommandButton cmdKeyGen
Caption = "生成密钥"
Height = 375
Left = 720
TabIndex = 19
Top = 3120
Width = 1335
End
Begin VB.CommandButton cmdDecrypt
Caption = "解密"
Height = 495
Left = 4800
TabIndex = 15
Top = 3240
Width = 1125
End
Begin VB.TextBox Text10
Height = 540
Left = 3120
MultiLine = -1 'True
TabIndex = 14
Top = 2520
Width = 6210
End
Begin VB.TextBox Text9
Height = 660
Left = 3120
MultiLine = -1 'True
TabIndex = 13
Top = 1440
Width = 6195
End
Begin VB.TextBox Text3
Height = 660
Left = 3120
TabIndex = 12
Text = "Good morning,everyone!"
Top = 480
Width = 6195
End
Begin VB.CommandButton cmdEncrypt
Caption = "加密"
Height = 495
Left = 3120
TabIndex = 11
Top = 3240
Width = 1215
End
Begin VB.Frame Frame1
Caption = "密钥生成区"
Height = 3675
Left = 120
TabIndex = 0
Top = 120
Width = 2715
Begin VB.TextBox txtQ
BackColor = &H8000000A&
Height = 315
Left = 1440
Locked = -1 'True
TabIndex = 9
ToolTipText = "Random number Q"
Top = 480
Width = 1125
End
Begin VB.TextBox txtP
BackColor = &H8000000A&
Height = 315
Left = 120
Locked = -1 'True
TabIndex = 8
ToolTipText = "Random number P"
Top = 495
Width = 1005
End
Begin VB.TextBox txtD
BackColor = &H8000000A&
Height = 315
Left = 1440
Locked = -1 'True
TabIndex = 6
ToolTipText = "D = Inverse of E"
Top = 2280
Width = 1125
End
Begin VB.TextBox txtN
BackColor = &H8000000A&
Height = 315
Left = 1440
Locked = -1 'True
TabIndex = 3
ToolTipText = "N = P * Q"
Top = 960
Width = 1125
End
Begin VB.TextBox txtE
BackColor = &H8000000A&
Height = 315
Left = 1440
Locked = -1 'True
TabIndex = 2
ToolTipText = "E = Random number relatively prime to PHI"
Top = 1800
Width = 1125
End
Begin VB.Label Label7
Caption = "N = P * Q"
Height = 375
Left = 240
TabIndex = 22
Top = 1200
Width = 855
End
Begin VB.Label Label12
Caption = "(Q)"
Height = 270
Left = 1485
TabIndex = 10
Top = 225
Width = 885
End
Begin VB.Label Label10
Caption = "解密密钥"
Height = 315
Left = 240
TabIndex = 7
Top = 2280
Width = 885
End
Begin VB.Label Label3
Caption = "(N)Modulus"
Height = 345
Left = 120
TabIndex = 5
Top = 960
Width = 1095
End
Begin VB.Label Label2
Caption = "加密密钥"
Height = 225
Left = 240
TabIndex = 4
Top = 1800
Width = 1020
End
Begin VB.Label Label1
Caption = "(P)"
Height = 270
Left = 135
TabIndex = 1
Top = 225
Width = 885
End
End
Begin VB.Label Label6
Caption = "解密后的明文"
Height = 240
Left = 3120
TabIndex = 18
Top = 2160
Width = 1920
End
Begin VB.Label Label5
Caption = "密文"
Height = 225
Left = 3120
TabIndex = 17
Top = 1200
Width = 1740
End
Begin VB.Label Label4
Caption = "明文"
Height = 210
Left = 3120
TabIndex = 16
Top = 240
Width = 1815
End
Begin VB.Menu mnuExit
Caption = "关闭"
Visible = 0 'False
End
Begin VB.Menu mnuView
Caption = "&Information"
Visible = 0 'False
End
Begin VB.Menu mnuAbout
Caption = "关于"
Visible = 0 'False
End
End
Attribute VB_Name = "RSA"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim E, D, N As Double
Private Sub cmdAbout_Click()
frmAbout.Show vbModal
End Sub
Private Sub cmdDecrypt_Click()
Text10 = dec(Text9, key(2), key(3))
End Sub
Private Sub cmdEncrypt_Click()
Text9 = enc(Text3, key(1), key(3))
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdKeyGen_Click()
keyGen
txtP = p 'P
txtQ = q 'Q
txtPhi = PHI 'PHI
txtE = key(1) 'E
txtD = key(2) 'D
txtN = key(3) 'N
Text4 = txtE
Text5 = txtN
Text6 = txtN
Text7 = txtD
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -