C# - MD5 in BASE64

public String encriptStringByMD5(String input)
{
     String output;

     //The encoder class used to convert strPlainText to an array of bytes
     Encoding enc = Encoding.GetEncoding("windows-874");

     //Create an instance of the MD5CryptoServiceProvider class
     MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
     //Call ComputeHash, passing in the plain-text string as an array of bytes
     //The return value is the encrypted value, as an array of bytes
     Byte[] hashedDataBytes = md5Hasher.ComputeHash(enc.GetBytes(input));

     output = Convert.ToBase64String(hashedDataBytes,0,hashedDataBytes.Length );
     //output = BitConverter.ToString(hashedDataBytes);
     return output;
}

Popular posts from this blog

SAP CPI - Loop Process Call with SuccessFactor (oData V2)

Setting IntelliJ IDEA to run Groovy Script

C# - BASE64 to Image