4 ms·
prints the following: "Simon Tatham" Specifically, it takes a power mapped string sequence and shifts the values off. Each set equates to a line of #'s and spa
by PythonDeveloper 15y ago
prints the following:
"Simon Tatham"
Specifically, it takes a power mapped string sequence and shifts the values off. Each set equates to a line of #'s and spaces. Pretty ingenious, actually.
- acqq 15y agoHow exactly is he using the pow function? It's a number to the 37th and then mod 0x13AC59F3ECAC3127065A9, how did he select the numbers and why is he doing that operations?
- dalke 15y agoWhat it's doing is computing row = x * * 37 mod 0x13AC59F3ECAC3127065A9 with seven different values of x. The "row" bit i encodes either a 0 (for space) or 1 (for hash), for i in range(0, 79). I think that part of the output you understand. The question is how to get the values of "x" and how to get the modulo value. You just need to compute row * * (1/37) mod 0x13AC59F3ECAC3127065A9 . I can't for the life of me recall how to do it, but you can see the result at Wolfram Alpha: http://www.wolframalpha.com/input/?i=x+**+37+mod+1486468559035429142160809+%3D+604462963859271849083326 http://www.wolframalpha.com/input/?i=x+**+37+mod+14864685590... . How then do you get the 0x13AC59F3ECAC3127065A9? It needs to be relatively prime to the values, and larger than any of the output values. Beyond that, I don't know why that specific (composite, with two factors) number was chosen. Nor do I know why 37 was chosen.
- acqq 15y agoI think you're on the good track. Since there are no new suggestions, my opinion is: http://en.wikipedia.org/wiki/RSA_(algorithm) http://en.wikipedia.org/wiki/RSA_(algorithm) The answer to "why" is: he's the author of the Putty SSH client, and he decided to use the bignum feature of Python to demonstrate the encryption in as little code as possible and make the signature out of it.