Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.70 KB | None | 0 0
  1.  
  2. import java.math.BigInteger;
  3.  
  4. class EEA{
  5.     BigInteger lnko;
  6.     BigInteger x;
  7.     BigInteger y;
  8.  
  9.     public EEA(BigInteger lnko, BigInteger x, BigInteger y) {
  10.         this.lnko = lnko;
  11.         this.x = x;
  12.         this.y = y;
  13.     }
  14.  
  15.     @Override
  16.     public String toString() {
  17.         return "lnko: " + lnko + " X:" + x + " Y:" + y;
  18.     }
  19.    
  20.     public static EEA lnko(BigInteger a, BigInteger b){
  21.         BigInteger[] X = new BigInteger[100];
  22.         BigInteger[] Y = new BigInteger[100];;
  23.         X[0] = BigInteger.ONE;
  24.         X[1] = BigInteger.ZERO;
  25.         Y[1] = BigInteger.ONE;
  26.         Y[0] = BigInteger.ZERO;
  27.         int k = 1;
  28.        
  29.        
  30.         BigInteger r;
  31.         a = a.abs();
  32.         b = b.abs();
  33.         while(!b.equals(BigInteger.ZERO)){
  34.             BigInteger hanyszor = a.divide(b);
  35.             r = a.mod(b);
  36.             a = b;
  37.             b = r;
  38.             X[k + 1] = (X[k].multiply(hanyszor)).add(X[k - 1]);
  39.             Y[k + 1] = (Y[k].multiply(hanyszor)).add(Y[k - 1]);
  40.             k++;
  41.         }
  42.        
  43.         return new EEA(a, X[k-1].multiply(new BigInteger(((int)Math.pow(-1, k-1)) + "")),
  44.                 Y[k-1].multiply(new BigInteger(((int)Math.pow(-1, k )) + "")));
  45.     }
  46. }
  47.  
  48.  
  49. class MillerRabin{
  50.     BigInteger N;
  51.     int k;
  52.     int r;
  53.     int d;
  54.    
  55.     void getrandd(){
  56.        
  57.     }
  58.    
  59.    
  60.     //write n as 2rยทd + 1 with d odd (by factoring out powers of 2 from n โˆ’ 1)
  61.    
  62. }
  63.  
  64.  
  65. public class EA {
  66.     public static void main(String[] args) {
  67.         BigInteger a = new BigInteger("235");
  68.         BigInteger b = new BigInteger("124");
  69.         EEA asd = EEA.lnko(a, b);
  70.         System.out.println(asd);
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement