The code sample can be used in web pages to encrypt a password.
The GetEncryptedPassword converts the plain text input to cipher text, in cryptography terminologies. To our use, is the static FormsAuthentication.HashPasswordForStoringInConfigFile() function that takes the plainText and also the algorithm that should be used to encrypt the password.
In this example we use the SHA1 algorithm. Technically, the SHA1 algorithm is a hash algorithm and hence returns only a hash of the plaintext. A hashing algorithm one whose input size is not-fixed, but output's size is fixed.
public string GetEncryptedPassword(string plainText) { return FormsAuthentication.HashPasswordForStoringInConfigFile(plainText, "SHA1"); }
|
No responses found. Be the first to respond and make money from revenue sharing program.
|