這是Herr Deng桑的教學blog,主要處理作業與班導事務,另外還有數位小品。
package go;import java.math.BigInteger;import java.security.SecureRandom;public class CAI { public static void main(String[] args)throws Exception { System.out.println("My name is RAMBO!"); SecureRandom rnd=new SecureRandom(); BigInteger p,q,n,phiN,e,d; int b=512, u=128; p=new BigInteger("13"); System.out.println("p="+p); q=new BigInteger("17"); System.out.println("q="+q); n=p.multiply(q); System.out.println("n="+n); BigInteger one=new BigInteger("1"); phiN=p.subtract(one).multiply(q.subtract(one)); System.out.println("phiN="+phiN); e=new BigInteger("5"); System.out.println("e="+e); d=e.modInverse(phiN); System.out.println("d="+d); BigInteger m=new BigInteger("100"); System.out.println("m="+m); BigInteger c=m.modPow(e, n); System.out.println("c="+c); BigInteger m1=c.modPow(d, n); System.out.println("m1="+m1); System.out.println(m.equals(m1)); }}
n=221phi(n)=192私鑰指數d=77密文c=172
n=221phi(n)=192d=77c=172
b10041032 林佳雯n=221phi(n)=192私鑰指數d=77密文c=172
N=221phi(n)=192私鑰指數d=77密文c=172
package go;import java.math.BigInteger;import java.security.SecureRandom;public class CAI {public static void main(String[] args)throws Exception{System.out.println("My name is RAMBO!");SecureRandom rnd=new SecureRandom();BigInteger p,q,n,phiN,e,d;int b=512, u=128;p=new BigInteger("13");System.out.println("p="+p);q=new BigInteger("17");System.out.println("q="+q);n=p.multiply(q);System.out.println("n="+n);BigInteger one=new BigInteger("1");phiN=p.subtract(one).multiply(q.subtract(one));System.out.println("phiN="+phiN);e=new BigInteger("5");System.out.println("e="+e);d=e.modInverse(phiN);System.out.println("d="+d);BigInteger m=new BigInteger("100");System.out.println("m="+m);BigInteger c=m.modPow(e, n);System.out.println("c="+c);BigInteger m1=c.modPow(d, n);System.out.println("m1="+m1);System.out.println(m.equals(m1));}}
package go;import java.math.BigInteger;import java.security.SecureRandom;public class CA {public static void main(String[] args)throws Exception{System.out.println("My name is RAMBO!");SecureRandom rnd=new SecureRandom();BigInteger p,q,n,phiN,e,d;int b=512, u=128;p=new BigInteger("13");System.out.println("p="+p);q=new BigInteger("17");System.out.println("q="+q);n=p.multiply(q);System.out.println("n="+n);BigInteger one=new BigInteger("1");phiN=p.subtract(one).multiply(q.subtract(one));System.out.println("phiN="+phiN);e=new BigInteger("5");System.out.println("e="+e);d=e.modInverse(phiN);System.out.println("d="+d);BigInteger m=new BigInteger("100");System.out.println("m="+m);BigInteger c=m.modPow(e, n);System.out.println("c="+c);BigInteger n1=c.modPow(d, n);System.out.println("n1="+n1);System.out.println(m.equals(n1));}}
package go;import java.math.BigInteger;import java.security.SecureRandom;public class CKI {public static void main(String[] args)throws Exception{System.out.println("My name is RAMBO!");SecureRandom rnd=new SecureRandom();BigInteger p,q,n,phiN,e,d;int b=512, u=128;p=new BigInteger("13");System.out.println("p="+p);q=new BigInteger("17");System.out.println("q="+q);n=p.multiply(q);System.out.println("n="+n);BigInteger one=new BigInteger("1");phiN=p.subtract(one).multiply(q.subtract(one));System.out.println("phiN="+phiN);e=new BigInteger("5");System.out.println("e="+e);d=e.modInverse(phiN);System.out.println("d="+d);BigInteger m=new BigInteger("100");System.out.println("m="+m);BigInteger c=m.modPow(e, n);System.out.println("c="+c);BigInteger K=c.modPow(d, n);System.out.println("K="+K);System.out.println(m.equals(K));}}
n = 221phi(n) = 192私鑰指數d = 77密文c = 172
張貼留言
52 則留言:
package go;
import java.math.BigInteger;
import java.security.SecureRandom;
public class CAI {
public static void main(String[] args)throws Exception
{
System.out.println("My name is RAMBO!");
SecureRandom rnd=new SecureRandom();
BigInteger p,q,n,phiN,e,d;
int b=512, u=128;
p=new BigInteger("13");
System.out.println("p="+p);
q=new BigInteger("17");
System.out.println("q="+q);
n=p.multiply(q);
System.out.println("n="+n);
BigInteger one=new BigInteger("1");
phiN=p.subtract(one).multiply(q.subtract(one));
System.out.println("phiN="+phiN);
e=new BigInteger("5");
System.out.println("e="+e);
d=e.modInverse(phiN);
System.out.println("d="+d);
BigInteger m=new BigInteger("100");
System.out.println("m="+m);
BigInteger c=m.modPow(e, n);
System.out.println("c="+c);
BigInteger m1=c.modPow(d, n);
System.out.println("m1="+m1);
System.out.println(m.equals(m1));
}
}
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
d=77
c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
b10041032 林佳雯
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
N=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
d=77
c=172
n=221
phi(n)=192
d=77
c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
N=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
package go;
import java.math.BigInteger;
import java.security.SecureRandom;
public class CAI {
public static void main(String[] args)throws Exception
{
System.out.println("My name is RAMBO!");
SecureRandom rnd=new SecureRandom();
BigInteger p,q,n,phiN,e,d;
int b=512, u=128;
p=new BigInteger("13");
System.out.println("p="+p);
q=new BigInteger("17");
System.out.println("q="+q);
n=p.multiply(q);
System.out.println("n="+n);
BigInteger one=new BigInteger("1");
phiN=p.subtract(one).multiply(q.subtract(one));
System.out.println("phiN="+phiN);
e=new BigInteger("5");
System.out.println("e="+e);
d=e.modInverse(phiN);
System.out.println("d="+d);
BigInteger m=new BigInteger("100");
System.out.println("m="+m);
BigInteger c=m.modPow(e, n);
System.out.println("c="+c);
BigInteger m1=c.modPow(d, n);
System.out.println("m1="+m1);
System.out.println(m.equals(m1));
}
}
package go;
import java.math.BigInteger;
import java.security.SecureRandom;
public class CAI {
public static void main(String[] args)throws Exception
{
System.out.println("My name is RAMBO!");
SecureRandom rnd=new SecureRandom();
BigInteger p,q,n,phiN,e,d;
int b=512, u=128;
p=new BigInteger("13");
System.out.println("p="+p);
q=new BigInteger("17");
System.out.println("q="+q);
n=p.multiply(q);
System.out.println("n="+n);
BigInteger one=new BigInteger("1");
phiN=p.subtract(one).multiply(q.subtract(one));
System.out.println("phiN="+phiN);
e=new BigInteger("5");
System.out.println("e="+e);
d=e.modInverse(phiN);
System.out.println("d="+d);
BigInteger m=new BigInteger("100");
System.out.println("m="+m);
BigInteger c=m.modPow(e, n);
System.out.println("c="+c);
BigInteger m1=c.modPow(d, n);
System.out.println("m1="+m1);
System.out.println(m.equals(m1));
}
}
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
n=221
phi(n)=192
私鑰指數d=77
密文c=172
package go;
import java.math.BigInteger;
import java.security.SecureRandom;
public class CAI {
public static void main(String[] args)throws Exception
{
System.out.println("My name is RAMBO!");
SecureRandom rnd=new SecureRandom();
BigInteger p,q,n,phiN,e,d;
int b=512, u=128;
p=new BigInteger("13");
System.out.println("p="+p);
q=new BigInteger("17");
System.out.println("q="+q);
n=p.multiply(q);
System.out.println("n="+n);
BigInteger one=new BigInteger("1");
phiN=p.subtract(one).multiply(q.subtract(one));
System.out.println("phiN="+phiN);
e=new BigInteger("5");
System.out.println("e="+e);
d=e.modInverse(phiN);
System.out.println("d="+d);
BigInteger m=new BigInteger("100");
System.out.println("m="+m);
BigInteger c=m.modPow(e, n);
System.out.println("c="+c);
BigInteger m1=c.modPow(d, n);
System.out.println("m1="+m1);
System.out.println(m.equals(m1));
}
}
package go;
import java.math.BigInteger;
import java.security.SecureRandom;
public class CA {
public static void main(String[] args)throws Exception
{
System.out.println("My name is RAMBO!");
SecureRandom rnd=new SecureRandom();
BigInteger p,q,n,phiN,e,d;
int b=512, u=128;
p=new BigInteger("13");
System.out.println("p="+p);
q=new BigInteger("17");
System.out.println("q="+q);
n=p.multiply(q);
System.out.println("n="+n);
BigInteger one=new BigInteger("1");
phiN=p.subtract(one).multiply(q.subtract(one));
System.out.println("phiN="+phiN);
e=new BigInteger("5");
System.out.println("e="+e);
d=e.modInverse(phiN);
System.out.println("d="+d);
BigInteger m=new BigInteger("100");
System.out.println("m="+m);
BigInteger c=m.modPow(e, n);
System.out.println("c="+c);
BigInteger n1=c.modPow(d, n);
System.out.println("n1="+n1);
System.out.println(m.equals(n1));
}
}
package go;
import java.math.BigInteger;
import java.security.SecureRandom;
public class CKI {
public static void main(String[] args)throws Exception
{
System.out.println("My name is RAMBO!");
SecureRandom rnd=new SecureRandom();
BigInteger p,q,n,phiN,e,d;
int b=512, u=128;
p=new BigInteger("13");
System.out.println("p="+p);
q=new BigInteger("17");
System.out.println("q="+q);
n=p.multiply(q);
System.out.println("n="+n);
BigInteger one=new BigInteger("1");
phiN=p.subtract(one).multiply(q.subtract(one));
System.out.println("phiN="+phiN);
e=new BigInteger("5");
System.out.println("e="+e);
d=e.modInverse(phiN);
System.out.println("d="+d);
BigInteger m=new BigInteger("100");
System.out.println("m="+m);
BigInteger c=m.modPow(e, n);
System.out.println("c="+c);
BigInteger K=c.modPow(d, n);
System.out.println("K="+K);
System.out.println(m.equals(K));
}
}
n=221
phi(n)=192
d=77
c=172
n = 221
phi(n) = 192
私鑰指數d = 77
密文c = 172
張貼留言