• Home
Name Date Size #Lines LOC

..--

.npmignoreD12-May-202422 22

LICENSED12-May-20241.5 KiB4036

README.mdD12-May-20241.6 KiB17651

example.htmlD12-May-2024200 1210

example.jsD12-May-2024107 33

index.jsD12-May-202440.8 KiB1,3581,053

package.jsonD12-May-20241.4 KiB5453

README.md

1# jsbn: javascript big number
2
3[Tom Wu's Original Website](http://www-cs-students.stanford.edu/~tjw/jsbn/)
4
5I 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 modular pattern applied to prevent global leaks and to allow for use with node.js on the server side.
6
7## usage
8
9    var BigInteger = require('jsbn');
10
11    var a = new BigInteger('91823918239182398123');
12    alert(a.bitLength()); // 67
13
14
15## API
16
17### bi.toString()
18
19returns the base-10 number as a string
20
21### bi.negate()
22
23returns a new BigInteger equal to the negation of `bi`
24
25### bi.abs
26
27returns new BI of absolute value
28
29### bi.compareTo
30
31
32
33### bi.bitLength
34
35
36
37### bi.mod
38
39
40
41### bi.modPowInt
42
43
44
45### bi.clone
46
47
48
49### bi.intValue
50
51
52
53### bi.byteValue
54
55
56
57### bi.shortValue
58
59
60
61### bi.signum
62
63
64
65### bi.toByteArray
66
67
68
69### bi.equals
70
71
72
73### bi.min
74
75
76
77### bi.max
78
79
80
81### bi.and
82
83
84
85### bi.or
86
87
88
89### bi.xor
90
91
92
93### bi.andNot
94
95
96
97### bi.not
98
99
100
101### bi.shiftLeft
102
103
104
105### bi.shiftRight
106
107
108
109### bi.getLowestSetBit
110
111
112
113### bi.bitCount
114
115
116
117### bi.testBit
118
119
120
121### bi.setBit
122
123
124
125### bi.clearBit
126
127
128
129### bi.flipBit
130
131
132
133### bi.add
134
135
136
137### bi.subtract
138
139
140
141### bi.multiply
142
143
144
145### bi.divide
146
147
148
149### bi.remainder
150
151
152
153### bi.divideAndRemainder
154
155
156
157### bi.modPow
158
159
160
161### bi.modInverse
162
163
164
165### bi.pow
166
167
168
169### bi.gcd
170
171
172
173### bi.isProbablePrime
174
175
176