NuGet Package OTP Sharp

This is an implementation of HOTP and TOTP which are commonly used for multi factor authentication by using a shared key between the client and the server to generate and verify one time use codes.

This library is capable of generating and verifying both TOTP and HOTP authentication codes. The calculations in this library are known to be compatible with Google 2-Step Verification and consequently the Google Authenticator smartphone app. It is also known to be able to generate codes for Amazon Web Services Multi Factor Authentication and Dropbox 2 step authentication. It should work with any other service or client that is RFC compliant.

This library is released under an MIT license.

No warranty is provided as to the correctness of the library and the consumer of the library assumes all risk for the use thereof, as per the MIT license.

Every effort has gone into implementing this library in accordance with the RFCs mentioned above. However it is up to the users of this library to read through the RFCs and ensure that this implementation is in accordance with the security procedures outlined therein.

The implementation includes the code calculation as well as simple verification. Persistence of the keys, secure key storage, ensuring that a single code can't be validated multiple times and other things are not a part of this library. Thus far those functions (and any others mentioned in the RFCs) are up to the consumer of this library.

For documentation please visit the project website.


Author(s): Devin Martin
Last Update: Monday, November 16, 2015
.NET Fiddle: Online Example
Project Url:
NuGet Url:

Install-Package OtpSharp
dotnet add package OtpSharp
paket add OtpSharp
OtpSharp Download (Unzip the "nupkg" after downloading)

3 packages depend on this package.