ComputeKeyedHash() public static method

Computes the HMAC hash of a given byte[]. This is a wrapper over the Mac crypto functions.
public static ComputeKeyedHash ( this data, string key, KeyedHashAlgorithm hashType = KeyedHashAlgorithm.HMACSHA256 ) : byte[]
data this byte[] of content to hash
key string secret key to salt the hash. This is assumed to be UTF-8 encoded
hashType System.Security.Cryptography.KeyedHashAlgorithm determines which alogirthm to use. The recommendation is to use HMAC-SHA256
return byte[]
示例#1
0
 public void ComputeKeyedHashNullException()
 {
     ExtensionMethods.ComputeKeyedHash("value".ToByteArray(), null);
 }
示例#2
0
 public void ComputeKeyedHashNullTest()
 {
     Assert.IsNull(ExtensionMethods.ComputeKeyedHash(null, "secretkey"));
 }