klyn.cryptography.Mac.getInstance
method

    public static getInstance(algorithm as String) as Mac throws CryptoException:

Description

Compatibility factory for dynamic algorithm selection.

The preferred API is `Hmac(SHA256())`, `Hmac(SHA512())`, and so on.

Parameters

- algorithm HMAC algorithm such as `HmacSHA256` or `SHA-256`.

Returns

Ready-to-use MAC instance.

Throws

- CryptoException when the algorithm is unsupported. ```klyn import klyn.cryptography mac = Mac.getInstance("HmacSHA256") print(mac.algorithm) ```