home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 35 / hot35.iso / ficheros / LVB / T2W32543.ZIP / _ENCRYPT.FRM < prev    next >
Text File  |  1998-05-21  |  26KB  |  793 lines

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