嘿,我想在手机上存储密码的哈希,但我不知道该怎么做.我似乎只能找到加密方法.哈希密码的最佳方法是什么?谢谢
是否可以从Sql Server 2008中的存储过程生成字符串的SHA-256哈希?
出于部署原因,我更喜欢它在TSQL中.
我正在尝试构建 SHA256 ComputeHash 的等效版本(来自 C#,与下面示例的输出完全相同),以响应 Native/JavaScript。这是以下 C#:
public static string Hash(string input)
{
if (string.IsNullOrWhiteSpace(input)) return "";
using (SHA256 hasher = SHA256.Create())
{
// Convert the input string to a byte array and compute the hash.
byte[] data = hasher.ComputeHash(Encoding.Unicode.GetBytes(input));
// Create a new Stringbuilder to collect the bytes
// and create a string.
StringBuilder sBuilder = new StringBuilder();
// Loop through each byte of the hashed data
// and format each one as a hexadecimal string.
for (int i …Run Code Online (Sandbox Code Playgroud)