public void GetHmacHash() { string actual = EncodingExt.ToBase64Url(CryptoExt.GetHmacHash("HMACSHA256", "lys", "salt")); string actual2 = EncodingExt.ToBase64Url(CryptoExt.GetHmacHash <HMACSHA256>("lys", "salt")); string expect = "Liof_mjT4Kd1V7I7ItvcTGO3yBezkbN0UVDHXm7m1Vg"; Assert.AreEqual(expect, actual); Assert.AreEqual(expect, actual2); }
public string ComputeHash(string header, string payload, string salt) { return(CryptoExt.GetHmacHash(TokenConfig.Alg, $"{header}.{payload}", salt, EncodeType.Encode)); }