createHmacFor function

Hmac createHmacFor ({OTPAlgorithm algorithm, List<int> key })

Implementation

Hmac createHmacFor({OTPAlgorithm algorithm, List<int> key}) {
  if (key == null) {
    return null;
  }

  switch (algorithm) {
    case OTPAlgorithm.SHA1:
      return Hmac(sha1, key);
    case OTPAlgorithm.SHA256:
      return Hmac(sha256, key);
    case OTPAlgorithm.SHA384:
      return Hmac(sha384, key);
    case OTPAlgorithm.SHA512:
      return Hmac(sha512, key);

    default:
      return null;
  }
}