• Stars
    star
    167
  • Rank 226,635 (Top 5 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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.

jsbn: javascript big number

Tom Wu's Original Website

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([radix]) => string

Returns a string representing the BigInteger bi.

  • radix - Optional. An integer between 2 and 36 specifying the base to use for representing numeric values.

If the radix is not specified, the preferred radix is assumed to be 10.

bi.negate() => BigInteger

Returns a new BigInteger equal to the negation of bi.

bi.abs() => BigInteger

Returns a BigInteger equal to the absolute value of bi.

note: if the bi is a positive value, it will be returned as is, otherwise a new instance of BigInteger is returned.

bi.compareTo(other) => number

Compare to BigIntegers. The return value will be a negative JavaScript number if bi is less than other, a positive number if bi is greater than other, and 0 if bi and other represents the same integer.

bi.bitLength() => number

Returns the number of bits used to store bi as a JavaScript number.

bi.mod(m) => BigInteger

Returns a BigInteger with the value of (bi mod m).

bi.modPow(exponent, m) => BitInteger

Returns a BigInteger with the value of (biexponent mod m).

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

More Repositories

1

ngx-super-table

A feature-rich table component built with angular.
TypeScript
115
star
2

angularjs-table

A table component built with angular (1.x) that is catered to real-time data.
JavaScript
33
star
3

typeroots-fail

Illustrates proper setup of typeRoots for custom declaration files
TypeScript
22
star
4

ngx-d3-tooltip

Add tooltips to your d3 visualizations using Angular Components.
TypeScript
4
star
5

d3-layout-circle-graph

A d3 layout generator for visualizing a graph using a circle of nodes and chords connecting them.
JavaScript
3
star
6

stonks

STONKS
TypeScript
3
star
7

bland-chart

An SVG charting module that uses Raphael.js for rendering and Backbone for code organization
JavaScript
2
star
8

node-github2cocoon

Express.js middleware to use a github repository/branch as a zip file endpoint for the CocoonJS Launcher.
JavaScript
2
star
9

bobs-tree

A tool for storing and viewing genealogical data. Love you grandpa bob!
JavaScript
1
star
10

malhar-ui-console-2

Malhar UI Console
JavaScript
1
star
11

tabled

Backbone UI component for building interactive tables.
JavaScript
1
star
12

angular-jsbn-big-integer

BigInteger class from Tom Wu's jsbn library, as an angular service.
JavaScript
1
star
13

skills-barchart

A horizontal bar chart for visualizing skills in different categories, where the x-axis is novice-proficient-advanced-expert. Great for resumes!
TypeScript
1
star
14

backbone-set-event

Triggers an event on backbone collections when Collection.set() is called
JavaScript
1
star
15

The-Bland-Framework

A work-in-progress PHP framework, based on Kohana with less statics and globals.
JavaScript
1
star
16

shadcn-redwood-example

Example setup of shadcn-ui in a RedwoodJS Project
TypeScript
1
star