diff options
author | Kat Marchán <kzm@zkat.tech> | 2018-08-15 23:30:52 +0300 |
---|---|---|
committer | Kat Marchán <kzm@zkat.tech> | 2018-08-21 02:17:43 +0300 |
commit | 37b8f405f35c861b7beeed56f71ad20b0bf87889 (patch) | |
tree | 96cbf4a9121d6a9d29cc72bd0d790011d65d110f /node_modules/ecc-jsbn/index.js | |
parent | 1f6ba1cb174590c1f5d2b00e2ca238dfa39d507a (diff) |
request@2.88.0
Credit: @mikeal
Diffstat (limited to 'node_modules/ecc-jsbn/index.js')
-rwxr-xr-x[-rw-r--r--] | node_modules/ecc-jsbn/index.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/node_modules/ecc-jsbn/index.js b/node_modules/ecc-jsbn/index.js index 24372810b..fb19a1d6f 100644..100755 --- a/node_modules/ecc-jsbn/index.js +++ b/node_modules/ecc-jsbn/index.js @@ -1,6 +1,7 @@ var crypto = require("crypto"); var BigInteger = require("jsbn").BigInteger; var ECPointFp = require("./lib/ec.js").ECPointFp; +var Buffer = require("safer-buffer").Buffer; exports.ECCurves = require("./lib/sec.js"); // zero prepad @@ -40,17 +41,17 @@ exports.ECKey = function(curve, key, isPublic) if(this.P) { // var pubhex = unstupid(this.P.getX().toBigInteger().toString(16),bytes*2)+unstupid(this.P.getY().toBigInteger().toString(16),bytes*2); -// this.PublicKey = new Buffer("04"+pubhex,"hex"); - this.PublicKey = new Buffer(c.getCurve().encodeCompressedPointHex(this.P),"hex"); +// this.PublicKey = Buffer.from("04"+pubhex,"hex"); + this.PublicKey = Buffer.from(c.getCurve().encodeCompressedPointHex(this.P),"hex"); } if(priv) { - this.PrivateKey = new Buffer(unstupid(priv.toString(16),bytes*2),"hex"); + this.PrivateKey = Buffer.from(unstupid(priv.toString(16),bytes*2),"hex"); this.deriveSharedSecret = function(key) { if(!key || !key.P) return false; var S = key.P.multiply(priv); - return new Buffer(unstupid(S.getX().toBigInteger().toString(16),bytes*2),"hex"); + return Buffer.from(unstupid(S.getX().toBigInteger().toString(16),bytes*2),"hex"); } } } |