古典恺撒维吉尼亚密码体制VBVERSION 5.00Begin VB.Form Form1 BackColor = &H00808000& Caption = "古典密码体制" ClientHeight = 3135 ClientLeft = 3060 ClientTop = 3450 ClientWidth = 6360 LinkTopic = "Form3" ScaleHeight = 3135 ScaleWidth = 6360 Begin VB.CommandButton Command2 BackColor = &H00C0E0FF& Caption = "维吉尼亚密码体制" BeginProperty Font Name = "宋体" Size = 15 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 735 Left = 3360 Style = 1 'Graphical TabIndex = 2 Top = 1320 Width = 2775 End Begin VB.CommandButton Command1 BackColor = &H00C0E0FF& Caption = "恺撒密码体制" BeginProperty Font Name = "宋体" Size = 15 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 735 Left = 360 Style = 1 'Graphical TabIndex = 1 Top = 1320 Width = 2535 End Begin VB.Label Label2 BackColor = &H00808000& Caption = "制作人:张琰燕 0408008404" BeginProperty Font Name = "宋体" Size = 12 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 2880 TabIndex = 3 Top = 2520 Width = 3015 End Begin VB.Label Label1 BackColor = &H00808000& Caption = "请选择你所需的加密体制" BeginProperty Font Name = "新宋体" Size = 18 Charset = 134 Weight = 700 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00FF80FF& Height = 615 Left = 1080 TabIndex = 0 Top = 480 Width = 4455 EndEndAttribute VB_Name = "Form1"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = FalsePrivate Sub Command1_Click()Form2.Visible = TrueForm2.Enabled = TrueEnd Sub
Private Sub Command2_Click()若图片无法显示请联系QQ3710167,古典恺撒维吉尼亚密码体制VB系统免费,转发请注明源于www.lwfree.cn
Private Sub Form_Load()Form1.Visible = TrueForm1.Enabled = TrueForm2.Visible = FalseForm3.Visible = FalseEnd Sub90
古典恺撒维吉尼亚密码体制VBVERSION 5.00Begin VB.Form Form2 BackColor = &H00808000& Caption = "恺撒密码体制" ClientHeight = 3615 ClientLeft = 3060 ClientTop = 3450 ClientWidth = 7170 FillColor = &H00C0C000& BeginProperty Font Name = "宋体" Size = 15.75 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C0C000& LinkTopic = "Form1" ScaleHeight = 3615 ScaleLeft = 200 ScaleMode = 0 'User若图片无法显示请联系QQ3710167,古典恺撒维吉尼亚密码体制VB系统免费,转发请注明源于www.lwfree.cn Size = 9 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 3120 MaskColor = &H00FFC0C0& Style = 1 'Graphical TabIndex = 10 Top = 2880 UseMaskColor = -1 'True Width = 855 End Begin VB.CommandButton Command2 BackColor = &H00FFC0C0& Caption = "解密" BeginProperty Font Name = "宋体" Size = 9 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 3120 MaskColor = &H00FF8080& Style = 1 'Graphical TabIndex = 7 Top = 2280 UseMaskColor = -1 'True Width = 855 End Begin VB.CommandButton Command1 BackColor = &H00FFC0C0& Caption = "加密" BeginProperty Font Name = "宋体" Size = 9 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 3120 MaskColor = &H8000000F& Style = 1 'Graphical TabIndex = 6 Top = 1680 Width = 855 End Begin VB.TextBox Text3 Height = 2055 Left = 4320 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 5 Top = 720 Width = 2415 End Begin VB.TextBox Text1 Height = 2055 Left = 360 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 4 Top = 720 Width = 2415 End Begin VB.TextBox Text2 Height = 375 IMEMode = 3 'DISABLE Left = 3120 PasswordChar = "*" TabIndex = 3 Top = 840 Width = 855 End Begin VB.Label Label6 BackColor = &H00808000& Caption = "(数字)" BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 3240 TabIndex = 11 Top = 1320 Width = 735 End Begin VB.Label Label5 BackColor = &H00808000& Caption = "(均为字母)" BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 4680 TabIndex = 9 Top = 3000 Width = 1335 End Begin VB.Label Label4 BackColor = &H00808000& Caption = "(均为字母)" BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 720 TabIndex = 8 Top = 3000 Width = 1335 End Begin VB.Label Label3 BackColor = &H00808000& BackStyle = 0 'Transparent Caption = "密 文" BeginProperty Font Name = "宋体" Size = 15 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000080FF& Height = 300 Left = 5160 TabIndex = 2 Top = 240 Width = 855 End Begin VB.Label Label1 BackStyle = 0 'Transparent Caption = "明 文" BeginProperty Font Name = "宋体" Size = 15 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000080FF& Height = 300 Left = 1200 TabIndex = 1 Top = 240 Width = 855 End Begin VB.Label Label2 AutoSize = -1 'True BackColor = &H00808000& BackStyle = 0 'Transparent Caption = "密 钥" BeginProperty Font Name = "宋体" Size = 15 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000080FF& Height = 300 Left = 3240 TabIndex = 0 Top = 240 Width = 750 EndEndAttribute VB_Name = "Form2"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = False
Const aph = "abcdefghijklmnopqrstuvwxyz" '定义字母表Private Sub Command1_Click() '加密If Text1.Text = "" Then '判断明文是否为空MsgBox "请输入您要加密的明文", vbInformationText1.SetFocusElseIf Text2.Text = "" Then '判断密钥是否为空MsgBox "请输入密钥", vbInformationText2.SetFocusElseIf IsNumeric(Text2.Text) = 0 Then '判断密钥是否正确MsgBox "请输入正确的密钥", vbExclamationText2.Text = ""Text2.SetFocusElseDim l%, i%, j%Dim StrPos1%, Strpos2%Dim Mystr$, str1$, str2$Dim Newstr() As Stringl = Len(Text1.Text) '获取明文长度ReDim Newstr(1 To l) '定义一动态数组来存放加密后的数据j = 0For i = 1 To l Step 1 '加密过程Mystr = Mid(Text1.Text, i, 1) '截取明文的数据StrPos1 = InStr(1, aph, Mystr, 1) '判断明文字母在字母表中的位置If StrPos1 <> 0 Then '当明文在字母表中执行如下j = j + 1Strpos2 = (StrPos1 + Val(Text2.Text)) Mod 26 '加密后所在字母表中的位置If Strpos2 = 0 ThenStrpos2 = 26End IfNewstr(i) = Mid(aph, Strpos2, 1) '加密后的数据赋给动态数组End IfNext iIf j <> l Then '判断明文是否正确即是否都为字母MsgBox "请输入正确的数据", vbExclamationText1.SetFocusCommand3.Enabled = TrueElsestr1 = Join(Newstr, "") '把数组转换成字符串str2 = UCase(str1) '把字符串转换成大写Text3.Text = str2 '显示加密后的密文Command3.Enabled = TrueEnd IfEnd IfEnd Sub
Private Sub Command2_Click() '解密If Text3.Text = "" Then '判断密文是否为空MsgBox "请输入您要解密的密文", vbInformationText3.SetFocusElseIf Text2.Text = "" Then '判断密钥是否为空MsgBox "请输入密钥", vbInformationText2.SetFocusElseIf IsNumeric(Text2.Text) = 0 Then '判断密钥是否正确MsgBox "请输入正确的密钥", vbExclamationText2.Text = ""Text2.SetFocusElseDim l%, i%, j%Dim StrPos1%, Strpos2%Dim Mystr$, str1$Dim Newstr() As Stringl = Len(Text3.Text) '获取密文长度ReDim Newstr(1 To l) '定义一个动态数组暂存解密后的数据j = 0For i = 1 To l Step 1 '解密过程Mystr = Mid(Text3.Text, i, 1) '截取密文数据StrPos1 = InStr(1, aph, Mystr, 1) '查找密文在字母表中的位置If StrPos1 <> 0 Then '当密文在字母表中则执行以下代码j = j + 1Strpos2 = (StrPos1 - Val(Text2.Text) Mod 26 + 26) Mod 26 '解密后的位置If Strpos2 = 0 ThenStrpos2 = 26End IfNewstr(i) = Mid(aph, Strpos2, 1) '把解密后的数据赋给数组End IfNext iIf j <> l Then '判断密文是否正确MsgBox "请输入正确的数据", vbExclamationText3.SetFocusCommand3.Enabled = TrueElsestr1 = Join(Newstr, "") '把数组转换成字符串Text1.Text = str1 '显示解密后的数据Command3.Enabled = TrueEnd IfEnd IfEnd Sub
Private Sub Command3_Click() '清空i = MsgBox("你确定要清除所有的内容吗?", vbOKCancel + vbInformation)If i = 1 ThenText1.Text = ""Text2.Text = ""Text3.Text = ""Command3.Enabled = FalseElseEnd IfEnd Sub
Private Sub Form_Load()Command3.Enabled = FalseEnd Sub
古典恺撒维吉尼亚密码体制VBVERSION 5.00Begin VB.Form Form3 BackColor = &H00808000& Caption = "维吉尼亚密码体制" ClientHeight = 3675 ClientLeft = 3060 ClientTop = 3450 ClientWidth = 7170 LinkTopic = "Form1" ScaleHeight = 3675 ScaleLeft = 200 ScaleMode = 0 'User ScaleTop = 200 ScaleWidth = 7215.284 Begin VB.CommandButton Command3 BackColor = &H00FFC0C0& Caption = "清空" Height = 375 Left = 5280 Style = 1 'Graphical TabIndex = 8 Top = 3000 Width = 975 End Begin VB.CommandButton Command2 BackColor = &H00FFC0C0& Caption = "解密" Height = 375 Left = 3120 Style = 1 'Graphical TabIndex = 7 Top = 3000 Width = 975 End Begin VB.CommandButton Command1 BackColor = &H00FFC0C0& Caption = "加密" Height = 375 Left = 720 Style = 1 'Graphical TabIndex = 6 Top = 3000 Width = 975 End Begin VB.TextBox Text3 BeginProperty Font Name = "宋体" Size = 15 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 1935 Left = 4800 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 5 Top = 720 Width = 1815 End Begin VB.TextBox Text2 BeginProperty Font Name = "宋体" Size = 15 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 1935 IMEMode = 3 'DISABLE Left = 2640 MultiLine = -1 'True PasswordChar = "*" ScrollBars = 2 'Vertical TabIndex = 4 Top = 720 Width = 1815 End Begin VB.TextBox Text1 BeginProperty Font Name = "宋体" Size = 15 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 1935 Left = 360 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 3 Top = 720 Width = 1815 End Begin VB.Label Label3 BackColor = &H00808000& Caption = "密 文" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000080FF& Height = 375 Left = 5280 TabIndex = 2 Top = 240 Width = 855 End Begin VB.Label Label2 BackColor = &H00808000& Caption = "密 钥" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000080FF& Height = 375 Left = 3120 TabIndex = 1 Top = 240 Width = 855 End Begin VB.Label Label1 BackColor = &H00808000& Caption = "明 文" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000080FF& Height = 375 Left = 960 TabIndex = 0 Top = 240 Width = 855 EndEndAttribute VB_Name = "Form3"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = FalseConst aph = "abcdefghijklmnopqrstuvwxyz" '定义字母表Private Sub Command1_Click() '加密If Text1.Text = "" Then '判断明文是否为空MsgBox "请输入您要加密的明文", vbInformationText1.SetFocusElseIf Text2.Text = "" Then '判断密钥是否为空MsgBox "请输入密钥", vbInformationText2.SetFocusElseDim l1%, l2%, i%, j%Dim StrPos1%, Strpos2%, Ms%Dim Mystr$, Mystr2$, mingwen$l2 = Len(Text2.Text) '获取密钥长度j = 0For i = 1 To l2 '判断密钥是否均为字母Mystr2 = Mid(Text2.Text, i, 1)Strpos2 = InStr(1, aph, Mystr2, 1)If Strpos2 <> 0 Thenj = j + 1End IfNextIf j <> l2 Then '判断密钥是否正确MsgBox "请输入正确的密钥", vbExclamationText2.Text = ""Text2.SetFocusElsemingwen = Text1.Text '获取原明文l1 = Len(Text1.Text) '获取明文长度j = 0For i = 1 To l1 Step 1 '加密过程Mystr = Mid(Text1.Text, i, 1)If i Mod l2 = 0 ThenMystr2 = Mid(Text2.Text, l2, 1)ElseMystr2 = Mid(Text2.Text, i Mod l2, 1)End IfStrPos1 = InStr(1, aph, Mystr, 1) '查找原文字母在字母表中的位置Ms = InStr(1, aph, Mystr2, 1) '查找密钥字母在字母表中的位置If StrPos1 <> 0 Thenj = j + 1Strpos2 = (StrPos1 + Ms - 1) Mod 26 '加密If Strpos2 = 0 ThenStrpos2 = 26End IfMid$(mingwen, i, 1) = Mid$(aph, Strpos2, 1)End IfNext iIf j <> l1 Then '判断明文是否正确即明文是否均为字母MsgBox "请输入正确的加密数据", vbExclamationText1.SetFocusCommand3.Enabled = TrueElsemingwen = UCase(mingwen) '把加密后的数据转换成大写Text3.Text = mingwen '显示加密后的数据Command3.Enabled = TrueEnd IfEnd IfEnd IfEnd Sub
Private Sub Command2_Click() '解密If Text3.Text = "" Then '判断密文是否为空MsgBox "请输入您要解密的密文", vbInformationText3.SetFocusElseIf Text2.Text = "" Then '判断密钥是否为空MsgBox "请输入密钥", vbInformationText2.SetFocusElseDim l1%, l2%, i%, j%Dim StrPos1%, Strpos2%, Ms%Dim Mystr$, Mystr2$, miwen$l2 = Len(Text2.Text) '获取密钥长度j = 0For i = 1 To l2 '判断密钥是否均为字母Mystr2 = Mid(Text2.Text, i, 1)Strpos2 = InStr(1, aph, Mystr2, 1)If Strpos2 <> 0 Thenj = j + 1End IfNextIf j <> l2 Then '判断密钥是否正确MsgBox "请输入正确的密钥", vbExclamationText2.Text = ""Text2.SetFocusElsemiwen = Text3.Text '获取密文l1 = Len(Text3.Text) '获取密文长度j = 0For i = 1 To l1 Step 1 '解密过程Mystr = Mid(Text3.Text, i, 1)If i Mod l2 = 0 ThenMystr2 = Mid(Text2.Text, l2, 1)ElseMystr2 = Mid(Text2.Text, i Mod l2, 1)End IfStrPos1 = InStr(1, aph, Mystr, 1) '获取密文在字母表中的位置Ms = InStr(1, aph, Mystr2, 1) '获取密钥在字母表中的位置If StrPos1 <> 0 Thenj = j + 1Strpos2 = (StrPos1 - Ms + 1 + 26) Mod 26 '解密If Strpos2 = 0 ThenStrpos2 = 26End IfMid$(miwen, i, 1) = Mid$(aph, Strpos2, 1)End IfNext iIf j <> l1 Then '判断密文是否正确即密文是否均为字母MsgBox "请输入正确的解密数据", vbExclamationText3.SetFocusCommand3.Enabled = TrueElseText1.Text = miwen '显示解密后的数据Command3.Enabled = TrueEnd IfEnd IfEnd IfEnd Sub
若图片无法显示请联系QQ3710167,古典恺撒维吉尼亚密码体制VB系统免费,转发请注明源于www.lwfree.cnCommand3.Enabled = FalseEnd Sub