There is only some slow blogging going on recently… So here’s something to fill the Lazyness-Gaps :)

  1.         /// <summary>
  2.         /// Encrypts the specified Text to SHA1
  3.         /// </summary>
  4.         /// <param name="text">The Text to encrypt</param>
  5.         /// <returns>The SHA1-Encrypted text</returns>
  6.         public static string EncryptToSHA1(this string text)
  7.         {
  8.             SHA1 sha1 = new SHA1CryptoServiceProvider();
  9.  
  10.             byte[] arrayData = Encoding.ASCII.GetBytes(text);
  11.             byte[] arrayResult = sha1.ComputeHash(arrayData);
  12.  
  13.             string result = string.Empty;
  14.             string temp = string.Empty;
  15.  
  16.             for (int i = 0; i < arrayResult.Length; i++)
  17.             {
  18.                 temp = Convert.ToString(arrayResult[i], 16);
  19.                 if (temp.Length == 1)
  20.                     temp = "0" + temp;
  21.                 result += temp;
  22.             }
  23.  
  24.             return result;
  25.         }