开发者

asp.net to php encoding

开发者 https://www.devze.com 2023-03-01 21:35 出处:网络
I need to do this with php encryption method. turkey 3d a bank payment module in the code for the example given to me in this way encryption.

I need to do this with php encryption method. turkey 3d a bank payment module in the code for the example given to me in this way encryption. could you help me translate this into php code?

    SHA1 sha1 = new SHA1CryptoServiceProvider();
    byte[] notHashedBytes = System.Text.Encoding.ASCII.GetBytes(notHashedStr);
    byte[] hashedByte = sha1.ComputeHash(notHashedBytes);
    string h开发者_开发问答ashedStr = System.Convert.ToBase64String(hashedByte);
    return hashedStr;


I know nothing about .Net but from what I gathered in this page seems like the PHP equivalent is just:

$hashedStr = base64_encode(sha1($notHashedStr, true));

You need to encode the raw binary format and not the hexadecimal representation.

0

精彩评论

暂无评论...
验证码 换一张
取 消