home *** CD-ROM | disk | FTP | other *** search
/ BUG 11 / BUGCD1998_02.ISO / util / time2win / t2w32500.exe / _ENCRYPT.FRM < prev    next >
Text File  |  1997-12-25  |  28KB  |  860 lines

  1. VERSION 5.00
  2. Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "THREED32.OCX"
  3. Begin VB.Form frmEncrypt 
  4.    BorderStyle     =   4  'Fixed ToolWindow
  5.    Caption         =   "Encrypt - Decrypt"
  6.    ClientHeight    =   5055
  7.    ClientLeft      =   510
  8.    ClientTop       =   2205
  9.    ClientWidth     =   9705
  10.    MaxButton       =   0   'False
  11.    MDIChild        =   -1  'True
  12.    PaletteMode     =   1  'UseZOrder
  13.    ScaleHeight     =   5055
  14.    ScaleWidth      =   9705
  15.    ShowInTaskbar   =   0   'False
  16.    Begin VB.TextBox txt_Result 
  17.       BackColor       =   &H00C0C0C0&
  18.       BorderStyle     =   0  'None
  19.       Height          =   4110
  20.       Left            =   105
  21.       Locked          =   -1  'True
  22.       MultiLine       =   -1  'True
  23.       ScrollBars      =   2  'Vertical
  24.       TabIndex        =   0
  25.       Top             =   720
  26.       Width           =   9540
  27.    End
  28.    Begin Threed.SSPanel SSPanel1 
  29.       Align           =   1  'Align Top
  30.       Height          =   480
  31.       Left            =   0
  32.       TabIndex        =   1
  33.       Top             =   0
  34.       Width           =   9705
  35.       _Version        =   65536
  36.       _ExtentX        =   17119
  37.       _ExtentY        =   847
  38.       _StockProps     =   15
  39.       ForeColor       =   -2147483640
  40.       BackColor       =   12632256
  41.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  42.          Name            =   "MS Sans Serif"
  43.          Size            =   8.25
  44.          Charset         =   0
  45.          Weight          =   400
  46.          Underline       =   0   'False
  47.          Italic          =   0   'False
  48.          Strikethrough   =   0   'False
  49.       EndProperty
  50.       Begin VB.ComboBox cmb_Function 
  51.          Height          =   315
  52.          Left            =   1365
  53.          TabIndex        =   2
  54.          Top             =   90
  55.          Width           =   7095
  56.       End
  57.       Begin Threed.SSCommand cmdNP 
  58.          Height          =   300
  59.          Index           =   1
  60.          Left            =   9360
  61.          TabIndex        =   6
  62.          Top             =   90
  63.          Width           =   255
  64.          _Version        =   65536
  65.          _ExtentX        =   450
  66.          _ExtentY        =   529
  67.          _StockProps     =   78
  68.          Caption         =   ">"
  69.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  70.             Name            =   "MS Sans Serif"
  71.             Size            =   8.25
  72.             Charset         =   0
  73.             Weight          =   400
  74.             Underline       =   0   'False
  75.             Italic          =   0   'False
  76.             Strikethrough   =   0   'False
  77.          EndProperty
  78.          BevelWidth      =   1
  79.          Font3D          =   3
  80.          RoundedCorners  =   0   'False
  81.          Outline         =   0   'False
  82.       End
  83.       Begin Threed.SSCommand cmdNP 
  84.          Height          =   300
  85.          Index           =   0
  86.          Left            =   8520
  87.          TabIndex        =   5
  88.          Top             =   90
  89.          Width           =   255
  90.          _Version        =   65536
  91.          _ExtentX        =   450
  92.          _ExtentY        =   529
  93.          _StockProps     =   78
  94.          Caption         =   "<"
  95.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  96.             Name            =   "MS Sans Serif"
  97.             Size            =   8.25
  98.             Charset         =   0
  99.             Weight          =   400
  100.             Underline       =   0   'False
  101.             Italic          =   0   'False
  102.             Strikethrough   =   0   'False
  103.          EndProperty
  104.          BevelWidth      =   1
  105.          Font3D          =   3
  106.          RoundedCorners  =   0   'False
  107.          Outline         =   0   'False
  108.       End
  109.       Begin Threed.SSCommand SSCommand1 
  110.          Default         =   -1  'True
  111.          Height          =   300
  112.          Left            =   8835
  113.          TabIndex        =   3
  114.          Top             =   90
  115.          Width           =   465
  116.          _Version        =   65536
  117.          _ExtentX        =   820
  118.          _ExtentY        =   529
  119.          _StockProps     =   78
  120.          Caption         =   "&Go"
  121.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  122.             Name            =   "MS Sans Serif"
  123.             Size            =   8.25
  124.             Charset         =   0
  125.             Weight          =   400
  126.             Underline       =   0   'False
  127.             Italic          =   0   'False
  128.             Strikethrough   =   0   'False
  129.          EndProperty
  130.          BevelWidth      =   1
  131.          RoundedCorners  =   0   'False
  132.          Outline         =   0   'False
  133.       End
  134.       Begin VB.Label Label2 
  135.          Caption         =   "&Select a function"
  136.          Height          =   255
  137.          Left            =   90
  138.          TabIndex        =   4
  139.          Top             =   120
  140.          Width           =   1275
  141.       End
  142.    End
  143. End
  144. Attribute VB_Name = "frmEncrypt"
  145. Attribute VB_GlobalNameSpace = False
  146. Attribute VB_Creatable = False
  147. Attribute VB_PredeclaredId = True
  148. Attribute VB_Exposed = False
  149. Option Explicit
  150. Option Base 1
  151.  
  152. Private Const Iteration = 10
  153.  
  154. Dim IsLoaded         As Integer
  155.  
  156. Dim TimerStartOk     As Integer
  157. Dim TimerCloseOk     As Integer
  158.  
  159. Dim TimerHandle      As Integer
  160. Dim TimerValue       As Long
  161.  
  162. Private Sub cmdNP_Click(Index As Integer)
  163.  
  164.    Call sub_NextPrev(cmb_Function, Index)
  165.  
  166. End Sub
  167.  
  168.  
  169. Private Sub cmb_Function_Click()
  170.    
  171.    If (IsLoaded = False) Then Exit Sub
  172.    
  173.    Call cDisableFI(mdiT2W.Picture1)
  174.    
  175.    txt_Result = ""
  176.    
  177.    DoEvents
  178.    
  179.    Select Case cmb_Function.ListIndex
  180.       Case 0
  181.          Call TestStringEncrypt
  182.       Case 1
  183.          Call TestFileEncrypt
  184.       Case 2
  185.          Call TestDESencrypt
  186.       Case 3
  187.          Call TestDESencryptFile
  188.       Case 4
  189.          Call TestIDEAencrypt
  190.       Case 5
  191.          Call TestIDEAencryptFile
  192.       Case 6
  193.          Call TestDIAMONDencrypt(DIAMOND_FULL_MODE1)
  194.       Case 7
  195.          Call TestDIAMONDencryptFile(DIAMOND_FULL_MODE1)
  196.       Case 8
  197.          Call TestDIAMONDencrypt(DIAMOND_LITE_MODE1)
  198.       Case 9
  199.          Call TestDIAMONDencryptFile(DIAMOND_LITE_MODE1)
  200.       Case 10
  201.          Call TestDIAMONDencrypt(DIAMOND_FULL_MODE2)
  202.       Case 11
  203.          Call TestDIAMONDencryptFile(DIAMOND_FULL_MODE2)
  204.       Case 12
  205.          Call TestDIAMONDencrypt(DIAMOND_LITE_MODE2)
  206.       Case 13
  207.          Call TestDIAMONDencryptFile(DIAMOND_LITE_MODE2)
  208.       Case 14
  209.          Call TestRUBYencrypt(RUBY_MODE_MINIMUM)
  210.       Case 15
  211.          Call TestRUBYencryptFile(RUBY_MODE_MINIMUM)
  212.       Case 16
  213.          Call TestRUBYencrypt(RUBY_MODE_PORTABLE_SAFE)
  214.       Case 17
  215.          Call TestRUBYencryptFile(RUBY_MODE_PORTABLE_SAFE)
  216.       Case 18
  217.          Call TestRUBYencrypt(RUBY_MODE_FORT_KNOX)
  218.       Case 19
  219.          Call TestRUBYencryptFile(RUBY_MODE_FORT_KNOX)
  220.    End Select
  221.  
  222.    DoEvents
  223.    Call cEnableFI(mdiT2W.Picture1)
  224.    
  225. End Sub
  226.  
  227.  
  228. Private Sub Form_Activate()
  229.  
  230.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  231.  
  232. End Sub
  233.  
  234. Private Sub Form_Load()
  235.  
  236.    IsLoaded = False
  237.    
  238.    Show
  239.  
  240.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_encrypt.t2w")
  241.    
  242.    IsLoaded = True
  243.    
  244. End Sub
  245.  
  246. Private Sub SSCommand1_Click()
  247.    
  248.    Call cmb_Function_Click
  249.    
  250. End Sub
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258. Private Sub TestFileEncrypt()
  259.  
  260.    Dim lResult          As Long
  261.    Dim strResult        As String
  262.    Dim strDisplay       As String
  263.    
  264.    Dim i                As Integer
  265.    
  266.    Dim File1            As String
  267.    Dim File2            As String
  268.    Dim File3            As String
  269.    Dim Key              As String
  270.    
  271.    strResult = ""
  272.    strDisplay = ""
  273.    
  274.    File1 = T2WFileTest
  275.    File2 = "autoexec.encrypted"
  276.    File3 = "autoexec.decrypted"
  277.    Key = "1234567890"
  278.  
  279.    For i = ENCRYPT_LEVEL_0 To ENCRYPT_LEVEL_4
  280.       strDisplay = strDisplay & "Encrypt (level " & i & ") '" & File1 & "' with '?' to '" & File2 & "' is " & cFileEncrypt(File1, File2, Key, i) & vbCrLf
  281.       strDisplay = strDisplay & "Decrypt (level " & i & ") '" & File2 & "' with '?' to '" & File3 & "' is " & cFileDecrypt(File2, File3, Key, i) & vbCrLf
  282.       strDisplay = strDisplay & "Compare (ns) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  283.    Next i
  284.  
  285.    txt_Result = strDisplay
  286.  
  287.    'time the function
  288.  
  289.    TimerHandle = cTimerOpen()
  290.    TimerStartOk = cTimerStart(TimerHandle)
  291.    
  292.    For i = 1 To Iteration
  293.       lResult = cFileEncrypt(File1, File2, Key, ENCRYPT_LEVEL_3)
  294.    Next i
  295.    
  296.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  297.    
  298.    TimerCloseOk = cTimerClose(TimerHandle)
  299.  
  300. End Sub
  301.  
  302. Public Sub TestStringEncrypt()
  303.  
  304.    Dim lResult          As Long
  305.    Dim strResult        As String
  306.    Dim strDisplay       As String
  307.    
  308.    Dim i                As Integer
  309.    
  310.    Dim Str1             As String
  311.    Dim Str2             As String
  312.    Dim Key              As String
  313.    
  314.    strResult = ""
  315.    strDisplay = ""
  316.    
  317.    Str1 = "T2WIN-32, t2win-32"
  318.    Key = "1234567890"
  319.  
  320.    For i = ENCRYPT_LEVEL_0 To ENCRYPT_LEVEL_4
  321.       Str2 = cEncrypt(Str1, Key, i)
  322.       strDisplay = strDisplay & "Encrypt (level " & i & ") of [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  323.       strDisplay = strDisplay & "Decrypt (level " & i & ") of [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDecrypt(Str2, Key, i) & "]" & vbCrLf & vbCrLf
  324.    Next i
  325.    
  326.    strDisplay = strDisplay & vbCrLf
  327.  
  328.    Str1 = "Windows 95/NT : Hints and Tips"
  329.  
  330.    For i = ENCRYPT_LEVEL_0 To ENCRYPT_LEVEL_4
  331.       Str2 = cEncrypt(Str1, Key, i)
  332.       strDisplay = strDisplay & "Encrypt (level " & i & ") of [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  333.       strDisplay = strDisplay & "Decrypt (level " & i & ") of [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDecrypt(Str2, Key, i) & "]" & vbCrLf & vbCrLf
  334.    Next i
  335.   
  336.    strDisplay = strDisplay & vbCrLf
  337.  
  338.    Str1 = "Under the sky, the sun lights"
  339.    
  340.    For i = ENCRYPT_LEVEL_0 To ENCRYPT_LEVEL_4
  341.       Str2 = cEncrypt(Str1, Key, i)
  342.       strDisplay = strDisplay & "Encrypt (level " & i & ") of [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  343.       strDisplay = strDisplay & "Decrypt (level " & i & ") of [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDecrypt(Str2, Key, i) & "]" & vbCrLf & vbCrLf
  344.    Next i
  345.    
  346.    strDisplay = strDisplay & vbCrLf
  347.  
  348.    txt_Result = strDisplay
  349.  
  350.    'time the function
  351.  
  352.    TimerHandle = cTimerOpen()
  353.    TimerStartOk = cTimerStart(TimerHandle)
  354.    
  355.    For i = 1 To Iteration
  356.       strResult = cEncrypt(Str1, Key, ENCRYPT_LEVEL_3)
  357.    Next i
  358.    
  359.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  360.    
  361.    TimerCloseOk = cTimerClose(TimerHandle)
  362.  
  363. End Sub
  364.  
  365. Private Sub TestDESencrypt()
  366.  
  367.    Dim lResult          As Long
  368.    Dim strResult        As String
  369.    Dim strDisplay       As String
  370.    
  371.    Dim i                As Integer
  372.    
  373.    Dim Str1             As String
  374.    Dim Str2             As String
  375.    Dim Key              As String
  376.    
  377.    strResult = ""
  378.    strDisplay = ""
  379.    
  380.    Key = "1234567890"
  381.    
  382.    Str1 = "TIME TO WIN (32-Bit)"
  383.  
  384.    Str2 = cDESencrypt(Str1, Key)
  385.    strDisplay = strDisplay & "DESencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  386.    strDisplay = strDisplay & "DESdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDESdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
  387.    
  388.    strDisplay = strDisplay & vbCrLf
  389.  
  390.    Str1 = "T2WIN-32 a DLL for VB 4.0"
  391.  
  392.    Str2 = cDESencrypt(Str1, Key)
  393.    strDisplay = strDisplay & "DESencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  394.    strDisplay = strDisplay & "DESdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDESdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
  395.    
  396.    strDisplay = strDisplay & vbCrLf
  397.  
  398.    Str1 = "Windows 95/NT : Hints and Tips"
  399.  
  400.    Str2 = cDESencrypt(Str1, Key)
  401.    strDisplay = strDisplay & "DESencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  402.    strDisplay = strDisplay & "DESdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDESdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
  403.   
  404.    strDisplay = strDisplay & vbCrLf
  405.  
  406.    Str1 = "Under the sky, the sun lights"
  407.    
  408.    Str2 = cDESencrypt(Str1, Key)
  409.    strDisplay = strDisplay & "DESencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  410.    strDisplay = strDisplay & "DESdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDESdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
  411.    
  412.    strDisplay = strDisplay & vbCrLf
  413.  
  414.    Str1 = "the fox jump over over the lazy dogs"
  415.    
  416.    Str2 = cDESencrypt(Str1, Key)
  417.    strDisplay = strDisplay & "DESencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  418.    strDisplay = strDisplay & "DESdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDESdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
  419.    
  420.    strDisplay = strDisplay & vbCrLf
  421.  
  422.    txt_Result = strDisplay
  423.    
  424.    'time the function
  425.  
  426.    TimerHandle = cTimerOpen()
  427.    TimerStartOk = cTimerStart(TimerHandle)
  428.    
  429.    For i = 1 To Iteration
  430.       strResult = cDESencrypt(Str1, Key)
  431.    Next i
  432.    
  433.    strResult = cDESencrypt(strResult, Key)
  434.    
  435.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  436.    
  437.    TimerCloseOk = cTimerClose(TimerHandle)
  438.    
  439. End Sub
  440.  
  441. Private Sub TestIDEAencrypt()
  442.  
  443.    Dim lResult          As Long
  444.    Dim strResult        As String
  445.    Dim strDisplay       As String
  446.    
  447.    Dim i                As Integer
  448.    
  449.    Dim Str1             As String
  450.    Dim Str2             As String
  451.    Dim Key              As String
  452.    
  453.    strResult = ""
  454.    strDisplay = ""
  455.    
  456.    Key = "1234567890123456"
  457.    
  458.    Str1 = "TIME TO WIN (32-Bit)"
  459.  
  460.    Str2 = cIDEAencrypt(Str1, Key)
  461.    strDisplay = strDisplay & "IDEAencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  462.    strDisplay = strDisplay & "IDEAdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cIDEAdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
  463.    
  464.    strDisplay = strDisplay & vbCrLf
  465.  
  466.    Str1 = "T2WIN-32 a DLL for VB 4.0"
  467.  
  468.    Str2 = cIDEAencrypt(Str1, Key)
  469.    strDisplay = strDisplay & "IDEAencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  470.    strDisplay = strDisplay & "IDEAdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cIDEAdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
  471.    
  472.    strDisplay = strDisplay & vbCrLf
  473.  
  474.    Str1 = "Windows 95/NT : Hints and Tips"
  475.  
  476.    Str2 = cIDEAencrypt(Str1, Key)
  477.    strDisplay = strDisplay & "IDEAencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  478.    strDisplay = strDisplay & "IDEAdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cIDEAdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
  479.   
  480.    strDisplay = strDisplay & vbCrLf
  481.  
  482.    Str1 = "Under the sky, the sun lights"
  483.    
  484.    Str2 = cIDEAencrypt(Str1, Key)
  485.    strDisplay = strDisplay & "IDEAencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  486.    strDisplay = strDisplay & "IDEAdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cIDEAdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
  487.    
  488.    strDisplay = strDisplay & vbCrLf
  489.  
  490.    Str1 = "the fox jump over over the lazy dogs"
  491.    
  492.    Str2 = cIDEAencrypt(Str1, Key)
  493.    strDisplay = strDisplay & "IDEAencrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  494.    strDisplay = strDisplay & "IDEAdecrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cIDEAdecrypt(Str2, Key) & "]" & vbCrLf & vbCrLf
  495.    
  496.    strDisplay = strDisplay & vbCrLf
  497.  
  498.    txt_Result = strDisplay
  499.    
  500.    'time the function
  501.  
  502.    TimerHandle = cTimerOpen()
  503.    TimerStartOk = cTimerStart(TimerHandle)
  504.    
  505.    For i = 1 To Iteration
  506.       strResult = cIDEAencrypt(Str1, Key)
  507.    Next i
  508.    
  509.    strResult = cIDEAencrypt(strResult, Key)
  510.    
  511.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  512.    
  513.    TimerCloseOk = cTimerClose(TimerHandle)
  514.  
  515. End Sub
  516.  
  517. Private Sub TestDESencryptFile()
  518.  
  519.    Dim lResult          As Long
  520.    Dim strResult        As String
  521.    Dim strDisplay       As String
  522.    
  523.    Dim i                As Integer
  524.    
  525.    Dim File1            As String
  526.    Dim File2            As String
  527.    Dim File3            As String
  528.    Dim Key              As String
  529.    
  530.    strResult = ""
  531.    strDisplay = ""
  532.    
  533.    File1 = T2WFileTest
  534.    File2 = "autoexec.desencrypted"
  535.    File3 = "autoexec.desdecrypted"
  536.    Key = "1234567890"
  537.  
  538.    strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
  539.  
  540.    strDisplay = strDisplay & "DESencryptFile '" & File1 & "' with '?' to '" & File2 & "' is " & cDESencryptFile(File1, File2, Key) & vbCrLf
  541.    strDisplay = strDisplay & "DESdecryptFile '" & File2 & "' with '?' to '" & File3 & "' is " & cDESdecryptFile(File2, File3, Key) & vbCrLf
  542.    strDisplay = strDisplay & "Compare (ns) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  543.    
  544.    txt_Result = strDisplay
  545.  
  546.    'time the function
  547.  
  548.    TimerHandle = cTimerOpen()
  549.    TimerStartOk = cTimerStart(TimerHandle)
  550.    
  551.    For i = 1 To Iteration
  552.       lResult = cDESencryptFile(File1, File2, Key)
  553.    Next i
  554.    
  555.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  556.    
  557.    TimerCloseOk = cTimerClose(TimerHandle)
  558.  
  559. End Sub
  560.  
  561. Private Sub TestIDEAencryptFile()
  562.  
  563.    Dim lResult          As Long
  564.    Dim strResult        As String
  565.    Dim strDisplay       As String
  566.    
  567.    Dim i                As Integer
  568.    
  569.    Dim File1            As String
  570.    Dim File2            As String
  571.    Dim File3            As String
  572.    Dim Key              As String
  573.    
  574.    strResult = ""
  575.    strDisplay = ""
  576.    
  577.    File1 = T2WFileTest
  578.    File2 = "autoexec.ideaencrypted"
  579.    File3 = "autoexec.ideadecrypted"
  580.    Key = "1234567890123456"
  581.  
  582.    strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
  583.  
  584.    strDisplay = strDisplay & "IDEAencryptFile '" & File1 & "' with '?' to '" & File2 & "' is " & cIDEAencryptFile(File1, File2, Key) & vbCrLf
  585.    strDisplay = strDisplay & "IDEAdecryptFile '" & File2 & "' with '?' to '" & File3 & "' is " & cIDEAdecryptFile(File2, File3, Key) & vbCrLf
  586.    strDisplay = strDisplay & "Compare (ns) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  587.    
  588.    txt_Result = strDisplay
  589.  
  590.    'time the function
  591.  
  592.    TimerHandle = cTimerOpen()
  593.    TimerStartOk = cTimerStart(TimerHandle)
  594.    
  595.    For i = 1 To Iteration
  596.       lResult = cIDEAencryptFile(File1, File2, Key)
  597.    Next i
  598.    
  599.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  600.    
  601.    TimerCloseOk = cTimerClose(TimerHandle)
  602.  
  603. End Sub
  604.  
  605. Private Sub TestDIAMONDencrypt(Mode As Integer)
  606.  
  607.    Dim lResult          As Long
  608.    Dim strResult        As String
  609.    Dim strDisplay       As String
  610.    
  611.    Dim i                As Integer
  612.    
  613.    Dim Str1             As String
  614.    Dim Str2             As String
  615.    Dim Key              As String
  616.    
  617.    strResult = ""
  618.    strDisplay = ""
  619.    
  620.    strDisplay = strDisplay & "DIAMOND " & IIf(((Mode Mod 2) = 1), "Full", "Lite") & " Mode" & IIf(((Mode - 1) / 2) = 0, "1", "2") & vbCrLf & vbCrLf
  621.  
  622.    Key = "1234567890123456"
  623.    
  624.    Str1 = "TIME TO WIN (32-Bit)"
  625.  
  626.    Str2 = cDIAMONDencrypt(Str1, Key, Mode)
  627.    strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  628.    strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDIAMONDdecrypt(Str2, Key, Mode) & "]" & vbCrLf
  629.    
  630.    strDisplay = strDisplay & vbCrLf
  631.  
  632.    Str1 = "T2WIN-32 a DLL for VB 4.0"
  633.  
  634.    Str2 = cDIAMONDencrypt(Str1, Key, Mode)
  635.    strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  636.    strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDIAMONDdecrypt(Str2, Key, Mode) & "]" & vbCrLf
  637.    
  638.    strDisplay = strDisplay & vbCrLf
  639.  
  640.    Str1 = "Under the sky, the sun lights"
  641.    
  642.    Str2 = cDIAMONDencrypt(Str1, Key, Mode)
  643.    strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  644.    strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDIAMONDdecrypt(Str2, Key, Mode) & "]" & vbCrLf
  645.    
  646.    strDisplay = strDisplay & vbCrLf
  647.  
  648.    Str1 = "the fox jump over over the lazy dogs"
  649.    
  650.    Str2 = cDIAMONDencrypt(Str1, Key, Mode)
  651.    strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  652.    strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cDIAMONDdecrypt(Str2, Key, Mode) & "]" & vbCrLf
  653.    
  654.    strDisplay = strDisplay & vbCrLf
  655.  
  656.    txt_Result = strDisplay
  657.    
  658.    'time the function
  659.  
  660.    TimerHandle = cTimerOpen()
  661.    TimerStartOk = cTimerStart(TimerHandle)
  662.    
  663.    For i = 1 To Iteration
  664.       strResult = cDIAMONDencrypt(Str1, Key, Mode)
  665.    Next i
  666.    
  667.    strResult = cDIAMONDencrypt(strResult, Key, Mode)
  668.    
  669.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  670.    
  671.    TimerCloseOk = cTimerClose(TimerHandle)
  672.  
  673. End Sub
  674.  
  675. Private Sub TestDIAMONDencryptFile(Mode As Integer)
  676.  
  677.    Dim lResult          As Long
  678.    Dim strResult        As String
  679.    Dim strDisplay       As String
  680.    
  681.    Dim i                As Integer
  682.    
  683.    Dim File1            As String
  684.    Dim File2            As String
  685.    Dim File3            As String
  686.    Dim Key              As String
  687.    
  688.    strResult = ""
  689.    strDisplay = ""
  690.    
  691.    strDisplay = strDisplay & "DIAMOND " & IIf(((Mode Mod 2) = 1), "Full", "Lite") & " Mode" & IIf(((Mode - 1) / 2) = 0, "1", "2") & vbCrLf & vbCrLf
  692.  
  693.    File1 = T2WFileTest
  694.    File2 = "autoexec.DIAMONDencrypted"
  695.    File3 = "autoexec.DIAMONDdecrypted"
  696.    Key = "1234567890123456"
  697.  
  698.    strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
  699.  
  700.    strDisplay = strDisplay & "encryptFile '" & File1 & "' with '?' to '" & File2 & "' is " & cDIAMONDencryptFile(File1, File2, Key, Mode) & vbCrLf
  701.    strDisplay = strDisplay & "decryptFile '" & File2 & "' with '?' to '" & File3 & "' is " & cDIAMONDdecryptFile(File2, File3, Key, Mode) & vbCrLf
  702.    strDisplay = strDisplay & "Compare (ns) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  703.    
  704.    txt_Result = strDisplay
  705.  
  706.    'time the function
  707.  
  708.    TimerHandle = cTimerOpen()
  709.    TimerStartOk = cTimerStart(TimerHandle)
  710.    
  711.    For i = 1 To Iteration
  712.       lResult = cDIAMONDencryptFile(File1, File2, Key, Mode)
  713.    Next i
  714.    
  715.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  716.    
  717.    TimerCloseOk = cTimerClose(TimerHandle)
  718.  
  719. End Sub
  720.  
  721. Private Sub TestRUBYencrypt(Mode As Integer)
  722.  
  723.    Dim lResult          As Long
  724.    Dim strResult        As String
  725.    Dim strDisplay       As String
  726.    
  727.    Dim i                As Integer
  728.    
  729.    Dim Str1             As String
  730.    Dim Str2             As String
  731.    Dim Key              As String
  732.    
  733.    Dim DescMode         As String
  734.    
  735.    strResult = ""
  736.    strDisplay = ""
  737.    
  738.    Select Case Mode
  739.       Case RUBY_MODE_MINIMUM: DescMode = "RUBY - minimum"
  740.       Case RUBY_MODE_DESK_LOCK: DescMode = "RUBY - desk lock"
  741.       Case RUBY_MODE_DEAD_BOLT: DescMode = "RUBY - dead bolt"
  742.       Case RUBY_MODE_PORTABLE_SAFE: DescMode = "RUBY - portable safe"
  743.       Case RUBY_MODE_ANCHORED_SAFE: DescMode = "RUBY - anchored safe"
  744.       Case RUBY_MODE_BANK_VAULT: DescMode = "RUBY - bank vault"
  745.       Case RUBY_MODE_FORT_KNOX: DescMode = "RUBY - FORT KNOX"
  746.    End Select
  747.    
  748.    strDisplay = strDisplay & DescMode & vbCrLf & vbCrLf
  749.  
  750.    Key = "1234567890123456"
  751.    
  752.    Str1 = "TIME TO WIN (32-Bit)"
  753.  
  754.    Str2 = cRUBYencrypt(Str1, Key, Mode)
  755.    strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  756.    strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cRUBYdecrypt(Str2, Key, Mode) & "]" & vbCrLf
  757.    
  758.    strDisplay = strDisplay & vbCrLf
  759.  
  760.    Str1 = "T2WIN-32 a DLL for VB 4.0"
  761.  
  762.    Str2 = cRUBYencrypt(Str1, Key, Mode)
  763.    strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  764.    strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cRUBYdecrypt(Str2, Key, Mode) & "]" & vbCrLf
  765.    
  766.    strDisplay = strDisplay & vbCrLf
  767.  
  768.    Str1 = "Under the sky, the sun lights"
  769.    
  770.    Str2 = cRUBYencrypt(Str1, Key, Mode)
  771.    strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  772.    strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cRUBYdecrypt(Str2, Key, Mode) & "]" & vbCrLf
  773.    
  774.    strDisplay = strDisplay & vbCrLf
  775.  
  776.    Str1 = "the fox jump over over the lazy dogs"
  777.    
  778.    Str2 = cRUBYencrypt(Str1, Key, Mode)
  779.    strDisplay = strDisplay & "encrypt [" & Str1 & "] with '?' is [" & cFilterChars(Str2, Chr$(0)) & "]" & vbCrLf
  780.    strDisplay = strDisplay & "decrypt [" & cFilterChars(Str2, Chr$(0)) & "] with '?' is [" & cRUBYdecrypt(Str2, Key, Mode) & "]" & vbCrLf
  781.    
  782.    strDisplay = strDisplay & vbCrLf
  783.  
  784.    txt_Result = strDisplay
  785.    
  786.    'time the function
  787.  
  788.    TimerHandle = cTimerOpen()
  789.    TimerStartOk = cTimerStart(TimerHandle)
  790.    
  791.    For i = 1 To Iteration
  792.       strResult = cRUBYencrypt(Str1, Key, Mode)
  793.    Next i
  794.    
  795.    strResult = cRUBYencrypt(strResult, Key, Mode)
  796.    
  797.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  798.    
  799.    TimerCloseOk = cTimerClose(TimerHandle)
  800.  
  801. End Sub
  802.  
  803. Private Sub TestRUBYencryptFile(Mode As Integer)
  804.    
  805.    Dim lResult          As Long
  806.    Dim strResult        As String
  807.    Dim strDisplay       As String
  808.    
  809.    Dim i                As Integer
  810.    
  811.    Dim File1            As String
  812.    Dim File2            As String
  813.    Dim File3            As String
  814.    Dim Key              As String
  815.    
  816.    Dim DescMode         As String
  817.    
  818.    strResult = ""
  819.    strDisplay = ""
  820.    
  821.    Select Case Mode
  822.       Case RUBY_MODE_MINIMUM: DescMode = "RUBY - minimum"
  823.       Case RUBY_MODE_DESK_LOCK: DescMode = "RUBY - desk lock"
  824.       Case RUBY_MODE_DEAD_BOLT: DescMode = "RUBY - dead bolt"
  825.       Case RUBY_MODE_PORTABLE_SAFE: DescMode = "RUBY - portable safe"
  826.       Case RUBY_MODE_ANCHORED_SAFE: DescMode = "RUBY - anchored safe"
  827.       Case RUBY_MODE_BANK_VAULT: DescMode = "RUBY - bank vault"
  828.       Case RUBY_MODE_FORT_KNOX: DescMode = "RUBY - FORT KNOX"
  829.    End Select
  830.  
  831.    strDisplay = strDisplay & DescMode & vbCrLf & vbCrLf
  832.  
  833.    File1 = T2WFileTest
  834.    File2 = "autoexec.RUBYencrypted"
  835.    File3 = "autoexec.RUBYdecrypted"
  836.    Key = "1234567890123456"
  837.  
  838.    strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
  839.  
  840.    strDisplay = strDisplay & "encryptFile '" & File1 & "' with '?' to '" & File2 & "' is " & cRUBYencryptFile(File1, File2, Key, Mode) & vbCrLf
  841.    strDisplay = strDisplay & "decryptFile '" & File2 & "' with '?' to '" & File3 & "' is " & cRUBYdecryptFile(File2, File3, Key, Mode) & vbCrLf
  842.    strDisplay = strDisplay & "Compare (ns) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  843.    
  844.    txt_Result = strDisplay
  845.    
  846.    'time the function
  847.  
  848.    TimerHandle = cTimerOpen()
  849.    TimerStartOk = cTimerStart(TimerHandle)
  850.    
  851.    For i = 1 To Iteration
  852.       lResult = cRUBYencryptFile(File1, File2, Key, Mode)
  853.    Next i
  854.    
  855.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  856.    
  857.    TimerCloseOk = cTimerClose(TimerHandle)
  858.  
  859. End Sub
  860.