Hey, Im using a flat file to store details of an administrator (username, password, and some file settings). The password gets converted letter by letter to hex and has 11hex added to each. It is then stored in this format. When comparing an input password against the stored one, the conversion of the input one matches, but it shows an error (my program, not VB6) saying they dont match.
This is the code for the 'encryption' and comparing:
Public Function strHex(convert As String) As String
Dim index As Integer
Dim strShort As String
For index = 1 To Len(convert)
strShort = Mid(convert, index, 1)
strHex = strHex + (Hex$(Asc(strShort)) & Hex$(11))
Next
MsgBox (strHex)
End Function
Public Function loginAdmin() As Boolean
Rem validates the password entered admin details
Dim AdminRec As AdminRecord
loginAdmin = True
Open flpath & flName For Random As #1
Get #1, 1, AdminRec
If (MOSgui.txtUserName <> RTrim(AdminRec.UserName)) Then
MsgBox ("Invalid user"
loginAdmin = False
End If
If (RTrim(MOSgui.txtPassword) <> AdminRec.PassWord) Then
MsgBox ("invalid password"
loginAdmin = False
End If
Close #1
End Function
Im hoping someone can point out what's wrong cause even though ive checked and checked i cant see anything wrong. I even split it up into invalid user / password to determine which comparison was causing the problem. Any help is appreciated.
TIA
~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
This is the code for the 'encryption' and comparing:
Public Function strHex(convert As String) As String
Dim index As Integer
Dim strShort As String
For index = 1 To Len(convert)
strShort = Mid(convert, index, 1)
strHex = strHex + (Hex$(Asc(strShort)) & Hex$(11))
Next
MsgBox (strHex)
End Function
Public Function loginAdmin() As Boolean
Rem validates the password entered admin details
Dim AdminRec As AdminRecord
loginAdmin = True
Open flpath & flName For Random As #1
Get #1, 1, AdminRec
If (MOSgui.txtUserName <> RTrim(AdminRec.UserName)) Then
MsgBox ("Invalid user"
loginAdmin = False
End If
If (RTrim(MOSgui.txtPassword) <> AdminRec.PassWord) Then
MsgBox ("invalid password"
loginAdmin = False
End If
Close #1
End Function
Im hoping someone can point out what's wrong cause even though ive checked and checked i cant see anything wrong. I even split it up into invalid user / password to determine which comparison was causing the problem. Any help is appreciated.
TIA
~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."