Source

wincrypt / Form2.frm

VERSION 2.00
Begin Form Form2 
   Caption         =   "Internal program - DO NOT DISTRIBUTE"
   ClientHeight    =   3600
   ClientLeft      =   1095
   ClientTop       =   1500
   ClientWidth     =   7365
   Height          =   4020
   Left            =   1035
   LinkTopic       =   "Form2"
   ScaleHeight     =   3600
   ScaleWidth      =   7365
   Top             =   1140
   Width           =   7485
   Begin TextBox rba 
      Height          =   375
      Left            =   2760
      TabIndex        =   9
      Text            =   "Text3"
      Top             =   3120
      Width           =   3735
   End
   Begin TextBox rb 
      Height          =   285
      Left            =   2520
      TabIndex        =   8
      Text            =   "Text3"
      Top             =   2760
      Width           =   3375
   End
   Begin CommandButton Command1 
      Caption         =   "&Add"
      Default         =   -1  'True
      Height          =   375
      Left            =   1320
      TabIndex        =   3
      Top             =   2280
      Width           =   3855
   End
   Begin TextBox Text2 
      Height          =   285
      Left            =   1920
      TabIndex        =   5
      Text            =   "WinCrypt.cfg"
      Top             =   1440
      Width           =   5175
   End
   Begin TextBox Text1 
      Height          =   285
      Left            =   2880
      TabIndex        =   4
      Top             =   840
      Width           =   4335
   End
   Begin Label Label5 
      Caption         =   "Test read back after:"
      Height          =   255
      Left            =   840
      TabIndex        =   7
      Top             =   3240
      Width           =   1935
   End
   Begin Label Label4 
      Caption         =   "Test read back:"
      Height          =   255
      Left            =   840
      TabIndex        =   6
      Top             =   2880
      Width           =   1935
   End
   Begin Label Label3 
      Caption         =   "WinCrypt config:"
      Height          =   255
      Left            =   240
      TabIndex        =   2
      Top             =   1440
      Width           =   2775
   End
   Begin Label Label2 
      Caption         =   "Type password to add to file:"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   840
      Width           =   2775
   End
   Begin Label Label1 
      Caption         =   "WinCrypt 1.1 maintainance"
      Height          =   495
      Left            =   480
      TabIndex        =   0
      Top             =   120
      Width           =   6375
   End
End
Dim BinHandle As Integer

Sub Command1_Click ()
TestFile = Text2.Text
If Not CheckFileExistance(TestFile) Then
    MsgBox "That file doesn't exist", 64, "File not found"
    Exit Sub
End If

CypheredString = CryptString(Text1)
ConfigHandle = FreeFile
Open TestFile For Random As ConfigHandle
Put ConfigHandle, 5, CypheredString
MsgBox "String: " & Text1 & Chr(10) & "is: " & CypheredString, 64, "Password entry confirmed"
Get ConfigHandle, 5, ReadBack
rb = ReadBack
rba = CryptString(rb)
Close ConfigHandle
End Sub

Function CryptString (SourceVariant As Variant)
If SourceVariant = "" Then Exit Function
'// Fast exit for speed
Dim i As Long

BinHandle = FreeFile
Open "WinCrypt.bin" For Random As BinHandle

For i = 1 To Len(SourceVariant)
    GetSingleChar = Mid(SourceVariant, i, 1)
    NewSingleChar = SwapChar(GetSingleChar)
    Cry = Cry & NewSingleChar
Next i
Close BinHandle
CryptString = Cry
End Function

Sub Form_Load ()
If Not CheckFileExistance("WinCrypt.bin") Then
    MsgBox "Can't find BIN"
    End
End If
End Sub

Function SwapChar (Source)
'// Do not call directly, use CryptString(SourceVariant)

SourceInt = Asc(Source)
SourceInt = (SourceInt + 1)
Get BinHandle, SourceInt, R
SwapChar = Chr(R)
End Function
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.