public verify(text as String, expected as String, expectedEncoding as String = "hex") as Boolean throws CryptoException:
Verifies a MAC value against the provided message.
| Parameter | Description |
|---|---|
text | Source UTF-8 text. |
expected | Expected MAC value. |
expectedEncoding | Expected encoding: hex or base64. |
True when the MAC matches.
import klyn.cryptography
mac = Hmac(SHA256())
mac.init("secret")
digest = mac.doFinal("hello")
print(mac.verify("hello", digest.hex))