3 ms·
Yeah, but that comment can be made about literally every software in existence. Even core language keywords are doing a lot of heavy lifting in the interpreter.
by icebraining 7y ago
Yeah, but that comment can be made about literally every software in existence. Even core language keywords are doing a lot of heavy lifting in the interpreter.
In Python, the stdlib is effectively part of the language, so as long as they're not installing third-party libs, I don't see how it can be misleading.
- anamexis 7y agoI think you both raise valid points. This was an interesting thing to look at to see get a quick idea of how TOTP works. On the flip side, though, if this we had this hypothetical implementation: import totp if __name__ == '__main__': totp.generate() Well, we probably wouldn't be here discussing it.
- PeterisP 7y agoWell, the key part essentially is just like that, it's the single line mac = hmac.new(secret_bytes, counter_bytes, digest).digest() and everything else is just converting data to/from the proper format for this function.
- anamexis 7y agoWell sure, but given that TOTP is itself just formatted HMAC, that "everything else" of formatting is the essence of TOTP. Otherwise you probably wouldn't say you're implementing TOTP, you'd say you're implementing HMAC.