All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.turingcomplete.kotlinonetimepassword.HmacAlgorithm.kt Maven / Gradle / Ivy

Go to download

A Kotlin one-time password library to generate "Google Authenticator", "Time-based One-time Password" (TOTP) and "HMAC-based One-time Password" (HOTP) codes based on RFC 4226 and 6238.

There is a newer version: 2.4.1
Show newest version
package dev.turingcomplete.kotlinonetimepassword

/**
 * Available "keyed-hash message authentication code" (HMAC) algorithms.
 * See: https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#Mac
 *
 * @property macAlgorithmName the name of the algorithm used for
 *                            [javax.crypto.Mac.getInstance(java.lang.String)]
 * @property hashBytes the length of the returned hash produced by the algorithm.
 */
enum class HmacAlgorithm(val macAlgorithmName: String, val hashBytes: Int) {
  /**
   * SHA1 HMAC with a hash of 20-bytes
   */
  SHA1("HmacSHA1", 20),
  /**
   * SHA256 HMAC with a hash of 32-bytes
   */
  SHA256("HmacSHA256", 32),
  /**
   * SHA512 HMAC with a hash of 64-bytes
   */
  SHA512("HmacSHA512", 64);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy