gpt4 book ai didi

windows - Windows Phone 8.1 中的 SHA1Managed

转载 作者:可可西里 更新时间:2023-11-01 14:49:59 26 4
gpt4 key购买 nike

我在开发 Windows Phone 8 应用程序以散列字符串时一直在使用它,但我在 Windows Phone 8.1 中找不到等效项

SHA1Managed sha1 = new SHA1Managed();
byte[] res = sha1.ComputeHash(System.Text.Encoding.UTF8.GetBytes(this.Uuid + this.SessionToken));
return BitConverter.ToString(res, 0, res.Length).Replace("-", "").ToLower();

如何使用 SHA1 在 Windows Phone 8.1 中计算哈希值?

最佳答案

HashAlgorithmProvider hashProvider = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha1);
IBuffer hash = hashProvider.HashData(CryptographicBuffer.ConvertStringToBinary(someValue, BinaryStringEncoding.Utf8));
string hashValue = CryptographicBuffer.EncodeToBase64String(hash);

关于windows - Windows Phone 8.1 中的 SHA1Managed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23909038/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com