1
0
mirror of https://github.com/XFox111/SimpleOTP.git synced 2026-04-22 08:00:45 +03:00
1
simpleotp.hotp
Eugene Fox edited this page 2024-09-18 16:16:09 +03:00

Hotp

Namespace: SimpleOTP

Represents a HOTP (HMAC-based One-Time Password) generator.

public class Hotp : Otp

Inheritance ObjectOtpHotp
Attributes NullableContextAttribute, NullableAttribute

Properties

Counter

Gets or sets the counter value used for generating OTP codes.

public long Counter { get; set; }

Property Value

Int64

Secret

Gets or sets the secret key used for generating OTPs.

public OtpSecret Secret { get; set; }

Property Value

OtpSecret

Algorithm

Gets or sets the algorithm used for generating OTP codes.

public OtpAlgorithm Algorithm { get; set; }

Property Value

OtpAlgorithm

Digits

Gets or sets the number of digits in the OTP code.

public int Digits { get; set; }

Property Value

Int32
Default: 6. Recommended: 6-8.

Constructors

Hotp(OtpSecret)

Initializes a new instance of the Hotp class

public Hotp(OtpSecret secret)

Parameters

secret OtpSecret
The secret key used for generating OTP codes.

Hotp(OtpSecret, Int64)

Initializes a new instance of the Hotp class

public Hotp(OtpSecret secret, long counter)

Parameters

secret OtpSecret
The secret key used for generating OTP codes.

counter Int64
The counter value used for generating OTP codes.

Hotp(OtpSecret, Int64, Int32)

Initializes a new instance of the Hotp class

public Hotp(OtpSecret secret, long counter, int digits)

Parameters

secret OtpSecret
The secret key used for generating OTP codes.

counter Int64
The counter value used for generating OTP codes.

digits Int32
The number of digits in the OTP code.

Hotp(OtpSecret, Int64, OtpAlgorithm)

Initializes a new instance of the Hotp class

public Hotp(OtpSecret secret, long counter, OtpAlgorithm algorithm)

Parameters

secret OtpSecret
The secret key used for generating OTP codes.

counter Int64
The counter value used for generating OTP codes.

algorithm OtpAlgorithm
The algorithm used for generating OTP codes.

Hotp(OtpSecret, Int64, OtpAlgorithm, Int32)

Initializes a new instance of the Hotp class

public Hotp(OtpSecret secret, long counter, OtpAlgorithm algorithm, int digits)

Parameters

secret OtpSecret
The secret key used for generating OTP codes.

counter Int64
The counter value used for generating OTP codes.

algorithm OtpAlgorithm
The algorithm used for generating OTP codes.

digits Int32
The number of digits in the OTP code.

Methods

GetCounter()

Gets the current counter value.

protected long GetCounter()

Returns

Int64
The current counter value.