Code example for BigInteger

Methods: shiftLeft

0
 
        BigInteger min = TWO;
        int m = dhParams.getM();
        if (m != 0)
        { 
            min = ONE.shiftLeft(m - 1);
        } 
 
        BigInteger max = p.subtract(TWO);
        BigInteger q = dhParams.getQ();
        if (q != null)
        { 
            max = q.subtract(TWO);
        } 
 
        return BigIntegers.createRandomInRange(min, max, random);
    } 
 
    BigInteger calculatePublic(DHParameters dhParams, BigInteger x)
    { 
        return dhParams.getG().modPow(x, dhParams.getP());