Hello,

I have a fairly basic knowlegde of Visual basic,
I am trying to create a form to create a username and password which is then saved in a .txt file, the problem being that anyone can read it.
Is there any way that it can be simply encrypted before being saved into the .txt file. i ahve created a module for the creation of a username and password. the Creation works and is saved correctly, i just don't undersand the correct code for it to be encrypted before it is saved
Here is the code so far:

Public Sub CreateUser()
On Error GoTo A
Dim User, Pass As String
User = FrmLogin.txtUsernameCreate.Text
Pass = FrmLogin.txtPasswordCreate.Text
Open App.Path & "/Users/" & User & ".txt" For Output As #1
Print #1, User
Print #1, Pass
Close #1
MsgBox "Your Account Has Heen Created Successfully", vbInformation, "Congratulations"
FrmLogin.txtUsernameCreate.Text = ""
FrmLogin.txtPasswordCreate.Text = ""
Exit Sub
A:
MsgBox " Account Cannot Be Created", vbCritical, "Error"
End Sub

Public Sub ChangeASC()

Dim ASC As String

ASC = FrmLogin.txtPasswordCreate.Text
For k = 1 To Len(ASC)
ASC(k) = ASC(k) + (2)

Output = App.Path & "/Users/" & User & ".txt"

End Sub

Thanks in advance!

Ian.

Recommended Answers

You can encrypt any way you like, just as you did is fine.
It might give trouble if the ascii code is 254 or 255.
Find out some information about an XOR function

Jump to Post

All 2 Replies

You can encrypt any way you like, just as you did is fine.
It might give trouble if the ascii code is 254 or 255.
Find out some information about an XOR function

i thing this proj will help you. you have to only save that encrypted text into txt file actualy i have my project which encrypt the whole txt file and then user can also decrypt the whole file again.

below i am giving you my starting work of encryption proj as an example.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.