remove explicit default encoding
This commit is contained in:
parent
c603fccd6f
commit
59476a8087
6
index.js
6
index.js
@ -165,7 +165,7 @@ function encrypt_aes (text, pass, mode = encryption_mode_cbc_256) {
|
|||||||
const salt = crypto.randomBytes (mode.salt_size);
|
const salt = crypto.randomBytes (mode.salt_size);
|
||||||
// eslint-disable-next-line no-sync
|
// eslint-disable-next-line no-sync
|
||||||
const key = crypto.pbkdf2Sync (
|
const key = crypto.pbkdf2Sync (
|
||||||
Buffer.from (pass, 'utf-8'),
|
Buffer.from (pass),
|
||||||
salt,
|
salt,
|
||||||
mode.iterations,
|
mode.iterations,
|
||||||
mode.key_size,
|
mode.key_size,
|
||||||
@ -203,7 +203,7 @@ function decrypt_aes (
|
|||||||
buf = buf.slice (mode.salt_size);
|
buf = buf.slice (mode.salt_size);
|
||||||
// eslint-disable-next-line no-sync
|
// eslint-disable-next-line no-sync
|
||||||
const key = crypto.pbkdf2Sync (
|
const key = crypto.pbkdf2Sync (
|
||||||
Buffer.from (pass, 'utf-8'),
|
Buffer.from (pass),
|
||||||
salt,
|
salt,
|
||||||
mode.iterations,
|
mode.iterations,
|
||||||
mode.key_size,
|
mode.key_size,
|
||||||
@ -216,7 +216,7 @@ function decrypt_aes (
|
|||||||
cipher.update (buf),
|
cipher.update (buf),
|
||||||
cipher.final ()
|
cipher.final ()
|
||||||
])
|
])
|
||||||
.toString ('utf-8');
|
.toString ();
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (rethrow)
|
if (rethrow)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user