Skip to content

Commit

Permalink
test: added seed performance test
Browse files Browse the repository at this point in the history
  • Loading branch information
FajarKim committed Jan 2, 2024
1 parent 9a53ac6 commit 26b6689
Showing 1 changed file with 332 additions and 0 deletions.
332 changes: 332 additions & 0 deletions test/testSEED.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,332 @@
const assert = require("assert");
const { encrypt, decrypt } = require("../index");

/*********************************************************
* SEED *
*********************************************************/
describe("Encryption and Decryption data test using SEED", function () {
// SEED algorithm
it("should encrypt and decrypt data using SEED algorithm", function () {
const algorithm = "seed";
const data = "Hello, World!";
const password = "secret";

const encryptedData = encrypt(algorithm, data, password);
const decryptedData = decrypt(algorithm, encryptedData, password);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED algorithm with Base64", function () {
const algorithm = "seed";
const data = "Hello, World!";
const password = "secret";
const extra = "base64";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED algorithm with Binary", function () {
const algorithm = "seed";
const data = "Hello, World!";
const password = "secret";
const extra = "binary";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED algorithm with Hex", function () {
const algorithm = "seed";
const data = "Hello, World!";
const password = "secret";
const extra = "hex";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED algorithm with Zlib", function () {
const algorithm = "seed";
const data = "Hello, World!";
const password = "secret";
const extra = "zlib";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

// SEED-CBC algorithm
it("should encrypt and decrypt data using SEED-CBC algorithm", function () {
const algorithm = "seed-cbc";
const data = "Hello, World!";
const password = "secret";

const encryptedData = encrypt(algorithm, data, password);
const decryptedData = decrypt(algorithm, encryptedData, password);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-CBC algorithm with Base64", function () {
const algorithm = "seed-cbc";
const data = "Hello, World!";
const password = "secret";
const extra = "base64";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-CBC algorithm with Binary", function () {
const algorithm = "seed-cbc";
const data = "Hello, World!";
const password = "secret";
const extra = "binary";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-CBC algorithm with Hex", function () {
const algorithm = "seed-cbc";
const data = "Hello, World!";
const password = "secret";
const extra = "hex";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-CBC algorithm with Zlib", function () {
const algorithm = "seed-cbc";
const data = "Hello, World!";
const password = "secret";
const extra = "zlib";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

// SEED-CFB algorithm
it("should encrypt and decrypt data using SEED-CFB algorithm", function () {
const algorithm = "seed-cfb";
const data = "Hello, World!";
const password = "secret";

const encryptedData = encrypt(algorithm, data, password);
const decryptedData = decrypt(algorithm, encryptedData, password);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-CFB algorithm with Base64", function () {
const algorithm = "seed-cfb";
const data = "Hello, World!";
const password = "secret";
const extra = "base64";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-CFB algorithm with Binary", function () {
const algorithm = "seed-cfb";
const data = "Hello, World!";
const password = "secret";
const extra = "binary";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-CFB algorithm with Hex", function () {
const algorithm = "seed-cfb";
const data = "Hello, World!";
const password = "secret";
const extra = "hex";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-CFB algorithm with Zlib", function () {
const algorithm = "seed-cfb";
const data = "Hello, World!";
const password = "secret";
const extra = "zlib";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

// SEED-ECB algorithm
it("should encrypt and decrypt data using SEED-ECB algorithm", function () {
const algorithm = "seed-ecb";
const data = "Hello, World!";
const password = "secret";

const encryptedData = encrypt(algorithm, data, password);
const decryptedData = decrypt(algorithm, encryptedData, password);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-ECB algorithm with Base64", function () {
const algorithm = "seed-ecb";
const data = "Hello, World!";
const password = "secret";
const extra = "base64";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-ECB algorithm with Binary", function () {
const algorithm = "seed-ecb";
const data = "Hello, World!";
const password = "secret";
const extra = "binary";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-ECB algorithm with Hex", function () {
const algorithm = "seed-ecb";
const data = "Hello, World!";
const password = "secret";
const extra = "hex";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-ECB algorithm with Zlib", function () {
const algorithm = "seed-ecb";
const data = "Hello, World!";
const password = "secret";
const extra = "zlib";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

// SEED-OFB algorithm
it("should encrypt and decrypt data using SEED-OFB algorithm", function () {
const algorithm = "seed-ofb";
const data = "Hello, World!";
const password = "secret";

const encryptedData = encrypt(algorithm, data, password);
const decryptedData = decrypt(algorithm, encryptedData, password);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-OFB algorithm with Base64", function () {
const algorithm = "seed-ofb";
const data = "Hello, World!";
const password = "secret";
const extra = "base64";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-OFB algorithm with Binary", function () {
const algorithm = "seed-ofb";
const data = "Hello, World!";
const password = "secret";
const extra = "binary";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-OFB algorithm with Hex", function () {
const algorithm = "seed-ofb";
const data = "Hello, World!";
const password = "secret";
const extra = "hex";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});

it("should encrypt and decrypt data using SEED-OFB algorithm with Zlib", function () {
const algorithm = "seed-ofb";
const data = "Hello, World!";
const password = "secret";
const extra = "zlib";

const encryptedData = encrypt(algorithm, data, password, extra);
const decryptedData = decrypt(algorithm, encryptedData, password, extra);

assert.ok(encryptedData);
assert.ok(decryptedData);
});
});

0 comments on commit 26b6689

Please sign in to comment.