14.07.2013 Views

dissertacao.pdf

dissertacao.pdf

dissertacao.pdf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A Implementations of the attacks from section<br />

3.2<br />

A.1 Common Modulus Attack<br />

rcm = {};<br />

i = 3;<br />

While[i < 13,<br />

nbits = 2∧ nbits = 2 i; ∧ nbits = 2 i; ∧i; p = RandomPrime[{2∧ (nbits/2 − 1), 2∧ p = RandomPrime[{2 (nbits/2) − 1}];<br />

∧ (nbits/2 − 1), 2∧ p = RandomPrime[{2 (nbits/2) − 1}];<br />

∧ (nbits/2 − 1), 2∧ (nbits/2) − 1}];<br />

q = RandomPrime[{2∧ (nbits/2 − 1), 2∧ q = RandomPrime[{2 (nbits/2) − 1}];<br />

∧ (nbits/2 − 1), 2∧ q = RandomPrime[{2 (nbits/2) − 1}];<br />

∧ (nbits/2 − 1), 2∧ (nbits/2) − 1}];<br />

While[q == p, q = RandomPrime[{2∧ (nbits/2 − 1), 2∧ While[q == p, q = RandomPrime[{2 (nbits/2) − 1}]];<br />

∧ (nbits/2 − 1), 2∧ While[q == p, q = RandomPrime[{2 (nbits/2) − 1}]];<br />

∧ (nbits/2 − 1), 2∧ (nbits/2) − 1}]];<br />

n = p ∗ q;<br />

e1 = n;<br />

While[e1 == n, e1 = RandomPrime[n]; ]<br />

e2 = n;<br />

While[e2 == ne2 ne2 ne2 == e1, e2 = RandomPrime[n]; ]<br />

m = RandomPrime[n];<br />

c1 = PowerMod[m, e1, n];<br />

c2 = PowerMod[m, e2, n];<br />

r = Append[rcm, {nbits, Timing[<br />

l = ExtendedGCD[e1, e2];<br />

a1 = l[[2, 1]];<br />

a2 = l[[2, 2]];<br />

dec = Mod[PowerMod[c1, a1, n] ∗ PowerMod[c2, a2, n], n]<br />

][[1]]}];<br />

Print[rcm];<br />

i++;<br />

]<br />

56

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!