?? a.frm
字號:
VERSION 5.00
Begin VB.Form A
Caption = "加密算法A"
ClientHeight = 6645
ClientLeft = 60
ClientTop = 450
ClientWidth = 7065
BeginProperty Font
Name = "宋體"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 6645
ScaleWidth = 7065
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Command5
Caption = "重新操作"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5520
TabIndex = 8
Top = 5280
Width = 1215
End
Begin VB.CommandButton Command4
Caption = "清除明文"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2280
TabIndex = 7
Top = 2400
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "解密"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5520
TabIndex = 6
Top = 4320
Width = 1215
End
Begin VB.TextBox Text2
BackColor = &H8000000F&
Enabled = 0 'False
BeginProperty Font
Name = "宋體"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 1455
Left = 480
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 5
Top = 4320
Width = 4815
End
Begin VB.CommandButton Command2
Caption = "退出"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4080
TabIndex = 3
Top = 2400
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "加密"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
TabIndex = 2
Top = 2400
Width = 1215
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1335
Left = 480
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Top = 720
Width = 4815
End
Begin VB.Line Line1
BorderWidth = 2
X1 = 360
X2 = 6600
Y1 = 3360
Y2 = 3360
End
Begin VB.Label Label2
Caption = "輸出密文:"
BeginProperty Font
Name = "宋體"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 4
Top = 3720
Width = 1455
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "輸入明文:"
BeginProperty Font
Name = "宋體"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 480
TabIndex = 0
Top = 240
Width = 1575
End
End
Attribute VB_Name = "A"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Rem 這是加密算法A
Option Explicit
Private Sub Command1_Click()
Dim Str1 As String, Str2 As String, ch As String
Dim strlen As Integer, i As Integer, chx As Integer
Str1 = Trim(Text1.Text)
Rem 將輸入文本框的字符串的前后空格去掉后賦值給Str1
strlen = Len(Str1)
Rem 求字符串的長度
For i = 1 To strlen
ch = Mid(Str1, i, 1)
Rem 取第i個字符
chx = Asc(ch)
Rem 求第i個字符的ASCII值
If chx Mod 2 = 0 Then
chx = chx + 1
Rem 如果該字符的ASCII值為偶數,chx+1
Else
chx = chx - 1
Rem 如果該字符的ASCII值為奇數,chx-1
End If
Str2 = Str2 & Chr(chx)
Text2.Text = Str2
Next i
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Text1.BackColor = &H8000000F
Dim Str1 As String, Str2 As String, ch As String
Dim strlen As Integer, i As Integer, chx As Integer
Str2 = Text2.Text
strlen = Len(Str2)
For i = 1 To strlen
chx = Asc(Mid(Str2, i, 1))
If chx Mod 2 = 0 Then
chx = chx + 1
Else
chx = chx - 1
End If
Str1 = Str1 & Chr(chx)
Text1.Text = Str1
Next i
End Sub
Private Sub Command4_Click()
Text1.Text = ""
End Sub
Private Sub Command5_Click()
Text1.Text = ""
Text2.Text = ""
Text1.BackColor = &H80000005
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -