kspearrin / kspearrin/Otp.NET

TOTP not match If we pass totpSize = 6 and step = 60

Open
#65 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.3k
Forks
179
PR merge metrics
No merged PRs in 30d

Description

This code result match with Google Authenticator

```
var base32Bytes = Base32Encoding.ToBytes(key);
var totp = new Totp(base32Bytes);
var totpCode = totp.ComputeTotp();
```


This code result not match with Google Authenticator

```
var base32Bytes = Base32Encoding.ToBytes(key);
var totp = new Totp(base32Bytes, totpSize: 6, step: 60);
var totpCode = totp.ComputeTotp();
```
Google Authenticator URI example

`var uriString = new OtpUri(OtpType.Totp, key, "myemail@yahoo.com", "Test Not Working", digits: 6, period: 60).ToString();`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the two Totp snippets and comparing their results with the Google Authenticator URI created by OtpUri using digits: 6 and period: 60. Read the Totp constructor parameters and OtpUri serialization to trace how totpSize and step are represented. Done means the generated six-digit code matches Google Authenticator for the 60-second period.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.