⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 Polybios密码体制算法实现
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4950
   ClientLeft      =   60
   ClientTop       =   465
   ClientWidth     =   7860
   LinkTopic       =   "Form1"
   ScaleHeight     =   4950
   ScaleWidth      =   7860
   StartUpPosition =   3  '窗口缺省
   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          =   615
      Left            =   5400
      TabIndex        =   9
      Top             =   2160
      Width           =   2175
   End
   Begin VB.TextBox txtresult 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   1680
      TabIndex        =   8
      Top             =   3000
      Width           =   5895
   End
   Begin VB.TextBox sectext 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   1680
      TabIndex        =   6
      Top             =   2160
      Width           =   3375
   End
   Begin VB.TextBox Textout 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   1800
      MultiLine       =   -1  'True
      TabIndex        =   3
      Top             =   960
      Width           =   5775
   End
   Begin VB.TextBox inputext 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   1800
      TabIndex        =   1
      Text            =   "asdfasdf"
      Top             =   240
      Width           =   3375
   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          =   615
      Left            =   5280
      TabIndex        =   0
      Top             =   240
      Width           =   2295
   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          =   495
      Left            =   120
      TabIndex        =   7
      Top             =   3240
      Width           =   1575
   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          =   615
      Left            =   120
      TabIndex        =   5
      Top             =   2280
      Width           =   1335
   End
   Begin VB.Label Label2 
      Caption         =   "密文结果"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   240
      TabIndex        =   4
      Top             =   1200
      Width           =   1455
   End
   Begin VB.Label Label1 
      Caption         =   "输入明文"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   240
      TabIndex        =   2
      Top             =   360
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim table(25)  As String
Dim matrix(5, 5) As String
Dim temp(5)  As String
Private Sub Form_Load()
Dim zimu  As Variant
table(1) = "a": table(2) = "b": table(3) = "c": table(4) = "d": table(5) = "e": table(6) = "f": table(7) = "g": table(8) = "h": table(9) = "i": table(10) = "k": table(11) = "l": table(12) = "m": table(13) = "n": table(14) = "o": table(15) = "p": table(16) = "q": table(17) = "r": table(18) = "s": table(19) = "t": table(20) = "u": table(21) = "v": table(22) = "w": table(23) = "x": table(24) = "y": table(25) = "z"
temp(1) = "a": temp(2) = "b": temp(3) = "c": temp(4) = "d": temp(5) = "e"
For i = 1 To 5
For j = 1 To 5
matrix(i, j) = table(5 * (i - 1) + j)
Next j
Next i
End Sub
Private Sub Command1_Click()
Dim key() As String
Dim tempkey As String
Dim length As Integer

tempkey = inputext.Text
length = Len(tempkey)
ReDim key(1 To length)
For i = 1 To length Step 1
key(i) = Mid(LCase(tempkey), i, 1)
If key(i) = "j" Then key(i) = "i"
Next i

For i = 1 To length Step 1
For m = 1 To 5
For n = 1 To 5
If (key(i) = matrix(m, n)) Then
Textout.Text = Textout + temp(m) + temp(n)
 End If
Next n
Next m
Next i
End Sub

Private Sub Command2_Click()
Dim key() As String
Dim tempkey As String
Dim length As Integer
Dim tempx As Integer, tempy As Integer

tempkey = sectext.Text
length = Len(sectext)
If ((length Mod 2) = 0) Then
ReDim key(1 To length)
For i = 1 To length Step 1
key(i) = Mid(LCase(sectext), i, 1)
Next i
For i = 1 To length Step 2
For j = 1 To 5
If (key(i) = temp(j)) Then tempx = j
If (key(i + 1) = temp(j)) Then tempy = j
Next j
txtresult.Text = txtresult.Text + table(5 * (tempx - 1) + tempy)
Next i
Else
MsgBox ("输入密文格式不正确,请重新输入!")
End If
End Sub





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -