klyn.cryptography.Mac.verify
method

    public verify(text as String, expected as String, expectedEncoding as String = "hex") as Boolean throws CryptoException:

Description

Verifies a MAC value against the provided message.

Parameters

- text Source UTF-8 text.
- expected Expected MAC value.
- expectedEncoding Expected encoding: `hex` or `base64`.

Returns

True when the MAC matches.

Throws

- CryptoException when the key is missing or the operation fails. ```klyn import klyn.cryptography mac = Hmac(SHA256()) mac.init("secret") digest = mac.doFinal("hello") print(mac.verify("hello", digest.hex)) ```