Hierarchy

Constructors

  • Parameters

    • number: string | number | number[] | Uint8Array | Buffer | new BN
    • Optional base: number | "hex"
    • Optional endian: Endianness

    Returns BN

  • Parameters

    • number: string | number | number[] | Uint8Array | Buffer | new BN
    • Optional endian: Endianness

    Returns BN

Properties

BN: typeof new BN
wordSize: 26

Methods

  • Returns new BN

    Description

    absolute value

  • Parameters

    Returns new BN

    Description

    addition

  • Parameters

    • b: number

    Returns new BN

    Description

    addition

  • Parameters

    Returns new BN

    Description

    and

  • Parameters

    • b: number

    Returns new BN

    Description

    and (NOTE: andln is going to be replaced with andn in future)

  • Parameters

    • b: number

    Returns new BN

    Description

    add 1 << b to the number

  • Returns number

    Description

    get number of bits occupied

  • Returns number

    Description

    return number of bytes occupied

  • Returns new BN

    Description

    clone number

  • Parameters

    Returns 0 | 1 | -1

    Description

    compare numbers and return -1 (a < b), 0 (a == b), or 1 (a > b) depending on the comparison result

  • Parameters

    • b: number

    Returns 0 | 1 | -1

    Description

    compare numbers and return -1 (a < b), 0 (a == b), or 1 (a > b) depending on the comparison result

  • Parameters

    Returns new BN

    Description

    divide

  • Parameters

    Returns new BN

    Description

    rounded division

  • Parameters

    • b: number

    Returns new BN

    Description

    divide

  • Parameters

    Returns {
        a: new BN;
        b: new BN;
        gcd: new BN;
    }

    Description

    Extended GCD results ({ a: ..., b: ..., gcd: ... })

  • Parameters

    Returns boolean

    Description

    a equals b

  • Parameters

    • b: number

    Returns boolean

    Description

    a equals b

  • Parameters

    • width: number

    Returns new BN

    Description

    convert from two's complement representation, where width is the bit width

  • Parameters

    Returns new BN

    Description

    GCD

  • Parameters

    Returns boolean

    Description

    a greater than b

  • Parameters

    Returns boolean

    Description

    a greater than or equals b

  • Parameters

    • b: number

    Returns boolean

    Description

    a greater than or equals b

  • Parameters

    • b: number

    Returns boolean

    Description

    a greater than b

  • Returns new BN

    Description

    absolute value

  • Parameters

    Returns new BN

    Description

    addition

  • Parameters

    • b: number

    Returns new BN

    Description

    addition

  • Parameters

    Returns new BN

    Description

    and

  • Parameters

    • b: number

    Returns new BN

    Description

    divide

  • Parameters

    • b: number

    Returns new BN

    Description

    clear bits with indexes higher or equal to b

  • Parameters

    Returns new BN

    Description

    multiply

  • Parameters

    • b: number

    Returns new BN

    Description

    multiply

  • Returns new BN

    Description

    negate sign

  • Parameters

    • w: number

    Returns new BN

    Description

    not (for the width specified by w)

  • Parameters

    Returns new BN

    Description

    inverse a modulo b

  • Parameters

    Returns new BN

    Description

    or

  • Returns boolean

    Description

    check if value is even

  • Returns boolean

    Description

    true if the number is negative

  • Returns boolean

    Description

    check if value is odd

  • Returns boolean

    Description

    check if value is zero

  • Parameters

    • b: number

    Returns new BN

    Description

    shift left

  • Returns new BN

    Description

    square

  • Parameters

    Returns new BN

    Description

    subtraction

  • Parameters

    • b: number

    Returns new BN

    Description

    subtraction

  • Parameters

    Returns new BN

    Description

    and

  • Parameters

    Returns new BN

    Description

    or

  • Parameters

    • b: number

    Returns new BN

    Description

    shift left

  • Parameters

    • b: number

    Returns new BN

    Description

    shift right

  • Parameters

    Returns new BN

    Description

    xor

  • Parameters

    Returns new BN

    Description

    xor

  • Parameters

    Returns boolean

    Description

    a less than b

  • Parameters

    Returns boolean

    Description

    a less than or equals b

  • Parameters

    • b: number

    Returns boolean

    Description

    a less than or equals b

  • Parameters

    • b: number

    Returns boolean

    Description

    a less than b

  • Parameters

    • b: number

    Returns new BN

    Description

    clear bits with indexes higher or equal to b

  • Parameters

    Returns new BN

    Description

    reduct

  • Parameters

    • b: number

    Returns number

    Deprecated

    Description

    reduct

  • Parameters

    • b: number

    Returns number

    Description

    reduct

  • Parameters

    Returns new BN

    Description

    multiply

  • Parameters

    • b: number

    Returns new BN

    Description

    multiply

  • Returns new BN

    Description

    negate sign

  • Parameters

    • w: number

    Returns new BN

    Description

    not (for the width specified by w)

  • Parameters

    Returns new BN

    Description

    or

  • Parameters

    Returns new BN

    Description

    raise a to the power of b

  • Parameters

    • b: number

    Returns new BN

    Description

    set specified bit to 1

  • Parameters

    • b: number

    Returns new BN

    Description

    shift left

  • Parameters

    • b: number

    Returns new BN

    Description

    shift right

  • Returns new BN

    Description

    square

  • Parameters

    Returns new BN

    Description

    subtraction

  • Parameters

    • b: number

    Returns new BN

    Description

    subtraction

  • Parameters

    • b: number

    Returns boolean

    Description

    test if specified bit is set

  • Parameters

    • Optional endian: Endianness
    • Optional length: number

    Returns number[]

    Description

    convert to byte Array, and optionally zero pad to length, throwing if already exceeding

  • Parameters

    • ArrayType: BufferConstructor
    • Optional endian: Endianness
    • Optional length: number

    Returns Buffer

    Description

    convert to an instance of type, which must behave like an Array

  • Parameters

    • ArrayType: any[]
    • Optional endian: Endianness
    • Optional length: number

    Returns any[]

  • Parameters

    • Optional endian: Endianness
    • Optional length: number

    Returns Buffer

    Description

    convert to Node.js Buffer (if available). For compatibility with browserify and similar tools, use this instead: a.toArrayLike(Buffer, endian, length)

  • Returns number

    Description

    convert to Javascript Number (limited to 53 bits)

  • Parameters

    • reductionContext: ReductionContext

    Returns RedBN

    Description

    Convert number to red

  • Parameters

    • Optional base: number | "hex"
    • Optional length: number

    Returns string

    Description

    convert to base-string and pad with zeroes

  • Parameters

    • width: number

    Returns new BN

    Description

    convert to two's complement representation, where width is bit width

  • Parameters

    Returns new BN

    Description

    and

  • Parameters

    Returns 0 | 1 | -1

    Description

    compare numbers and return -1 (a < b), 0 (a == b), or 1 (a > b) depending on the comparison result

  • Parameters

    Returns new BN

    Description

    reduct

  • Parameters

    Returns new BN

    Description

    or

  • Parameters

    • b: number

    Returns new BN

    Description

    shift left

  • Parameters

    • b: number

    Returns new BN

    Description

    shift right

  • Parameters

    Returns new BN

    Description

    xor

  • Parameters

    Returns new BN

    Description

    xor

  • Returns number

    Description

    return number of less-significant consequent zero bits (example: 1010000 has 4 zero bits)

  • Parameters

    • b: any

    Returns b is new BN

    Description

    returns true if the supplied object is a BN.js instance

  • Parameters

    Returns new BN

    Description

    returns the maximum of 2 BN instances.

  • Parameters

    Returns new BN

    Description

    returns the minimum of 2 BN instances.

  • Parameters

    Returns ReductionContext

    Description

    create a reduction context with the Montgomery trick.

  • Parameters

    • reductionContext: IPrimeName | new BN

    Returns ReductionContext

    Description

    create a reduction context

Generated using TypeDoc