Fix Buffer depricated usage

This commit is contained in:
microshine 2020-03-13 14:19:38 +03:00
parent a2b9971e46
commit 073b6ac93f
1 changed files with 2 additions and 2 deletions

View File

@ -42,7 +42,7 @@ function aes(key: Buffer, message: Buffer) {
} }
function getMessageBlock(message: Buffer, blockIndex: number) { function getMessageBlock(message: Buffer, blockIndex: number) {
const block = new Buffer(blockSize); const block = Buffer.alloc(blockSize);
const start = blockIndex * blockSize; const start = blockIndex * blockSize;
const end = start + blockSize; const end = start + blockSize;
@ -52,7 +52,7 @@ function getMessageBlock(message: Buffer, blockIndex: number) {
} }
function getPaddedMessageBlock(message: Buffer, blockIndex: number) { function getPaddedMessageBlock(message: Buffer, blockIndex: number) {
const block = new Buffer(blockSize); const block = Buffer.alloc(blockSize);
const start = blockIndex * blockSize; const start = blockIndex * blockSize;
const end = message.length; const end = message.length;