Microsoft Authenticator yields an apparent 9-digit base-10 value for its secret code. This format doesn't work with other TOTP applications, which seem to expect Base32 values.
Any suggestions for how to convert the authenticator decimal codes into something usable outside of a Microsoft authenticator application?
I tried simply converting the code to Base32 using the below function. It yields a 6-digit valid input for TOTP, but the codes generated with this Base32 value don't match what comes out of the Microsoft Authenticator application.
def encode(n):
N = 32
chars ="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
return (encode(n//N)+chars[n%N]).lstrip("0") if n>0 else "0"
# Example:
# print(encode(100000000))
# C7LYIA
So I expect some other transformation is needed... Or is the "code" provided at setup just another one-time passcode, and if so, how can the secret code itself be retrieved?