【问题标题】:SHA1Managed in Windows Phone 8.1Windows Phone 8.1 中的 SHA1Managed
【发布时间】:2014-07-17 12:35:02
【问题描述】:

我在开发 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();

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

【问题讨论】:

  • 在最坏的情况下你可以看看 bouncycastle。

标签: windows encryption sha1 windows-phone-8.1


【解决方案1】:
HashAlgorithmProvider hashProvider = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha1);
IBuffer hash = hashProvider.HashData(CryptographicBuffer.ConvertStringToBinary(someValue, BinaryStringEncoding.Utf8));
string hashValue = CryptographicBuffer.EncodeToBase64String(hash);

【讨论】:

    猜你喜欢
    • 2023-04-03
    • 2014-11-21
    • 1970-01-01
    • 1970-01-01
    • 2014-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多