home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Shareware 35
/
hot35.iso
/
ficheros
/
LVB
/
T2W32543.ZIP
/
_ENCRYPT.FRM
< prev
next >
Wrap
Text File
|
1998-05-21
|
26KB
|
793 lines
VERSION 5.00
Begin VB.Form frmEncrypt
BorderStyle = 4 'Fixed ToolWindow
Caption = "Encrypt - Decrypt"
ClientHeight = 5055
ClientLeft = 510
ClientTop = 2205
ClientWidth = 9705
MaxButton = 0 'False
MDIChild = -1 'True
PaletteMode = 1 'UseZOrder
ScaleHeight = 5055
ScaleWidth = 9705
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Height = 570
Left = 0
TabIndex = 1
Top = -90
Width = 9705
Begin VB.CommandButton cmdNP
Caption = ">"
Height = 285
Index = 1
Left = 9360
TabIndex = 6
Top = 195
Width = 285
End
Begin VB.CommandButton cmdNP
Caption = "<"
Height = 285
Index = 0
Left = 8460
TabIndex = 5
Top = 195
Width = 285
End
Begin VB.CommandButton Command1
Caption = "&Go"
Default = -1 'True
Height = 285
Left = 8820
TabIndex = 4
Top = 195
Width = 465
End
Begin VB.ComboBox cmb_Function
Height = 315
Left = 1365
TabIndex = 2
Top = 180
Width = 7005
End
Begin VB.Label Label2
Caption = "&Select a function"
Height = 255
Left = 90
TabIndex = 3
Top = 210
Width = 1275
End
End
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 = 720
Width = 9540
End
End
Attribute VB_Name = "frmEncrypt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Private Const Iteration = 10
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 TestStringEncrypt
Case 1
Call TestFileEncrypt
Case 2
Call TestDESencrypt
Case 3
Call TestDESencryptFile
Case 4
Call TestIDEAencrypt
Case 5
Call TestIDEAencryptFile
Case 6
Call TestDIAMONDencrypt(DIAMOND_FULL_MODE1)
Case 7
Call TestDIAMONDencryptFile(DIAMOND_FULL_MODE1)
Case 8
Call TestDIAMONDencrypt(DIAMOND_LITE_MODE1)
Case 9
Call TestDIAMONDencryptFile(DIAMOND_LITE_MODE1)
Case 10
Call TestDIAMONDencrypt(DIAMOND_FULL_MODE2)
Case 11
Call TestDIAMONDencryptFile(DIAMOND_FULL_MODE2)
Case 12
Call TestDIAMONDencrypt(DIAMOND_LITE_MODE2)
Case 13
Call TestDIAMONDencryptFile(DIAMOND_LITE_MODE2)
Case 14
Call TestRUBYencrypt(RUBY_MODE_MINIMUM)
Case 15
Call TestRUBYencryptFile(RUBY_MODE_MINIMUM)
Case 16
Call TestRUBYencrypt(RUBY_MODE_PORTABLE_SAFE)
Case 17
Call TestRUBYencryptFile(RUBY_MODE_PORTABLE_SAFE)
Case 18
Call TestRUBYencrypt(RUBY_MODE_FORT_KNOX)
Case 19
Call TestRUBYencryptFile(RUBY_MODE_FORT_KNOX)
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 Command1_Click()
Call cmb_Function_Click
End Sub
Private Sub TestFileEncrypt()
Dim lResult 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
lResult = cFileEncrypt(File1, File2, Key, ENCRYPT_LEVEL_3)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestStringEncrypt()
Dim lResult 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/NT : 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
Private Sub TestDESencrypt()
Dim lResult 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 = ""
Key = "1234567890"
Str1 = "TIME TO WIN (32-Bit)"
Str2 = cDESencrypt(Str1, Key)
strDisplay = strDisplay & "DESencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "DESdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDESdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "T2WIN-32 a DLL for VB 4.0"
Str2 = cDESencrypt(Str1, Key)
strDisplay = strDisplay & "DESencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "DESdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDESdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "Windows 95/NT : Hints and Tips"
Str2 = cDESencrypt(Str1, Key)
strDisplay = strDisplay & "DESencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "DESdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDESdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "Under the sky, the sun lights"
Str2 = cDESencrypt(Str1, Key)
strDisplay = strDisplay & "DESencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "DESdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDESdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "the fox jump over over the lazy dogs"
Str2 = cDESencrypt(Str1, Key)
strDisplay = strDisplay & "DESencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "DESdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDESdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
strDisplay = strDisplay & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cDESencrypt(Str1, Key)
Next i
strResult = cDESencrypt(strResult, Key)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestIDEAencrypt()
Dim lResult 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 = ""
Key = "1234567890123456"
Str1 = "TIME TO WIN (32-Bit)"
Str2 = cIDEAencrypt(Str1, Key)
strDisplay = strDisplay & "IDEAencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "IDEAdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cIDEAdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "T2WIN-32 a DLL for VB 4.0"
Str2 = cIDEAencrypt(Str1, Key)
strDisplay = strDisplay & "IDEAencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "IDEAdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cIDEAdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "Windows 95/NT : Hints and Tips"
Str2 = cIDEAencrypt(Str1, Key)
strDisplay = strDisplay & "IDEAencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "IDEAdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cIDEAdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "Under the sky, the sun lights"
Str2 = cIDEAencrypt(Str1, Key)
strDisplay = strDisplay & "IDEAencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "IDEAdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cIDEAdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "the fox jump over over the lazy dogs"
Str2 = cIDEAencrypt(Str1, Key)
strDisplay = strDisplay & "IDEAencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "IDEAdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cIDEAdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
strDisplay = strDisplay & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cIDEAencrypt(Str1, Key)
Next i
strResult = cIDEAencrypt(strResult, Key)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestDESencryptFile()
Dim lResult 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.desencrypted"
File3 = "autoexec.desdecrypted"
Key = "1234567890"
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
strDisplay = strDisplay & "DESencryptFile '" & File1 & "' with '?' to '" & File2 & "' is " & cDESencryptFile(File1, File2, Key) & vbCrLf
strDisplay = strDisplay & "DESdecryptFile '" & File2 & "' with '?' to '" & File3 & "' is " & cDESdecryptFile(File2, File3, Key) & vbCrLf
strDisplay = strDisplay & "Compare (ns) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cDESencryptFile(File1, File2, Key)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestIDEAencryptFile()
Dim lResult 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.ideaencrypted"
File3 = "autoexec.ideadecrypted"
Key = "1234567890123456"
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
strDisplay = strDisplay & "IDEAencryptFile '" & File1 & "' with '?' to '" & File2 & "' is " & cIDEAencryptFile(File1, File2, Key) & vbCrLf
strDisplay = strDisplay & "IDEAdecryptFile '" & File2 & "' with '?' to '" & File3 & "' is " & cIDEAdecryptFile(File2, File3, Key) & vbCrLf
strDisplay = strDisplay & "Compare (ns) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cIDEAencryptFile(File1, File2, Key)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestDIAMONDencrypt(Mode As Integer)
Dim lResult 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 = ""
strDisplay = strDisplay & "DIAMOND " & IIf(((Mode Mod 2) = 1), "Full", "Lite") & " Mode" & IIf(((Mode - 1) / 2) = 0, "1", "2") & vbCrLf & vbCrLf
Key = "1234567890123456"
Str1 = "TIME TO WIN (32-Bit)"
Str2 = cDIAMONDencrypt(Str1, Key, Mode)
strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDIAMONDdecrypt(Str2, Key, Mode) & "]" & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "T2WIN-32 a DLL for VB 4.0"
Str2 = cDIAMONDencrypt(Str1, Key, Mode)
strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDIAMONDdecrypt(Str2, Key, Mode) & "]" & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "Under the sky, the sun lights"
Str2 = cDIAMONDencrypt(Str1, Key, Mode)
strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDIAMONDdecrypt(Str2, Key, Mode) & "]" & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "the fox jump over over the lazy dogs"
Str2 = cDIAMONDencrypt(Str1, Key, Mode)
strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDIAMONDdecrypt(Str2, Key, Mode) & "]" & vbCrLf
strDisplay = strDisplay & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cDIAMONDencrypt(Str1, Key, Mode)
Next i
strResult = cDIAMONDencrypt(strResult, Key, Mode)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestDIAMONDencryptFile(Mode As Integer)
Dim lResult 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 = ""
strDisplay = strDisplay & "DIAMOND " & IIf(((Mode Mod 2) = 1), "Full", "Lite") & " Mode" & IIf(((Mode - 1) / 2) = 0, "1", "2") & vbCrLf & vbCrLf
File1 = T2WFileTest
File2 = "autoexec.DIAMONDencrypted"
File3 = "autoexec.DIAMONDdecrypted"
Key = "1234567890123456"
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
strDisplay = strDisplay & "encryptFile '" & File1 & "' with '?' to '" & File2 & "' is " & cDIAMONDencryptFile(File1, File2, Key, Mode) & vbCrLf
strDisplay = strDisplay & "decryptFile '" & File2 & "' with '?' to '" & File3 & "' is " & cDIAMONDdecryptFile(File2, File3, Key, Mode) & vbCrLf
strDisplay = strDisplay & "Compare (ns) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cDIAMONDencryptFile(File1, File2, Key, Mode)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestRUBYencrypt(Mode As Integer)
Dim lResult 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
Dim DescMode As String
strResult = ""
strDisplay = ""
Select Case Mode
Case RUBY_MODE_MINIMUM: DescMode = "RUBY - minimum"
Case RUBY_MODE_DESK_LOCK: DescMode = "RUBY - desk lock"
Case RUBY_MODE_DEAD_BOLT: DescMode = "RUBY - dead bolt"
Case RUBY_MODE_PORTABLE_SAFE: DescMode = "RUBY - portable safe"
Case RUBY_MODE_ANCHORED_SAFE: DescMode = "RUBY - anchored safe"
Case RUBY_MODE_BANK_VAULT: DescMode = "RUBY - bank vault"
Case RUBY_MODE_FORT_KNOX: DescMode = "RUBY - FORT KNOX"
End Select
strDisplay = strDisplay & DescMode & vbCrLf & vbCrLf
Key = "1234567890123456"
Str1 = "TIME TO WIN (32-Bit)"
Str2 = cRUBYencrypt(Str1, Key, Mode)
strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cRUBYdecrypt(Str2, Key, Mode) & "]" & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "T2WIN-32 a DLL for VB 4.0"
Str2 = cRUBYencrypt(Str1, Key, Mode)
strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cRUBYdecrypt(Str2, Key, Mode) & "]" & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "Under the sky, the sun lights"
Str2 = cRUBYencrypt(Str1, Key, Mode)
strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cRUBYdecrypt(Str2, Key, Mode) & "]" & vbCrLf
strDisplay = strDisplay & vbCrLf
Str1 = "the fox jump over over the lazy dogs"
Str2 = cRUBYencrypt(Str1, Key, Mode)
strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cRUBYdecrypt(Str2, Key, Mode) & "]" & vbCrLf
strDisplay = strDisplay & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cRUBYencrypt(Str1, Key, Mode)
Next i
strResult = cRUBYencrypt(strResult, Key, Mode)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestRUBYencryptFile(Mode As Integer)
Dim lResult 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
Dim DescMode As String
strResult = ""
strDisplay = ""
Select Case Mode
Case RUBY_MODE_MINIMUM: DescMode = "RUBY - minimum"
Case RUBY_MODE_DESK_LOCK: DescMode = "RUBY - desk lock"
Case RUBY_MODE_DEAD_BOLT: DescMode = "RUBY - dead bolt"
Case RUBY_MODE_PORTABLE_SAFE: DescMode = "RUBY - portable safe"
Case RUBY_MODE_ANCHORED_SAFE: DescMode = "RUBY - anchored safe"
Case RUBY_MODE_BANK_VAULT: DescMode = "RUBY - bank vault"
Case RUBY_MODE_FORT_KNOX: DescMode = "RUBY - FORT KNOX"
End Select
strDisplay = strDisplay & DescMode & vbCrLf & vbCrLf
File1 = T2WFileTest
File2 = "autoexec.RUBYencrypted"
File3 = "autoexec.RUBYdecrypted"
Key = "1234567890123456"
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
strDisplay = strDisplay & "encryptFile '" & File1 & "' with '?' to '" & File2 & "' is " & cRUBYencryptFile(File1, File2, Key, Mode) & vbCrLf
strDisplay = strDisplay & "decryptFile '" & File2 & "' with '?' to '" & File3 & "' is " & cRUBYdecryptFile(File2, File3, Key, Mode) & vbCrLf
strDisplay = strDisplay & "Compare (ns) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cRUBYencryptFile(File1, File2, Key, Mode)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub