📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "数字签名"
ClientHeight = 8220
ClientLeft = 60
ClientTop = 345
ClientWidth = 6675
LinkTopic = "Form1"
ScaleHeight = 8220
ScaleWidth = 6675
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command4
Caption = "直接复制密文"
Height = 495
Left = 2280
TabIndex = 13
Top = 5280
Width = 1815
End
Begin VB.CommandButton Command3
Caption = "清空"
Height = 495
Left = 4680
TabIndex = 7
Top = 6840
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "解密"
Height = 495
Left = 4200
TabIndex = 5
Top = 5280
Width = 1815
End
Begin VB.TextBox Text4
Height = 495
Left = 2280
TabIndex = 4
Top = 4440
Width = 3735
End
Begin VB.TextBox Text3
Height = 495
Left = 2280
TabIndex = 3
Top = 3600
Width = 3735
End
Begin VB.CommandButton Command1
Caption = "加密"
Height = 495
Left = 4200
TabIndex = 2
Top = 2760
Width = 1815
End
Begin VB.TextBox Text2
Height = 495
Left = 2280
TabIndex = 1
Top = 1920
Width = 3735
End
Begin VB.TextBox Text1
Height = 495
Left = 2280
TabIndex = 0
Top = 1080
Width = 3735
End
Begin VB.Label Label7
Caption = "N=119 e=5 d=77"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 1920
TabIndex = 14
Top = 6600
Width = 975
End
Begin VB.Label Label6
Caption = "解密后明文:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 12
Top = 4560
Width = 1455
End
Begin VB.Label Label5
Caption = "请输入密文:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 11
Top = 3720
Width = 1455
End
Begin VB.Label Label4
Caption = "加密后密文:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 10
Top = 2040
Width = 1455
End
Begin VB.Label Label3
Caption = "请输入明文:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 9
Top = 1200
Width = 1455
End
Begin VB.Label Label2
Caption = "N=589 e=23 d=47"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 480
TabIndex = 8
Top = 6600
Width = 855
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = $"Form1.frx":0000
BeginProperty Font
Name = "Times New Roman"
Size = 15
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 2280
TabIndex = 6
Top = 120
Width = 2175
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strInput1$, Code$, strInput2$, Recode$, c As String * 1
Dim i%, Length%
Function FormatStr(ByVal str As String, ByVal Bits As Integer)
If Len(str) > Bits Then
FormatStr = str
Else
FormatStr = String(Bits - Len(str), "0") & str
End If
End Function
Private Sub Command1_Click()
Dim R1 As Double, E As Single, P1 As Single
Dim MidCode() As String
strInput1 = Text1.Text
Length = Len(strInput1)
Code = ""
For i = 1 To Length
c = Mid$(strInput1, i, 1)
R1 = 1
E = 47
P1 = Asc(c) Mod 589
Do While E > 0
If E Mod 2 = 1 Then
R1 = (R1 * P1) Mod 589
E = E - 1
End If
P1 = (P1 * P1) Mod 589
E = E / 2
Loop
Code = Code & FormatStr(R1, 3)
Next i
Code = String(Len(Code) Mod 2, "0") & Code
s = ""
For i = Len(Code) To 2 Step -2
s = Mid(Code, i - 1, 2) & " " & s
Next i
MidCode = Split(Trim(s), " ")
Code = ""
For i = 0 To UBound(MidCode)
E = 5
R1 = 1
P1 = Val(MidCode(i)) Mod 119
Do While E > 0
If E Mod 2 = 1 Then
R1 = (R1 * P1) Mod 119
E = E - 1
End If
P1 = (P1 * P1) Mod 119
E = E / 2
Loop
Code = Code & FormatStr(R1, 3)
Next i
Text2.Text = Code
End Sub
Private Sub Command2_Click()
Dim R2 As Double, D As Single, P2 As Single
Dim X() As String
strInput2 = Text3.Text
s = ""
For i = Len(strInput2) To 3 Step -3
s = Mid(strInput2, i - 2, 3) & " " & s
Next i
X = Split(Trim(s), " ")
Length = UBound(X) + 1
Recode = ""
For i = 1 To Length
R2 = 1
D = 77
P2 = Val(X(i - 1)) Mod 119
Do While D > 0
If D Mod 2 = 1 Then
R2 = (R2 * P2) Mod 119
D = D - 1
End If
P2 = (P2 * P2) Mod 119
D = D / 2
Loop
Recode = Recode & FormatStr(R2, 2)
Next i
s = ""
For i = Len(Recode) To 3 Step -3
s = Mid(Recode, i - 2, 3) & " " & s
Next i
X = Split(Trim(s), " ")
Recode = ""
For i = 0 To UBound(X)
R2 = 1
D = 23
P2 = Val(X(i)) Mod 589
Do While D > 0
If D Mod 2 = 1 Then
R2 = (R2 * P2) Mod 589
D = D - 1
End If
P2 = (P2 * P2) Mod 589
D = D / 2
Loop
Recode = Recode + Chr$(R2)
Next i
Text4.Text = Recode
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Command4_Click()
Text3.Text = Text2.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -