+ Reply to Thread
Results 1 to 3 of 3

Thread: encrypt & decrypt password

  1. #1
    swethajain is offline VB.NET Forum Enthusiast swethajain is on a distinguished programming path ahead
    .NET Framework
    .NET 2.0
    Join Date
    Feb 2010
    Age
    22
    Posts
    48
    Reputation
    0

    Question encrypt & decrypt password

    Hi
    I have a login page with username & password.I want the password to be encrypted while inserting into the database &decrypted while the user logins and check whether it is valid or not. can anyone give me the source code?

    Thanks,
    Swetha

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Age
    37
    Posts
    10,843
    Reputation
    1443

    Default

    You don't normally keep password as decryptable data, you use a one-way hash. Each time user enters a password you can hash it and compare with the original. That way there is 'no' way for unauthorized to get that information from your data.
    Code:
    Dim pass As String = "word"
    Dim sha As New System.Security.Cryptography.SHA1Managed
    Dim hash As String = Convert.ToBase64String(sha.ComputeHash(System.Text.Encoding.UTF8.GetBytes(pass)))

  3. #3
    swethajain is offline VB.NET Forum Enthusiast swethajain is on a distinguished programming path ahead
    .NET Framework
    .NET 2.0
    Join Date
    Feb 2010
    Age
    22
    Posts
    48
    Reputation
    0

    Default

    Hi
    Thank you soo much for the reply.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

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