public static string SHA1Encrypt(string sourceText) { SHA1 sha = new SHA1CryptoServiceProvider(); ASCIIEncoding enc = new ASCIIEncoding(); byte[] dataToHash = enc.GetBytes(sourceText); byte[] dataHashed = sha.ComputeHash(dataToHash); string hash = BitConverter.ToString(dataHashed).Replace("-", ""); return hash; }