#region OneWayHash
///
/// Encrypts input string
///
/// string
/// string
public string OneWayHash(string input)
{
// convert pwd into hashed value //
HashAlgorithm HA = new SHA1Managed();
//declare a new encoder
UTF8Encoding UTF8Encoder = new UTF8Encoding();
//get byte representation of input text
byte[] inputBytes = UTF8Encoder.GetBytes(input);
//hash the input byte array
byte[] output = HA.ComputeHash(inputBytes);
//convert output byte array to a string
string newString = Convert.ToBase64String(output);
return newString;
}
#endregion
|