VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3135
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6645
   LinkTopic       =   "Form1"
   ScaleHeight     =   3135
   ScaleWidth      =   6645
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   1575
      Left            =   3360
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   8
      Top             =   600
      Width           =   3015
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   1575
      Left            =   120
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   7
      Top             =   600
      Width           =   3015
   End
   Begin VB.CommandButton CommandJM12 
      Caption         =   "解密1"
      Height          =   375
      Left            =   2040
      TabIndex        =   6
      Top             =   2400
      Width           =   855
   End
   Begin VB.CommandButton CommandJM11 
      Caption         =   "加密1"
      Height          =   375
      Left            =   1080
      TabIndex        =   5
      Top             =   2400
      Width           =   855
   End
   Begin VB.CommandButton CommandQUIT 
      Caption         =   "退 出"
      Height          =   375
      Left            =   5400
      TabIndex        =   4
      Top             =   2400
      Width           =   975
   End
   Begin VB.CommandButton CommandJM22 
      Caption         =   "解密2"
      Height          =   375
      Left            =   4200
      TabIndex        =   3
      Top             =   2400
      Width           =   855
   End
   Begin VB.CommandButton CommandJM21 
      Caption         =   "加密2"
      Height          =   375
      Left            =   3240
      TabIndex        =   2
      Top             =   2400
      Width           =   855
   End
   Begin VB.CommandButton CommandDK 
      Caption         =   "打 开"
      Height          =   375
      Left            =   120
      TabIndex        =   1
      Top             =   2400
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "中文文件的加密与解密"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   375
      Left            =   1800
      TabIndex        =   0
      Top             =   120
      Width           =   2775
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private SY As Variant, FLEN As Long
Rem 打开中文文件
Private Sub CommandDK_Click()
   Open "F:\VB\素材\ZWT1.TXT" For Binary As #1
   FLEN = LOF(1)                           '获得文件的长度
   SY = Input(FLEN, #1)
   Text1.Text = SY
   Close #1
End Sub
Rem 加密1
Private Sub CommandJM11_Click()
   Open "F:\VB\素材\ZWT1.TXT" For Binary As #1
   SY = Mid$(SY, 5) + Left$(SY, 4)
   Text2.Text = SY
   FLEN = Len(SY)                          '这里的SY长度是文件长度的一半
   For I = 1 To FLEN
      Put #1, I * 2 - 1, Mid$(SY, I, 1)    '一个汉字占两个字节
   Next I
   Close #1
End Sub
Rem 解密1
Private Sub CommandJM12_Click()
   Open "F:\VB\素材\ZWT1.TXT" For Binary As #1
   FLEN = Len(SY)
   SY = Right$(SY, 4) + Mid$(SY, 1, FLEN - 4)
   Text2.Text = SY
   For I = 1 To FLEN
      Put #1, I * 2 - 1, Mid$(SY, I, 1)
   Next I
   Close #1
End Sub
Rem 加密2
Private Sub CommandJM21_Click()
   Dim I As Long, SM, FLEN1 As Variant
   Open "F:\VB\素材\ZWT1.TXT" For Binary As #1
   SM = ""
   FLEN1 = FLEN / 2
   For I = 1 To Int(FLEN1) / 2
       SM = SM + Mid$(SY, I, 1) + Mid$(SY, FLEN1 + 1 - I, 1)
   Next I
   If FLEN1 / 2 <> Int(FLEN1 / 2) Then
      SM = SM + Mid$(SY, I, 1)
   End If
   Text2.Text = SM
   For I = 1 To FLEN
      Put #1, I * 2 - 1, Mid$(SM, I, 1)
   Next I
   Close #1
End Sub
Rem 解密2
Private Sub CommandJM22_Click()
   Dim I As Long, N As Integer
   Dim SM, SM1, SM2 As Variant
   Open "F:\VB\素材\ZWT1.TXT" For Binary As #1
   SM = "": N = 1
   FLEN1 = FLEN / 2
   If FLEN1 / 2 <> Int(FLEN1 / 2) Then
      N = 2
   End If
   For I = 1 To FLEN1 Step 2
       SM1 = SM1 + Mid$(SY, I, 1)
       SM2 = SM2 + Mid$(SY, FLEN1 + N - I, 1)
   Next I
   SM = SM1 + SM2
   Text2.Text = SM
   For I = 1 To FLEN
      Put #1, I * 2 - 1, Mid$(SM, I, 1)
   Next I
   Close #1
End Sub
Rem 退出
Private Sub CommandQUIT_Click()
   Reset
   End
End Sub
