Skip to content

sim756/sim756.HOTP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sim756.HOTP

RFC 4226 (HOTP) - HMAC-Based One-Time Password Generator.

NOTE - CRITICAL CHANGE!

This library is not compatible with TOTP (Time-based One-Time Password) anymore! Please check the ISSUE #1 (FIXED) - #1

For TOTP, pelase use the following TOTP library

NuGet - sim756.TOTP - https://www.nuget.org/packages/sim756.TOTP
GitHub - sim756.TOTP - https://www.github.com/sim756/sim756.TOTP

NuGet

https://www.nuget.org/packages/sim756.HOTP

GitHub

https://github.com/sim756/sim756.HOTP

// Example 1: Using KeyString property and default counter (0)
var generator = new HOTPGenerator { KeyString = "QWERTYUIOPASDFGH" };
string hotp = generator.Compute(0);
// Example 2: Using KeyString property and a specific counter (e.g., 2)
var generator2 = new HOTPGenerator { KeyString = "QWERTYUIOPASDFGH" };
string nextHotp = generator2.Compute(2);
// Example 3: Using object initializer for KeyString and Length, and default counter (0)
var generator3 = new HOTPGenerator
{
    KeyString = "QWERTYUIOPASDFGH",
    Length = 6
};
string hotp3 = generator3.Compute(0);