public static byte[] ComputeHmacsha1(byte[] toBeHashed, byte[] key)
{
using (var hmac = new HMACSHA1(key))
{
return hmac.ComputeHash(toBeHashed);
}
}
public static byte[] ComputeHmacsha256(byte[] toBeHashed, byte[] key)
{
using (var hmac = new HMACSHA256(key))
{
return hmac.ComputeHash(toBeHashed);
}
}
public static byte[] ComputeHmacsha512(byte[] toBeHashed, byte[] key)
{
using (var hmac = new HMACSHA512(key))
{
return hmac.ComputeHash(toBeHashed);
}
}
public static byte[] ComputeHmacmd5(byte[] toBeHashed, byte[] key)
{
using (var hmac = new HMACMD5(key))
{
return hmac.ComputeHash(toBeHashed);
}
}
Hiển thị các bài đăng có nhãn KeyedHashAlgorithm. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn KeyedHashAlgorithm. Hiển thị tất cả bài đăng
Chủ Nhật, 8 tháng 1, 2017
Keyed Hash Algorithm examples in .Net
Nhãn:
Cryptography
,
HashAlgorithm
,
HMAC
,
KeyedHashAlgorithm
Đăng ký:
Bài đăng
(
Atom
)