📄 凯撒密码.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "凯撒密码"
ClientHeight = 5115
ClientLeft = 60
ClientTop = 450
ClientWidth = 8145
Icon = "凯撒密码.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5115
ScaleWidth = 8145
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
BackColor = &H80000005&
DragIcon = "凯撒密码.frx":08CA
Height = 5175
Left = 0
MouseIcon = "凯撒密码.frx":1194
Picture = "凯撒密码.frx":1A5E
ScaleHeight = 5115
ScaleWidth = 8115
TabIndex = 0
Top = 0
Width = 8175
Begin VB.CommandButton Command3
Caption = "关 于"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 465
Left = 4440
TabIndex = 7
Top = 3240
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "加 密"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 720
TabIndex = 6
Top = 3240
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "解 密"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2640
TabIndex = 5
Top = 3240
Width = 1095
End
Begin VB.TextBox Text2
BackColor = &H00C0FFC0&
Height = 495
Left = 2040
TabIndex = 4
Top = 1680
Width = 2295
End
Begin VB.TextBox Text1
BackColor = &H00C0FFC0&
Height = 495
Left = 2040
TabIndex = 2
Top = 720
Width = 2295
End
Begin VB.Label Label2
BackColor = &H00008000&
BackStyle = 0 'Transparent
Caption = "密 文"
BeginProperty Font
Name = "黑体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 495
Left = 840
TabIndex = 3
Top = 1680
Width = 975
End
Begin VB.Label Label1
BackColor = &H00008000&
BackStyle = 0 'Transparent
Caption = "明 文"
BeginProperty Font
Name = "黑体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 495
Left = 840
TabIndex = 1
Top = 720
Width = 975
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim i As Long
Dim S As String
Dim strOne As String
Dim bytMove As Long
Dim strPasswordOne As String
strPasswordOne = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
S = Text2.Text
For i = 1 To Len(S)
strOne = Mid$(S, i, 1)
bytMove = InStr(1, strPasswordOne, strOne, vbTextCompare)
If bytMove <> 0 Then
'Mid$(S, i, 1) = Mid$(strPasswordOne, bytMove - 3, 1) '填充转换后的数据
If (Asc(Mid$(strPasswordOne, bytMove - 3, 1)) >= 97 And Asc(Mid$(strPasswordOne, bytMove - 3, 1)) <= 122) Then
Mid$(S, i, 1) = Mid$(strPasswordOne, bytMove - 3, 1)
Else
Mid$(S, i, 1) = Chr(Asc(Mid$(strPasswordOne, bytMove - 3, 1)) + 32)
End If
End If
Next
Text1.Text = S '显示
End Sub
Private Sub Command2_Click()
Dim i As Long
Dim S As String
Dim strOne As String
Dim bytMove As Long
Dim strPasswordOne As String
strPasswordOne = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
S = Text1.Text
For i = 1 To Len(S)
strOne = Mid$(S, i, 1)
bytMove = InStr(1, strPasswordOne, strOne, vbTextCompare)
If bytMove <> 0 Then
'Mid$(S, i, 1) = Mid$(strPasswordOne, bytMove + 3, 1) '填充转换后的数据
If (Asc(Mid$(strPasswordOne, bytMove + 3, 1)) >= 65 And Asc(Mid$(strPasswordOne, bytMove + 3, 1)) <= 90) Then
Mid$(S, i, 1) = Mid$(strPasswordOne, bytMove + 3, 1)
Else
Mid$(S, i, 1) = Chr(Asc(Mid$(strPasswordOne, bytMove + 3, 1)) - 32)
End If
End If
Next
Text2.Text = S '显示
End Sub
Private Sub Command3_Click()
Form2.Show
'MsgBox "这是关于凯撒密码的实现,其中密钥已经确定为3!(Chr(10)) 作者:陈珍珍 学号:0408008422", vbExclamation
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -