diff --git a/index.js b/index.js index 3169794..923d1b6 100644 --- a/index.js +++ b/index.js @@ -165,7 +165,7 @@ function encrypt_aes (text, pass, mode = encryption_mode_cbc_256) { const salt = crypto.randomBytes (mode.salt_size); // eslint-disable-next-line no-sync const key = crypto.pbkdf2Sync ( - Buffer.from (pass, 'utf-8'), + Buffer.from (pass), salt, mode.iterations, mode.key_size, @@ -203,7 +203,7 @@ function decrypt_aes ( buf = buf.slice (mode.salt_size); // eslint-disable-next-line no-sync const key = crypto.pbkdf2Sync ( - Buffer.from (pass, 'utf-8'), + Buffer.from (pass), salt, mode.iterations, mode.key_size, @@ -216,7 +216,7 @@ function decrypt_aes ( cipher.update (buf), cipher.final () ]) - .toString ('utf-8'); + .toString (); } catch (e) { if (rethrow)