110,534
社区成员
发帖
与我相关
我的任务
分享
$s = hex2bin('7BBD37EC8530F606FD238DADA2295AD38649F39B');
echo .sha1($s);
string h = To("7BBD37EC8530F606FD238DADA2295AD38649F39B");
Console.WriteLine(SHA1(h));
public string To(string hash)
{
string s = hash;
byte[] buff = new byte[s.Length / 2];
int index = 0;
for (int i = 0; i < s.Length; i += 2)
{
buff[index] = Convert.ToByte(s.Substring(i, 2), 16);
++index;
}
string result = Encoding.Default.GetString(buff);
// Console.Write(result);
return result;
}
private static string SHA1(string text)
{
byte[] cleanBytes = Encoding.Default.GetBytes(text);
byte[] hashedBytes = System.Security.Cryptography.SHA1.Create().ComputeHash(cleanBytes);
return BitConverter.ToString(hashedBytes).Replace("-", "");
}