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

  1. VERSION 5.00
  2. Begin VB.Form frmCrypt 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Crypt"
  5.    ClientHeight    =   4845
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   7485
  9.    MaxButton       =   0   'False
  10.    MDIChild        =   -1  'True
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   4845
  13.    ScaleWidth      =   7485
  14.    ShowInTaskbar   =   0   'False
  15.    Begin VB.Frame Frame1 
  16.       Height          =   570
  17.       Left            =   0
  18.       TabIndex        =   1
  19.       Top             =   -90
  20.       Width           =   7485
  21.       Begin VB.CommandButton cmdNP 
  22.          Caption         =   ">"
  23.          Height          =   285
  24.          Index           =   1
  25.          Left            =   7110
  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            =   6210
  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            =   6570
  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           =   4755
  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             =   630
  74.       Width           =   7260
  75.    End
  76. End
  77. Attribute VB_Name = "frmCrypt"
  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. Private Sub cmdNP_Click(Index As Integer)
  95.  
  96.    Call sub_NextPrev(cmb_Function, Index)
  97.  
  98. End Sub
  99.  
  100.  
  101. Private Sub cmb_Function_Click()
  102.    
  103.    If (IsLoaded = False) Then Exit Sub
  104.    
  105.    Call cDisableFI(mdiT2W.Picture1)
  106.    
  107.    txt_Result = ""
  108.    
  109.    DoEvents
  110.    
  111.    Select Case cmb_Function.ListIndex
  112.       Case 0
  113.          Call TestFileCrypt
  114.       Case 1
  115.          Call TestCrypt
  116.    End Select
  117.  
  118.    DoEvents
  119.    Call cEnableFI(mdiT2W.Picture1)
  120.    
  121. End Sub
  122.  
  123.  
  124. Private Sub Form_Activate()
  125.  
  126.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  127.  
  128. End Sub
  129.  
  130. Private Sub Form_Load()
  131.  
  132.    IsLoaded = False
  133.    
  134.    Show
  135.  
  136.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_crypt.t2w")
  137.    
  138.    IsLoaded = True
  139.    
  140. End Sub
  141.  
  142. Private Sub Command1_Click()
  143.    
  144.    Call cmb_Function_Click
  145.    
  146. End Sub
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154. Private Sub TestFileCrypt()
  155.  
  156.    Dim lResult          As Long
  157.    Dim strResult        As String
  158.    Dim strDisplay       As String
  159.    
  160.    Dim i                As Integer
  161.    
  162.    Dim File1            As String
  163.    Dim File2            As String
  164.    Dim File3            As String
  165.    
  166.    strResult = ""
  167.    strDisplay = ""
  168.    
  169.    File1 = T2WFileTest
  170.    File2 = "autoexec.hi-encrypted"
  171.    File3 = "autoexec.hi-decrypted"
  172.    
  173.    strDisplay = strDisplay & "File Crypt '" & File1 & "' to '" & File2 & "' with password '1234567' is " & cFileCrypt(File1, File2, "1234567") & vbCrLf
  174.    strDisplay = strDisplay & "File Crypt '" & File2 & "' to '" & File3 & "' with password '1234567' is " & cFileCrypt(File2, File3, "1234567") & vbCrLf
  175.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  176.  
  177.    txt_Result = strDisplay
  178.  
  179.    'time the function
  180.  
  181.    TimerHandle = cTimerOpen()
  182.    TimerStartOk = cTimerStart(TimerHandle)
  183.    
  184.    For i = 1 To Iteration
  185.       lResult = cFileCrypt(File1, File2, "1234567")
  186.    Next i
  187.    
  188.    lResult = cFileCrypt(File2, File3, "1234567")
  189.    
  190.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  191.    
  192.    TimerCloseOk = cTimerClose(TimerHandle)
  193.  
  194. End Sub
  195.  
  196. Public Sub TestCrypt()
  197.  
  198.    Dim lResult          As Long
  199.    Dim strResult        As String
  200.    Dim strDisplay       As String
  201.    
  202.    Dim i                As Integer
  203.    
  204.    Dim Str1             As String
  205.    Dim Str2             As String
  206.    Dim Str3             As String
  207.    
  208.    strResult = ""
  209.    strDisplay = ""
  210.    
  211.    Str1 = "T2WIN-32, t2win-32, T2WIN-32, t2win-32, T2WIN-32, t2win-32"
  212.    Str2 = cCrypt(Str1, "1234567")
  213.    Str3 = cCrypt(Str2, "1234567")
  214.    
  215.    strDisplay = strDisplay & "Crypt '" & Str1 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str2 & "'" & vbCrLf & vbCrLf
  216.    strDisplay = strDisplay & "Crypt '" & Str2 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str3 & "'" & vbCrLf & vbCrLf
  217.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  218.  
  219.    Str1 = String$(30, "a") + String$(6, "b") + String$(5, "c") + String$(4, "d")
  220.    Str2 = cCrypt(Str1, "1234567")
  221.    Str3 = cCrypt(Str2, "1234567")
  222.    
  223.    strDisplay = strDisplay & "Crypt '" & Str1 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str2 & "'" & vbCrLf & vbCrLf
  224.    strDisplay = strDisplay & "Crypt '" & Str2 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str3 & "'" & vbCrLf & vbCrLf
  225.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  226.  
  227.    txt_Result = strDisplay
  228.  
  229.    'time the function
  230.  
  231.    TimerHandle = cTimerOpen()
  232.    TimerStartOk = cTimerStart(TimerHandle)
  233.    
  234.    For i = 1 To Iteration
  235.       Str2 = cCrypt(Str1, "1234567")
  236.    Next i
  237.    
  238.    Str3 = cCrypt(Str2, "1234567")
  239.    
  240.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  241.    
  242.    TimerCloseOk = cTimerClose(TimerHandle)
  243.  
  244. End Sub
  245.