generateHOTPCode method

int generateHOTPCode (
  1. String secret,
  2. int counter,
  3. {int length: 6,
  4. Algorithm algorithm: Algorithm.SHA1}
)

Generates a one time password code based on a counter you provide and increment.

This function does not increment for you. Optional parameters to change the length of the code provided (default 6) and hashing algorithm (default SHA1) These settings are defaulted to the RFC standard but can be changed.

Implementation

static int generateHOTPCode(String secret, int counter,
    {int length = 6, Algorithm algorithm = Algorithm.SHA1}) {
  return _generateCode(secret, counter, length, getAlgorithm(algorithm),
      _getAlgorithmByteLength(algorithm),
      isHOTP: true);
}