bn.js 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/lib/bn.js +5 -5
- package/package.json +1 -1
- package/CHANGELOG.md +0 -51
package/README.md
CHANGED
|
@@ -21,11 +21,17 @@ console.log(res.toString(10)); // 57047
|
|
|
21
21
|
|
|
22
22
|
**Note**: decimals are not supported in this library.
|
|
23
23
|
|
|
24
|
+
## Sponsors
|
|
25
|
+
|
|
26
|
+
[](https://scoutapm.com/)
|
|
27
|
+
My Open Source work is supported by [Scout APM](https://scoutapm.com/) and
|
|
28
|
+
[other sponsors](https://github.com/sponsors/indutny).
|
|
29
|
+
|
|
24
30
|
## Notation
|
|
25
31
|
|
|
26
32
|
### Prefixes
|
|
27
33
|
|
|
28
|
-
There are several prefixes to instructions that affect the way
|
|
34
|
+
There are several prefixes to instructions that affect the way they work. Here
|
|
29
35
|
is the list of them in the order of appearance in the function name:
|
|
30
36
|
|
|
31
37
|
* `i` - perform operation in-place, storing the result in the host object (on
|
|
@@ -50,7 +56,7 @@ is the list of them in the order of appearance in the function name:
|
|
|
50
56
|
|
|
51
57
|
## Instructions
|
|
52
58
|
|
|
53
|
-
Prefixes/postfixes are put in parens at the of the line. `endian` - could be
|
|
59
|
+
Prefixes/postfixes are put in parens at the end of the line. `endian` - could be
|
|
54
60
|
either `le` (little-endian) or `be` (big-endian).
|
|
55
61
|
|
|
56
62
|
### Utilities
|
|
@@ -129,7 +135,7 @@ for [Mersenne Prime][1].
|
|
|
129
135
|
|
|
130
136
|
### Reduction context
|
|
131
137
|
|
|
132
|
-
To enable this
|
|
138
|
+
To enable this trick one should create a reduction context:
|
|
133
139
|
|
|
134
140
|
```js
|
|
135
141
|
var red = BN.red(num);
|
package/lib/bn.js
CHANGED
|
@@ -480,16 +480,16 @@
|
|
|
480
480
|
var w = this.words[i];
|
|
481
481
|
var word = (((w << off) | carry) & 0xffffff).toString(16);
|
|
482
482
|
carry = (w >>> (24 - off)) & 0xffffff;
|
|
483
|
-
if (carry !== 0 || i !== this.length - 1) {
|
|
484
|
-
out = zeros[6 - word.length] + word + out;
|
|
485
|
-
} else {
|
|
486
|
-
out = word + out;
|
|
487
|
-
}
|
|
488
483
|
off += 2;
|
|
489
484
|
if (off >= 26) {
|
|
490
485
|
off -= 26;
|
|
491
486
|
i--;
|
|
492
487
|
}
|
|
488
|
+
if (carry !== 0 || i !== this.length - 1) {
|
|
489
|
+
out = zeros[6 - word.length] + word + out;
|
|
490
|
+
} else {
|
|
491
|
+
out = word + out;
|
|
492
|
+
}
|
|
493
493
|
}
|
|
494
494
|
if (carry !== 0) {
|
|
495
495
|
out = carry.toString(16) + out;
|
package/package.json
CHANGED
package/CHANGELOG.md
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
5.2.0 / 2021-02-23
|
|
2
|
-
------------------
|
|
3
|
-
|
|
4
|
-
- fix: Buffer not using global in browser (#260)
|
|
5
|
-
- Fix LE constructor for HEX (#265)
|
|
6
|
-
|
|
7
|
-
5.1.3 / 2020-08-14
|
|
8
|
-
------------------
|
|
9
|
-
|
|
10
|
-
- Add support for defined but not implemented Symbol.for (#252)
|
|
11
|
-
|
|
12
|
-
5.1.2 / 2020-05-20
|
|
13
|
-
------------------
|
|
14
|
-
|
|
15
|
-
- Fix BN v5/v4 interoperability issue (#249)
|
|
16
|
-
|
|
17
|
-
5.1.1 / 2019-12-24
|
|
18
|
-
------------------
|
|
19
|
-
|
|
20
|
-
- Temporary workaround for BN#_move (#236)
|
|
21
|
-
- Add eslintrc instead config in package.json (#237)
|
|
22
|
-
|
|
23
|
-
5.1.0 / 2019-12-23
|
|
24
|
-
------------------
|
|
25
|
-
|
|
26
|
-
- Benchmark for BigInt (#226)
|
|
27
|
-
- Add documentation for max/min (#232)
|
|
28
|
-
- Update BN#inspect for Symbols (#225)
|
|
29
|
-
- Improve performance of toArrayLike (#222)
|
|
30
|
-
- temporary disable jumboMulTo in BN#mulTo (#221)
|
|
31
|
-
- optimize toBitArray function (#212)
|
|
32
|
-
- fix iaddn sign issue (#216)
|
|
33
|
-
|
|
34
|
-
5.0.0 / 2019-07-04
|
|
35
|
-
------------------
|
|
36
|
-
|
|
37
|
-
- travis: update node versions (#205)
|
|
38
|
-
- Refactor buffer constructor (#200)
|
|
39
|
-
- lib: fix for negative numbers: imuln, modrn, idivn (#185)
|
|
40
|
-
- bn: fix Red#imod (#178)
|
|
41
|
-
- check unexpected high bits for invalid characters (#173)
|
|
42
|
-
- document support very large integers (#158)
|
|
43
|
-
- only define toBuffer if Buffer is defined (#172)
|
|
44
|
-
- lib: better validation of string input (#151)
|
|
45
|
-
- tests: reject decimal input in constructor (#91)
|
|
46
|
-
- bn: make .strip() an internal method (#105)
|
|
47
|
-
- lib: deprecate `.modn()` introduce `.modrn()` (#112 #129 #130)
|
|
48
|
-
- bn: don't accept invalid characters (#141)
|
|
49
|
-
- package: use `files` insteadof `.npmignore` (#152)
|
|
50
|
-
- bn: improve allocation speed for buffers (#167)
|
|
51
|
-
- toJSON to default to interoperable hex (length % 2) (#164)
|