1 year ago
#210560
64_Tesseract
Cannot find any information on 9-digit decimal TOTP key
Long story short, I'm trying to create a front-end for a 2FA app in Python and I encountered something strange.
Typical TOTP keys are base-32 numbers with 16 or 32 digits, but one of the accounts I was testing instead has a 9-digit decimal key (for example 091827364
).
On an authenticator app, this behaves just like any other 2FA code, but none of the libraries I've seen in Python support it - they simply use the base64.b32decode()
function to extract the bytes from the key - but base-32 does not include 1, 8 & 9 which are present in my key, and trying to use it throws an error.
I've thought this integer (at least I assume that's how it's treated) simply gets converted to base-32 before being passed into the hashing program, but even after some trial-and-error I couldn't replicate the 2FA codes I got on my phone app.
There must be some sort of conversion algorithm I'm not aware of. Is there a specific name for this 9-digit key? I've tried searching for different types of TOTP keys, but the only things that ever came up were useless "TOTP vs HOTP" tech blogs...
python
base64
totp
base32
0 Answers
Your Answer