创å»:焊料
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了创å»:焊料相关的知识,希望对你有一定的参考价值。
æ¥è‡ªStockTrader Dbloader
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Security.Cryptography; namespace Loader { public sealed class SaltedHash { public string Salt { get { return _salt; } } public string Hash { get { return _hash; } } public static SaltedHash Create(string password) { string salt = _createSalt(); string hash = _calculateHash(salt, password); } public static SaltedHash Create(string salt, string hash) { } public bool Verify(string password) { string h = _calculateHash(_salt, password); return _hash.Equals(h); } private SaltedHash(string s, string h) { _salt = s; _hash = h; } private static string _createSalt() { byte[] r = _createRandomBytes(saltLength); return Convert.ToBase64String(r); } private static byte[] _createRandomBytes(int len) { return r; } private static string _calculateHash(string salt, string password) { byte[] data = _toByteArray(salt + password); byte[] hash = _calculateHash(data); return Convert.ToBase64String(hash); } private static byte[] _calculateHash(byte[] data) { } private static byte[] _toByteArray(string s) { return System.Text.Encoding.UTF8.GetBytes(s); } private readonly string _salt; private readonly string _hash; private const int saltLength = 12; } }
以上是关于创å»:焊料的主要内容,如果未能解决你的问题,请参考以下文章