DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Visual Basic 4 / 5 / 6 (http://www.daniweb.com/forums/forum4.html)
-   -   Encrypting a .txt file through VB6 (http://www.daniweb.com/forums/thread161278.html)

Ian90 Dec 8th, 2008 10:44 am
Encrypting a .txt file through VB6
 
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.

ddanbe Dec 10th, 2008 2:20 pm
Re: Encrypting a .txt file through VB6
 
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

andy_aphale Dec 11th, 2008 1:02 pm
Re: Encrypting a .txt file through VB6
 
1 Attachment(s)
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.


All times are GMT -4. The time now is 5:34 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC