-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblocking.js
More file actions
28 lines (17 loc) · 834 Bytes
/
Copy pathblocking.js
File metadata and controls
28 lines (17 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const fs = require("node:fs");
const crypto = require("node:crypto");
console.log("Namaste World");
let a = 4536;
let b = 4864;
// pbkdf2 - password based key derivative function version 2
// all these sync function never ever have callback because the LibUv doesn't register a callback because sync function never ever have a callback. The main thread will hold on till it is generating a key
// Sync Function - WILL BLOCK THE MAIN THREAD - DON'T USE IT
crypto.pbkdf2Sync("password", "salt", 50000000, 64, "sha512");
console.log("First Key is generated.");
// Async Function
crypto.pbkdf2("password", "salt", 50000000, 64, "sha512", (err, key) => {
console.log("Second Key is generated.");
});
// sync function
fs.readFileSync("./file.txt", "utf-8");
console.log("file read successfully");