欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2024-02-01 19:14:52
...
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;
}

相关标签: php