Results 1 to 11 of 11

Thread: [RESOLVED] saving top secret data

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    269

    Resolved [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

  2. #2

  3. #3
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    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:
    1. Private Function EncryptText(strInput As String) As String
    2. Dim strAsc As String
    3. Dim strMain As String
    4. Dim i as Integer
    5.  
    6. For i = 1 To Len(strInput)
    7.     strAsc = Asc(Mid(strInput, i, 1))
    8.     strMain = strMain & Chr(strAsc + 111)
    9. Next i
    10.  
    11. EncryptText = strMain
    12. End Function
    13.  
    14. Private Function DecryptText(strInput As String) As String
    15. Dim strAsc As String
    16. Dim strMain As String
    17. Dim i as Integer
    18.  
    19. For i = 1 To Len(strInput)
    20.     strAsc = Asc(Mid(strInput, i, 1))
    21.     strMain = strMain & Chr(strAsc - 111)
    22. Next i
    23.  
    24. DecryptText = strMain
    25. End Function
    To call them use
    VB Code:
    1. strEncryptedText = EncryptText(Text1.text)
    2.  
    3. strDecryptedText = DecryptText(Text1.Text)
    Chris

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    269

    Re: saving top secret data

    thanks a lot to both

  5. #5
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    269

    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.

  7. #7
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: [RESOLVED] saving top secret data

    Quote Originally Posted by CVMichael
    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
    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!
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  8. #8
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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.

  9. #9
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: [RESOLVED] saving top secret data

    can you show me some code please?
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  10. #10
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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.

  11. #11
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width