Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Who can explain what the python lines at the end do? (tartarus.org)
2 points by acqq on Dec 12, 2011 | hide | past | favorite | 4 comments


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.


How 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?


What 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+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.


I think you're on the good track. Since there are no new suggestions, my opinion is:

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: