Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ECFieldElementFp.prototype.lucasSequence = function(P,Q,k)
{
var n = k.bitLength();
var s = k.getLowestSetBit();
var Uh = BigInteger.ONE;
var Vl = BigInteger.TWO;
var Vh = P;
var Ql = BigInteger.ONE;
var Qh = BigInteger.ONE;
for (var j = n - 1; j >= s + 1; --j)
{
Ql = this.modMult(Ql, Qh);
if (k.testBit(j))
{
Qh = this.modMult(Ql, Q);
Uh = this.modMult(Uh, Vh);
Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql)));
Vh = this.modReduce(Vh.multiply(Vh).subtract(Qh.shiftLeft(1)));
}
else
ECFieldElementFp.prototype.lucasSequence = function(P,Q,k)
{
var n = k.bitLength();
var s = k.getLowestSetBit();
var Uh = BigInteger.ONE;
var Vl = BigInteger.TWO;
var Vh = P;
var Ql = BigInteger.ONE;
var Qh = BigInteger.ONE;
for (var j = n - 1; j >= s + 1; --j)
{
Ql = this.modMult(Ql, Qh);
if (k.testBit(j))
{
Qh = this.modMult(Ql, Q);
Uh = this.modMult(Uh, Vh);
Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql)));
Vh = this.modReduce(Vh.multiply(Vh).subtract(Qh.shiftLeft(1)));
}
else