fix deprecated warnings on Buffer class (#580)

Signed-off-by: Denis barbaron <denis.barbaron@orange.com>

Signed-off-by: Denis barbaron <denis.barbaron@orange.com>
This commit is contained in:
Denis Barbaron
2022-09-16 16:07:49 +02:00
committed by GitHub
parent da6c786a51
commit 878171ec24
8 changed files with 11622 additions and 11355 deletions

View File

@@ -7,7 +7,7 @@ function reverseByteBits(b) {
}
function reverseBufferByteBits(b) {
var result = new Buffer(b.length)
var result = Buffer.alloc(b.length)
for (var i = 0; i < result.length; ++i) {
result[i] = reverseByteBits(b[i])
@@ -17,7 +17,7 @@ function reverseBufferByteBits(b) {
}
function normalizePassword(password) {
var key = new Buffer(8).fill(0)
var key = Buffer.alloc(8).fill(0)
// Make sure the key is always 8 bytes long. VNC passwords cannot be
// longer than 8 bytes. Shorter passwords are padded with zeroes.
@@ -28,7 +28,7 @@ function normalizePassword(password) {
function encrypt(challenge, password) {
var key = normalizePassword(password)
var iv = new Buffer(0).fill(0)
var iv = Buffer.alloc(0).fill(0)
// Note: do not call .final(), .update() is the one that gives us the
// desired result.