Hacking - The Art of Exploitation, 2nd Edition

(Romina) #1

402 0x700


With a little bit of basic algebra, the terms can be moved around for each
line so the remainder (shown in bold) is by itself on the left of the equal sign:

53 = 7253 −60 · 120


14 = 120− 2·53


11 =53− 3·14


3 =14−1·11


2 =11−3·3


1 =3− 1·2


Starting from the bottom, it’s clear that:


1=3−1· 2


The line above that, though, is 2 = 11 − 3 · 3, which gives a substitution
for 2:

1=3−1·(11− 3·3)


1=4· 3 − 1·11


The line above that shows that 3 = 14 − 1 · 11, which can also be
substituted in for 3:

1=4·(14− 1·11)−1·11


1=4·14−5· 11


Of course, the line above that shows that 11 = 53 − 3 · 14, prompting
another substitution:

1=4·14−5·(53− 3·14)


1=19· 14 −5·53


Following the pattern, we use the line that shows 14 = 120 − 2 · 53,
resulting in another substitution:

1=19·(120− 2 · 53)−5·53


1=19·120− 43 · 53


And finally, the top line shows that 53 = 7253 − 60 · 120, for a final
substitution:

1=19·120− 43 · (7253− 60 · 120)


1 = 2599 · 120− 43 · 7253


2599 · 120 + −43 · 7253 = 1


This shows that J and K would be 2599 and −43, respectively.

Free download pdf