string encryption in window form..?

goodmorningsky

Centurion
Joined
Aug 18, 2003
Messages
172
In web form, i uses

FormsAuthentication.HashPasswordForStoringinConfigFile(myPassword, "SHA1");

to encrypt password input.

How can I do this thing in Window application.
I want to encrypt input password.

(I guess I have to use something like HashAlgorithmn class, but, it taks only byte[], not string.

Thank you..
 
take a look at the System.Text.Encoding namespace , eg:
Visual Basic:
        Dim strPass As String = "a password"
        Dim key As New Security.Cryptography.RSACryptoServiceProvider()
        Dim b As Byte() = key.Encrypt(System.Text.Encoding.ASCII.GetBytes(strPass.ToCharArray), False)
        MessageBox.Show(System.Text.Encoding.ASCII.GetString(b))
 
Back
Top