NOTE: The names of some variables or procedures may differ from example program. Also, only chunks of code relative the checking the password are shown. Variables are represented with blue text.
The point of the program is that multiple passwords can be used and there's a huge range of possibilities.
Form1:
Code: Select all
Dim Password As String
Dim CSum As Integer
Public Function PasswordEncrypt(inputpassword As String) As String
Dim Character As String, i As Integer
Character = ""
Dim TextLength As Integer
TextLength = Len(inputpassword)
For i = 1 To TextLength
Character = Mid(inputpassword, i, 1)
Select Case Asc(Character)
Case 48 To 57
Character = Chr(Asc(Character) + 50)
CSum = CSum + Asc(Character)
Case 65 To 122
Character= Chr(Asc(Character) + 100)
CSum = CSum + Asc(Character)
End Select
Next
End Function
Private Sub Login_Click()
PasswordLock txtencrypt.Text
Password = ""
If CSum = 1661 Then
Me.tw224.Text = CSum
frmSuccess.Show
Unload Me
Else
FailedLogin
End If
End Sub
Private Sub Form_Load()
CSum = 0
nBeep = 0
End Sub
Private Sub FailedLogin()
tmrBeep.Enabled = True
End Sub
Code: Select all
Private Sub Form_Load()
Dim RSum As Integer
Dim Mult As String
Mult = RSum + 1
Mult = Mult + Mult
RSum = Mult * 151
If Form1.tw224.Text <> RSum Then
Unload Me
End If
End Sub
Code: Select all
Dim CSum As Integer
In this loop, the string is converted to an integer one character at a time using this encryption method I wrote. This is what defines the loop to go through each character.
Code: Select all
Dim TextLength As Integer
TextLength = Len(inputpassword)
Code: Select all
For i = 1 To TextLength
Character = Mid(inputpassword, i, 1)
Select Case Asc(Character)
Case 48 To 57
Character = Chr(Asc(Character) + 50)
CSum = CSum + Asc(Character)
Case 65 To 122
Character = Chr(Asc(Character) + 100)
CSum = CSum + Asc(Character)
End Select
Next
Code: Select all
Case 48 To 57
Character = Chr(Asc(Character) + 50)
CSum = CSum + Asc(Character)
This is for if the current character is a letter:
Code: Select all
Case 65 To 122
Character = Chr(Asc(Character) + 100)
CSum = CSum + Asc(Temp)
Since the CSum is never reset. If the password fails once, it's most likely to never succeed again espcially if the sum exceeds 1661 which doesn't take that many characters.
Now here is the basic use of the sum in the if statement of the command button:
Code: Select all
If CSum = 1661 Then
Me.tw224.Text = CSum
frmSuccess.Show
Unload Me
Else
FailedLogin
End If
Code for frmSuccess:
Code: Select all
Private Sub Form_Load()
Dim RSum As Integer
Dim Mult As String
Mult = RSum + 1
Mult = Mult + Mult
RSum = Mult * 151
If Form1.tw224.Text <> RSum Then
Unload Me
End If
End Sub
Code: Select all
Dim RSum As Integer
Code: Select all
Dim Mult As String
Mult = RSum + 1
Code: Select all
Mult = Mult + Mult
Code: Select all
RSum = Mult * 151
Code: Select all
If Form1.tw224.Text <> RSum Then
Unload Me
End If
Passwords that will work with this (and the demo program)
Code: Select all
yellow00a
pinkdog98
tealgun67
orange6999
cyanredw
smoking14
asshole77
sodazman
If you did not download the demo program while the hack challenge was going on here it is.
'Protect' in a zip file
Hope this is useful
