BIG
BIG
Kind: global class
this: {"{"}BIG{"}"}
- BIG
- new BIG()
- instance
- .zero() ⇒
- .one() ⇒
- .iszilch() ⇒
- .isunity() ⇒
- .cswap()
- .cmove()
- .copy() ⇒
- .hcopy() ⇒
- .rcopy() ⇒
- .norm() ⇒
- .fshr() ⇒
- .shr() ⇒
- .fshl() ⇒
- .shl() ⇒
- .nbits() ⇒
- .toString() ⇒
- .add() ⇒
- .or() ⇒
- .plus() ⇒
- .inc() ⇒
- .sub() ⇒
- .rsub() ⇒
- .dec() ⇒
- .minus() ⇒
- .imul() ⇒
- .tobytearray()
- .toBytes()
- .muladd()
- .pmul() ⇒
- .pxmul() ⇒
- .div3() ⇒
- .mod2m() ⇒
- .invmod2m() ⇒
- .mod() ⇒
- .div() ⇒
- .parity() ⇒
- .bit() ⇒
- .lastbits() ⇒
- .jacobi() ⇒
- .invmodp() ⇒
- .powmod() ⇒
- static
new BIG()
General purpose Constructor
biG.zero() ⇒
set to zero
Kind: instance method of BIG
Returns: BIG number
this: {"{"}BIG{"}"}
biG.one() ⇒
set to one
Kind: instance method of BIG
Returns: BIG number
this: {"{"}BIG{"}"}
biG.iszilch() ⇒
test for zero
Kind: instance method of BIG
Returns: True if zero
this: {"{"}BIG{"}"}
biG.isunity() ⇒
test for unity
Kind: instance method of BIG
Returns: True if one
this: {"{"}BIG{"}"}
biG.cswap()
Conditional swap of two BIGs depending on d using XOR - no branches
Kind: instance method of BIG
this: {"{"}BIG{"}"}
Parameter: b BIG number
Parameter: d BIG number
biG.cmove()
Conditional move of BIG depending on d using XOR - no branches
Kind: instance method of BIG
this: {"{"}BIG{"}"}
Parameter: b BIG number
Parameter: d BIG number
biG.copy() ⇒
Copy from another BIG
Kind: instance method of BIG
Returns: The BIG object
this: {"{"}BIG{"}"}
Parameter: y BIG number
biG.hcopy() ⇒
copy from bottom half of ctx.DBIG
Kind: instance method of BIG
Returns: The new BIG object
this: {"{"}BIG{"}"}
Parameter: y BIG number
biG.rcopy() ⇒
copy from ROM
Kind: instance method of BIG
Returns: The BIG object
this: {"{"}BIG{"}"}
Parameter: y BIG number in ROM
biG.norm() ⇒
normalise BIG - force all digits < 2^BASEBITS
Kind: instance method of BIG
Returns: BIG number
this: {"{"}BIG{"}"}
biG.fshr() ⇒
Quick Fast shifts a BIG right by a small number of bits - input must be normalised, output will be normalised
Kind: instance method of BIG
Returns: r The shifted out part
this: {"{"}BIG{"}"}
Parameter: k Number of bits to shift
biG.shr() ⇒
General shift right by k bits
Kind: instance method of BIG
Returns: BIG number
this: {"{"}BIG{"}"}
Parameter: k Number of bits to shift
biG.fshl() ⇒
Fast shifts a BIG left by a small number of bits - input must be normalised, output will be normalised
Kind: instance method of BIG
Returns: r The shifted out part
this: {"{"}BIG{"}"}
Parameter: k Number of bits to shift
biG.shl() ⇒
General shift left by k bits
Kind: instance method of BIG
Returns: BIG number
this: {"{"}BIG{"}"}
Parameter: k Number of bits to shift
biG.nbits() ⇒
length in bits
Kind: instance method of BIG
Returns: The number of bigs in BIG object
this: {"{"}BIG{"}"}
biG.toString() ⇒
Convert to string
Kind: instance method of BIG
Returns: string representation of a BIG number
this: {"{"}BIG{"}"}
biG.add() ⇒
Sum two BIG mumbers
Kind: instance method of BIG
Returns: this+=y
this: {"{"}BIG{"}"}
Parameter: y BIG object
biG.or() ⇒
OR two BIG mumbers
Kind: instance method of BIG
Returns: this|=y
this: {"{"}BIG{"}"}
Parameter: y BIG object
biG.plus() ⇒
Sum two BIG mumbers
Kind: instance method of BIG
Returns: this+x
this: {"{"}BIG{"}"}
Parameter: x BIG object
biG.inc() ⇒
Sum BIG and integer
Kind: instance method of BIG
Returns: this+=i
this: {"{"}BIG{"}"}
Parameter: i Integer to add
biG.sub() ⇒
Subtract BIG from one another
Kind: instance method of BIG
Returns: this-=y
this: {"{"}BIG{"}"}
Parameter: y BIG object
biG.rsub() ⇒
Reverse subtract BIG from one another
Kind: instance method of BIG
Returns: this=x-this
this: {"{"}BIG{"}"}
Parameter: x BIG object
biG.dec() ⇒
Subtract integer from BIG
Kind: instance method of BIG
Returns: this-=i
this: {"{"}BIG{"}"}
Parameter: i Integer to subtract
biG.minus() ⇒
Subtract BIG
Kind: instance method of BIG
Returns: New BIG object
this: {"{"}BIG{"}"}
Parameter: x BIG object
biG.imul() ⇒
Multiply by small integer
Kind: instance method of BIG
Returns: this*c
this: {"{"}BIG{"}"}
Parameter: c small integer
biG.tobytearray()
convert this BIG to byte array
Kind: instance method of BIG
this: {"{"}BIG{"}"}
biG.toBytes()
convert this to byte array
Kind: instance method of BIG
this: {"{"}BIG{"}"}
biG.muladd()
this[i]+=x*y+c, and return high part
Kind: instance method of BIG
this: {"{"}BIG{"}"}
biG.pmul() ⇒
multiply by larger int
Kind: instance method of BIG
Returns: carry value
this: {"{"}BIG{"}"}
Parameter: c large integer
biG.pxmul() ⇒
multiply by still larger int - results requires a DBIG
Kind: instance method of BIG
Returns: DBIG object
this: {"{"}BIG{"}"}
Parameter: c large integer
biG.div3() ⇒
divide by 3
Kind: instance method of BIG
Returns: carry value
this: {"{"}BIG{"}"}
biG.mod2m() ⇒
set x = x mod 2^m
Kind: instance method of BIG
Returns: BIG object
this: {"{"}BIG{"}"}
Parameter: m Exponent
biG.invmod2m() ⇒
a=1/a mod 2^256. This is very fast!
Kind: instance method of BIG
Returns: BIG object
this: {"{"}BIG{"}"}
biG.mod() ⇒
reduce this mod m
Kind: instance method of BIG
Returns: BIG object
this: {"{"}BIG{"}"}
biG.div() ⇒
this/=m1
Kind: instance method of BIG
Returns: BIG number
this: {"{"}BIG{"}"}
Paramter: m1 divisor
biG.parity() ⇒
return parity of this
Kind: instance method of BIG
Returns: BIG object
this: {"{"}BIG{"}"}
biG.bit() ⇒
return n-th bit of this
Kind: instance method of BIG
Returns: bit value
this: {"{"}BIG{"}"}
Parameter: nth bit to return
biG.lastbits() ⇒
return last n bits of this
Kind: instance method of BIG
Returns: bit values
this: {"{"}BIG{"}"}
Parameter: n bits to return
biG.jacobi() ⇒
Jacobi Symbol (this/p)
Kind: instance method of BIG
Returns: 0, 1 or -1
this: {"{"}BIG{"}"}
Parameter: p BIG number
biG.invmodp() ⇒
this=1/this mod p. Binary method
Kind: instance method of BIG
Returns: BIG object
this: {"{"}BIG{"}"}
Parameter: p The BIG Modulus
biG.powmod() ⇒
Exponentation modulo m
Kind: instance method of BIG
Returns: this^e mod m
this: {"{"}BIG{"}"}
Parameter: e1 BIG number
Parameter: m The BIG Modulus
BIG.frombytearray() ⇒
convert from byte array to BIG
Kind: static method of BIG
Returns: BIG object
this: {"{"}BIG{"}"}
Parameter: b Bytearray
BIG.smul() ⇒
return a*b where product fits a BIG
Kind: static method of BIG
Returns: a*b
this: {"{"}BIG{"}"}
Parameter: a BIG number
Parameter: b BIG number
BIG.comp() ⇒
Compare a and b
Kind: static method of BIG
Returns: 0 if a==b, -1 if a<b, +1 if a>b
this: {"{"}BIG{"}"}
Parameter: a BIG number (normalised)
Parameter: b BIG number (normalised
BIG.random() ⇒
Get 8*MODBYTES size random number
Kind: static method of BIG
Returns: BIG number
this: {"{"}BIG{"}"}
Parameter: rng Cryptographically Secure Random Number Generator
BIG.randomnum() ⇒
Create random BIG in portable way, one bit at a time
Kind: static method of BIG
Returns: BIG number
this: {"{"}BIG{"}"}
Parameter: rng Cryptographically Secure Random Number Generator
Parameter: q The BIG Modulus
BIG.mul() ⇒
Multiple two BIG numbers
Kind: static method of BIG
Returns: a*b as a DBIG number
this: {"{"}BIG{"}"}
Parameter: a BIG number
Parameter: b BIG number
BIG.sqr() ⇒
Square two BIG numbers
Kind: static method of BIG
Returns: a*2 as a DBIG number
this: {"{"}BIG{"}"}
Parameter: a BIG number
BIG.modmul() ⇒
Multiple two BIG numbers modulo m
Kind: static method of BIG
Returns: a1*b1 mod m as a BIG number
this: {"{"}BIG{"}"}
Parameter: a1 BIG number
Parameter: b1 BIG number
Parameter: m The BIG Modulus
BIG.modsqr() ⇒
Square a BIG number modulo m
Kind: static method of BIG
Returns: a*2 mod m as a BIG number
this: {"{"}BIG{"}"}
Parameter: a1 BIG number
Parameter: m The BIG Modulus
BIG.modneg() ⇒
Inversion
Kind: static method of BIG
Returns: -a1 mod m
this: {"{"}BIG{"}"}
Parameter: a1 BIG number
Parameter: m The BIG Modulus
BIG.invmod256() ⇒
Arazi and Qi inversion mod 256
Kind: static method of BIG
Returns: BIG number
this: {"{"}BIG{"}"}
Parameter: a BIG number