Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PYOTP should respect RFC 6238 OTP tokens shorter than 6 digits should… #16

Merged
merged 2 commits into from
Aug 14, 2015

Conversation

HaloZero
Copy link

… be padded with 0

A fixed PR from the changes #7

According to RFC 6238, OTP tokens shorter
than 6 digits should be padded with 0 on the left in order to become 6 digits.
As a demonstration, the following code will produce a 5 digit token 41267 in
commit 5616a8d while the token
should really be 041267. This patch fixes the issue.

import pyotp
print pyotp.HOTP('KEHY3WFC7IGYK6Z3').at(int(1413252660/30))
041267

kislyuk added a commit that referenced this pull request Aug 14, 2015
Pad tokens with zeros, per the example in RFC 6238
@kislyuk kislyuk merged commit 765e277 into pyauth:master Aug 14, 2015
This was referenced Aug 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants