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

📄 crypto.frm

📁 一个VB小程序,能够进行大数的计算,可以作为学习的参考
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Slate 
   BackColor       =   &H00000000&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "CryptoSlate"
   ClientHeight    =   5535
   ClientLeft      =   465
   ClientTop       =   705
   ClientWidth     =   10215
   BeginProperty Font 
      Name            =   "Fixedsys"
      Size            =   9
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H00E0E0E0&
   MaxButton       =   0   'False
   ScaleHeight     =   23.063
   ScaleLeft       =   -1
   ScaleMode       =   0  'User
   ScaleWidth      =   85.125
   Begin VB.ListBox Genrator 
      Appearance      =   0  'Flat
      BackColor       =   &H00400040&
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   1680
      Sorted          =   -1  'True
      TabIndex        =   2
      Top             =   120
      Width           =   1815
   End
   Begin VB.FileListBox Encoder 
      Appearance      =   0  'Flat
      BackColor       =   &H00400040&
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   1680
      Pattern         =   "*.txt"
      TabIndex        =   0
      Top             =   480
      Width           =   1815
   End
   Begin VB.FileListBox Decoder 
      Appearance      =   0  'Flat
      BackColor       =   &H00400040&
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   1680
      Pattern         =   "*.bin"
      TabIndex        =   1
      Top             =   840
      Width           =   1815
   End
   Begin VB.TextBox Box 
      BackColor       =   &H00400000&
      ForeColor       =   &H00E0E0E0&
      Height          =   3735
      Left            =   120
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   3
      TabStop         =   0   'False
      Top             =   1320
      Width           =   9975
   End
   Begin VB.Label GnrLabel 
      BackColor       =   &H00000000&
      BackStyle       =   0  'Transparent
      Caption         =   "Bitlength N"
      ForeColor       =   &H00E0E0E0&
      Height          =   255
      Left            =   120
      TabIndex        =   6
      Top             =   120
      Width           =   1455
   End
   Begin VB.Label EncLabel 
      BackColor       =   &H00000000&
      BackStyle       =   0  'Transparent
      Caption         =   "Plaintext"
      ForeColor       =   &H00E0E0E0&
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   480
      Width           =   1455
   End
   Begin VB.Label DecLabel 
      BackColor       =   &H00000000&
      BackStyle       =   0  'Transparent
      Caption         =   "Ciphertext"
      ForeColor       =   &H00E0E0E0&
      Height          =   255
      Left            =   120
      TabIndex        =   5
      Top             =   840
      Width           =   1455
   End
   Begin VB.Menu Run 
      Caption         =   "&Run"
      Begin VB.Menu Commands 
         Caption         =   "&Go"
         Index           =   0
         Shortcut        =   {F5}
      End
      Begin VB.Menu Commands 
         Caption         =   "&Break"
         Index           =   1
         Shortcut        =   {F1}
      End
      Begin VB.Menu Commands 
         Caption         =   "&Quit"
         Index           =   2
         Shortcut        =   {F4}
      End
   End
End
Attribute VB_Name = "Slate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_Description = "LargeInt cryptography Visual Basic adaptation demo."
'Author : Sjoerd.J.Schaper - vspickelen@zonnet.nl
'URL    : http://largeint.sourceforge.net/index.html
'Date   : 05-05-2004
'Code   : Visual Basic for Windows 5.0
Option Explicit
Private Busy As Boolean '              used to lock the Subs

Private Sub Commands_Click(Index As Integer)
  Select Case Index
  Case 0
    SendKeys "~" '                    [Enter]
  Case 1
    Key = -1 '                         mimic the ON KEY event trap
  Case 2
    Close: End '                      [Quit]
  End Select
End Sub

Private Sub Decoder_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Busy = 0 Then '   [Enter]
  Busy = -1
  Decode Decoder.List(Decoder.ListIndex)
  Busy = 0: ListRefresh
End If
End Sub

Private Sub Encoder_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Busy = 0 Then
  Busy = -1
  Encode Encoder.List(Encoder.ListIndex)
  Busy = 0: ListRefresh
End If
End Sub

Private Sub Form_Load()
Dim g As String, size As Long
Dim i As Integer, r As Integer
  r = Init(size, g)
'Working directory
  WrkD = Trim$(Environ$("LARGEINT"))
  If WrkD = "" Then WrkD = ".\"
  If Right$(WrkD, 1) <> "\" Then WrkD = WrkD + "\"
'List initialization
  Slate.Encoder.Path = WrkD
  Slate.Decoder.Path = WrkD
  r = 64: ListRefresh
  For i = 0 To 4
    Genrator.AddItem Str$(r), i
    r = 2 * r
  Next i
  Genrator.ListIndex = 2
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Call Term: Cancel = 0
End Sub

Private Sub Genrator_KeyPress(KeyAscii As Integer)
Dim r As Integer
If KeyAscii = 13 And Busy = 0 Then
  Busy = -1
  r = MsgBox("Overwrite existing keyfiles?", 324, "Generator")
  If r = 6 Then Generate Genrator.ListIndex
  Busy = 0
End If
End Sub

Private Sub ListRefresh()
Dim i As Integer, j As Integer, r As Integer
'List update
  Slate.Encoder.Refresh
  j = Slate.Encoder.ListCount - 1: r = j
  For i = 0 To j
    If LCase(Slate.Encoder.List(i)) = "original.txt" Then r = i: Exit For
  Next i
  Slate.Encoder.ListIndex = r
  Slate.Decoder.Refresh
  j = Slate.Decoder.ListCount - 1: r = j
  For i = 0 To j
    If LCase(Slate.Decoder.List(i)) = "encoded.bin" Then r = i: Exit For
  Next i
  Slate.Decoder.ListIndex = r
End Sub

⌨️ 快捷键说明

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