Generated by JsDoc Toolkit 2.3.3-beta on Wed Nov 06 2013 17:43:36 GMT+0100 (MEZ)
HTML template: Codeview

Class sjcl.bn


Defined in: bn.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
sjcl.bn(it)
Method Summary
Method Attributes Method Name and Description
 
add(that)
this + that.
 
addM(that)
this += that.
 
Return the length in bits, rounded up to the nearest byte.
 
Constant-time normalize.
 
this *= 2.
 
equals(that)
Returns true if "this" and "that" are equal.
<static>  
sjcl.bn.fromBits(bits)
 
Reduce and normalize.
 
Get the i'th limb of this, zero if i is too large.
 
Constant time comparison function.
 
this /= 2, rounded down.
 
Initializes this with it, either as a bn, a number, or a hex string.
 
return inverse mod prime p.
 
mul(that)
this * that.
 
mulmod(that, N)
this * that mod N
 
Propagate carries.
 
power(l)
this ^ n.
 
powermod(x, N)
this ^ x mod N
<static>  
sjcl.bn.ppr.fullReduce()
mostly constant-time, very expensive full reduction.
<static>  
sjcl.bn.ppr.inverse()
<static>  
sjcl.bn.ppr.reduce()
Approximate reduction mod p.
<static>  
sjcl.bn.pseudoMersennePrime(exponent, coeff)
Creates a new subclass of bn, based on reduction modulo a pseudo-Mersenne prime, i.e.
 
Reduce mod a modulus.
 
this ^ 2.
 
sub(that)
this - that.
 
subM(that)
this -= that.
 
toBits(len)
Serialize to a bit array
 
Convert to a hex string.
Class Detail
sjcl.bn(it)
Parameters:
it
Method Detail
add(that)
this + that. Does not normalize.
Parameters:
that
addM(that)
this += that. Does not normalize.
Parameters:
that
bitLength()
Return the length in bits, rounded up to the nearest byte.
cnormalize()
Constant-time normalize. Does not allocate additional space.
doubleM()
this *= 2. Requires normalized; ends up normalized.
equals(that)
Returns true if "this" and "that" are equal. Calls fullReduce(). Equality test is in constant time.
Parameters:
that
<static> sjcl.bn.fromBits(bits)
Parameters:
bits
fullReduce()
Reduce and normalize.
getLimb(i)
Get the i'th limb of this, zero if i is too large.
Parameters:
i
greaterEquals(that)
Constant time comparison function. Returns 1 if this >= that, or zero otherwise.
Parameters:
that
halveM()
this /= 2, rounded down. Requires normalized; ends up normalized.
initWith(it)
Initializes this with it, either as a bn, a number, or a hex string.
Parameters:
it
inverseMod(p)
return inverse mod prime p. p must be odd. Binary extended Euclidean algorithm mod p.
Parameters:
p
mul(that)
this * that. Normalizes and reduces.
Parameters:
that
mulmod(that, N)
this * that mod N
Parameters:
that
N
normalize()
Propagate carries.
power(l)
this ^ n. Uses square-and-multiply. Normalizes and reduces.
Parameters:
l
powermod(x, N)
this ^ x mod N
Parameters:
x
N
<static> sjcl.bn.ppr.fullReduce()
mostly constant-time, very expensive full reduction.
<static> sjcl.bn.ppr.inverse()
<static> sjcl.bn.ppr.reduce()
Approximate reduction mod p. May leave a number which is negative or slightly larger than p.
<static> sjcl.bn.pseudoMersennePrime(exponent, coeff)
Creates a new subclass of bn, based on reduction modulo a pseudo-Mersenne prime, i.e. a prime of the form 2^e + sum(a * 2^b),where the sum is negative and sparse.
Parameters:
exponent
coeff
reduce()
Reduce mod a modulus. Stubbed for subclassing.
square()
this ^ 2. Normalizes and reduces.
sub(that)
this - that. Does not normalize.
Parameters:
that
subM(that)
this -= that. Does not normalize.
Parameters:
that
toBits(len)
Serialize to a bit array
Parameters:
len
toString()
Convert to a hex string.