public class Totp extends Object
| Constructor and Description | 
|---|
Totp()
Creates a default Totp instance with a 30 second time step, T0 of 0 using HMAC-SHA-1 producing an
 8 digit output. 
 | 
Totp(Hotp.HashAlgorithm algorithm,
    int digits)
Creates a Totp instance with a 30 second time step, T0 of 0 using the provided parameters. 
 | 
Totp(int timeStepSeconds,
    long T0,
    Hotp.HashAlgorithm algorithm,
    int digits)
Creates a Totp instance with a 30 second time step, T0 of 0 using the provided parameters. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
String | 
totp(byte[] key)
Calculates a TOTP result using the provided key and the current time 
 | 
String | 
totp(byte[] key,
    long time)
Calculates a TOTP result using the provided key and provided time 
 | 
public Totp()
public Totp(Hotp.HashAlgorithm algorithm, int digits)
algorithm - the algorithm to usedigits - the number of digitspublic Totp(int timeStepSeconds,
            long T0,
            Hotp.HashAlgorithm algorithm,
            int digits)
timeStepSeconds - the size of the time step in seconds (this is X in the RFC)algorithm - the algorithm to useT0 - the time adjustment from UNIX time in seconds (based on UTC and the epoch)digits - the number of digitsHotppublic String totp(byte[] key)
key - the key/seed to use for calculating the valuepublic String totp(byte[] key, long time)
key - the key/seed to use for calculating the valuetime - the time value to useCopyright © 2020 National Institute of Standards and Technology. All rights reserved.