当前位置:Gxlcms > PHP教程 > php-求助各位大神,一小段C#转PHP

php-求助各位大神,一小段C#转PHP

时间:2021-07-01 10:21:17 帮助过:34人阅读

php

因工作需要,将下面这段C#用PHP实现,请教各位大神能帮忙写一下,我弄了两天了都没成功,书到用时方恨少。

public static string encryptData( string clientid, string CLIENTFLAG, string CLIENTKEY, string CLIENTCONST)

{
Random rd = new Random();
int N1 = rd.Next(1000, 10000);
int N2 = rd.Next(1000, 10000);
}
string str = N2 +CLIENTFLAG +CLIENTKEY +CLIENTCONST + N1;
byte[] byteStr = System.Text.Encoding.UTF8.GetBytes(str);
string strMd5 = BitConverter.ToString(md5.ComputeHash(byteStr)).Replace("-", string.Empty).ToLower();
return N1 + strMd5.Substring(7, 21) + N2;
}

人气教程排行