SugarCRM released a SOAPAPI, but I need to send the MD5 function PHP whose password is compatible with the MD5 format (SugarCRM is built on PHP ). So I wrote a PHP MD5 function to simulate
Recently, I need to use SugarCRM (a good one), an open source CRM implementation to integrate ASP. NET applications.
SugarCRM released a soap api, but I need to send the MD5 function PHP whose password is compatible with the MD5 format (SugarCRM is built on PHP ). So I wrote a PHP MD5 function to simulate
Using System. Security. Cryptography;
Using System. Text;
Public sealed class PhpCompatible
{
Public static string Md5Hash (string pass)
{
MD5 md5 = MD5CryptoServiceProvider. Create ();
Byte [] dataMd5 = md5.ComputeHash (Encoding. Default. GetBytes (pass ));
StringBuilder sb = new StringBuilder ();
For (int I = 0; I <dataMd5.Length; I ++)
Sb. AppendFormat ("{0: x2}", dataMd5 [I]);
Return sb. ToString ();
}
AppendFormat is a difficulty, I found, because I need to pad the hexadecimal number 0. The solution is to remove a string in the format of 2 x. It is hard to understand the functions of common file formats.
There are many PHP applications, and we need a mechanism to interact with them. I hope this function can help you, if you are as described by me