[RESOLVED] saving top secret data
hi.
First of all i would like to know how can i save data in VB besides saving it in a TXT file or a .DAT that i already know how to do.
But also i want to know how to save some data that the user cannot access (or understand) by opening the save file.
(if i save some data in a TXT the user can open it and read it)
Thanks
Re: saving top secret data
You can encrypt your text before printing to a file.
Here is an Encryption sample by Randy Birch.
Re: saving top secret data
You could use these two functions, one is to encrypt a string, the other is to decrypt the string. So you could use these, encrpty the data before you save it to a txt or dat file. It will make the text unreadable. It can be cracked by someone who knows what they are doing but otherwise its fine. If you need something 100% unbreakable you should be paying a professional to do it for you who knows that they are doing.
VB Code:
Private Function EncryptText(strInput As String) As String
Dim strAsc As String
Dim strMain As String
Dim i as Integer
For i = 1 To Len(strInput)
strAsc = Asc(Mid(strInput, i, 1))
strMain = strMain & Chr(strAsc + 111)
Next i
EncryptText = strMain
End Function
Private Function DecryptText(strInput As String) As String
Dim strAsc As String
Dim strMain As String
Dim i as Integer
For i = 1 To Len(strInput)
strAsc = Asc(Mid(strInput, i, 1))
strMain = strMain & Chr(strAsc - 111)
Next i
DecryptText = strMain
End Function
To call them use
VB Code:
strEncryptedText = EncryptText(Text1.text)
strDecryptedText = DecryptText(Text1.Text)
Re: saving top secret data
Re: [RESOLVED] saving top secret data
Both previous examples are encoding functions (do not require a password).
You should see these 2 threads for much better security:
Average security
VB - 31 Bit Encryption function
Very strong security:
VB - 128, 160 and 256 Bit File Encryption/Decryption with MD5, SHA1 and SHA256
Re: [RESOLVED] saving top secret data
thanks you too.
actually i dont need high security, so previous codes will do.
but ill take a look just to learn, im intrested on that.
Re: [RESOLVED] saving top secret data
Quote:
Originally Posted by CVMichael
I find your code great.
I have a form for password maintenance. I want to use your code in such a way that when the user create a new user and password the password will be save in ACCESS but in an encrypted form. In my log in form the user will type the password and compare the typed password against the saved and encrypted password. Is this possible with your code? If it is I appreciate it very much if you could show me how. thanks!
Re: [RESOLVED] saving top secret data
Quote:
Originally Posted by Simply Me
I find your code great.
I have a form for password maintenance. I want to use your code in such a way that when the user create a new user and password the password will be save in ACCESS but in an encrypted form. In my log in form the user will type the password and compare the typed password against the saved and encrypted password. Is this possible with your code? If it is I appreciate it very much if you could show me how. thanks!
You don't have to use my encryptions for that...
You can HASH the password (one way encryption), and store the password hashed in the database.
When you want to check if the password is correct, you have to hash the password given by the user, and compare the hashed password to see if it's the same as the hashed pasword in the database.
Re: [RESOLVED] saving top secret data
can you show me some code please?
Re: [RESOLVED] saving top secret data
Quote:
Originally Posted by Simply Me
can you show me some code please?
Choose what encryption strength you want to use, copy the class (MD5, SHA, or SHA256) in your project, add it to the project.
Start writing the log in, and write code to retrieve log in info from the database.
I-ll fill in the parts that you don't know after you attached what you have.
Re: [RESOLVED] saving top secret data
Quote:
Originally Posted by Simply Me
can you show me some code please?
See this thread:
http://www.vbforums.com/showthread.p...ght=encryption