gpt4 book ai didi

c# - Windows Phone 中的 SHA-1 算法

转载 作者:行者123 更新时间:2023-12-02 05:40:56 26 4
gpt4 key购买 nike

在我的 Windows Phone 应用程序中,我需要使用 SHA-1 算法获取哈希值。我怎样才能做到这一点?例如我有 string text="1234";

最佳答案

您将使用 SHA1Managed类来计算字节数组的散列。可能会做这样的事情:

var sha = new SHA1Managed(); 
var bytes = System.Text.Encoding.UTF8.GetBytes(text);
byte[] resultHash = sha.ComputeHash(bytes);

关于c# - Windows Phone 中的 SHA-1 算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10980811/

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