Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/pyotp/contrib/steam.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,12 @@ def generate_otp(self, input: int) -> str:
:param input: the HMAC counter value to use as the OTP input.
Usually either the counter, or the computed integer based on the Unix timestamp
"""
str_code = super().generate_otp(input)
int_code = int(str_code)

steam_code = ""
int_code = int(super().generate_otp(input))
total_chars = len(STEAM_CHARS)

digits = []
for _ in range(STEAM_DEFAULT_DIGITS):
pos = int_code % total_chars
char = STEAM_CHARS[int(pos)]
steam_code += char
digits.append(STEAM_CHARS[int_code % total_chars])
int_code //= total_chars

return steam_code
return "".join(digits)