bn.js 4.11.6 → 4.11.7

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/.npmignore CHANGED
@@ -1,6 +1,8 @@
1
1
  benchmarks/
2
2
  coverage/
3
+ test/
3
4
  node_modules/
4
5
  npm-debug.log
5
6
  1.js
6
7
  logo.png
8
+ .travis.yml
package/README.md CHANGED
@@ -40,12 +40,12 @@ is the list of them in the order of appearance in the function name:
40
40
  The only available postfix at the moment is:
41
41
 
42
42
  * `n` - which means that the argument of the function must be a plain JavaScript
43
- number
43
+ Number. Decimals are not supported.
44
44
 
45
45
  ### Examples
46
46
 
47
47
  * `a.iadd(b)` - perform addition on `a` and `b`, storing the result in `a`
48
- * `a.pmod(b)` - reduce `a` modulo `b`, returning positive value
48
+ * `a.umod(b)` - reduce `a` modulo `b`, returning positive value
49
49
  * `a.iushln(13)` - shift bits of `a` left by 13
50
50
 
51
51
  ## Instructions
@@ -63,7 +63,9 @@ either `le` (little-endian) or `be` (big-endian).
63
63
  pad to length, throwing if already exceeding
64
64
  * `a.toArrayLike(type, endian, length)` - convert to an instance of `type`,
65
65
  which must behave like an `Array`
66
- * `a.toBuffer(endian, length)` - convert to Node.js Buffer (if available)
66
+ * `a.toBuffer(endian, length)` - convert to Node.js Buffer (if available). For
67
+ compatibility with browserify and similar tools, use this instead:
68
+ `a.toArrayLike(Buffer, endian, length)`
67
69
  * `a.bitLength()` - get number of bits occupied
68
70
  * `a.zeroBits()` - return number of less-significant consequent zero bits
69
71
  (example: `1010000` has 4 zero bits)
@@ -81,7 +83,7 @@ either `le` (little-endian) or `be` (big-endian).
81
83
  * `a.eq(b)` - `a` equals `b` (`n`)
82
84
  * `a.toTwos(width)` - convert to two's complement representation, where `width` is bit width
83
85
  * `a.fromTwos(width)` - convert from two's complement representation, where `width` is the bit width
84
- * `a.isBN(object)` - returns true if the supplied `object` is a BN.js instance
86
+ * `BN.isBN(object)` - returns true if the supplied `object` is a BN.js instance
85
87
 
86
88
  ### Arithmetics
87
89
 
@@ -150,7 +152,7 @@ Or:
150
152
  var red = BN.mont(num);
151
153
  ```
152
154
 
153
- To reduce numbers with [Montgomery trick][1]. `.mont()` is generally faster than
155
+ To reduce numbers with [Montgomery trick][0]. `.mont()` is generally faster than
154
156
  `.red(num)`, but slower than `BN.red(primeName)`.
155
157
 
156
158
  ### Converting numbers
package/lib/bn.js CHANGED
@@ -50,6 +50,7 @@
50
50
 
51
51
  var Buffer;
52
52
  try {
53
+ // Obfuscate that we require Buffer, to reduce size
53
54
  Buffer = require('buf' + 'fer').Buffer;
54
55
  } catch (e) {
55
56
  }
@@ -3287,7 +3288,7 @@
3287
3288
  };
3288
3289
 
3289
3290
  Red.prototype.pow = function pow (a, num) {
3290
- if (num.isZero()) return new BN(1);
3291
+ if (num.isZero()) return new BN(1).toRed(this);
3291
3292
  if (num.cmpn(1) === 0) return a.clone();
3292
3293
 
3293
3294
  var windowSize = 4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bn.js",
3
- "version": "4.11.6",
3
+ "version": "4.11.7",
4
4
  "description": "Big number implementation in pure javascript",
5
5
  "main": "lib/bn.js",
6
6
  "scripts": {
package/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- sudo: false
2
- language: node_js
3
- node_js:
4
- - "0.10"
5
- - "0.12"
6
- - "4"
7
- - "5"
8
- env:
9
- matrix:
10
- - TEST_SUITE=unit
11
- matrix:
12
- include:
13
- - node_js: "4"
14
- env: TEST_SUITE=lint
15
- script: npm run $TEST_SUITE