diff --git a/test_blake2b.js b/test_blake2b.js index 3f9d7b9..7708d5e 100644 --- a/test_blake2b.js +++ b/test_blake2b.js @@ -26,7 +26,7 @@ test('Input types', function (t) { // Supports string, Uint8Array, and Buffer inputs // We already verify that blake2bHex('abc') produces the correct hash above t.equal(blake2bHex(new Uint8Array([97, 98, 99])), blake2bHex('abc')) - t.equal(blake2bHex(new Buffer([97, 98, 99])), blake2bHex('abc')) + t.equal(blake2bHex(Buffer.from([97, 98, 99])), blake2bHex('abc')) t.end() }) diff --git a/test_blake2s.js b/test_blake2s.js index 8f9e922..6f1788a 100644 --- a/test_blake2s.js +++ b/test_blake2s.js @@ -14,7 +14,7 @@ test('BLAKE2s basic', function (t) { '508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982') t.equal(blake2sHex(new Uint8Array([97, 98, 99])), '508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982') - t.equal(blake2sHex(new Buffer([97, 98, 99])), + t.equal(blake2sHex(Buffer.from([97, 98, 99])), '508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982') t.end() }) diff --git a/util.js b/util.js index bf8c40a..1d84267 100644 --- a/util.js +++ b/util.js @@ -8,7 +8,7 @@ function normalizeInput (input) { } else if (input instanceof Buffer) { ret = new Uint8Array(input) } else if (typeof (input) === 'string') { - ret = new Uint8Array(new Buffer(input, 'utf8')) + ret = new Uint8Array(Buffer.from(input, 'utf8')) } else { throw new Error(ERROR_MSG_INPUT) }