-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Thepelicanbrief2
Message 5 in Discussion

Hi,   Ideally your database should store encrypted password and that to one way 
encryption. That means the password cannot be decrypted. MD5 is one of the algo u can 
use which is a one way hash algo.   Following is a sample code which might help u.   
Public Function GetEncryptedPassword(ByVal pass As String) As String Implements 
IEncryption.GetEncryptedPassword
            'Encrypt the passord
            Dim md5Hasher As New MD5CryptoServiceProvider()
                     Dim encoder As New UTF8Encoding()
            Dim encPasswordAsBytes() As Byte
            Dim encPasswordAsString As String
            Dim tmp(20) As Char             encPasswordAsBytes = 
md5Hasher.ComputeHash(encoder.GetBytes(pass))
            'encPasswordAsBytes.CopyTo(tmp, 0)
            'GetEncryptedPassword = New String(tmp)             Dim sb As New 
System.Text.StringBuilder()
            Dim outputByte As Byte
            For Each outputByte In encPasswordAsBytes
                ' convert each byte to a Hexadecimal upper case string
                sb.Append(outputByte.ToString("x2").ToUpper)
            Next outputByte             md5Hasher = Nothing
            encoder = Nothing             GetEncryptedPassword = sb.ToString()         
End Function   regards,   tpb

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to