PARI9-21-07

PARI9-21-07 - (00:24) gp >...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
A Tutorial on RSA with Big Primes (00:21) gp > p=nextprime(random(10^30)) \\ picks a random prime less than 10^30 %1 = 738873402423833494183027176953 (00:21) gp > q=nextprime(random(10^25)) %2 = 3787776806865662882378273 (00:22) gp > setrand(2) \\ if you want to change the starting point of the random number generator %3 = 2 (00:22) gp > p=nextprime(random(10^30)) %4 = 420829752590518623220964128931 (00:22) gp > q=nextprime(random(10^25)) \\ for security, it is better to choose primes of slightly different orders of magnitude. %5 = 118661898673302028252493 (00:22) gp > n=p*q %6 = 49936457460606882603937486236150029895426667874174983 (00:22) gp > e=random(n) %7 = 27911888897893919924427824802746641865747755531264298 (00:22) gp > phin=(p-1)*(q-1) %8 = 49936457460606882603937065406278777478130144881793560 (00:23) gp > while(gcd(e,phin)!=1, e=e+1) \\ to guarantee relatively prime (00:23) gp > e \\ see, we got one bigger %9 = 27911888897893919924427824802746641865747755531264299
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (00:24) gp > d=lift(Mod(e,phin)^(-1)) \\ lift turns the input into an integer, NOT an integer mod e any longer %10 = 24004316919709947998922871438864307780709766943417672 (00:25) gp > (e*d)%phin \\ always good to check these things %11 = 1 (00:25) gp > log(n)/log(27) \\ gives the number of letters we can encode %12 = 36.81692875661933554457136534 (00:25) gp > m=5+27*21+27^2*12+27^3*5+27^4*18 \\ m=EULER %13 = 9673673 (00:28) gp > E(x)=lift(Mod(x,n)^e) \\ Encodes using above data (00:29) gp > D(x)=lift(Mod(x,n)^d) \\ Decodes using above data (00:29) gp > secret=E(m) \\ This is the ciphertext %14 = 24150232700102980434440083538785706321933018688396212 (00:29) gp > D(secret) \\ With any luck, this should give back "EULER" %15 = 9673673 (00:29) gp > factor(n) %18 = [118661898673302028252493 1] [420829752590518623220964128931 1] (00:42) gp > ## *** last result computed in 28,190 ms....
View Full Document

Page1 / 2

PARI9-21-07 - (00:24) gp >...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online