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

Parameter | Description
--- | ---
`algorithm` | HMAC algorithm such as `HmacSHA256` or `SHA-256`.

Returns

Ready-to-use MAC instance.

Throws

- CryptoException when the algorithm is unsupported.

Example

    import klyn.cryptography

    mac = Mac.getInstance("HmacSHA256")
    print(mac.algorithm)