We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d71e803 commit d7a9bf4Copy full SHA for d7a9bf4
routes/users.js
@@ -19,18 +19,14 @@ function encrypt(text) {
19
20
const encrypted = Buffer.concat([cipher.update(text), cipher.final()]);
21
22
- return encrypted.toString("hex");
+ return encrypted.toString("utf-8");
23
}
24
25
function decrypt(content) {
26
- const decipher = crypto.createDecipheriv(
27
- algorithm,
28
- secret.slice(0, 32),
29
- Buffer.from(iv.toString("hex"), "hex")
30
- );
+ const decipher = crypto.createDecipheriv(algorithm, secret.slice(0, 32), iv);
31
32
const decrpyted = Buffer.concat([
33
- decipher.update(Buffer.from(content, "hex")),
+ decipher.update(Buffer.from(content, "utf8")),
34
decipher.final(),
35
]);
36
0 commit comments