-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
33 lines (28 loc) · 1015 Bytes
/
test.js
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
29
30
31
32
33
const { Suite } = require("benchmark");
const { createCipher, encrypt, decrypt } = require("aes256");
const Instance = require('neboris');
const key = "8dbbba31e2d004091c0db20de4cd731d9d07de06611e9db6ec995e60ff59c331";
const phrase = "Hello World!";
const buffer = Buffer.from(phrase);
new Suite()
.add("aes256", async () => {
const aes256 = createCipher(key);
const encryptedText = aes256.encrypt(phrase);
aes256.decrypt(encryptedText);
const encryptBuffer = aes256.encrypt(buffer);
aes256.decrypt(encryptBuffer);
})
.add("neboris", async () => {
const neboris = new Instance(key);
const encryptedText = neboris.encrypt(phrase);
neboris.decrypt(encryptedText);
const encryptedBuffer = neboris.encrypt(buffer);
neboris.decrypt(encryptedBuffer);
})
.on("cycle", async (event) => {
console.log(String(event.target));
})
.on("complete", async function() {
console.log("Fastest package is " + this.filter("fastest").map("name"));
})
.run({ "async": true });