home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmEncrypt
- BorderStyle = 4 'Fixed ToolWindow
- Caption = "Encrypt - Decrypt"
- ClientHeight = 4845
- ClientLeft = 1890
- ClientTop = 3270
- ClientWidth = 7485
- Height = 5250
- Left = 1830
- MaxButton = 0 'False
- MDIChild = -1 'True
- ScaleHeight = 4845
- ScaleWidth = 7485
- ShowInTaskbar = 0 'False
- Top = 2925
- Width = 7605
- Begin VB.TextBox txt_Result
- BackColor = &H00C0C0C0&
- BorderStyle = 0 'None
- Height = 4110
- Left = 105
- Locked = -1 'True
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 0
- Top = 630
- Width = 7260
- End
- Begin Threed.SSPanel SSPanel1
- Align = 1 'Align Top
- Height = 480
- Left = 0
- TabIndex = 1
- Top = 0
- Width = 7485
- _Version = 65536
- _ExtentX = 13203
- _ExtentY = 847
- _StockProps = 15
- ForeColor = -2147483640
- BackColor = 12632256
- Begin VB.ComboBox cmb_Function
- Height = 315
- Left = 1365
- TabIndex = 2
- Top = 90
- Width = 4785
- End
- Begin Threed.SSCommand cmdNP
- Height = 300
- Index = 1
- Left = 7140
- TabIndex = 6
- Top = 90
- Width = 255
- _Version = 65536
- _ExtentX = 450
- _ExtentY = 529
- _StockProps = 78
- Caption = ">"
- BevelWidth = 1
- Font3D = 3
- RoundedCorners = 0 'False
- Outline = 0 'False
- End
- Begin Threed.SSCommand cmdNP
- Height = 300
- Index = 0
- Left = 6300
- TabIndex = 5
- Top = 90
- Width = 255
- _Version = 65536
- _ExtentX = 450
- _ExtentY = 529
- _StockProps = 78
- Caption = "<"
- BevelWidth = 1
- Font3D = 3
- RoundedCorners = 0 'False
- Outline = 0 'False
- End
- Begin VB.Label Label2
- Caption = "&Select a function"
- Height = 255
- Left = 90
- TabIndex = 4
- Top = 120
- Width = 1275
- End
- Begin Threed.SSCommand SSCommand1
- Default = -1 'True
- Height = 300
- Left = 6615
- TabIndex = 3
- Top = 90
- Width = 465
- _Version = 65536
- _ExtentX = 820
- _ExtentY = 529
- _StockProps = 78
- Caption = "&Go"
- BevelWidth = 1
- RoundedCorners = 0 'False
- Outline = 0 'False
- End
- End
- Attribute VB_Name = "frmEncrypt"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Option Base 1
- Private Const Iteration = 25
- Dim IsLoaded As Integer
- Dim TimerStartOk As Integer
- Dim TimerCloseOk As Integer
- Dim TimerHandle As Integer
- Dim TimerValue As Long
- Private Sub cmdNP_Click(Index As Integer)
- Call sub_NextPrev(cmb_Function, Index)
- End Sub
- Private Sub cmb_Function_Click()
- If (IsLoaded = False) Then Exit Sub
- Call cDisableFI(mdiT2W.Picture1)
- txt_Result = ""
- DoEvents
- Select Case cmb_Function.ListIndex
- Case 0
- Call TestFileEncrypt
- Case 1
- Call TestStringEncrypt
- End Select
- DoEvents
- Call cEnableFI(mdiT2W.Picture1)
- End Sub
- Private Sub Form_Activate()
- mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
- End Sub
- Private Sub Form_Load()
- IsLoaded = False
- Show
- Call sub_Load_Combo(cmb_Function, T2WDirInst + "_encrypt.t2w")
- IsLoaded = True
- End Sub
- Private Sub SSCommand1_Click()
- Call cmb_Function_Click
- End Sub
- Private Sub TestFileEncrypt()
- Dim lngResult As Long
- Dim strResult As String
- Dim strDisplay As String
- Dim i As Integer
- Dim File1 As String
- Dim File2 As String
- Dim File3 As String
- Dim Key As String
- strResult = ""
- strDisplay = ""
- File1 = T2WFileTest
- File2 = "autoexec.encrypted"
- File3 = "autoexec.decrypted"
- Key = "1234567890"
- For i = ENCRYPT_LEVEL_0 To ENCRYPT_LEVEL_4
- strDisplay = strDisplay & "Encrypt (level " & i & ") '" & File1 & "' with '?' to '" & File2 & "' is " & cFileEncrypt(File1, File2, Key, i) & vbCrLf
- strDisplay = strDisplay & "Decrypt (level " & i & ") '" & File2 & "' with '?' to '" & File3 & "' is " & cFileDecrypt(File2, File3, Key, i) & vbCrLf
- strDisplay = strDisplay & "Compare (ns) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
- Next i
- txt_Result = strDisplay
- 'time the function
- TimerHandle = cTimerOpen()
- TimerStartOk = cTimerStart(TimerHandle)
- For i = 1 To Iteration
- lngResult = cFileEncrypt(File1, File2, Key, ENCRYPT_LEVEL_3)
- Next i
- mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
- TimerCloseOk = cTimerClose(TimerHandle)
- End Sub
- Public Sub TestStringEncrypt()
- Dim lngResult As Long
- Dim strResult As String
- Dim strDisplay As String
- Dim i As Integer
- Dim Str1 As String
- Dim Str2 As String
- Dim Key As String
- strResult = ""
- strDisplay = ""
- Str1 = "T2WIN-32, t2win-32"
- Key = "1234567890"
- For i = ENCRYPT_LEVEL_0 To ENCRYPT_LEVEL_4
- Str2 = cEncrypt(Str1, Key, i)
- strDisplay = strDisplay & "Encrypt (level " & i & ") of [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
- strDisplay = strDisplay & "Decrypt (level " & i & ") of [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDecrypt(Str2, Key, i) & "]" & vbCrLf & vbCrLf
- Next i
- strDisplay = strDisplay & vbCrLf
- Str1 = "Windows 95 : Hints and Tips"
- For i = ENCRYPT_LEVEL_0 To ENCRYPT_LEVEL_4
- Str2 = cEncrypt(Str1, Key, i)
- strDisplay = strDisplay & "Encrypt (level " & i & ") of [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
- strDisplay = strDisplay & "Decrypt (level " & i & ") of [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDecrypt(Str2, Key, i) & "]" & vbCrLf & vbCrLf
- Next i
- strDisplay = strDisplay & vbCrLf
- Str1 = "Under the sky, the sun lights"
- For i = ENCRYPT_LEVEL_0 To ENCRYPT_LEVEL_4
- Str2 = cEncrypt(Str1, Key, i)
- strDisplay = strDisplay & "Encrypt (level " & i & ") of [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
- strDisplay = strDisplay & "Decrypt (level " & i & ") of [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDecrypt(Str2, Key, i) & "]" & vbCrLf & vbCrLf
- Next i
- strDisplay = strDisplay & vbCrLf
- txt_Result = strDisplay
- 'time the function
- TimerHandle = cTimerOpen()
- TimerStartOk = cTimerStart(TimerHandle)
- For i = 1 To Iteration
- strResult = cEncrypt(Str1, Key, ENCRYPT_LEVEL_3)
- Next i
- mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
- TimerCloseOk = cTimerClose(TimerHandle)
- End Sub
-