dave_c
Jan 23rd, 2000, 04:24 AM
This is a really straightforward problem, but basically i need a password screen with password, and the option to change the password (obviously you will have to ask for the current password). Piss i know, but im a bit of a newbie.
MartinLiss
Jan 23rd, 2000, 08:01 AM
Just put a TextBox on a form and set the TextBox's Password property to "*". Then code MyForm.Show vbModal. If what the user then types into the TextBox matches the password, unload MyForm, otherwise display an error message.
------------------
Marty
Can you buy an entire chess set in a pawn shop?
Tonio169
Jan 23rd, 2000, 10:03 AM
you could also create an encrypted file to store the passwords there and change it's contents when ever an authorized user wants to change password.
venkatraman_r
Jan 23rd, 2000, 04:21 PM
I too, have heared of this crypting technology for storing the passwords..Can any of you please tell me the way how to encrypt the files and validate if there is a correct password given by the user??
------------------
Regards,
Venkat
venkatraman_r@hotmail.com
ICQ: 45714766
http://venkat.iscool.net
Venkat,
The most common way of encrypting in VB is to convert the value to ascii and store it numerically. This is also very common and always looked for by those who try to crack passwords and hack programs.
To increase the strength of your encryption you can run the subsequent ascii values through a one way mathmatical equation. Then when the user types in his/her password also change the new value to ascii and run it through the same equation and check to see if the value match. If they match then the password is valid.
------------------
Boothman
There is a war out there and it is about who controls the information, it's all about the information.
DiGiTaIErRoR
Jan 24th, 2000, 12:41 AM
here's a way of encrypting if you don't get how...
If you have VB6 ignore this part:
Public Function Replace(Msg As String, A As String, B As String)
Dim I As Integer
I = InStr(Msg$, A$)
While I <> 0
Msg$ = Left$(Msg$, I - 1) & B$ & Mid$(Msg$, I + Len(A$))
I = InStr(I + Len(A$), Msg$, A$)
Wend
Replace = Msg$
End Function
VB6 includes this command anyway the rest of the code:
Public Function Crypt(TxtBox1 As TextBox)
Dim ASCode As String
Dim ASCodVar As String
For x = 1 To Len(TxtBox1)
ASCodVar = Asc(Mid$(TxtBox1, x, 1))
If Len(ASCodVar) < 3 Then
Do
ASCodVar = "0" & ASCodVar
Loop Until Len(ASCodVar) = 3
End If
ASCode = ASCode & ASCodVar
Next x
Crypt = ASCode
End Function
Public Function DeCrypt(TxtBox1 As String)
Dim myChar As String
Dim DCrypt As String
For x = 1 To Len(TxtBox1) Step 3
myChar = Chr$(Mid$(TxtBox1, x, 3))
DCrypt = DCrypt & myChar
Next x
DeCrypt = DCrypt
End Function
Private Sub Command1_Click()
code$ = Crypt(Text1)
code$ = Replace(code$, "0", "*")
code$ = Replace(code$, "1", "$")
code$ = Replace(code$, "2", "^")
code$ = Replace(code$, "3", "~")
code$ = Replace(code$, "4", "@")
code$ = Replace(code$, "5", "`")
code$ = Replace(code$, "6", "?")
code$ = Replace(code$, "7", "|")
code$ = Replace(code$, "8", "!")
code$ = Replace(code$, "9", "%")
Text2.Text = code$
End Sub
Private Sub Command2_Click()
code$ = Text2.Text
code$ = Replace(code$, "*", "0")
code$ = Replace(code$, "$", "1")
code$ = Replace(code$, "^", "2")
code$ = Replace(code$, "~", "3")
code$ = Replace(code$, "@", "4")
code$ = Replace(code$, "`", "5")
code$ = Replace(code$, "?", "6")
code$ = Replace(code$, "|", "7")
code$ = Replace(code$, "!", "8")
code$ = Replace(code$, "%", "9")
Text3.Text = DeCrypt(code$)
End Sub
what this does:
converts the characters into the ASCii reference then changes the numbers into characters then back upon request
pretty simple
Good Luck
------------------
DiGiTaIErRoR
all modern encryption techniques use the XOR mathematical operator, look it up on the MSDN website