Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new Buffer is deprecated and unsafe #200

Merged
merged 1 commit into from Sep 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/constructor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ describe('BN.js/Constructor', function () {
// the Array code is able to handle Buffer
describe('with Buffer input', function () {
it('should not fail on empty Buffer', function () {
assert.equal(new BN(new Buffer(0)).toString(16), '0');
assert.equal(new BN(Buffer.alloc(0)).toString(16), '0');
});

it('should import/export big endian', function () {
assert.equal(new BN(new Buffer('010203', 'hex')).toString(16), '10203');
assert.equal(new BN(Buffer.from('010203', 'hex')).toString(16), '10203');
});

it('should import little endian', function () {
assert.equal(new BN(new Buffer('010203', 'hex'), 'le').toString(16), '30201');
assert.equal(new BN(Buffer.from('010203', 'hex'), 'le').toString(16), '30201');
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/pummel/dh-group-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('BN.js/Slow DH test', function () {
var mont = BN.red(new BN(group.prime, 16));
var priv = new BN(group.priv, 16);
var multed = base.toRed(mont).redPow(priv).fromRed();
var actual = new Buffer(multed.toArray());
var actual = Buffer.from(multed.toArray());
assert.equal(actual.toString('hex'), group.pub);
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/red-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ describe('BN.js/Reduction context', function () {
}
return bits;
}
var t = new Buffer('aff1651e4cd6036d57aa8b2a05ccf1a9d5a40166340ecbbdc55' +
var t = Buffer.from('aff1651e4cd6036d57aa8b2a05ccf1a9d5a40166340ecbbdc55' +
'be10b568aa0aa3d05ce9a2fcec9df8ed018e29683c6051cb83e' +
'46ce31ba4edb045356a8d0d80b', 'hex');
var g = new BN('5c7ff6b06f8f143fe8288433493e4769c4d988ace5be25a0e24809670' +
Expand Down