home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 32 / hot34.iso / ficheros / LVB / T2W32523.ZIP / _CRYPT.FRM < prev    next >
Text File  |  1998-04-07  |  9KB  |  312 lines

  1. VERSION 5.00
  2. Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "THREED32.OCX"
  3. Begin VB.Form frmCrypt 
  4.    BorderStyle     =   4  'Fixed ToolWindow
  5.    Caption         =   "Crypt"
  6.    ClientHeight    =   4845
  7.    ClientLeft      =   1890
  8.    ClientTop       =   3270
  9.    ClientWidth     =   7485
  10.    MaxButton       =   0   'False
  11.    MDIChild        =   -1  'True
  12.    PaletteMode     =   1  'UseZOrder
  13.    ScaleHeight     =   4845
  14.    ScaleWidth      =   7485
  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             =   630
  26.       Width           =   7260
  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           =   7485
  35.       _Version        =   65536
  36.       _ExtentX        =   13203
  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           =   4785
  56.       End
  57.       Begin Threed.SSCommand cmdNP 
  58.          Height          =   300
  59.          Index           =   1
  60.          Left            =   7140
  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            =   6300
  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            =   6615
  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 = "frmCrypt"
  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. Private Sub cmdNP_Click(Index As Integer)
  162.  
  163.    Call sub_NextPrev(cmb_Function, Index)
  164.  
  165. End Sub
  166.  
  167.  
  168. Private Sub cmb_Function_Click()
  169.    
  170.    If (IsLoaded = False) Then Exit Sub
  171.    
  172.    Call cDisableFI(mdiT2W.Picture1)
  173.    
  174.    txt_Result = ""
  175.    
  176.    DoEvents
  177.    
  178.    Select Case cmb_Function.ListIndex
  179.       Case 0
  180.          Call TestFileCrypt
  181.       Case 1
  182.          Call TestCrypt
  183.    End Select
  184.  
  185.    DoEvents
  186.    Call cEnableFI(mdiT2W.Picture1)
  187.    
  188. End Sub
  189.  
  190.  
  191. Private Sub Form_Activate()
  192.  
  193.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  194.  
  195. End Sub
  196.  
  197. Private Sub Form_Load()
  198.  
  199.    IsLoaded = False
  200.    
  201.    Show
  202.  
  203.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_crypt.t2w")
  204.    
  205.    IsLoaded = True
  206.    
  207. End Sub
  208.  
  209. Private Sub SSCommand1_Click()
  210.    
  211.    Call cmb_Function_Click
  212.    
  213. End Sub
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221. Private Sub TestFileCrypt()
  222.  
  223.    Dim lResult          As Long
  224.    Dim strResult        As String
  225.    Dim strDisplay       As String
  226.    
  227.    Dim i                As Integer
  228.    
  229.    Dim File1            As String
  230.    Dim File2            As String
  231.    Dim File3            As String
  232.    
  233.    strResult = ""
  234.    strDisplay = ""
  235.    
  236.    File1 = T2WFileTest
  237.    File2 = "autoexec.hi-encrypted"
  238.    File3 = "autoexec.hi-decrypted"
  239.    
  240.    strDisplay = strDisplay & "File Crypt '" & File1 & "' to '" & File2 & "' with password '1234567' is " & cFileCrypt(File1, File2, "1234567") & vbCrLf
  241.    strDisplay = strDisplay & "File Crypt '" & File2 & "' to '" & File3 & "' with password '1234567' is " & cFileCrypt(File2, File3, "1234567") & vbCrLf
  242.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  243.  
  244.    txt_Result = strDisplay
  245.  
  246.    'time the function
  247.  
  248.    TimerHandle = cTimerOpen()
  249.    TimerStartOk = cTimerStart(TimerHandle)
  250.    
  251.    For i = 1 To Iteration
  252.       lResult = cFileCrypt(File1, File2, "1234567")
  253.    Next i
  254.    
  255.    lResult = cFileCrypt(File2, File3, "1234567")
  256.    
  257.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  258.    
  259.    TimerCloseOk = cTimerClose(TimerHandle)
  260.  
  261. End Sub
  262.  
  263. Public Sub TestCrypt()
  264.  
  265.    Dim lResult          As Long
  266.    Dim strResult        As String
  267.    Dim strDisplay       As String
  268.    
  269.    Dim i                As Integer
  270.    
  271.    Dim Str1             As String
  272.    Dim Str2             As String
  273.    Dim Str3             As String
  274.    
  275.    strResult = ""
  276.    strDisplay = ""
  277.    
  278.    Str1 = "T2WIN-32, t2win-32, T2WIN-32, t2win-32, T2WIN-32, t2win-32"
  279.    Str2 = cCrypt(Str1, "1234567")
  280.    Str3 = cCrypt(Str2, "1234567")
  281.    
  282.    strDisplay = strDisplay & "Crypt '" & Str1 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str2 & "'" & vbCrLf & vbCrLf
  283.    strDisplay = strDisplay & "Crypt '" & Str2 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str3 & "'" & vbCrLf & vbCrLf
  284.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  285.  
  286.    Str1 = String$(30, "a") + String$(6, "b") + String$(5, "c") + String$(4, "d")
  287.    Str2 = cCrypt(Str1, "1234567")
  288.    Str3 = cCrypt(Str2, "1234567")
  289.    
  290.    strDisplay = strDisplay & "Crypt '" & Str1 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str2 & "'" & vbCrLf & vbCrLf
  291.    strDisplay = strDisplay & "Crypt '" & Str2 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str3 & "'" & vbCrLf & vbCrLf
  292.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  293.  
  294.    txt_Result = strDisplay
  295.  
  296.    'time the function
  297.  
  298.    TimerHandle = cTimerOpen()
  299.    TimerStartOk = cTimerStart(TimerHandle)
  300.    
  301.    For i = 1 To Iteration
  302.       Str2 = cCrypt(Str1, "1234567")
  303.    Next i
  304.    
  305.    Str3 = cCrypt(Str2, "1234567")
  306.    
  307.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  308.    
  309.    TimerCloseOk = cTimerClose(TimerHandle)
  310.  
  311. End Sub
  312.