4 ms·
I get your point but equally the point of programming languages is to abstract away the harder stuff. The question is just how much abstraction developers want
by pushpop 7y ago
I get your point but equally the point of programming languages is to abstract away the harder stuff. The question is just how much abstraction developers want between the code and the execution.
I mean, you could make the same claim about one written in C because it doesn’t include stdio.h. So where do you draw the line? Assembly?
- xendo 7y agoMy point is that saying that something is written in 18 lines of code when actually all the heavy lifting is done by the libraries is misleading. That doesn’t mean I don’t appreciate Python’s expressiveness and rich standard library.
- icebraining 7y agoYeah, 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.