The code for generating MD5 with c # is as follows: {code ...} the MD5 generated by the above code is f5da53705563c657581a6d0853286fdc. The problem is that the MD5 generated by c # is inconsistent with the MD5 generated by PHP. due to service restrictions, you cannot change the c # code. you can only start with PHP. The code for generating MD5 with c # is as follows:
Class CreateMD5 {static void Main (string [] args) {string source = ""; using (MD5 md5Hash = MD5.Create () {string hash = GetMd5Hash (md5Hash, source); Console. writeLine (hash) ;}} static string GetMd5Hash (MD5 md5Hash, string input) {// here it is Unicode byte [] data = md5Hash. computeHash (Encoding. unicode. getBytes (input); StringBuilder sBuilder = new StringBuilder (); for (int I = 0; I <data. length; I ++) {sBuilder. append (data [I]. toString ("x2");} return sBuilder. toString ();}}
The MD5 generated by the above code is f5da53705563c657581a6d0853286fdc.
The problem is that the MD5 generated by c # is inconsistent with the MD5 generated by PHP.
Due to business restrictions, you cannot change the c # code, but you can only start with PHP.
Reply content:
The code for generating MD5 with c # is as follows:
Class CreateMD5 {static void Main (string [] args) {string source = ""; using (MD5 md5Hash = MD5.Create () {string hash = GetMd5Hash (md5Hash, source); Console. writeLine (hash) ;}} static string GetMd5Hash (MD5 md5Hash, string input) {// here it is Unicode byte [] data = md5Hash. computeHash (Encoding. unicode. getBytes (input); StringBuilder sBuilder = new StringBuilder (); for (int I = 0; I <data. length; I ++) {sBuilder. append (data [I]. toString ("x2");} return sBuilder. toString ();}}
The MD5 generated by the above code is f5da53705563c657581a6d0853286fdc.
The problem is that the MD5 generated by c # is inconsistent with the MD5 generated by PHP.
Due to business restrictions, you cannot change the c # code, but you can only start with PHP.
Step 1 before md5
$ Tmp = mb_convert_encoding ('question Guide', 'utf-16le', 'utf8 ');