# jsbn

> The jsbn library is a fast, portable implementation of large-number math in pure JavaScript, enabling public-key crypto and other applications on desktop and mobile browsers.

Latest version **1.1.0** (published 2017-02-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsbn
pnpm add jsbn
yarn add jsbn
bun add jsbn
```

## Health

**Score 38/100 (D)** — status: abandoned.

Positive: has types package; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-02-13 |
| First published | 2013-04-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/jsbn) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 173 |
| Author | Tom Wu |
| Maintainers | andyperlitch |
| Keywords | biginteger, bignumber, big, integer |

## Links

- npm: https://www.npmjs.com/package/jsbn
- Repository: https://github.com/andyperlitch/jsbn
- Homepage: https://github.com/andyperlitch/jsbn#readme
- Issues: https://github.com/andyperlitch/jsbn/issues
- npm.io page: https://npm.io/package/jsbn

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-02-13
- 0.1.1 — 2017-02-12
- 0.1.0 — 2015-10-29
- 0.0.0 — 2013-04-27

## README

# jsbn: javascript big number

[Tom Wu's Original Website](http://www-cs-students.stanford.edu/~tjw/jsbn/)

I felt compelled to put this on github and publish to npm. I haven't tested every other big integer library out there, but the few that I have tested in comparison to this one have not even come close in performance. I am aware of the `bi` module on npm, however it has been modified and I wanted to publish the original without modifications. This is jsbn and jsbn2 from Tom Wu's original website above, with the module pattern applied to prevent global leaks and to allow for use with node.js on the server side.

## usage

    var BigInteger = require('jsbn').BigInteger;

    var bi = new BigInteger('91823918239182398123');
    console.log(bi.bitLength()); // 67


## API

### bi.toString()

returns the base-10 number as a string

### bi.negate()

returns a new BigInteger equal to the negation of `bi`

### bi.abs

returns new BI of absolute value

### bi.compareTo



### bi.bitLength



### bi.mod



### bi.modPowInt



### bi.clone



### bi.intValue



### bi.byteValue



### bi.shortValue



### bi.signum



### bi.toByteArray



### bi.equals



### bi.min



### bi.max



### bi.and



### bi.or



### bi.xor



### bi.andNot



### bi.not



### bi.shiftLeft



### bi.shiftRight



### bi.getLowestSetBit



### bi.bitCount



### bi.testBit



### bi.setBit



### bi.clearBit



### bi.flipBit



### bi.add



### bi.subtract



### bi.multiply



### bi.divide



### bi.remainder



### bi.divideAndRemainder



### bi.modPow



### bi.modInverse



### bi.pow



### bi.gcd



### bi.isProbablePrime

---
_Source: https://npm.io/package/jsbn · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
