Encrypting a .txt file through VB6

Reply

Join Date: Dec 2008
Posts: 1
Reputation: Ian90 is an unknown quantity at this point 
Solved Threads: 0
Ian90 Ian90 is offline Offline
Newbie Poster

Encrypting a .txt file through VB6

 
0
  #1
Dec 8th, 2008
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:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Public Sub CreateUser()
  2. On Error GoTo A
  3. Dim User, Pass As String
  4. User = FrmLogin.txtUsernameCreate.Text
  5. Pass = FrmLogin.txtPasswordCreate.Text
  6. Open App.Path & "/Users/" & User & ".txt" For Output As #1
  7. Print #1, User
  8. Print #1, Pass
  9. Close #1
  10. MsgBox "Your Account Has Heen Created Successfully", vbInformation, "Congratulations"
  11. FrmLogin.txtUsernameCreate.Text = ""
  12. FrmLogin.txtPasswordCreate.Text = ""
  13. Exit Sub
  14. A:
  15. MsgBox " Account Cannot Be Created", vbCritical, "Error"
  16. End Sub
  17.  
  18. Public Sub ChangeASC()
  19.  
  20. Dim ASC As String
  21.  
  22. ASC = FrmLogin.txtPasswordCreate.Text
  23. For k = 1 To Len(ASC)
  24. ASC(k) = ASC(k) + (2)
  25.  
  26. Output = App.Path & "/Users/" & User & ".txt"
  27.  
  28. End Sub

Thanks in advance!

Ian.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,908
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 273
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: Encrypting a .txt file through VB6

 
0
  #2
Dec 10th, 2008
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
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 19
Reputation: andy_aphale is an unknown quantity at this point 
Solved Threads: 1
andy_aphale andy_aphale is offline Offline
Newbie Poster

Re: Encrypting a .txt file through VB6

 
0
  #3
Dec 11th, 2008
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.
Attached Files
File Type: zip encrypt & decrypt.zip (1.5 KB, 52 views)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC