예제 #1
0
 private static (int, Func <KeyedHashAlgorithm>) Dict(HmacTypes type)
 {
     return(type switch
     {
         HmacTypes.HmacMd5 => (128, () => new HMACMD5()),
         HmacTypes.HmacSha1 => (160, () => new HMACSHA1()),
         HmacTypes.HmacSha256 => (256, () => new HMACSHA256()),
         HmacTypes.HmacSha384 => (384, () => new HMACSHA384()),
         HmacTypes.HmacSha512 => (512, () => new HMACSHA512()),
         _ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
     });
예제 #2
0
 public static IHMAC Create(HmacTypes type, byte[] key) => Factory.Create(type, key);
예제 #3
0
 public static IHMAC Create(HmacTypes type, string key, Encoding encoding = null) => Factory.Create(type, key, encoding);
예제 #4
0
 internal HmacFunction(HmacTypes type, byte[] key)
 {
     _hmacConfig = HmacTable.Map(type);
     HashType    = type;
     Key         = key;
 }
예제 #5
0
 public static IHMAC Create(HmacTypes type, byte[] key) => new HmacFunction(type, key);
예제 #6
0
 public static IHMAC Create(HmacTypes type, string key, Encoding encoding = null) => new HmacFunction(type, encoding.SafeEncodingValue().GetBytes(key));