Skip to content

simpleotp.otpalgorithm

Eugene Fox edited this page Sep 18, 2024 · 1 revision

OtpAlgorithm

Namespace: SimpleOTP

Represents the hashing algorithm used for One-Time Passwords.

public struct OtpAlgorithm

Inheritance ObjectValueTypeOtpAlgorithm
Implements IEquatable<OtpAlgorithm>, IEquatable<String>, IXmlSerializable
Attributes SerializableAttribute, NullableContextAttribute, NullableAttribute, IsReadOnlyAttribute, JsonConverterAttribute

Properties

SHA1

The HMAC-SHA1 hashing algorithm.

public static OtpAlgorithm SHA1 { get; }

Property Value

OtpAlgorithm

SHA256

The HMAC-SHA256 hashing algorithm.

public static OtpAlgorithm SHA256 { get; }

Property Value

OtpAlgorithm

SHA512

The HMAC-SHA512 hashing algorithm.

public static OtpAlgorithm SHA512 { get; }

Property Value

OtpAlgorithm

MD5

The HMAC-MD5 hashing algorithm.

public static OtpAlgorithm MD5 { get; }

Property Value

OtpAlgorithm

Remarks:

This is not a standard algorithm, but it is defined by IIJ specification and recognized by default.
Internet Initiative Japan. URI format

Constructors

OtpAlgorithm(String)

Initializes a new instance of the OtpAlgorithm struct.

OtpAlgorithm(string value)

Parameters

value String
The algorithm to use.

Exceptions

ArgumentException
Thrown if value is empty or whitespace.

ArgumentNullException
Thrown if value is .

Methods

Equals(OtpAlgorithm)

bool Equals(OtpAlgorithm other)

Parameters

other OtpAlgorithm

Returns

Boolean

Equals(String)

bool Equals(string other)

Parameters

other String

Returns

Boolean

Equals(Object)

bool Equals(object obj)

Parameters

obj Object

Returns

Boolean

IsStandard()

Determines whether the specified OtpAlgorithm is standard HMAC SHA algorithm (SHA-1, SHA-256 or SHA-512).

bool IsStandard()

Returns

Boolean
if the specified OtpAlgorithm is standard; otherwise, .

GetHashCode()

int GetHashCode()

Returns

Int32

ToString()

Returns the string representation of the OtpAlgorithm struct.

string ToString()

Returns

String
The string representation of the OtpAlgorithm struct.

GetSchema()

XmlSchema GetSchema()

Returns

XmlSchema

ReadXml(XmlReader)

void ReadXml(XmlReader reader)

Parameters

reader XmlReader

WriteXml(XmlWriter)

void WriteXml(XmlWriter writer)

Parameters

writer XmlWriter

IsStandard(String)

Determines whether the specified OtpAlgorithm is standard HMAC SHA algorithm (SHA-1, SHA-256 or SHA-512).

bool IsStandard(string algorithm)

Parameters

algorithm String
The algorithm to check.

Returns

Boolean
if the specified OtpAlgorithm is standard; otherwise, .

IsStandard(OtpAlgorithm)

Determines whether the specified OtpAlgorithm is standard HMAC SHA algorithm (SHA-1, SHA-256 or SHA-512).

bool IsStandard(OtpAlgorithm algorithm)

Parameters

algorithm OtpAlgorithm
The algorithm to check.

Returns

Boolean
if the specified OtpAlgorithm is standard; otherwise, .

Clone this wiki locally