Constructors
constructor
- new BN(number: string | number | BN | number[] | Uint8Array | Buffer, base?: number | "hex", endian?: Endianness): BN
-
Parameters
-
number: string | number | BN | number[] | Uint8Array | Buffer
-
Optional
base: number | "hex"
-
Returns BN
- new BN(number: string | number | BN | number[] | Uint8Array | Buffer, endian?: Endianness): BN
-
Parameters
-
number: string | number | BN | number[] | Uint8Array | Buffer
-
Returns BN
Properties
Static
BN
Static
wordSize
wordSize: 26
Methods
abs
- abs(): BN
-
Returns BN
add
- add(b: BN): BN
-
Returns BN
addn
- addn(b: number): BN
-
Returns BN
and
- and(b: BN): BN
-
Returns BN
andln
- andln(b: number): BN
-
Returns BN
bincn
- bincn(b: number): BN
-
Returns BN
bitLength
- bitLength(): number
-
Returns number
byteLength
- byteLength(): number
-
Returns number
clone
- clone(): BN
-
Returns BN
cmp
- cmp(b: BN): 0 | 1 | -1
-
Returns 0 | 1 | -1
cmpn
- cmpn(b: number): 0 | 1 | -1
-
Returns 0 | 1 | -1
div
- div(b: BN): BN
-
Returns BN
divRound
- divRound(b: BN): BN
-
Returns BN
divmod
- divmod(b: BN, mode?: "div" | "mod", positive?: boolean): {
    div: BN;
    mod: BN;
}
-
Parameters
-
-
Optional
mode: "div" | "mod"
-
Optional
positive: boolean
Returns {
    div: BN;
    mod: BN;
}
divn
- divn(b: number): BN
-
Returns BN
egcd
- egcd(b: BN): {
    a: BN;
    b: BN;
    gcd: BN;
}
-
Returns {
    a: BN;
    b: BN;
    gcd: BN;
}
eq
- eq(b: BN): boolean
-
Returns boolean
eqn
- eqn(b: number): boolean
-
Returns boolean
fromTwos
- fromTwos(width: number): BN
-
Returns BN
gcd
- gcd(b: BN): BN
-
Returns BN
gt
- gt(b: BN): boolean
-
Returns boolean
gte
- gte(b: BN): boolean
-
Returns boolean
gten
- gten(b: number): boolean
-
Returns boolean
gtn
- gtn(b: number): boolean
-
Returns boolean
iabs
- iabs(): BN
-
Returns BN
iadd
- iadd(b: BN): BN
-
Returns BN
iaddn
- iaddn(b: number): BN
-
Returns BN
iand
- iand(b: BN): BN
-
Returns BN
idivn
- idivn(b: number): BN
-
Returns BN
imaskn
- imaskn(b: number): BN
-
Returns BN
imul
- imul(b: BN): BN
-
Returns BN
imuln
- imuln(b: number): BN
-
Returns BN
ineg
- ineg(): BN
-
Returns BN
inotn
- inotn(w: number): BN
-
Returns BN
invm
- invm(b: BN): BN
-
Returns BN
ior
- ior(b: BN): BN
-
Returns BN
isEven
- isEven(): boolean
-
Returns boolean
isNeg
- isNeg(): boolean
-
Returns boolean
isOdd
- isOdd(): boolean
-
Returns boolean
isZero
- isZero(): boolean
-
Returns boolean
ishln
- ishln(b: number): BN
-
Returns BN
ishrn
- ishrn(b: number): BN
-
Returns BN
isqr
- isqr(): BN
-
Returns BN
isub
- isub(b: BN): BN
-
Returns BN
isubn
- isubn(b: number): BN
-
Returns BN
iuand
- iuand(b: BN): BN
-
Returns BN
iuor
- iuor(b: BN): BN
-
Returns BN
iushln
- iushln(b: number): BN
-
Returns BN
iushrn
- iushrn(b: number): BN
-
Returns BN
iuxor
- iuxor(b: BN): BN
-
Returns BN
ixor
- ixor(b: BN): BN
-
Returns BN
lt
- lt(b: BN): boolean
-
Returns boolean
lte
- lte(b: BN): boolean
-
Returns boolean
lten
- lten(b: number): boolean
-
Returns boolean
ltn
- ltn(b: number): boolean
-
Returns boolean
maskn
- maskn(b: number): BN
-
Returns BN
mod
- mod(b: BN): BN
-
Returns BN
modn
- modn(b: number): number
-
Returns number
modrn
- modrn(b: number): number
-
Returns number
mul
- mul(b: BN): BN
-
Returns BN
muln
- muln(b: number): BN
-
Returns BN
neg
- neg(): BN
-
Returns BN
notn
- notn(w: number): BN
-
Returns BN
or
- or(b: BN): BN
-
Returns BN
pow
- pow(b: BN): BN
-
Returns BN
setn
- setn(b: number, value: boolean | 0 | 1): BN
-
Parameters
-
b: number
-
value: boolean | 0 | 1
Returns BN
shln
- shln(b: number): BN
-
Returns BN
shrn
- shrn(b: number): BN
-
Returns BN
sqr
- sqr(): BN
-
Returns BN
sub
- sub(b: BN): BN
-
Returns BN
subn
- subn(b: number): BN
-
Returns BN
testn
- testn(b: number): boolean
-
Returns boolean
toArray
- toArray(endian?: Endianness, length?: number): number[]
-
Returns number[]
toArrayLike
- toArrayLike(ArrayType: BufferConstructor, endian?: Endianness, length?: number): Buffer
-
Parameters
-
ArrayType: BufferConstructor
-
-
Optional
length: number
Returns Buffer
- toArrayLike(ArrayType: any[], endian?: Endianness, length?: number): any[]
-
Parameters
-
ArrayType: any[]
-
-
Optional
length: number
Returns any[]
toBuffer
- toBuffer(endian?: Endianness, length?: number): Buffer
-
Returns Buffer
toJSON
- toJSON(): string
-
Returns string
toNumber
- toNumber(): number
-
Returns number
toRed
- toRed(reductionContext: ReductionContext): RedBN
-
Returns RedBN
toString
- toString(base?: number | "hex", length?: number): string
-
Parameters
-
Optional
base: number | "hex"
-
Optional
length: number
Returns string
toTwos
- toTwos(width: number): BN
-
Returns BN
uand
- uand(b: BN): BN
-
Returns BN
ucmp
- ucmp(b: BN): 0 | 1 | -1
-
Returns 0 | 1 | -1
umod
- umod(b: BN): BN
-
Returns BN
uor
- uor(b: BN): BN
-
Returns BN
ushln
- ushln(b: number): BN
-
Returns BN
ushrn
- ushrn(b: number): BN
-
Returns BN
uxor
- uxor(b: BN): BN
-
Returns BN
xor
- xor(b: BN): BN
-
Returns BN
zeroBits
- zeroBits(): number
-
Returns number
Static
isBN
- isBN(b: any): b is BN
-
Returns b is BN
Static
max
- max(left: BN, right: BN): BN
-
Returns BN
Static
min
- min(left: BN, right: BN): BN
-
Returns BN
Description
absolute value