mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-08 07:21:02 -04:00
add formatter
This commit is contained in:
parent
c4e7c41a6e
commit
ce30989adc
693 changed files with 51226 additions and 26671 deletions
|
@ -9,20 +9,18 @@
|
|||
const utils = require("./browserUtils.js");
|
||||
|
||||
module.exports = {
|
||||
before: browser => {
|
||||
browser
|
||||
.resizeWindow(1280, 800)
|
||||
.url(browser.launchUrl);
|
||||
before: (browser) => {
|
||||
browser.resizeWindow(1280, 800).url(browser.launchUrl);
|
||||
},
|
||||
|
||||
"Loading screen": browser => {
|
||||
"Loading screen": (browser) => {
|
||||
// Check that the loading screen appears and then disappears within a reasonable time
|
||||
browser
|
||||
.waitForElementVisible("#preloader", 300)
|
||||
.waitForElementNotPresent("#preloader", 10000);
|
||||
},
|
||||
|
||||
"App loaded": browser => {
|
||||
"App loaded": (browser) => {
|
||||
browser.useCss();
|
||||
// Check that various important elements are loaded
|
||||
browser.expect.element("#operations").to.be.visible;
|
||||
|
@ -36,36 +34,68 @@ module.exports = {
|
|||
browser.expect.element("#output-text").to.be.visible;
|
||||
},
|
||||
|
||||
"Operations loaded": browser => {
|
||||
"Operations loaded": (browser) => {
|
||||
browser.useXpath();
|
||||
// Check that an operation in every category has been populated
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='To Base64']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='To Binary']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='AES Decrypt']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='PEM to Hex']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Power Set']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Parse IP range']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Remove Diacritics']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Sort']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='To UNIX Timestamp']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Extract dates']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Gzip']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Keccak']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='JSON Beautify']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Detect File Type']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Play Media']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Disassemble x86']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Register']").to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='To Base64']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='To Binary']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='AES Decrypt']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='PEM to Hex']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='Power Set']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='Parse IP range']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='Remove Diacritics']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='Sort']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='To UNIX Timestamp']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='Extract dates']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='Gzip']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='Keccak']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='JSON Beautify']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='Detect File Type']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='Play Media']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='Disassemble x86']",
|
||||
).to.be.present;
|
||||
browser.expect.element(
|
||||
"//li[contains(@class, 'operation') and text()='Register']",
|
||||
).to.be.present;
|
||||
},
|
||||
|
||||
"Recipe can be run": browser => {
|
||||
"Recipe can be run": (browser) => {
|
||||
const toHex = "//li[contains(@class, 'operation') and text()='To Hex']";
|
||||
const op = "#rec-list .operation .op-title";
|
||||
|
||||
// Check that operation is visible
|
||||
browser
|
||||
.useXpath()
|
||||
.expect.element(toHex).to.be.visible;
|
||||
browser.useXpath().expect.element(toHex).to.be.visible;
|
||||
|
||||
// Add it to the recipe by double clicking
|
||||
browser
|
||||
|
@ -79,7 +109,8 @@ module.exports = {
|
|||
browser
|
||||
.useCss()
|
||||
.waitForElementVisible(op, 100)
|
||||
.expect.element(op).text.to.contain("To Hex");
|
||||
.expect.element(op)
|
||||
.text.to.contain("To Hex");
|
||||
|
||||
// Enter input
|
||||
browser
|
||||
|
@ -92,7 +123,8 @@ module.exports = {
|
|||
browser
|
||||
.useCss()
|
||||
.waitForElementNotVisible("#stale-indicator", 1000)
|
||||
.expect.element("#output-text .cm-content").text.that.equals("44 6f 6e 27 74 20 50 61 6e 69 63 2e");
|
||||
.expect.element("#output-text .cm-content")
|
||||
.text.that.equals("44 6f 6e 27 74 20 50 61 6e 69 63 2e");
|
||||
|
||||
// Clear recipe
|
||||
browser
|
||||
|
@ -103,99 +135,131 @@ module.exports = {
|
|||
.waitForElementNotPresent(op);
|
||||
},
|
||||
|
||||
"Test every module": browser => {
|
||||
"Test every module": (browser) => {
|
||||
browser.useCss();
|
||||
|
||||
// BSON
|
||||
loadOp("BSON deserialise", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("BSON deserialise", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// Charts
|
||||
loadOp("Entropy", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Entropy", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// Ciphers
|
||||
loadOp("AES Encrypt", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("AES Encrypt", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// Code
|
||||
loadOp("XPath expression", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("XPath expression", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// Compression
|
||||
loadOp("Gzip", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Gzip", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// Crypto
|
||||
loadOp("MD5", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("MD5", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Default
|
||||
loadOp("Fork", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Fork", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// Diff
|
||||
loadOp("Diff", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Diff", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// Encodings
|
||||
loadOp("Encode text", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Encode text", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// Hashing
|
||||
loadOp("Streebog", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Streebog", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// Image
|
||||
loadOp("Extract EXIF", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Extract EXIF", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// PGP
|
||||
loadOp("PGP Encrypt", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("PGP Encrypt", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// PublicKey
|
||||
loadOp("Hex to PEM", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Hex to PEM", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// Regex
|
||||
loadOp("Strings", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Strings", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// Shellcode
|
||||
loadOp("Disassemble x86", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Disassemble x86", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// URL
|
||||
loadOp("URL Encode", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("URL Encode", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// UserAgent
|
||||
loadOp("Parse User Agent", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Parse User Agent", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
// YARA
|
||||
loadOp("YARA Rules", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("YARA Rules", browser).waitForElementNotVisible(
|
||||
"#output-loader",
|
||||
5000,
|
||||
);
|
||||
|
||||
browser.click("#clr-recipe");
|
||||
},
|
||||
|
||||
"Move around the UI": browser => {
|
||||
const otherCat = "//a[contains(@class, 'category-title') and contains(@data-target, '#catOther')]",
|
||||
genUUID = "//li[contains(@class, 'operation') and text()='Generate UUID']";
|
||||
"Move around the UI": (browser) => {
|
||||
const otherCat =
|
||||
"//a[contains(@class, 'category-title') and contains(@data-target, '#catOther')]",
|
||||
genUUID =
|
||||
"//li[contains(@class, 'operation') and text()='Generate UUID']";
|
||||
|
||||
browser.useXpath();
|
||||
|
||||
// Scroll to a lower category
|
||||
browser
|
||||
.getLocationInView(otherCat)
|
||||
.expect.element(otherCat).to.be.visible;
|
||||
browser.getLocationInView(otherCat).expect.element(otherCat).to.be
|
||||
.visible;
|
||||
|
||||
// Open category
|
||||
browser
|
||||
.click(otherCat)
|
||||
.expect.element(genUUID).to.be.visible;
|
||||
browser.click(otherCat).expect.element(genUUID).to.be.visible;
|
||||
|
||||
// Add op to recipe
|
||||
/* mouseButtonUp drops wherever the actual cursor is, not necessarily in the right place,
|
||||
|
@ -208,22 +272,26 @@ module.exports = {
|
|||
.useCss()
|
||||
.waitForElementVisible(".operation .op-title", 1000)
|
||||
.waitForElementNotVisible("#stale-indicator", 1000)
|
||||
.expect.element("#output-text .cm-content").text.which.matches(/[\da-f-]{36}/);
|
||||
.expect.element("#output-text .cm-content")
|
||||
.text.which.matches(/[\da-f-]{36}/);
|
||||
|
||||
browser.click("#clr-recipe");
|
||||
},
|
||||
|
||||
"Search": browser => {
|
||||
Search: (browser) => {
|
||||
// Search for an op
|
||||
browser
|
||||
.useCss()
|
||||
.clearValue("#search")
|
||||
.setValue("#search", "md5")
|
||||
.useXpath()
|
||||
.waitForElementVisible("//ul[@id='search-results']//b[text()='MD5']", 1000);
|
||||
.waitForElementVisible(
|
||||
"//ul[@id='search-results']//b[text()='MD5']",
|
||||
1000,
|
||||
);
|
||||
},
|
||||
|
||||
"Alert bar": browser => {
|
||||
"Alert bar": (browser) => {
|
||||
// Bake nothing to create an empty output which can be copied
|
||||
utils.clear(browser);
|
||||
utils.bake(browser);
|
||||
|
@ -233,18 +301,22 @@ module.exports = {
|
|||
.click("#copy-output")
|
||||
.waitForElementVisible("#snackbar-container")
|
||||
.waitForElementVisible("#snackbar-container .snackbar-content")
|
||||
.expect.element("#snackbar-container .snackbar-content").text.to.equal("Copied raw output successfully.");
|
||||
.expect.element("#snackbar-container .snackbar-content")
|
||||
.text.to.equal("Copied raw output successfully.");
|
||||
|
||||
// Alert bar disappears after the correct amount of time
|
||||
// Should disappear after 2000ms
|
||||
browser
|
||||
.waitForElementNotPresent("#snackbar-container .snackbar-content", 2500)
|
||||
.waitForElementNotPresent(
|
||||
"#snackbar-container .snackbar-content",
|
||||
2500,
|
||||
)
|
||||
.waitForElementNotVisible("#snackbar-container");
|
||||
},
|
||||
|
||||
after: browser => {
|
||||
after: (browser) => {
|
||||
browser.end();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -16,7 +16,7 @@
|
|||
const utils = require("./browserUtils.js");
|
||||
|
||||
module.exports = {
|
||||
before: browser => {
|
||||
before: (browser) => {
|
||||
browser
|
||||
.resizeWindow(1280, 800)
|
||||
.url(browser.launchUrl)
|
||||
|
@ -25,53 +25,215 @@ module.exports = {
|
|||
.click("#auto-bake-label");
|
||||
},
|
||||
|
||||
"Sanity check operations": async browser => {
|
||||
"Sanity check operations": async (browser) => {
|
||||
const Images = await import("../samples/Images.mjs");
|
||||
testOp(browser, "A1Z26 Cipher Decode", "20 5 19 20 15 21 20 16 21 20", "testoutput");
|
||||
testOp(browser, "A1Z26 Cipher Encode", "test input", "20 5 19 20 9 14 16 21 20");
|
||||
testOp(browser, "ADD", "test input", "Ê»ÉÊv¿ÄÆËÊ", [{ "option": "Hex", "string": "56" }]);
|
||||
testOp(browser, "AES Decrypt", "b443f7f7c16ac5396a34273f6f639caa", "test output", [{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" }, { "option": "Hex", "string": "00000000000000000000000000000000" }, "CBC", "Hex", "Raw", { "option": "Hex", "string": "" }]);
|
||||
testOp(browser, "AES Encrypt", "test input", "e42eb8fbfb7a98fff061cd2c1a794d92", [{"option": "Hex", "string": "00112233445566778899aabbccddeeff"}, {"option": "Hex", "string": "00000000000000000000000000000000"}, "CBC", "Raw", "Hex"]);
|
||||
testOp(browser, "AND", "test input", "4$04 $044", [{ "option": "Hex", "string": "34" }]);
|
||||
testOp(
|
||||
browser,
|
||||
"A1Z26 Cipher Decode",
|
||||
"20 5 19 20 15 21 20 16 21 20",
|
||||
"testoutput",
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
"A1Z26 Cipher Encode",
|
||||
"test input",
|
||||
"20 5 19 20 9 14 16 21 20",
|
||||
);
|
||||
testOp(browser, "ADD", "test input", "Ê»ÉÊv¿ÄÆËÊ", [
|
||||
{ option: "Hex", string: "56" },
|
||||
]);
|
||||
testOp(
|
||||
browser,
|
||||
"AES Decrypt",
|
||||
"b443f7f7c16ac5396a34273f6f639caa",
|
||||
"test output",
|
||||
[
|
||||
{ option: "Hex", string: "00112233445566778899aabbccddeeff" },
|
||||
{ option: "Hex", string: "00000000000000000000000000000000" },
|
||||
"CBC",
|
||||
"Hex",
|
||||
"Raw",
|
||||
{ option: "Hex", string: "" },
|
||||
],
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
"AES Encrypt",
|
||||
"test input",
|
||||
"e42eb8fbfb7a98fff061cd2c1a794d92",
|
||||
[
|
||||
{ option: "Hex", string: "00112233445566778899aabbccddeeff" },
|
||||
{ option: "Hex", string: "00000000000000000000000000000000" },
|
||||
"CBC",
|
||||
"Raw",
|
||||
"Hex",
|
||||
],
|
||||
);
|
||||
testOp(browser, "AND", "test input", "4$04 $044", [
|
||||
{ option: "Hex", string: "34" },
|
||||
]);
|
||||
testOp(browser, "Add line numbers", "test input", "1 test input");
|
||||
testOp(browser, ["From Hex", "Add Text To Image", "To Base64"], Images.PNG_HEX, Images.PNG_CHEF_B64, [[], ["Chef", "Center", "Middle", 0, 0, 16], []]);
|
||||
testOp(
|
||||
browser,
|
||||
["From Hex", "Add Text To Image", "To Base64"],
|
||||
Images.PNG_HEX,
|
||||
Images.PNG_CHEF_B64,
|
||||
[[], ["Chef", "Center", "Middle", 0, 0, 16], []],
|
||||
);
|
||||
testOp(browser, "Adler-32 Checksum", "test input", "16160411");
|
||||
testOp(browser, "Affine Cipher Decode", "test input", "rcqr glnsr", [1, 2]);
|
||||
testOp(browser, "Affine Cipher Encode", "test input", "njln rbfpn", [2, 1]);
|
||||
testOp(browser, "AMF Decode", "\u000A\u0013\u0001\u0003a\u0006\u0009test", /"\$value": "test"/);
|
||||
testOp(browser, "AMF Encode", '{"a": "test"}', "\u000A\u0013\u0001\u0003a\u0006\u0009test");
|
||||
testOp(
|
||||
browser,
|
||||
"Affine Cipher Decode",
|
||||
"test input",
|
||||
"rcqr glnsr",
|
||||
[1, 2],
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
"Affine Cipher Encode",
|
||||
"test input",
|
||||
"njln rbfpn",
|
||||
[2, 1],
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
"AMF Decode",
|
||||
"\u000A\u0013\u0001\u0003a\u0006\u0009test",
|
||||
/"\$value": "test"/,
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
"AMF Encode",
|
||||
'{"a": "test"}',
|
||||
"\u000A\u0013\u0001\u0003a\u0006\u0009test",
|
||||
);
|
||||
testOp(browser, "Analyse hash", "0123456789abcdef", /CRC-64/);
|
||||
testOp(browser, "Atbash Cipher", "test input", "gvhg rmkfg");
|
||||
// testOp(browser, "Avro to JSON", "test input", "test_output");
|
||||
testOp(browser, "BLAKE2b", "test input", "33ebdc8f38177f3f3f334eeb117a84e11f061bbca4db6b8923e5cec85103f59f415551a5d5a933fdb6305dc7bf84671c2540b463dbfa08ee1895cfaa5bd780b5", ["512", "Hex", { "option": "UTF8", "string": "pass" }]);
|
||||
testOp(browser, "BLAKE2s", "test input", "defe73d61dfa6e5807e4f9643e159a09ccda6be3c26dcd65f8a9bb38bfc973a7", ["256", "Hex", { "option": "UTF8", "string": "pass" }]);
|
||||
testOp(browser, "BSON deserialise", "\u0011\u0000\u0000\u0000\u0002a\u0000\u0005\u0000\u0000\u0000test\u0000\u0000", '{\u000A "a": "test"\u000A}');
|
||||
testOp(browser, "BSON serialise", '{"a":"test"}', "\u0011\u0000\u0000\u0000\u0002a\u0000\u0005\u0000\u0000\u0000test\u0000\u0000");
|
||||
testOp(
|
||||
browser,
|
||||
"BLAKE2b",
|
||||
"test input",
|
||||
"33ebdc8f38177f3f3f334eeb117a84e11f061bbca4db6b8923e5cec85103f59f415551a5d5a933fdb6305dc7bf84671c2540b463dbfa08ee1895cfaa5bd780b5",
|
||||
["512", "Hex", { option: "UTF8", string: "pass" }],
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
"BLAKE2s",
|
||||
"test input",
|
||||
"defe73d61dfa6e5807e4f9643e159a09ccda6be3c26dcd65f8a9bb38bfc973a7",
|
||||
["256", "Hex", { option: "UTF8", string: "pass" }],
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
"BSON deserialise",
|
||||
"\u0011\u0000\u0000\u0000\u0002a\u0000\u0005\u0000\u0000\u0000test\u0000\u0000",
|
||||
'{\u000A "a": "test"\u000A}',
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
"BSON serialise",
|
||||
'{"a":"test"}',
|
||||
"\u0011\u0000\u0000\u0000\u0002a\u0000\u0005\u0000\u0000\u0000test\u0000\u0000",
|
||||
);
|
||||
// testOp(browser, "Bacon Cipher Decode", "test input", "test_output");
|
||||
// testOp(browser, "Bacon Cipher Encode", "test input", "test_output");
|
||||
testOp(browser, "Bcrypt", "test input", /^\$2a\$06\$.{53}$/, [6]);
|
||||
testOp(browser, "Bcrypt compare", "test input", "Match: test input", ["$2a$05$FCfBSVX7OeRkK.9kQVFCiOYu9XtwtIbePqUiroD1lkASW9q5QClzG"]);
|
||||
testOp(browser, "Bcrypt parse", "$2a$05$kXWtAIGB/R8VEzInoM5ocOTBtyc0m2YTIwFiBU/0XoW032f9QrkWW", /Rounds: 5/);
|
||||
testOp(browser, "Bifid Cipher Decode", "qblb tfovy", "test input", ["pass"]);
|
||||
testOp(browser, "Bifid Cipher Encode", "test input", "qblb tfovy", ["pass"]);
|
||||
testOp(browser, "Bit shift left", "test input", "\u00E8\u00CA\u00E6\u00E8@\u00D2\u00DC\u00E0\u00EA\u00E8");
|
||||
testOp(browser, "Bcrypt compare", "test input", "Match: test input", [
|
||||
"$2a$05$FCfBSVX7OeRkK.9kQVFCiOYu9XtwtIbePqUiroD1lkASW9q5QClzG",
|
||||
]);
|
||||
testOp(
|
||||
browser,
|
||||
"Bcrypt parse",
|
||||
"$2a$05$kXWtAIGB/R8VEzInoM5ocOTBtyc0m2YTIwFiBU/0XoW032f9QrkWW",
|
||||
/Rounds: 5/,
|
||||
);
|
||||
testOp(browser, "Bifid Cipher Decode", "qblb tfovy", "test input", [
|
||||
"pass",
|
||||
]);
|
||||
testOp(browser, "Bifid Cipher Encode", "test input", "qblb tfovy", [
|
||||
"pass",
|
||||
]);
|
||||
testOp(
|
||||
browser,
|
||||
"Bit shift left",
|
||||
"test input",
|
||||
"\u00E8\u00CA\u00E6\u00E8@\u00D2\u00DC\u00E0\u00EA\u00E8",
|
||||
);
|
||||
testOp(browser, "Bit shift right", "test input", ":29:\u0010478::");
|
||||
testOp(browser, "Blowfish Decrypt", "10884e15427dd84ec35204e9c8e921ae", "test_output", [{"option": "Hex", "string": "1234567801234567"}, {"option": "Hex", "string": "0011223344556677"}, "CBC", "Hex", "Raw"]);
|
||||
testOp(browser, "Blowfish Encrypt", "test input", "f0fadbd1d90d774f714248cf26b96410", [{"option": "Hex", "string": "1234567801234567"}, {"option": "Hex", "string": "0011223344556677"}, "CBC", "Raw", "Hex"]);
|
||||
testOp(browser, ["From Hex", "Blur Image", "To Base64"], Images.PNG_HEX, Images.PNG_BLUR_B64);
|
||||
testOpHtml(browser, "Bombe", "XTSYN WAEUG EZALY NRQIM AMLZX MFUOD AWXLY LZCUZ QOQBQ JLCPK NDDRW F", "table tr:last-child td:first-child", "ECG", ["3-rotor", "LEYJVCNIXWPBQMDRTAKZGFUHOS", "BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "ESOVPZJAYQUIRHXLNFTGKDCMWB<K", "AY BR CU DH EQ FS GL IP JX KN MO TZ VW", "HELLO CYBER CHEFU SER", 0, true]);
|
||||
testOp(browser, ["Bzip2 Compress", "To Hex"], "test input", "42 5a 68 39 31 41 59 26 53 59 cf 96 82 1d 00 00 03 91 80 40 00 02 21 4e 00 20 00 21 90 c2 10 c0 88 33 92 8e df 17 72 45 38 50 90 cf 96 82 1d");
|
||||
testOp(browser, ["From Hex", "Bzip2 Decompress"], "425a68393141592653597b0884b7000003038000008200ce00200021a647a4218013709517c5dc914e14241ec2212dc0", "test_output", [[], [true]]);
|
||||
// testOp(browser, "CBOR Decode", "test input", "test output");
|
||||
// testOp(browser, "CBOR Encode", "test input", "test output");
|
||||
testOp(
|
||||
browser,
|
||||
"Blowfish Decrypt",
|
||||
"10884e15427dd84ec35204e9c8e921ae",
|
||||
"test_output",
|
||||
[
|
||||
{ option: "Hex", string: "1234567801234567" },
|
||||
{ option: "Hex", string: "0011223344556677" },
|
||||
"CBC",
|
||||
"Hex",
|
||||
"Raw",
|
||||
],
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
"Blowfish Encrypt",
|
||||
"test input",
|
||||
"f0fadbd1d90d774f714248cf26b96410",
|
||||
[
|
||||
{ option: "Hex", string: "1234567801234567" },
|
||||
{ option: "Hex", string: "0011223344556677" },
|
||||
"CBC",
|
||||
"Raw",
|
||||
"Hex",
|
||||
],
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
["From Hex", "Blur Image", "To Base64"],
|
||||
Images.PNG_HEX,
|
||||
Images.PNG_BLUR_B64,
|
||||
);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Bombe",
|
||||
"XTSYN WAEUG EZALY NRQIM AMLZX MFUOD AWXLY LZCUZ QOQBQ JLCPK NDDRW F",
|
||||
"table tr:last-child td:first-child",
|
||||
"ECG",
|
||||
[
|
||||
"3-rotor",
|
||||
"LEYJVCNIXWPBQMDRTAKZGFUHOS",
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
|
||||
"ESOVPZJAYQUIRHXLNFTGKDCMWB<K",
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
|
||||
"HELLO CYBER CHEFU SER",
|
||||
0,
|
||||
true,
|
||||
],
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
["Bzip2 Compress", "To Hex"],
|
||||
"test input",
|
||||
"42 5a 68 39 31 41 59 26 53 59 cf 96 82 1d 00 00 03 91 80 40 00 02 21 4e 00 20 00 21 90 c2 10 c0 88 33 92 8e df 17 72 45 38 50 90 cf 96 82 1d",
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
["From Hex", "Bzip2 Decompress"],
|
||||
"425a68393141592653597b0884b7000003038000008200ce00200021a647a4218013709517c5dc914e14241ec2212dc0",
|
||||
"test_output",
|
||||
[[], [true]],
|
||||
);
|
||||
// testOp(browser, "CBOR Decode", "test input", "test output");
|
||||
// testOp(browser, "CBOR Encode", "test input", "test output");
|
||||
testOp(browser, "CRC-16 Checksum", "test input", "77c7");
|
||||
testOp(browser, "CRC-32 Checksum", "test input", "29822bc8");
|
||||
testOp(browser, "CRC-8 Checksum", "test input", "9d");
|
||||
// testOp(browser, "CSS Beautify", "test input", "test_output");
|
||||
// testOp(browser, "CSS Minify", "test input", "test_output");
|
||||
// testOp(browser, "CSS Beautify", "test input", "test_output");
|
||||
// testOp(browser, "CSS Minify", "test input", "test_output");
|
||||
// testOp(browser, "CSS selector", "test input", "test_output");
|
||||
// testOp(browser, "CSV to JSON", "test input", "test_output");
|
||||
// testOp(browser, "CTPH", "test input", "test_output");
|
||||
// testOp(browser, "CTPH", "test input", "test_output");
|
||||
// testOp(browser, "Cartesian Product", "test input", "test_output");
|
||||
// testOp(browser, "Change IP format", "test input", "test_output");
|
||||
// testOp(browser, "Chi Square", "test input", "test_output");
|
||||
|
@ -79,24 +241,93 @@ module.exports = {
|
|||
// testOp(browser, "CipherSaber2 Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "Citrix CTX1 Decode", "test input", "test_output");
|
||||
// testOp(browser, "Citrix CTX1 Encode", "test input", "test_output");
|
||||
testOpHtml(browser, "Colossus", "CTBKJUVXHZ-H3L4QV+YEZUK+SXOZ/N", "table tr:last-child td:first-child", "30", ["", "KH Pattern", "Z", "", "", "None", "Select Program", "Letter Count", "", "", "", "", "", "", false, "", "", "", "", "", "", false, "", "", "", "", "", "", false, "", false, "", false, false, false, false, false, "", false, false, "", "", 0, "", "", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Colossus",
|
||||
"CTBKJUVXHZ-H3L4QV+YEZUK+SXOZ/N",
|
||||
"table tr:last-child td:first-child",
|
||||
"30",
|
||||
[
|
||||
"",
|
||||
"KH Pattern",
|
||||
"Z",
|
||||
"",
|
||||
"",
|
||||
"None",
|
||||
"Select Program",
|
||||
"Letter Count",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
],
|
||||
);
|
||||
// testOp(browser, "Comment", "test input", "test_output");
|
||||
// testOp(browser, "Compare CTPH hashes", "test input", "test_output");
|
||||
// testOp(browser, "Compare SSDEEP hashes", "test input", "test_output");
|
||||
// testOp(browser, "Conditional Jump", "test input", "test_output");
|
||||
testOpImage(browser, "Contain Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Convert area", "test input", "test_output");
|
||||
// testOp(browser, "Convert co-ordinate format", "test input", "test_output");
|
||||
// testOp(browser, "Convert co-ordinate format", "test input", "test_output");
|
||||
// testOp(browser, "Convert data units", "test input", "test_output");
|
||||
// testOp(browser, "Convert distance", "test input", "test_output");
|
||||
testOpImage(browser, "Convert Image Format", "files/Hitchhikers_Guide.jpeg");
|
||||
testOpImage(
|
||||
browser,
|
||||
"Convert Image Format",
|
||||
"files/Hitchhikers_Guide.jpeg",
|
||||
);
|
||||
// testOp(browser, "Convert mass", "test input", "test_output");
|
||||
// testOp(browser, "Convert speed", "test input", "test_output");
|
||||
// testOp(browser, "Convert to NATO alphabet", "test input", "test_output");
|
||||
// testOp(browser, "Count occurrences", "test input", "test_output");
|
||||
testOpImage(browser, "Cover Image", "files/Hitchhikers_Guide.jpeg");
|
||||
testOpImage(browser, "Crop Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "CSS Selector", "test input", "test output");
|
||||
// testOp(browser, "CSS Selector", "test input", "test output");
|
||||
// testOp(browser, "DES Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "DES Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "DNS over HTTPS", "test input", "test_output");
|
||||
|
@ -108,25 +339,50 @@ module.exports = {
|
|||
// testOp(browser, "Derive EVP key", "test input", "test_output");
|
||||
// testOp(browser, "Derive PBKDF2 key", "test input", "test_output");
|
||||
// testOp(browser, "Detect File Type", "test input", "test_output");
|
||||
testOpHtml(browser, "Diff", "The cat sat on the mat\n\nThe mat cat on the sat", "ins:first-child", "mat", ["\\n\\n", "Word", true, true, false, false]);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Diff",
|
||||
"The cat sat on the mat\n\nThe mat cat on the sat",
|
||||
"ins:first-child",
|
||||
"mat",
|
||||
["\\n\\n", "Word", true, true, false, false],
|
||||
);
|
||||
// testOp(browser, "Disassemble x86", "test input", "test_output");
|
||||
testOpImage(browser, "Dither Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Divide", "test input", "test_output");
|
||||
// testOp(browser, "Divide", "test input", "test_output");
|
||||
// testOp(browser, "Drop bytes", "test input", "test_output");
|
||||
// testOp(browser, "Encode NetBIOS Name", "test input", "test_output");
|
||||
// testOp(browser, "Encode text", "test input", "test_output");
|
||||
// testOp(browser, "Enigma", "test input", "test_output");
|
||||
testOpHtml(browser, "Entropy", "test input", "", /Shannon entropy: 2.8464393446710154/);
|
||||
// testOp(browser, "Escape string", "test input", "test_output");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Entropy",
|
||||
"test input",
|
||||
"",
|
||||
/Shannon entropy: 2.8464393446710154/,
|
||||
);
|
||||
// testOp(browser, "Escape string", "test input", "test_output");
|
||||
// testOp(browser, "Escape Unicode Characters", "test input", "test_output");
|
||||
// testOp(browser, "Expand alphabet range", "test input", "test_output");
|
||||
// testOp(browser, "Extract dates", "test input", "test_output");
|
||||
// testOp(browser, "Extract domains", "test input", "test_output");
|
||||
// testOp(browser, "Extract EXIF", "test input", "test_output");
|
||||
// testOp(browser, "Extract EXIF", "test input", "test_output");
|
||||
// testOp(browser, "Extract email addresses", "test input", "test_output");
|
||||
// testOp(browser, "Extract file paths", "test input", "test_output");
|
||||
testOpFile(browser, "Extract Files", "files/Hitchhikers_Guide.jpeg", ".card:last-child .collapsed", "extracted_at_0x3d38.zlib");
|
||||
testOpFile(browser, "Extract ID3", "files/mp3example.mp3", "tr:last-child td:last-child", "Kevin MacLeod");
|
||||
testOpFile(
|
||||
browser,
|
||||
"Extract Files",
|
||||
"files/Hitchhikers_Guide.jpeg",
|
||||
".card:last-child .collapsed",
|
||||
"extracted_at_0x3d38.zlib",
|
||||
);
|
||||
testOpFile(
|
||||
browser,
|
||||
"Extract ID3",
|
||||
"files/mp3example.mp3",
|
||||
"tr:last-child td:last-child",
|
||||
"Kevin MacLeod",
|
||||
);
|
||||
// testOp(browser, "Extract IP addresses", "test input", "test_output");
|
||||
// testOp(browser, "Extract LSB", "test input", "test_output");
|
||||
// testOp(browser, "Extract MAC addresses", "test input", "test_output");
|
||||
|
@ -141,9 +397,15 @@ module.exports = {
|
|||
testOpImage(browser, "Flip Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Fork", "test input", "test_output");
|
||||
// testOp(browser, "Format MAC addresses", "test input", "test_output");
|
||||
testOpHtml(browser, "Frequency distribution", "test input", "", /Number of bytes not represented: 248/);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Frequency distribution",
|
||||
"test input",
|
||||
"",
|
||||
/Number of bytes not represented: 248/,
|
||||
);
|
||||
// testOp(browser, "From BCD", "test input", "test_output");
|
||||
// testOp(browser, "From Base", "test input", "test_output");
|
||||
// testOp(browser, "From Base", "test input", "test_output");
|
||||
// testOp(browser, "From Base32", "test input", "test_output");
|
||||
// testOp(browser, "From Base58", "test input", "test_output");
|
||||
// testOp(browser, "From Base62", "test input", "test_output");
|
||||
|
@ -158,26 +420,35 @@ module.exports = {
|
|||
// testOp(browser, "From Hex", "test input", "test_output");
|
||||
// testOp(browser, "From Hex Content", "test input", "test_output");
|
||||
// testOp(browser, "From Hexdump", "test input", "test_output");
|
||||
// testOp(browser, "From MessagePack", "test input", "test_output");
|
||||
// testOp(browser, "From MessagePack", "test input", "test_output");
|
||||
// testOp(browser, "From Morse Code", "test input", "test_output");
|
||||
// testOp(browser, "From Octal", "test input", "test_output");
|
||||
// testOp(browser, "From Punycode", "test input", "test_output");
|
||||
// testOp(browser, "From Quoted Printable", "test input", "test_output");
|
||||
// testOp(browser, "From UNIX Timestamp", "test input", "test_output");
|
||||
testOpHtml(browser, "Fuzzy Match", "test input", "b:last-child", "in", ["tein", 15, 30, 30, 15, -5, -15, -1]);
|
||||
// testOp(browser, "From UNIX Timestamp", "test input", "test_output");
|
||||
testOpHtml(browser, "Fuzzy Match", "test input", "b:last-child", "in", [
|
||||
"tein",
|
||||
15,
|
||||
30,
|
||||
30,
|
||||
15,
|
||||
-5,
|
||||
-15,
|
||||
-1,
|
||||
]);
|
||||
// testOp(browser, "GOST hash", "test input", "test_output");
|
||||
// testOp(browser, "Generate all hashes", "test input", "test_output");
|
||||
// testOp(browser, "Generate HOTP", "test input", "test_output");
|
||||
// testOp(browser, "Generate HOTP", "test input", "test_output");
|
||||
testOpHtml(browser, "Generate Image", "test input", "img", "");
|
||||
// testOp(browser, "Generate Lorem Ipsum", "test input", "test_output");
|
||||
// testOp(browser, "Generate PGP Key Pair", "test input", "test_output");
|
||||
testOpHtml(browser, "Generate QR Code", "test input", "img", "");
|
||||
// testOp(browser, "Generate TOTP", "test input", "test_output");
|
||||
// testOp(browser, "Generate TOTP", "test input", "test_output");
|
||||
// testOp(browser, "Generate UUID", "test input", "test_output");
|
||||
// testOp(browser, "Generic Code Beautify", "test input", "test_output");
|
||||
// testOp(browser, "Group IP addresses", "test input", "test_output");
|
||||
// testOp(browser, "Gunzip", "test input", "test_output");
|
||||
// testOp(browser, "Gzip", "test input", "test_output");
|
||||
// testOp(browser, "Gunzip", "test input", "test_output");
|
||||
// testOp(browser, "Gzip", "test input", "test_output");
|
||||
// testOp(browser, "HAS-160", "test input", "test_output");
|
||||
// testOp(browser, "HMAC", "test input", "test_output");
|
||||
// testOp(browser, "HTML To Text", "test input", "test_output");
|
||||
|
@ -189,40 +460,78 @@ module.exports = {
|
|||
testOpHtml(browser, "Hex Density chart", "X Y\n0 1\n1 2", "svg", /X/);
|
||||
// testOp(browser, "Hex to Object Identifier", "test input", "test_output");
|
||||
// testOp(browser, "Hex to PEM", "test input", "test_output");
|
||||
testOpImage(browser, "Image Brightness / Contrast", "files/Hitchhikers_Guide.jpeg");
|
||||
testOpImage(
|
||||
browser,
|
||||
"Image Brightness / Contrast",
|
||||
"files/Hitchhikers_Guide.jpeg",
|
||||
);
|
||||
testOpImage(browser, "Image Filter", "files/Hitchhikers_Guide.jpeg");
|
||||
testOpImage(browser, "Image Hue/Saturation/Lightness", "files/Hitchhikers_Guide.jpeg");
|
||||
testOpImage(
|
||||
browser,
|
||||
"Image Hue/Saturation/Lightness",
|
||||
"files/Hitchhikers_Guide.jpeg",
|
||||
);
|
||||
testOpImage(browser, "Image Opacity", "files/Hitchhikers_Guide.jpeg");
|
||||
testOpHtml(browser, "Index of Coincidence", "test input", "", /Index of Coincidence: 0.08333333333333333/);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Index of Coincidence",
|
||||
"test input",
|
||||
"",
|
||||
/Index of Coincidence: 0.08333333333333333/,
|
||||
);
|
||||
testOpImage(browser, "Invert Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "JPath expression", "test input", "test_output");
|
||||
testOpHtml(browser, "JSON Beautify", "{a:1}", ".json-dict .json-literal", "1");
|
||||
// testOp(browser, "JPath expression", "test input", "test_output");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"JSON Beautify",
|
||||
"{a:1}",
|
||||
".json-dict .json-literal",
|
||||
"1",
|
||||
);
|
||||
// testOp(browser, "JSON Minify", "test input", "test_output");
|
||||
// testOp(browser, "JSON to CSV", "test input", "test_output");
|
||||
// testOp(browser, "JWT Decode", "test input", "test_output");
|
||||
// testOp(browser, "JWT Sign", "test input", "test_output");
|
||||
// testOp(browser, "JWT Verify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Beautify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Minify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Parser", "test input", "test_output");
|
||||
// testOp(browser, "JSON to CSV", "test input", "test_output");
|
||||
// testOp(browser, "JWT Decode", "test input", "test_output");
|
||||
// testOp(browser, "JWT Sign", "test input", "test_output");
|
||||
// testOp(browser, "JWT Verify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Beautify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Minify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Parser", "test input", "test_output");
|
||||
// testOp(browser, "Jump", "test input", "test_output");
|
||||
// testOp(browser, "Keccak", "test input", "test_output");
|
||||
// testOp(browser, "Keccak", "test input", "test_output");
|
||||
// testOp(browser, "Label", "test input", "test_output");
|
||||
// testOp(browser, "LM Hash", "test input", "test output");
|
||||
// testOp(browser, "LM Hash", "test input", "test output");
|
||||
// testOp(browser, "Lorenz", "test input", "test_output");
|
||||
// testOp(browser, "Luhn Checksum", "test input", "test_output");
|
||||
// testOp(browser, "LZ String", "test input", "test output");
|
||||
// testOp(browser, "LZ4 Compress", "test input", "test output");
|
||||
// testOp(browser, "LZ4 Decompress", "test input", "test output");
|
||||
// testOp(browser, "LZMA Compress", "test input", "test output");
|
||||
// testOp(browser, "LZMA Decompress", "test input", "test output");
|
||||
// testOp(browser, "MD2", "test input", "test_output");
|
||||
// testOp(browser, "MD4", "test input", "test_output");
|
||||
// testOp(browser, "MD5", "test input", "test_output");
|
||||
// testOp(browser, "MD6", "test input", "test_output");
|
||||
testOpHtml(browser, "Magic", "dGVzdF9vdXRwdXQ=", "tr:nth-of-type(1) th:nth-of-type(2)", "Result snippet");
|
||||
testOpHtml(browser, "Magic", "dGVzdF9vdXRwdXQ=", "tr:nth-of-type(2) td:nth-of-type(2)", "test_output");
|
||||
testOpHtml(browser, "Magic", "dGVzdF9vdXRwdXQ=", "tr:nth-of-type(2) td:nth-of-type(1)", /Base64/);
|
||||
// testOp(browser, "LZ String", "test input", "test output");
|
||||
// testOp(browser, "LZ4 Compress", "test input", "test output");
|
||||
// testOp(browser, "LZ4 Decompress", "test input", "test output");
|
||||
// testOp(browser, "LZMA Compress", "test input", "test output");
|
||||
// testOp(browser, "LZMA Decompress", "test input", "test output");
|
||||
// testOp(browser, "MD2", "test input", "test_output");
|
||||
// testOp(browser, "MD4", "test input", "test_output");
|
||||
// testOp(browser, "MD5", "test input", "test_output");
|
||||
// testOp(browser, "MD6", "test input", "test_output");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Magic",
|
||||
"dGVzdF9vdXRwdXQ=",
|
||||
"tr:nth-of-type(1) th:nth-of-type(2)",
|
||||
"Result snippet",
|
||||
);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Magic",
|
||||
"dGVzdF9vdXRwdXQ=",
|
||||
"tr:nth-of-type(2) td:nth-of-type(2)",
|
||||
"test_output",
|
||||
);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Magic",
|
||||
"dGVzdF9vdXRwdXQ=",
|
||||
"tr:nth-of-type(2) td:nth-of-type(1)",
|
||||
/Base64/,
|
||||
);
|
||||
// testOp(browser, "Mean", "test input", "test_output");
|
||||
// testOp(browser, "Median", "test input", "test_output");`
|
||||
// testOp(browser, "Merge", "test input", "test_output");`
|
||||
|
@ -231,76 +540,139 @@ module.exports = {
|
|||
// testOp(browser, "Multiply", "test input", "test_output");
|
||||
// testOp(browser, "NOT", "test input", "test_output");
|
||||
// testOp(browser, "Normalise Image", "test input", "test_output");
|
||||
// testOp(browser, "Normalise Unicode", "test input", "test_output");
|
||||
// testOp(browser, "Normalise Unicode", "test input", "test_output");
|
||||
// testOp(browser, "Numberwang", "test input", "test_output");
|
||||
// testOp(browser, "OR", "test input", "test_output");
|
||||
// testOp(browser, "Object Identifier to Hex", "test input", "test_output");
|
||||
testOpHtml(browser, "Offset checker", "test input\n\nbest input", ".hl5", "est input");
|
||||
// testOp(browser, "Optical Character Recognition", "test input", "test_output");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Offset checker",
|
||||
"test input\n\nbest input",
|
||||
".hl5",
|
||||
"est input",
|
||||
);
|
||||
// testOp(browser, "Optical Character Recognition", "test input", "test_output");
|
||||
// testOp(browser, "PEM to Hex", "test input", "test_output");
|
||||
// testOp(browser, "PGP Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "PGP Decrypt and Verify", "test input", "test_output");
|
||||
// testOp(browser, "PGP Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "PGP Encrypt and Sign", "test input", "test_output");
|
||||
// testOp(browser, "PGP Verify", "test input", "test_output");
|
||||
// testOp(browser, "PGP Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "PGP Decrypt and Verify", "test input", "test_output");
|
||||
// testOp(browser, "PGP Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "PGP Encrypt and Sign", "test input", "test_output");
|
||||
// testOp(browser, "PGP Verify", "test input", "test_output");
|
||||
// testOp(browser, "PHP Deserialize", "test input", "test_output");
|
||||
// testOp(browser, "Pad lines", "test input", "test_output");
|
||||
// testOp(browser, "Parse ASN.1 hex string", "test input", "test_output");
|
||||
testOpHtml(browser, "Parse colour code", "#000", ".colorpicker-preview", "rgb(0, 0, 0)");
|
||||
testOpHtml(browser, "Parse DateTime", "01/12/2000 13:00:00", "", /Date: Friday 1st December 2000/);
|
||||
// testOp(browser, "Parse ASN.1 hex string", "test input", "test_output");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Parse colour code",
|
||||
"#000",
|
||||
".colorpicker-preview",
|
||||
"rgb(0, 0, 0)",
|
||||
);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Parse DateTime",
|
||||
"01/12/2000 13:00:00",
|
||||
"",
|
||||
/Date: Friday 1st December 2000/,
|
||||
);
|
||||
// testOp(browser, "Parse IP range", "test input", "test_output");
|
||||
testOpHtml(browser, "Parse IPv4 header", "45 c0 00 c4 02 89 00 00 ff 11 1e 8c c0 a8 0c 01 c0 a8 0c 02", "tr:last-child td:last-child", "192.168.12.2");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Parse IPv4 header",
|
||||
"45 c0 00 c4 02 89 00 00 ff 11 1e 8c c0 a8 0c 01 c0 a8 0c 02",
|
||||
"tr:last-child td:last-child",
|
||||
"192.168.12.2",
|
||||
);
|
||||
// testOp(browser, "Parse IPv6 address", "test input", "test_output");
|
||||
// testOp(browser, "Parse ObjectID timestamp", "test input", "test_output");
|
||||
// testOp(browser, "Parse QR Code", "test input", "test_output");
|
||||
// testOp(browser, "Parse ObjectID timestamp", "test input", "test_output");
|
||||
// testOp(browser, "Parse QR Code", "test input", "test_output");
|
||||
// testOp(browser, "Parse SSH Host Key", "test input", "test_output");
|
||||
testOpHtml(browser, "Parse TCP", "c2eb0050a138132e70dc9fb9501804025ea70000", "tr:nth-of-type(2) td:last-child", "49899");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Parse TCP",
|
||||
"c2eb0050a138132e70dc9fb9501804025ea70000",
|
||||
"tr:nth-of-type(2) td:last-child",
|
||||
"49899",
|
||||
);
|
||||
// testOp(browser, "Parse TLV", "test input", "test_output");
|
||||
testOpHtml(browser, "Parse UDP", "04 89 00 35 00 2c 01 01", "tr:last-child td:last-child", "0x0101");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Parse UDP",
|
||||
"04 89 00 35 00 2c 01 01",
|
||||
"tr:last-child td:last-child",
|
||||
"0x0101",
|
||||
);
|
||||
// testOp(browser, "Parse UNIX file permissions", "test input", "test_output");
|
||||
// testOp(browser, "Parse URI", "test input", "test_output");
|
||||
// testOp(browser, "Parse User Agent", "test input", "test_output");
|
||||
// testOp(browser, "Parse User Agent", "test input", "test_output");
|
||||
// testOp(browser, "Parse X.509 certificate", "test input", "test_output");
|
||||
testOpFile(browser, "Play Media", "files/mp3example.mp3", "audio", "");
|
||||
// testOp(browser, "Power Set", "test input", "test_output");
|
||||
// testOp(browser, "Protobuf Decode", "test input", "test_output");
|
||||
// testOp(browser, "Protobuf Decode", "test input", "test_output");
|
||||
// testOp(browser, "Pseudo-Random Number Generator", "test input", "test_output");
|
||||
// testOp(browser, "RC2 Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "RC2 Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "RC4", "test input", "test_output");
|
||||
// testOp(browser, "RC4 Drop", "test input", "test_output");
|
||||
// testOp(browser, "RC2 Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "RC2 Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "RC4", "test input", "test_output");
|
||||
// testOp(browser, "RC4 Drop", "test input", "test_output");
|
||||
// testOp(browser, "RIPEMD", "test input", "test_output");
|
||||
// testOp(browser, "ROT13", "test input", "test_output");
|
||||
// testOp(browser, "ROT47", "test input", "test_output");
|
||||
// testOp(browser, "ROT8000", "test input", "test_output");
|
||||
// testOp(browser, "Rail Fence Cipher Decode", "test input", "test_output");
|
||||
// testOp(browser, "Rail Fence Cipher Encode", "test input", "test_output");
|
||||
testOpImage(browser, "Randomize Colour Palette", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Raw Deflate", "test input", "test_output");
|
||||
// testOp(browser, "Raw Inflate", "test input", "test_output");
|
||||
testOpImage(
|
||||
browser,
|
||||
"Randomize Colour Palette",
|
||||
"files/Hitchhikers_Guide.jpeg",
|
||||
);
|
||||
// testOp(browser, "Raw Deflate", "test input", "test_output");
|
||||
// testOp(browser, "Raw Inflate", "test input", "test_output");
|
||||
// testOp(browser, "Register", "test input", "test_output");
|
||||
testOpHtml(browser, "Regular expression", "The cat sat on the mat", ".hl2:last-child", "mat", ["User defined", ".at", true, true, false, false, false, false, "Highlight matches"]);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Regular expression",
|
||||
"The cat sat on the mat",
|
||||
".hl2:last-child",
|
||||
"mat",
|
||||
[
|
||||
"User defined",
|
||||
".at",
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
"Highlight matches",
|
||||
],
|
||||
);
|
||||
// testOp(browser, "Remove Diacritics", "test input", "test_output");
|
||||
// testOp(browser, "Remove EXIF", "test input", "test_output");
|
||||
// testOp(browser, "Remove line numbers", "test input", "test_output");
|
||||
// testOp(browser, "Remove null bytes", "test input", "test_output");
|
||||
// testOp(browser, "Remove whitespace", "test input", "test_output");
|
||||
testOpImage(browser, "Render Image", "files/Hitchhikers_Guide.jpeg");
|
||||
testOpHtml(browser, "Render Markdown", "# test input", "h1", "test input");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Render Markdown",
|
||||
"# test input",
|
||||
"h1",
|
||||
"test input",
|
||||
);
|
||||
testOpImage(browser, "Resize Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Return", "test input", "test_output");
|
||||
// testOp(browser, "Reverse", "test input", "test_output");
|
||||
testOpImage(browser, "Rotate Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Rotate left", "test input", "test_output");
|
||||
// testOp(browser, "Rotate right", "test input", "test_output");
|
||||
// testOp(browser, "Scrypt", "test input", "test output");
|
||||
// testOp(browser, "SHA0", "test input", "test_output");
|
||||
// testOp(browser, "SHA1", "test input", "test_output");
|
||||
// testOp(browser, "SHA2", "test input", "test_output");
|
||||
// testOp(browser, "SHA3", "test input", "test_output");
|
||||
// testOp(browser, "Scrypt", "test input", "test output");
|
||||
// testOp(browser, "SHA0", "test input", "test_output");
|
||||
// testOp(browser, "SHA1", "test input", "test_output");
|
||||
// testOp(browser, "SHA2", "test input", "test_output");
|
||||
// testOp(browser, "SHA3", "test input", "test_output");
|
||||
// testOp(browser, "SQL Beautify", "test input", "test_output");
|
||||
// testOp(browser, "SQL Minify", "test input", "test_output");
|
||||
// testOp(browser, "SSDEEP", "test input", "test_output");
|
||||
// testOp(browser, "SSDEEP", "test input", "test_output");
|
||||
// testOp(browser, "SUB", "test input", "test_output");
|
||||
// testOp(browser, "Scan for Embedded Files", "test input", "test_output");
|
||||
testOpHtml(browser, "Scatter chart", "a b\n1 2", "svg", /a/);
|
||||
|
@ -309,12 +681,24 @@ module.exports = {
|
|||
// testOp(browser, "Set Difference", "test input", "test_output");
|
||||
// testOp(browser, "Set Intersection", "test input", "test_output");
|
||||
// testOp(browser, "Set Union", "test input", "test_output");
|
||||
// testOp(browser, "Shake", "test input", "test_output");
|
||||
// testOp(browser, "Shake", "test input", "test_output");
|
||||
testOpImage(browser, "Sharpen Image", "files/Hitchhikers_Guide.jpeg");
|
||||
testOpHtml(browser, "Show Base64 offsets", "test input", "span:nth-last-of-type(2)", "B");
|
||||
testOpHtml(browser, "Show on map", "51.5007° N, 0.1246° W", "#presentedMap .leaflet-popup-content", "51.5007,-0.1246");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Show Base64 offsets",
|
||||
"test input",
|
||||
"span:nth-last-of-type(2)",
|
||||
"B",
|
||||
);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Show on map",
|
||||
"51.5007° N, 0.1246° W",
|
||||
"#presentedMap .leaflet-popup-content",
|
||||
"51.5007,-0.1246",
|
||||
);
|
||||
// testOp(browser, "Sleep", "test input", "test_output");
|
||||
// testOp(browser, "SM3", "test input", "test output");
|
||||
// testOp(browser, "SM3", "test input", "test output");
|
||||
// testOp(browser, "Snefru", "test input", "test_output");
|
||||
// testOp(browser, "Sort", "test input", "test_output");
|
||||
// testOp(browser, "Split", "test input", "test_output");
|
||||
|
@ -327,15 +711,27 @@ module.exports = {
|
|||
// testOp(browser, "Subsection", "test input", "test_output");
|
||||
// testOp(browser, "Substitute", "test input", "test_output");
|
||||
// testOp(browser, "Subtract", "test input", "test_output");
|
||||
// testOp(browser, "Sum", "test input", "test_output");
|
||||
// testOp(browser, "Sum", "test input", "test_output");
|
||||
// testOp(browser, "Swap endianness", "test input", "test_output");
|
||||
// testOp(browser, "Symmetric Difference", "test input", "test_output");
|
||||
testOpHtml(browser, "Syntax highlighter", "var a = [4,5,6]", ".hljs-selector-attr", "[4,5,6]");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Syntax highlighter",
|
||||
"var a = [4,5,6]",
|
||||
".hljs-selector-attr",
|
||||
"[4,5,6]",
|
||||
);
|
||||
// testOp(browser, "TCP/IP Checksum", "test input", "test_output");
|
||||
// testOp(browser, "Tail", "test input", "test_output");
|
||||
// testOp(browser, "Take bytes", "test input", "test_output");
|
||||
testOp(browser, "Tar", "test input", /^file\.txt\x00{92}/);
|
||||
testOpHtml(browser, "Text Encoding Brute Force", "test input", "tr:nth-of-type(4) td:last-child", /t\u2400e\u2400s\u2400t\u2400/);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Text Encoding Brute Force",
|
||||
"test input",
|
||||
"tr:nth-of-type(4) td:last-child",
|
||||
/t\u2400e\u2400s\u2400t\u2400/,
|
||||
);
|
||||
// testOp(browser, "To BCD", "test input", "test_output");
|
||||
// testOp(browser, "To Base", "test input", "test_output");
|
||||
// testOp(browser, "To Base32", "test input", "test_output");
|
||||
|
@ -345,7 +741,7 @@ module.exports = {
|
|||
// testOp(browser, "To Base85", "test input", "test_output");
|
||||
// testOp(browser, "To Binary", "test input", "test_output");
|
||||
// testOp(browser, "To Braille", "test input", "test_output");
|
||||
// testOp(browser, "To Camel case", "test input", "test_output");
|
||||
// testOp(browser, "To Camel case", "test input", "test_output");
|
||||
// testOp(browser, "To Case Insensitive Regex", "test input", "test_output");
|
||||
// testOp(browser, "To Charcode", "test input", "test_output");
|
||||
// testOp(browser, "To Decimal", "test input", "test_output");
|
||||
|
@ -353,14 +749,14 @@ module.exports = {
|
|||
// testOp(browser, "To Hex", "test input", "test_output");
|
||||
// testOp(browser, "To Hex Content", "test input", "test_output");
|
||||
// testOp(browser, "To Hexdump", "test input", "test_output");
|
||||
// testOp(browser, "To Kebab case", "test input", "test_output");
|
||||
// testOp(browser, "To Kebab case", "test input", "test_output");
|
||||
// testOp(browser, "To Lower case", "test input", "test_output");
|
||||
// testOp(browser, "To MessagePack", "test input", "test_output");
|
||||
// testOp(browser, "To MessagePack", "test input", "test_output");
|
||||
// testOp(browser, "To Morse Code", "test input", "test_output");
|
||||
// testOp(browser, "To Octal", "test input", "test_output");
|
||||
// testOp(browser, "To Punycode", "test input", "test_output");
|
||||
// testOp(browser, "To Quoted Printable", "test input", "test_output");
|
||||
// testOp(browser, "To Snake case", "test input", "test_output");
|
||||
// testOp(browser, "To Snake case", "test input", "test_output");
|
||||
testOpHtml(browser, "To Table", "a,b,c\n1,2,3", "", /| a | b | c |/);
|
||||
// testOp(browser, "To UNIX Timestamp", "test input", "test_output");
|
||||
// testOp(browser, "To Upper case", "test input", "test_output");
|
||||
|
@ -374,34 +770,49 @@ module.exports = {
|
|||
// testOp(browser, "Unescape string", "test input", "test_output");
|
||||
// testOp(browser, "Unescape Unicode Characters", "test input", "test_output");
|
||||
// testOp(browser, "Unique", "test input", "test_output");
|
||||
testOpHtml(browser, ["Tar", "Untar"], "test input", ".float-right", /10 bytes/);
|
||||
testOpHtml(browser, ["Zip", "Unzip"], "test input", "#files span.float-right", /10 bytes/);
|
||||
testOpHtml(
|
||||
browser,
|
||||
["Tar", "Untar"],
|
||||
"test input",
|
||||
".float-right",
|
||||
/10 bytes/,
|
||||
);
|
||||
testOpHtml(
|
||||
browser,
|
||||
["Zip", "Unzip"],
|
||||
"test input",
|
||||
"#files span.float-right",
|
||||
/10 bytes/,
|
||||
);
|
||||
// testOp(browser, "VarInt Decode", "test input", "test_output");
|
||||
// testOp(browser, "VarInt Encode", "test input", "test_output");
|
||||
testOpImage(browser, "View Bit Plane", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Vigenère Decode", "test input", "test_output");
|
||||
// testOp(browser, "Vigenère Encode", "test input", "test_output");
|
||||
testOp(browser, "Whirlpool", "test input", "8a0ee6885ba241353d17cbbe5f06538a7f04c8c955d376c20d6233fd4dd41aaffd13291447090ce781b5f940da266ed6d02cf8b79d4867065d10bdfc04166f38");
|
||||
testOp(
|
||||
browser,
|
||||
"Whirlpool",
|
||||
"test input",
|
||||
"8a0ee6885ba241353d17cbbe5f06538a7f04c8c955d376c20d6233fd4dd41aaffd13291447090ce781b5f940da266ed6d02cf8b79d4867065d10bdfc04166f38",
|
||||
);
|
||||
// testOp(browser, "Windows Filetime to UNIX Timestamp", "test input", "test_output");
|
||||
testOp(browser, "XKCD Random Number", "test input", "4");
|
||||
// testOp(browser, "XML Beautify", "test input", "test_output");
|
||||
// testOp(browser, "XML Minify", "test input", "test_output");
|
||||
// testOp(browser, "XML Beautify", "test input", "test_output");
|
||||
// testOp(browser, "XML Minify", "test input", "test_output");
|
||||
// testOp(browser, "XOR", "test input", "test_output");
|
||||
// testOp(browser, "XOR Brute Force", "test input", "test_output");
|
||||
// testOp(browser, "XPath expression", "test input", "test_output");
|
||||
// testOp(browser, "YARA Rules", "test input", "test_output");
|
||||
// testOp(browser, "XPath expression", "test input", "test_output");
|
||||
// testOp(browser, "YARA Rules", "test input", "test_output");
|
||||
testOp(browser, "Zip", "test input", /^PK\u0003\u0004\u0014\u0000{3}/);
|
||||
// testOp(browser, "Zlib Deflate", "test input", "test_output");
|
||||
// testOp(browser, "Zlib Inflate", "test input", "test_output");
|
||||
},
|
||||
|
||||
|
||||
after: browser => {
|
||||
after: (browser) => {
|
||||
browser.end();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/** @function
|
||||
* Clears the current recipe and bakes a new operation.
|
||||
*
|
||||
|
@ -410,8 +821,8 @@ module.exports = {
|
|||
* @param {string} input - input text for test
|
||||
* @param {Array<string>|Array<Array<string>>} args - arguments, nested if multiple ops
|
||||
*/
|
||||
function bakeOp(browser, opName, input, args=[]) {
|
||||
browser.perform(function() {
|
||||
function bakeOp(browser, opName, input, args = []) {
|
||||
browser.perform(function () {
|
||||
console.log(`Current test: ${opName}`);
|
||||
});
|
||||
utils.loadRecipe(browser, opName, input, args);
|
||||
|
@ -428,7 +839,7 @@ function bakeOp(browser, opName, input, args=[]) {
|
|||
* @param {string} output - expected output
|
||||
* @param {Array<string>|Array<Array<string>>} args - arguments, nested if multiple ops
|
||||
*/
|
||||
function testOp(browser, opName, input, output, args=[]) {
|
||||
function testOp(browser, opName, input, output, args = []) {
|
||||
bakeOp(browser, opName, input, args);
|
||||
utils.expectOutput(browser, output);
|
||||
}
|
||||
|
@ -443,13 +854,17 @@ function testOp(browser, opName, input, output, args=[]) {
|
|||
* @param {string} output - expected output
|
||||
* @param {Array<string>|Array<Array<string>>} args - arguments, nested if multiple ops
|
||||
*/
|
||||
function testOpHtml(browser, opName, input, cssSelector, output, args=[]) {
|
||||
function testOpHtml(browser, opName, input, cssSelector, output, args = []) {
|
||||
bakeOp(browser, opName, input, args);
|
||||
|
||||
if (typeof output === "string") {
|
||||
browser.expect.element("#output-html " + cssSelector).text.that.equals(output);
|
||||
browser.expect
|
||||
.element("#output-html " + cssSelector)
|
||||
.text.that.equals(output);
|
||||
} else if (output instanceof RegExp) {
|
||||
browser.expect.element("#output-html " + cssSelector).text.that.matches(output);
|
||||
browser.expect
|
||||
.element("#output-html " + cssSelector)
|
||||
.text.that.matches(output);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +877,7 @@ function testOpHtml(browser, opName, input, cssSelector, output, args=[]) {
|
|||
* @param {Array<string>|Array<Array<string>>} args - arguments, nested if multiple ops
|
||||
*/
|
||||
function testOpImage(browser, opName, filename, args) {
|
||||
browser.perform(function() {
|
||||
browser.perform(function () {
|
||||
console.log(`Current test: ${opName}`);
|
||||
});
|
||||
utils.loadRecipe(browser, opName, "", args);
|
||||
|
@ -472,7 +887,9 @@ function testOpImage(browser, opName, filename, args) {
|
|||
|
||||
browser
|
||||
.waitForElementVisible("#output-html img")
|
||||
.expect.element("#output-html img").to.have.css("width").which.matches(/^[^0]\d*px/);
|
||||
.expect.element("#output-html img")
|
||||
.to.have.css("width")
|
||||
.which.matches(/^[^0]\d*px/);
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
@ -486,7 +903,7 @@ function testOpImage(browser, opName, filename, args) {
|
|||
* @param {Array<string>|Array<Array<string>>} args - arguments, nested if multiple ops
|
||||
*/
|
||||
function testOpFile(browser, opName, filename, cssSelector, output, args) {
|
||||
browser.perform(function() {
|
||||
browser.perform(function () {
|
||||
console.log(`Current test: ${opName}`);
|
||||
});
|
||||
utils.loadRecipe(browser, opName, "", args);
|
||||
|
@ -495,8 +912,12 @@ function testOpFile(browser, opName, filename, cssSelector, output, args) {
|
|||
utils.bake(browser);
|
||||
|
||||
if (typeof output === "string") {
|
||||
browser.expect.element("#output-html " + cssSelector).text.that.equals(output);
|
||||
browser.expect
|
||||
.element("#output-html " + cssSelector)
|
||||
.text.that.equals(output);
|
||||
} else if (output instanceof RegExp) {
|
||||
browser.expect.element("#output-html " + cssSelector).text.that.matches(output);
|
||||
browser.expect
|
||||
.element("#output-html " + cssSelector)
|
||||
.text.that.matches(output);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@ function clear(browser) {
|
|||
.click("#clr-recipe")
|
||||
.click("#clr-io")
|
||||
.waitForElementNotPresent("#rec-list li.operation")
|
||||
.expect.element("#input-text .cm-content").text.that.equals("");
|
||||
.expect.element("#input-text .cm-content")
|
||||
.text.that.equals("");
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
@ -28,17 +29,17 @@ function clear(browser) {
|
|||
* @param {boolean} [type=true] - Whether to type the characters in by using sendKeys,
|
||||
* or to set the value of the editor directly (useful for special characters)
|
||||
*/
|
||||
function setInput(browser, input, type=true) {
|
||||
function setInput(browser, input, type = true) {
|
||||
clear(browser);
|
||||
if (type) {
|
||||
browser
|
||||
.useCss()
|
||||
.sendKeys("#input-text .cm-content", input)
|
||||
.pause(100);
|
||||
browser.useCss().sendKeys("#input-text .cm-content", input).pause(100);
|
||||
} else {
|
||||
browser.execute(text => {
|
||||
window.app.setInput(text);
|
||||
}, [input]);
|
||||
browser.execute(
|
||||
(text) => {
|
||||
window.app.setInput(text);
|
||||
},
|
||||
[input],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,10 +67,15 @@ function setChrEnc(browser, io, enc) {
|
|||
browser
|
||||
.useCss()
|
||||
.click(io + " .chr-enc-value")
|
||||
.waitForElementVisible(io + " .chr-enc-select .cm-status-bar-select-scroll")
|
||||
.waitForElementVisible(
|
||||
io + " .chr-enc-select .cm-status-bar-select-scroll",
|
||||
)
|
||||
.click("link text", enc)
|
||||
.waitForElementNotVisible(io + " .chr-enc-select .cm-status-bar-select-scroll")
|
||||
.expect.element(io + " .chr-enc-value").text.that.equals(enc);
|
||||
.waitForElementNotVisible(
|
||||
io + " .chr-enc-select .cm-status-bar-select-scroll",
|
||||
)
|
||||
.expect.element(io + " .chr-enc-value")
|
||||
.text.that.equals(enc);
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
@ -84,10 +90,15 @@ function setEOLSeq(browser, io, eol) {
|
|||
browser
|
||||
.useCss()
|
||||
.click(io + " .eol-value")
|
||||
.waitForElementVisible(io + " .eol-select .cm-status-bar-select-content")
|
||||
.waitForElementVisible(
|
||||
io + " .eol-select .cm-status-bar-select-content",
|
||||
)
|
||||
.click(`${io} .cm-status-bar-select-content a[data-val=${eol}]`)
|
||||
.waitForElementNotVisible(io + " .eol-select .cm-status-bar-select-content")
|
||||
.expect.element(io + " .eol-value").text.that.equals(eol);
|
||||
.waitForElementNotVisible(
|
||||
io + " .eol-select .cm-status-bar-select-content",
|
||||
)
|
||||
.expect.element(io + " .eol-value")
|
||||
.text.that.equals(eol);
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
@ -96,8 +107,8 @@ function setEOLSeq(browser, io, eol) {
|
|||
* @param {Browser} browser - Nightwatch client
|
||||
*/
|
||||
function copy(browser) {
|
||||
browser.perform(function() {
|
||||
const actions = this.actions({async: true});
|
||||
browser.perform(function () {
|
||||
const actions = this.actions({ async: true });
|
||||
|
||||
// Ctrl + Ins used as this works on Windows, Linux and Mac
|
||||
return actions
|
||||
|
@ -117,8 +128,8 @@ function copy(browser) {
|
|||
function paste(browser, el) {
|
||||
browser
|
||||
.click(el)
|
||||
.perform(function() {
|
||||
const actions = this.actions({async: true});
|
||||
.perform(function () {
|
||||
const actions = this.actions({ async: true });
|
||||
|
||||
// Shift + Ins used as this works on Windows, Linux and Mac
|
||||
return actions
|
||||
|
@ -141,22 +152,27 @@ function paste(browser, el) {
|
|||
function loadRecipe(browser, opName, input, args) {
|
||||
let recipeConfig;
|
||||
|
||||
if (typeof(opName) === "string") {
|
||||
recipeConfig = JSON.stringify([{
|
||||
"op": opName,
|
||||
"args": args
|
||||
}]);
|
||||
if (typeof opName === "string") {
|
||||
recipeConfig = JSON.stringify([
|
||||
{
|
||||
op: opName,
|
||||
args: args,
|
||||
},
|
||||
]);
|
||||
} else if (opName instanceof Array) {
|
||||
recipeConfig = JSON.stringify(
|
||||
opName.map((op, i) => {
|
||||
return {
|
||||
op: op,
|
||||
args: args.length ? args[i] : []
|
||||
args: args.length ? args[i] : [],
|
||||
};
|
||||
})
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
throw new Error("Invalid operation type. Must be string or array of strings. Received: " + typeof(opName));
|
||||
throw new Error(
|
||||
"Invalid operation type. Must be string or array of strings. Received: " +
|
||||
typeof opName,
|
||||
);
|
||||
}
|
||||
|
||||
clear(browser);
|
||||
|
@ -173,14 +189,18 @@ function loadRecipe(browser, opName, input, args) {
|
|||
* @param {string|RegExp} expected - The expected output value
|
||||
*/
|
||||
function expectOutput(browser, expected) {
|
||||
browser.execute(expected => {
|
||||
const output = window.app.manager.output.outputEditorView.state.doc.toString();
|
||||
if (expected instanceof RegExp) {
|
||||
return expected.test(output);
|
||||
} else {
|
||||
return expected === output;
|
||||
}
|
||||
}, [expected]);
|
||||
browser.execute(
|
||||
(expected) => {
|
||||
const output =
|
||||
window.app.manager.output.outputEditorView.state.doc.toString();
|
||||
if (expected instanceof RegExp) {
|
||||
return expected.test(output);
|
||||
} else {
|
||||
return expected === output;
|
||||
}
|
||||
},
|
||||
[expected],
|
||||
);
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
@ -190,17 +210,16 @@ function expectOutput(browser, expected) {
|
|||
* @param {string} filename - A path to a file in the samples directory
|
||||
*/
|
||||
function uploadFile(browser, filename) {
|
||||
const filepath = require("path").resolve(__dirname + "/../samples/" + filename);
|
||||
const filepath = require("path").resolve(
|
||||
__dirname + "/../samples/" + filename,
|
||||
);
|
||||
|
||||
// The file input cannot be interacted with by nightwatch while it is hidden,
|
||||
// so we temporarily expose it for the purposes of this test.
|
||||
browser.execute(() => {
|
||||
document.getElementById("open-file").style.display = "block";
|
||||
});
|
||||
browser
|
||||
.pause(100)
|
||||
.setValue("#open-file", filepath)
|
||||
.pause(100);
|
||||
browser.pause(100).setValue("#open-file", filepath).pause(100);
|
||||
browser.execute(() => {
|
||||
document.getElementById("open-file").style.display = "none";
|
||||
});
|
||||
|
@ -214,24 +233,22 @@ function uploadFile(browser, filename) {
|
|||
* @param {string} foldername - A path to a folder in the samples directory
|
||||
*/
|
||||
function uploadFolder(browser, foldername) {
|
||||
const folderpath = require("path").resolve(__dirname + "/../samples/" + foldername);
|
||||
const folderpath = require("path").resolve(
|
||||
__dirname + "/../samples/" + foldername,
|
||||
);
|
||||
|
||||
// The folder input cannot be interacted with by nightwatch while it is hidden,
|
||||
// so we temporarily expose it for the purposes of this test.
|
||||
browser.execute(() => {
|
||||
document.getElementById("open-folder").style.display = "block";
|
||||
});
|
||||
browser
|
||||
.pause(100)
|
||||
.setValue("#open-folder", folderpath)
|
||||
.pause(500);
|
||||
browser.pause(100).setValue("#open-folder", folderpath).pause(500);
|
||||
browser.execute(() => {
|
||||
document.getElementById("open-folder").style.display = "none";
|
||||
});
|
||||
browser.waitForElementVisible("#input-text .cm-file-details");
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
clear: clear,
|
||||
setInput: setInput,
|
||||
|
@ -243,5 +260,5 @@ module.exports = {
|
|||
loadRecipe: loadRecipe,
|
||||
expectOutput: expectOutput,
|
||||
uploadFile: uploadFile,
|
||||
uploadFolder: uploadFolder
|
||||
uploadFolder: uploadFolder,
|
||||
};
|
||||
|
|
|
@ -21,7 +21,6 @@ import log from "loglevel";
|
|||
* @constructor
|
||||
*/
|
||||
class TestRegister {
|
||||
|
||||
/**
|
||||
* initialise with no tests
|
||||
*/
|
||||
|
@ -50,38 +49,39 @@ class TestRegister {
|
|||
/**
|
||||
* Runs all the tests in the register.
|
||||
*/
|
||||
async runTests () {
|
||||
async runTests() {
|
||||
// Turn off logging to avoid messy errors
|
||||
log.setLevel("silent", false);
|
||||
|
||||
const progBar = new cliProgress.SingleBar({
|
||||
format: formatter,
|
||||
stopOnComplete: true
|
||||
}, cliProgress.Presets.shades_classic);
|
||||
const progBar = new cliProgress.SingleBar(
|
||||
{
|
||||
format: formatter,
|
||||
stopOnComplete: true,
|
||||
},
|
||||
cliProgress.Presets.shades_classic,
|
||||
);
|
||||
const testResults = [];
|
||||
|
||||
console.log("Running operation tests...");
|
||||
progBar.start(this.tests.length, 0, {
|
||||
msg: "Setting up"
|
||||
msg: "Setting up",
|
||||
});
|
||||
|
||||
for (const test of this.tests) {
|
||||
progBar.update(testResults.length, {
|
||||
msg: test.name
|
||||
msg: test.name,
|
||||
});
|
||||
|
||||
const chef = new Chef();
|
||||
const result = await chef.bake(
|
||||
test.input,
|
||||
test.recipeConfig,
|
||||
{ returnType: "string" }
|
||||
);
|
||||
const result = await chef.bake(test.input, test.recipeConfig, {
|
||||
returnType: "string",
|
||||
});
|
||||
|
||||
const ret = {
|
||||
test: test,
|
||||
status: null,
|
||||
output: null,
|
||||
duration: result.duration
|
||||
duration: result.duration,
|
||||
};
|
||||
|
||||
if (result.error) {
|
||||
|
@ -94,7 +94,8 @@ class TestRegister {
|
|||
"Expected",
|
||||
"\t" + test.expectedOutput.replace(/\n/g, "\n\t"),
|
||||
"Received",
|
||||
"\t" + result.error.displayStr.replace(/\n/g, "\n\t"),
|
||||
"\t" +
|
||||
result.error.displayStr.replace(/\n/g, "\n\t"),
|
||||
].join("\n");
|
||||
}
|
||||
} else {
|
||||
|
@ -107,16 +108,25 @@ class TestRegister {
|
|||
ret.output = "Expected an error but did not receive one.";
|
||||
} else if (result.result === test.expectedOutput) {
|
||||
ret.status = "passing";
|
||||
} else if ("expectedMatch" in test && test.expectedMatch.test(result.result)) {
|
||||
} else if (
|
||||
"expectedMatch" in test &&
|
||||
test.expectedMatch.test(result.result)
|
||||
) {
|
||||
ret.status = "passing";
|
||||
} else if ("unexpectedMatch" in test && !test.unexpectedMatch.test(result.result)) {
|
||||
} else if (
|
||||
"unexpectedMatch" in test &&
|
||||
!test.unexpectedMatch.test(result.result)
|
||||
) {
|
||||
ret.status = "passing";
|
||||
} else {
|
||||
ret.status = "failing";
|
||||
const expected = test.expectedOutput ? test.expectedOutput :
|
||||
test.expectedMatch ? test.expectedMatch.toString() :
|
||||
test.unexpectedMatch ? "to not find " + test.unexpectedMatch.toString() :
|
||||
"unknown";
|
||||
const expected = test.expectedOutput
|
||||
? test.expectedOutput
|
||||
: test.expectedMatch
|
||||
? test.expectedMatch.toString()
|
||||
: test.unexpectedMatch
|
||||
? "to not find " + test.unexpectedMatch.toString()
|
||||
: "unknown";
|
||||
ret.output = [
|
||||
"Expected",
|
||||
"\t" + expected.replace(/\n/g, "\n\t"),
|
||||
|
@ -140,27 +150,30 @@ class TestRegister {
|
|||
* Run all api related tests and wrap results in report format
|
||||
*/
|
||||
async runApiTests() {
|
||||
const progBar = new cliProgress.SingleBar({
|
||||
format: formatter,
|
||||
stopOnComplete: true
|
||||
}, cliProgress.Presets.shades_classic);
|
||||
const progBar = new cliProgress.SingleBar(
|
||||
{
|
||||
format: formatter,
|
||||
stopOnComplete: true,
|
||||
},
|
||||
cliProgress.Presets.shades_classic,
|
||||
);
|
||||
const testResults = [];
|
||||
|
||||
console.log("Running Node API tests...");
|
||||
progBar.start(this.apiTests.length, 0, {
|
||||
msg: "Setting up"
|
||||
msg: "Setting up",
|
||||
});
|
||||
|
||||
global.TESTING = true;
|
||||
for (const test of this.apiTests) {
|
||||
progBar.update(testResults.length, {
|
||||
msg: test.name
|
||||
msg: test.name,
|
||||
});
|
||||
|
||||
const result = {
|
||||
test: test,
|
||||
status: null,
|
||||
output: null
|
||||
output: null,
|
||||
};
|
||||
try {
|
||||
await test.run();
|
||||
|
@ -178,7 +191,6 @@ class TestRegister {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Formatter for the progress bar
|
||||
*
|
||||
|
@ -188,8 +200,15 @@ class TestRegister {
|
|||
* @returns {string}
|
||||
*/
|
||||
function formatter(options, params, payload) {
|
||||
const bar = options.barCompleteString.substr(0, Math.round(params.progress * options.barsize)) +
|
||||
options.barIncompleteString.substr(0, Math.round((1-params.progress) * options.barsize));
|
||||
const bar =
|
||||
options.barCompleteString.substr(
|
||||
0,
|
||||
Math.round(params.progress * options.barsize),
|
||||
) +
|
||||
options.barIncompleteString.substr(
|
||||
0,
|
||||
Math.round((1 - params.progress) * options.barsize),
|
||||
);
|
||||
|
||||
const percentage = Math.floor(params.progress * 100),
|
||||
duration = Math.floor((Date.now() - params.startTime) / 1000);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Helper function to convert a status to an icon.
|
||||
*
|
||||
|
@ -16,11 +15,13 @@
|
|||
* @returns {string}
|
||||
*/
|
||||
function statusToIcon(status) {
|
||||
return {
|
||||
erroring: "🔥",
|
||||
failing: "❌",
|
||||
passing: "✔️️",
|
||||
}[status] || "?";
|
||||
return (
|
||||
{
|
||||
erroring: "🔥",
|
||||
failing: "❌",
|
||||
passing: "✔️️",
|
||||
}[status] || "?"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,12 +31,18 @@ function statusToIcon(status) {
|
|||
* @param {Object} testResult
|
||||
*/
|
||||
function handleTestResult(testStatus, testResult) {
|
||||
testStatus.allTestsPassing = testStatus.allTestsPassing && testResult.status === "passing";
|
||||
testStatus.counts[testResult.status] = (testStatus.counts[testResult.status] || 0) + 1;
|
||||
testStatus.allTestsPassing =
|
||||
testStatus.allTestsPassing && testResult.status === "passing";
|
||||
testStatus.counts[testResult.status] =
|
||||
(testStatus.counts[testResult.status] || 0) + 1;
|
||||
testStatus.counts.total += 1;
|
||||
|
||||
if (testResult.duration > 2000) {
|
||||
console.log(`'${testResult.test.name}' took ${(testResult.duration / 1000).toFixed(1)}s to complete`);
|
||||
console.log(
|
||||
`'${testResult.test.name}' took ${(
|
||||
testResult.duration / 1000
|
||||
).toFixed(1)}s to complete`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +53,7 @@ function handleTestResult(testStatus, testResult) {
|
|||
* @param {Object[]} results - results from TestRegister
|
||||
*/
|
||||
export function logTestReport(testStatus, results) {
|
||||
results.forEach(r => handleTestResult(testStatus, r));
|
||||
results.forEach((r) => handleTestResult(testStatus, r));
|
||||
|
||||
console.log();
|
||||
for (const testStatusCount in testStatus.counts) {
|
||||
|
@ -58,21 +65,24 @@ export function logTestReport(testStatus, results) {
|
|||
console.log();
|
||||
|
||||
// Print error messages for tests that didn't pass
|
||||
results.filter(res => res.status !== "passing").forEach(testResult => {
|
||||
console.log([
|
||||
statusToIcon(testResult.status),
|
||||
testResult.test.name
|
||||
].join(" "));
|
||||
|
||||
if (testResult.output) {
|
||||
results
|
||||
.filter((res) => res.status !== "passing")
|
||||
.forEach((testResult) => {
|
||||
console.log(
|
||||
testResult.output
|
||||
.trim()
|
||||
.replace(/^/, "\t")
|
||||
.replace(/\n/g, "\n\t")
|
||||
[statusToIcon(testResult.status), testResult.test.name].join(
|
||||
" ",
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
if (testResult.output) {
|
||||
console.log(
|
||||
testResult.output
|
||||
.trim()
|
||||
.replace(/^/, "\t")
|
||||
.replace(/\n/g, "\n\t"),
|
||||
);
|
||||
}
|
||||
});
|
||||
console.log();
|
||||
|
||||
process.exit(testStatus.allTestsPassing ? 0 : 1);
|
||||
|
@ -83,8 +93,10 @@ export function logTestReport(testStatus, results) {
|
|||
*/
|
||||
export function setLongTestFailure() {
|
||||
const timeLimit = 120;
|
||||
setTimeout(function() {
|
||||
console.log(`Tests took longer than ${timeLimit} seconds to run, returning.`);
|
||||
setTimeout(function () {
|
||||
console.log(
|
||||
`Tests took longer than ${timeLimit} seconds to run, returning.`,
|
||||
);
|
||||
process.exit(1);
|
||||
}, timeLimit * 1000);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
/* eslint no-console: 0 */
|
||||
|
||||
|
||||
/**
|
||||
* Print useful stack on error
|
||||
*/
|
||||
|
@ -24,7 +23,6 @@ const wrapRun = (run) => async () => {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* it - wrapper for assertions to provide a helpful description
|
||||
* to the TestRegister
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
const assert = require("assert");
|
||||
|
||||
require("cyberchef").then(chef => {
|
||||
|
||||
require("cyberchef").then((chef) => {
|
||||
const d = chef.bake("Testing, 1 2 3", [
|
||||
chef.toHex,
|
||||
chef.reverse,
|
||||
|
@ -17,16 +16,15 @@ require("cyberchef").then(chef => {
|
|||
op: chef.unique,
|
||||
args: {
|
||||
delimiter: "Space",
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
op: chef.multiply,
|
||||
args: {
|
||||
delimiter: "Space",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
assert.equal(d.value, "630957449041920");
|
||||
|
||||
});
|
||||
|
|
|
@ -16,14 +16,14 @@ const a = bake("Testing, 1 2 3", [
|
|||
op: unique,
|
||||
args: {
|
||||
delimiter: "Space",
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
op: multiply,
|
||||
args: {
|
||||
delimiter: "Space",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
assert.equal(a.value, "630957449041920");
|
||||
|
@ -35,14 +35,14 @@ const b = chef.bake("Testing, 1 2 3", [
|
|||
op: chef.unique,
|
||||
args: {
|
||||
delimiter: "Space",
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
op: chef.multiply,
|
||||
args: {
|
||||
delimiter: "Space",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
assert.equal(b.value, "630957449041920");
|
||||
|
|
|
@ -10,10 +10,7 @@
|
|||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import {
|
||||
setLongTestFailure,
|
||||
logTestReport,
|
||||
} from "../lib/utils.mjs";
|
||||
import { setLongTestFailure, logTestReport } from "../lib/utils.mjs";
|
||||
|
||||
import TestRegister from "../lib/TestRegister.mjs";
|
||||
import "./tests/nodeApi.mjs";
|
||||
|
@ -28,14 +25,14 @@ const testStatus = {
|
|||
allTestsPassing: true,
|
||||
counts: {
|
||||
total: 0,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
setLongTestFailure();
|
||||
|
||||
const logOpsTestReport = logTestReport.bind(null, testStatus);
|
||||
|
||||
(async function() {
|
||||
(async function () {
|
||||
const results = await TestRegister.runApiTests();
|
||||
logOpsTestReport(results);
|
||||
})();
|
||||
|
|
|
@ -1,19 +1,25 @@
|
|||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
import Categories from "../../../src/core/config/Categories.json" assert {type: "json"};
|
||||
import OperationConfig from "../../../src/core/config/OperationConfig.json" assert {type: "json"};
|
||||
import Categories from "../../../src/core/config/Categories.json" assert {
|
||||
type: "json",
|
||||
};
|
||||
import OperationConfig from "../../../src/core/config/OperationConfig.json" assert {
|
||||
type: "json",
|
||||
};
|
||||
import it from "../assertionHandler.mjs";
|
||||
import assert from "assert";
|
||||
|
||||
TestRegister.addApiTests([
|
||||
it("Categories: operations should be in a category", () => {
|
||||
const catOps = [];
|
||||
Categories.forEach(cat => {
|
||||
Categories.forEach((cat) => {
|
||||
catOps.push(...cat.ops);
|
||||
});
|
||||
|
||||
for (const op in OperationConfig) {
|
||||
assert(catOps.includes(op), `'${op}' operation is not present in any category`);
|
||||
assert(
|
||||
catOps.includes(op),
|
||||
`'${op}' operation is not present in any category`,
|
||||
);
|
||||
}
|
||||
}),
|
||||
|
||||
]);
|
||||
|
|
|
@ -8,5 +8,4 @@ TestRegister.addApiTests([
|
|||
const dish = new Dish();
|
||||
assert(dish.presentAs);
|
||||
}),
|
||||
|
||||
]);
|
||||
|
|
|
@ -2,7 +2,7 @@ import assert from "assert";
|
|||
import it from "../assertionHandler.mjs";
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
import File from "../../../src/node/File.mjs";
|
||||
import {zip, Dish} from "../../../src/node/index.mjs";
|
||||
import { zip, Dish } from "../../../src/node/index.mjs";
|
||||
|
||||
TestRegister.addApiTests([
|
||||
it("File: should exist", () => {
|
||||
|
@ -28,13 +28,13 @@ TestRegister.addApiTests([
|
|||
|
||||
it("File: unknown type should have a type of application/unknown", () => {
|
||||
const uint8Array = new Uint8Array(Buffer.from("hello"));
|
||||
const file = new File([uint8Array], "sample.txt");
|
||||
const file = new File([uint8Array], "sample.txt");
|
||||
assert.strictEqual(file.type, "application/unknown");
|
||||
}),
|
||||
|
||||
it("File: should be able to make a dish from it", () => {
|
||||
const uint8Array = new Uint8Array(Buffer.from("hello"));
|
||||
const file = new File([uint8Array], "sample.txt");
|
||||
const file = new File([uint8Array], "sample.txt");
|
||||
try {
|
||||
const dish = new Dish(file, 7);
|
||||
assert.ok(dish.valid());
|
||||
|
@ -45,7 +45,7 @@ TestRegister.addApiTests([
|
|||
|
||||
it("File: should allow dish to translate to ArrayBuffer", () => {
|
||||
const uint8Array = new Uint8Array(Buffer.from("hello"));
|
||||
const file = new File([uint8Array], "sample.txt");
|
||||
const file = new File([uint8Array], "sample.txt");
|
||||
try {
|
||||
const dish = new Dish(file, 7);
|
||||
assert.ok(dish.value);
|
||||
|
@ -53,7 +53,6 @@ TestRegister.addApiTests([
|
|||
dish.get(4);
|
||||
assert.strictEqual(dish.type, 4);
|
||||
assert.ok(dish.valid());
|
||||
|
||||
} catch (e) {
|
||||
assert.fail(e.message);
|
||||
}
|
||||
|
@ -61,7 +60,7 @@ TestRegister.addApiTests([
|
|||
|
||||
it("File: should allow dish to translate from ArrayBuffer to File", () => {
|
||||
const uint8Array = new Uint8Array(Buffer.from("hello"));
|
||||
const file = new File([uint8Array], "sample.txt");
|
||||
const file = new File([uint8Array], "sample.txt");
|
||||
try {
|
||||
const dish = new Dish(file, 7);
|
||||
assert.ok(dish.value);
|
||||
|
@ -73,10 +72,8 @@ TestRegister.addApiTests([
|
|||
// translate back to File
|
||||
dish.get(7);
|
||||
assert.ok(dish.valid());
|
||||
|
||||
} catch (e) {
|
||||
assert.fail(e.message);
|
||||
}
|
||||
})
|
||||
|
||||
}),
|
||||
]);
|
||||
|
|
|
@ -15,7 +15,10 @@ TestRegister.addApiTests([
|
|||
|
||||
it("Composable Dish: Should construct empty dish object", () => {
|
||||
const dish = new Dish();
|
||||
assert.strictEqual(dish.value.byteLength, new ArrayBuffer(0).byteLength);
|
||||
assert.strictEqual(
|
||||
dish.value.byteLength,
|
||||
new ArrayBuffer(0).byteLength,
|
||||
);
|
||||
assert.strictEqual(dish.type, 4);
|
||||
}),
|
||||
|
||||
|
@ -30,7 +33,6 @@ TestRegister.addApiTests([
|
|||
assert.ok(result instanceof Dish);
|
||||
}),
|
||||
|
||||
|
||||
it("Composable dish: infers type from input if needed", () => {
|
||||
const dish = new Dish("string input");
|
||||
assert.strictEqual(dish.type, 1);
|
||||
|
@ -38,13 +40,15 @@ TestRegister.addApiTests([
|
|||
const numberDish = new Dish(333);
|
||||
assert.strictEqual(numberDish.type, 2);
|
||||
|
||||
const arrayBufferDish = new Dish(Buffer.from("some buffer input").buffer);
|
||||
const arrayBufferDish = new Dish(
|
||||
Buffer.from("some buffer input").buffer,
|
||||
);
|
||||
assert.strictEqual(arrayBufferDish.type, 4);
|
||||
|
||||
const byteArrayDish = new Dish(Buffer.from("some buffer input"));
|
||||
assert.strictEqual(byteArrayDish.type, 0);
|
||||
|
||||
const JSONDish = new Dish({key: "value"});
|
||||
const JSONDish = new Dish({ key: "value" });
|
||||
assert.strictEqual(JSONDish.type, 6);
|
||||
}),
|
||||
|
||||
|
@ -56,13 +60,21 @@ TestRegister.addApiTests([
|
|||
}),
|
||||
|
||||
it("Composable Dish: apply should allow set of arguments for operation", () => {
|
||||
const result = new Dish("input").apply(SHA3, {size: "256"});
|
||||
assert.strictEqual(result.toString(), "7640cc9b7e3662b2250a43d1757e318bb29fb4860276ac4373b67b1650d6d3e3");
|
||||
const result = new Dish("input").apply(SHA3, { size: "256" });
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"7640cc9b7e3662b2250a43d1757e318bb29fb4860276ac4373b67b1650d6d3e3",
|
||||
);
|
||||
}),
|
||||
|
||||
it("Composable Dish: apply functions can be chained", () => {
|
||||
const result = new Dish("input").apply(toBase32).apply(SHA3, {size: "224"});
|
||||
assert.strictEqual(result.toString(), "493e8136b759370a415ef2cf2f7a69690441ff86592aba082bc2e2e0");
|
||||
const result = new Dish("input")
|
||||
.apply(toBase32)
|
||||
.apply(SHA3, { size: "224" });
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"493e8136b759370a415ef2cf2f7a69690441ff86592aba082bc2e2e0",
|
||||
);
|
||||
}),
|
||||
|
||||
it("Dish translation: ArrayBuffer to ArrayBuffer", () => {
|
||||
|
@ -77,7 +89,13 @@ TestRegister.addApiTests([
|
|||
dish.get("array buffer");
|
||||
|
||||
assert.strictEqual(dish.type, 4);
|
||||
assert.deepStrictEqual(dish.value, new Uint8Array([0x73, 0x6f, 0x6d, 0x65, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67]).buffer);
|
||||
assert.deepStrictEqual(
|
||||
dish.value,
|
||||
new Uint8Array([
|
||||
0x73, 0x6f, 0x6d, 0x65, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e,
|
||||
0x67,
|
||||
]).buffer,
|
||||
);
|
||||
assert.deepEqual(dish.value.byteLength, 11);
|
||||
|
||||
dish.get("string");
|
||||
|
@ -90,12 +108,22 @@ TestRegister.addApiTests([
|
|||
dish.get(4);
|
||||
|
||||
assert.strictEqual(dish.type, 4);
|
||||
assert.deepStrictEqual(dish.value, new Uint8Array([0x31, 0x30, 0x30]).buffer);
|
||||
assert.deepStrictEqual(
|
||||
dish.value,
|
||||
new Uint8Array([0x31, 0x30, 0x30]).buffer,
|
||||
);
|
||||
assert.strictEqual(dish.value.byteLength, 3);
|
||||
|
||||
// Check the data in ArrayBuffer represents 100 as a string.
|
||||
const view = new DataView(dish.value, 0);
|
||||
assert.strictEqual(String.fromCharCode(view.getUint8(0), view.getUint8(1), view.getUint8(2)), "100");
|
||||
assert.strictEqual(
|
||||
String.fromCharCode(
|
||||
view.getUint8(0),
|
||||
view.getUint8(1),
|
||||
view.getUint8(2),
|
||||
),
|
||||
"100",
|
||||
);
|
||||
|
||||
dish.get("number");
|
||||
assert.strictEqual(dish.type, 2);
|
||||
|
@ -139,19 +167,30 @@ TestRegister.addApiTests([
|
|||
const dish = new Dish(number, Dish.BIG_NUMBER);
|
||||
|
||||
dish.get(Dish.ARRAY_BUFFER);
|
||||
assert.deepStrictEqual(dish.value, new Uint8Array([0x34, 0x30, 0x30, 0x31]).buffer);
|
||||
assert.deepStrictEqual(
|
||||
dish.value,
|
||||
new Uint8Array([0x34, 0x30, 0x30, 0x31]).buffer,
|
||||
);
|
||||
assert.strictEqual(dish.value.byteLength, 4);
|
||||
|
||||
// Check the data in ArrayBuffer represents 4001 as a string.
|
||||
const view = new DataView(dish.value, 0);
|
||||
assert.strictEqual(String.fromCharCode(view.getUint8(0), view.getUint8(1), view.getUint8(2), view.getUint8(3)), "4001");
|
||||
assert.strictEqual(
|
||||
String.fromCharCode(
|
||||
view.getUint8(0),
|
||||
view.getUint8(1),
|
||||
view.getUint8(2),
|
||||
view.getUint8(3),
|
||||
),
|
||||
"4001",
|
||||
);
|
||||
|
||||
dish.get(5);
|
||||
assert.deepStrictEqual(dish.value, number);
|
||||
}),
|
||||
|
||||
it("Dish translation: ArrayBuffer and JSON", () => {
|
||||
const jsonString = "{\"a\": 123455, \"b\": { \"aa\": [1,2,3]}}";
|
||||
const jsonString = '{"a": 123455, "b": { "aa": [1,2,3]}}';
|
||||
const dish = new Dish(JSON.parse(jsonString), Dish.JSON);
|
||||
|
||||
dish.get(Dish.ARRAY_BUFFER);
|
||||
|
@ -165,12 +204,23 @@ TestRegister.addApiTests([
|
|||
const dish = new Dish(file, Dish.FILE);
|
||||
|
||||
dish.get(Dish.ARRAY_BUFFER);
|
||||
assert.deepStrictEqual(dish.value, new Uint8Array([0x61, 0x62, 0x63, 0x64]).buffer);
|
||||
assert.deepStrictEqual(
|
||||
dish.value,
|
||||
new Uint8Array([0x61, 0x62, 0x63, 0x64]).buffer,
|
||||
);
|
||||
assert.strictEqual(dish.value.byteLength, 4);
|
||||
|
||||
// Check the data in ArrayBuffer represents "abcd"
|
||||
const view = new DataView(dish.value, 0);
|
||||
assert.strictEqual(String.fromCharCode(view.getUint8(0), view.getUint8(1), view.getUint8(2), view.getUint8(3)), "abcd");
|
||||
assert.strictEqual(
|
||||
String.fromCharCode(
|
||||
view.getUint8(0),
|
||||
view.getUint8(1),
|
||||
view.getUint8(2),
|
||||
view.getUint8(3),
|
||||
),
|
||||
"abcd",
|
||||
);
|
||||
|
||||
dish.get(Dish.FILE);
|
||||
|
||||
|
@ -187,13 +237,19 @@ TestRegister.addApiTests([
|
|||
const dish = new Dish([file1, file2], Dish.LIST_FILE);
|
||||
|
||||
dish.get(Dish.ARRAY_BUFFER);
|
||||
assert.deepStrictEqual(dish.value, [new Uint8Array([0x61, 0x62, 0x63, 0x64, 0x65]), new Uint8Array([0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b])]);
|
||||
assert.deepStrictEqual(dish.value, [
|
||||
new Uint8Array([0x61, 0x62, 0x63, 0x64, 0x65]),
|
||||
new Uint8Array([0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b]),
|
||||
]);
|
||||
assert.strictEqual(dish.value.length, 2);
|
||||
|
||||
dish.get(Dish.LIST_FILE);
|
||||
const dataArray = new Uint8Array(dish.value[0].data);
|
||||
// cant store chars in a Uint8Array, so make it a normal one.
|
||||
const actual = Array.prototype.slice.call(dataArray).map(c => String.fromCharCode(c)).join("");
|
||||
const actual = Array.prototype.slice
|
||||
.call(dataArray)
|
||||
.map((c) => String.fromCharCode(c))
|
||||
.join("");
|
||||
assert.strictEqual(actual, "abcdefghijk");
|
||||
}),
|
||||
]);
|
||||
|
|
|
@ -19,5 +19,4 @@ TestRegister.addApiTests([
|
|||
it("Utils: should parse escaped quotes and escaped backslashes correctly", () => {
|
||||
assert.equal(Utils.parseEscapedChars("\\\\\\'"), "\\'");
|
||||
}),
|
||||
|
||||
]);
|
||||
|
|
|
@ -13,10 +13,13 @@
|
|||
import assert from "assert";
|
||||
import it from "../assertionHandler.mjs";
|
||||
import chef from "../../../src/node/index.mjs";
|
||||
import { OperationError, ExcludedOperationError } from "../../../src/core/errors/index.mjs";
|
||||
import {
|
||||
OperationError,
|
||||
ExcludedOperationError,
|
||||
} from "../../../src/core/errors/index.mjs";
|
||||
import NodeDish from "../../../src/node/NodeDish.mjs";
|
||||
|
||||
import { toBase32, magic} from "../../../src/node/index.mjs";
|
||||
import { toBase32, magic } from "../../../src/node/index.mjs";
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addApiTests([
|
||||
|
@ -61,7 +64,7 @@ TestRegister.addApiTests([
|
|||
it("should accept arguments in object format for operations", () => {
|
||||
const result = chef.setUnion("1 2 3 4:3 4 5 6", {
|
||||
itemDelimiter: " ",
|
||||
sampleDelimiter: ":"
|
||||
sampleDelimiter: ":",
|
||||
});
|
||||
|
||||
assert.equal(result.value, "1 2 3 4 5 6");
|
||||
|
@ -101,7 +104,7 @@ TestRegister.addApiTests([
|
|||
const result = chef.fromBase32(chef.toBase32("something"));
|
||||
assert.equal(String(result), "something");
|
||||
// This kind of coercion uses toValue
|
||||
assert.equal(""+result, "NaN");
|
||||
assert.equal("" + result, "NaN");
|
||||
}),
|
||||
|
||||
it("should coerce to a number as you expect", () => {
|
||||
|
@ -119,7 +122,10 @@ TestRegister.addApiTests([
|
|||
assert.strictEqual(result[0].module, "Ciphers");
|
||||
assert.strictEqual(result[0].inputType, "string");
|
||||
assert.strictEqual(result[0].outputType, "string");
|
||||
assert.strictEqual(result[0].description, "Triple DES applies DES three times to each block to increase key size.<br><br><b>Key:</b> Triple DES uses a key length of 24 bytes (192 bits).<br>DES uses a key length of 8 bytes (64 bits).<br><br><b>IV:</b> The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.<br><br><b>Padding:</b> In CBC and ECB mode, PKCS#7 padding will be used as a default.");
|
||||
assert.strictEqual(
|
||||
result[0].description,
|
||||
"Triple DES applies DES three times to each block to increase key size.<br><br><b>Key:</b> Triple DES uses a key length of 24 bytes (192 bits).<br>DES uses a key length of 8 bytes (64 bits).<br><br><b>IV:</b> The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.<br><br><b>Padding:</b> In CBC and ECB mode, PKCS#7 padding will be used as a default.",
|
||||
);
|
||||
assert.strictEqual(result[0].args.length, 5);
|
||||
}),
|
||||
|
||||
|
@ -150,7 +156,10 @@ TestRegister.addApiTests([
|
|||
const result = chef.help("Checksum");
|
||||
assert.ok(result[0].name.includes("Checksum"));
|
||||
assert.ok(result[1].name.includes("Checksum"));
|
||||
assert.strictEqual(result[result.length - 1].name.includes("Checksum"), false);
|
||||
assert.strictEqual(
|
||||
result[result.length - 1].name.includes("Checksum"),
|
||||
false,
|
||||
);
|
||||
assert.ok(result[result.length - 1].description.includes("checksum"));
|
||||
}),
|
||||
|
||||
|
@ -183,40 +192,62 @@ TestRegister.addApiTests([
|
|||
it("chef.bake: should complain if recipe isnt a valid object", () => {
|
||||
assert.throws(() => chef.bake("some input", 3264), {
|
||||
name: "TypeError",
|
||||
message: "Recipe can only contain function names or functions"
|
||||
message: "Recipe can only contain function names or functions",
|
||||
});
|
||||
}),
|
||||
|
||||
it("chef.bake: Should complain if string op is invalid", () => {
|
||||
assert.throws(() => chef.bake("some input", "not a valid operation"), {
|
||||
name: "TypeError",
|
||||
message: "Couldn't find an operation with name 'not a valid operation'."
|
||||
message:
|
||||
"Couldn't find an operation with name 'not a valid operation'.",
|
||||
});
|
||||
}),
|
||||
|
||||
it("chef.bake: Should take an input and an operation and perform it", () => {
|
||||
const result = chef.bake("https://google.com/search?q=help", chef.parseURI);
|
||||
assert.strictEqual(result.toString(), "Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = help\n");
|
||||
const result = chef.bake(
|
||||
"https://google.com/search?q=help",
|
||||
chef.parseURI,
|
||||
);
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = help\n",
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: Should complain if an invalid operation is inputted", () => {
|
||||
assert.throws(() => chef.bake("https://google.com/search?q=help", () => {}), {
|
||||
name: "TypeError",
|
||||
message: "Inputted function not a Chef operation."
|
||||
});
|
||||
assert.throws(
|
||||
() => chef.bake("https://google.com/search?q=help", () => {}),
|
||||
{
|
||||
name: "TypeError",
|
||||
message: "Inputted function not a Chef operation.",
|
||||
},
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: accepts an array of operation names and performs them all in order", () => {
|
||||
const result = chef.bake("https://google.com/search?q=that's a complicated question", ["URL encode", "URL decode", "Parse URI"]);
|
||||
assert.strictEqual(result.toString(), "Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = that's a complicated question\n");
|
||||
const result = chef.bake(
|
||||
"https://google.com/search?q=that's a complicated question",
|
||||
["URL encode", "URL decode", "Parse URI"],
|
||||
);
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = that's a complicated question\n",
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: forgiving with operation names", () =>{
|
||||
const result = chef.bake("https://google.com/search?q=that's a complicated question", ["urlencode", "url decode", "parseURI"]);
|
||||
assert.strictEqual(result.toString(), "Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = that's a complicated question\n");
|
||||
it("chef.bake: forgiving with operation names", () => {
|
||||
const result = chef.bake(
|
||||
"https://google.com/search?q=that's a complicated question",
|
||||
["urlencode", "url decode", "parseURI"],
|
||||
);
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = that's a complicated question\n",
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: forgiving with operation names", () =>{
|
||||
it("chef.bake: forgiving with operation names", () => {
|
||||
const result = chef.bake("hello", ["to base 64"]);
|
||||
assert.strictEqual(result.toString(), "aGVsbG8=");
|
||||
}),
|
||||
|
@ -224,18 +255,27 @@ TestRegister.addApiTests([
|
|||
it("chef.bake: if recipe is empty array, return input as dish", () => {
|
||||
const result = chef.bake("some input", []);
|
||||
assert.strictEqual(result.toString(), "some input");
|
||||
assert(result instanceof NodeDish, "Result is not instance of NodeDish");
|
||||
assert(
|
||||
result instanceof NodeDish,
|
||||
"Result is not instance of NodeDish",
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: accepts an array of operations as recipe", () => {
|
||||
const result = chef.bake("https://google.com/search?q=that's a complicated question", [chef.URLEncode, chef.URLDecode, chef.parseURI]);
|
||||
assert.strictEqual(result.toString(), "Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = that's a complicated question\n");
|
||||
const result = chef.bake(
|
||||
"https://google.com/search?q=that's a complicated question",
|
||||
[chef.URLEncode, chef.URLDecode, chef.parseURI],
|
||||
);
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = that's a complicated question\n",
|
||||
);
|
||||
}),
|
||||
|
||||
it("should complain if an invalid operation is inputted as part of array", () => {
|
||||
assert.throws(() => chef.bake("something", [() => {}]), {
|
||||
name: "TypeError",
|
||||
message: "Inputted function not a Chef operation."
|
||||
message: "Inputted function not a Chef operation.",
|
||||
});
|
||||
}),
|
||||
|
||||
|
@ -243,8 +283,8 @@ TestRegister.addApiTests([
|
|||
const result = chef.bake("some input", {
|
||||
op: chef.toHex,
|
||||
args: {
|
||||
Delimiter: "Colon"
|
||||
}
|
||||
Delimiter: "Colon",
|
||||
},
|
||||
});
|
||||
assert.strictEqual(result.toString(), "73:6f:6d:65:20:69:6e:70:75:74");
|
||||
}),
|
||||
|
@ -259,35 +299,42 @@ TestRegister.addApiTests([
|
|||
it("chef.bake: should take single JSON object describing op and args ARRAY", () => {
|
||||
const result = chef.bake("some input", {
|
||||
op: chef.toHex,
|
||||
args: ["Colon"]
|
||||
args: ["Colon"],
|
||||
});
|
||||
assert.strictEqual(result.toString(), "73:6f:6d:65:20:69:6e:70:75:74");
|
||||
}),
|
||||
|
||||
it("chef.bake: should error if op in JSON is not chef op", () => {
|
||||
assert.throws(() => chef.bake("some input", {
|
||||
op: () => {},
|
||||
args: ["Colon"],
|
||||
}), {
|
||||
name: "TypeError",
|
||||
message: "Inputted function not a Chef operation."
|
||||
});
|
||||
assert.throws(
|
||||
() =>
|
||||
chef.bake("some input", {
|
||||
op: () => {},
|
||||
args: ["Colon"],
|
||||
}),
|
||||
{
|
||||
name: "TypeError",
|
||||
message: "Inputted function not a Chef operation.",
|
||||
},
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: should take multiple ops in JSON object form, some ops by string", () => {
|
||||
const result = chef.bake("some input", [
|
||||
{
|
||||
op: chef.toHex,
|
||||
args: ["Colon"]
|
||||
args: ["Colon"],
|
||||
},
|
||||
{
|
||||
op: "to octal",
|
||||
args: {
|
||||
delimiter: "Semi-colon",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
]);
|
||||
assert.strictEqual(result.toString(), "67;63;72;66;146;72;66;144;72;66;65;72;62;60;72;66;71;72;66;145;72;67;60;72;67;65;72;67;64");
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"67;63;72;66;146;72;66;144;72;66;65;72;62;60;72;66;71;72;66;145;72;67;60;72;67;65;72;67;64",
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: should take multiple ops in JSON object form, some without args", () => {
|
||||
|
@ -299,10 +346,13 @@ TestRegister.addApiTests([
|
|||
op: "to octal",
|
||||
args: {
|
||||
delimiter: "Semi-colon",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
]);
|
||||
assert.strictEqual(result.toString(), "67;63;40;66;146;40;66;144;40;66;65;40;62;60;40;66;71;40;66;145;40;67;60;40;67;65;40;67;64");
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"67;63;40;66;146;40;66;144;40;66;65;40;62;60;40;66;71;40;66;145;40;67;60;40;67;65;40;67;64",
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: should handle op with multiple args", () => {
|
||||
|
@ -312,70 +362,92 @@ TestRegister.addApiTests([
|
|||
formatOptions: "Dash/Dot",
|
||||
wordDelimiter: "Comma",
|
||||
letterDelimiter: "Backslash",
|
||||
}
|
||||
},
|
||||
});
|
||||
assert.strictEqual(result.toString(), "DotDotDot\\DashDashDash\\DashDash\\Dot,DotDot\\DashDot\\DotDashDashDot\\DotDotDash\\Dash");
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"DotDotDot\\DashDashDash\\DashDash\\Dot,DotDot\\DashDot\\DotDashDashDot\\DotDotDash\\Dash",
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: should take compact JSON format from Chef Website as recipe", () => {
|
||||
const result = chef.bake("some input", [{"op": "To Morse Code", "args": ["Dash/Dot", "Backslash", "Comma"]}, {"op": "Hex to PEM", "args": ["SOMETHING"]}, {"op": "To Snake case", "args": [false]}]);
|
||||
assert.strictEqual(result.toString(), "begin_something_anananaaaaak_da_aaak_da_aaaaananaaaaaaan_da_aaaaaaanan_da_aaak_end_something");
|
||||
const result = chef.bake("some input", [
|
||||
{ op: "To Morse Code", args: ["Dash/Dot", "Backslash", "Comma"] },
|
||||
{ op: "Hex to PEM", args: ["SOMETHING"] },
|
||||
{ op: "To Snake case", args: [false] },
|
||||
]);
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"begin_something_anananaaaaak_da_aaak_da_aaaaananaaaaaaan_da_aaaaaaanan_da_aaak_end_something",
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: should accept Clean JSON format from Chef website as recipe", () => {
|
||||
const result = chef.bake("some input", [
|
||||
{ "op": "To Morse Code",
|
||||
"args": ["Dash/Dot", "Backslash", "Comma"] },
|
||||
{ "op": "Hex to PEM",
|
||||
"args": ["SOMETHING"] },
|
||||
{ "op": "To Snake case",
|
||||
"args": [false] }
|
||||
{ op: "To Morse Code", args: ["Dash/Dot", "Backslash", "Comma"] },
|
||||
{ op: "Hex to PEM", args: ["SOMETHING"] },
|
||||
{ op: "To Snake case", args: [false] },
|
||||
]);
|
||||
assert.strictEqual(result.toString(), "begin_something_anananaaaaak_da_aaak_da_aaaaananaaaaaaan_da_aaaaaaanan_da_aaak_end_something");
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"begin_something_anananaaaaak_da_aaak_da_aaaaananaaaaaaan_da_aaaaaaanan_da_aaak_end_something",
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: should accept Clean JSON format from Chef website - args optional", () => {
|
||||
const result = chef.bake("some input", [
|
||||
{ "op": "To Morse Code" },
|
||||
{ "op": "Hex to PEM",
|
||||
"args": ["SOMETHING"] },
|
||||
{ "op": "To Snake case",
|
||||
"args": [false] }
|
||||
{ op: "To Morse Code" },
|
||||
{ op: "Hex to PEM", args: ["SOMETHING"] },
|
||||
{ op: "To Snake case", args: [false] },
|
||||
]);
|
||||
assert.strictEqual(result.toString(), "begin_something_aaaaaaaaaaaaaa_end_something");
|
||||
assert.strictEqual(
|
||||
result.toString(),
|
||||
"begin_something_aaaaaaaaaaaaaa_end_something",
|
||||
);
|
||||
}),
|
||||
|
||||
it("chef.bake: cannot accept flowControl operations in recipe", () => {
|
||||
assert.throws(() => chef.bake("some input", "magic"), {
|
||||
name: "TypeError",
|
||||
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
|
||||
message:
|
||||
"flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API",
|
||||
});
|
||||
assert.throws(() => chef.bake("some input", magic), {
|
||||
name: "TypeError",
|
||||
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
|
||||
message:
|
||||
"flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API",
|
||||
});
|
||||
assert.throws(() => chef.bake("some input", ["to base 64", "magic"]), {
|
||||
name: "TypeError",
|
||||
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
|
||||
message:
|
||||
"flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API",
|
||||
});
|
||||
}),
|
||||
|
||||
it("Excluded operations: throw a sensible error when you try and call one", () => {
|
||||
assert.throws(chef.fork,
|
||||
assert.throws(
|
||||
chef.fork,
|
||||
(err) => {
|
||||
assert(err instanceof ExcludedOperationError);
|
||||
assert.deepEqual(err.message, "Sorry, the Fork operation is not available in the Node.js version of CyberChef.");
|
||||
assert.deepEqual(
|
||||
err.message,
|
||||
"Sorry, the Fork operation is not available in the Node.js version of CyberChef.",
|
||||
);
|
||||
return true;
|
||||
},
|
||||
"Unexpected error type"
|
||||
"Unexpected error type",
|
||||
);
|
||||
assert.throws(chef.javaScriptBeautify,
|
||||
assert.throws(
|
||||
chef.javaScriptBeautify,
|
||||
(err) => {
|
||||
assert(err instanceof ExcludedOperationError);
|
||||
assert.deepEqual(err.message, "Sorry, the JavaScriptBeautify operation is not available in the Node.js version of CyberChef.");
|
||||
assert.deepEqual(
|
||||
err.message,
|
||||
"Sorry, the JavaScriptBeautify operation is not available in the Node.js version of CyberChef.",
|
||||
);
|
||||
return true;
|
||||
},
|
||||
"Unexpected error type"
|
||||
"Unexpected error type",
|
||||
);
|
||||
}),
|
||||
|
||||
|
@ -389,7 +461,7 @@ TestRegister.addApiTests([
|
|||
verifyResult: {
|
||||
type: "boolean",
|
||||
value: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
}),
|
||||
|
||||
|
@ -401,13 +473,14 @@ TestRegister.addApiTests([
|
|||
assert.strictEqual(chef.bitShiftRight.args.amount.value, 1);
|
||||
assert.strictEqual(chef.bitShiftRight.args.type.type, "option");
|
||||
assert.ok(Array.isArray(chef.bitShiftRight.args.type.options));
|
||||
|
||||
}),
|
||||
|
||||
it("Operation arguments: should list all options excluding subheadings", () => {
|
||||
// First element (subheading) removed
|
||||
assert.equal(chef.convertDistance.args.inputUnits.options[0], "Nanometres (nm)");
|
||||
assert.equal(
|
||||
chef.convertDistance.args.inputUnits.options[0],
|
||||
"Nanometres (nm)",
|
||||
);
|
||||
assert.equal(chef.defangURL.args.process.options[1], "Only full URLs");
|
||||
}),
|
||||
|
||||
]);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -11,10 +11,7 @@
|
|||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import {
|
||||
setLongTestFailure,
|
||||
logTestReport,
|
||||
} from "../lib/utils.mjs";
|
||||
import { setLongTestFailure, logTestReport } from "../lib/utils.mjs";
|
||||
|
||||
import TestRegister from "../lib/TestRegister.mjs";
|
||||
import "./tests/AESKeyWrap.mjs";
|
||||
|
@ -148,14 +145,14 @@ const testStatus = {
|
|||
allTestsPassing: true,
|
||||
counts: {
|
||||
total: 0,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
setLongTestFailure();
|
||||
|
||||
const logOpsTestReport = logTestReport.bind(null, testStatus);
|
||||
|
||||
(async function() {
|
||||
(async function () {
|
||||
const results = await TestRegister.runTests();
|
||||
logOpsTestReport(results);
|
||||
})();
|
||||
|
|
|
@ -7,316 +7,400 @@ import TestRegister from "../../lib/TestRegister.mjs";
|
|||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
"name": "AES Key Wrap: RFC Test Vector, 128-bit data, 128-bit KEK",
|
||||
"input": "00112233445566778899aabbccddeeff",
|
||||
"expectedOutput": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Wrap: RFC Test Vector, 128-bit data, 128-bit KEK",
|
||||
input: "00112233445566778899aabbccddeeff",
|
||||
expectedOutput: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Wrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Wrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Wrap: RFC Test Vector, 128-bit data, 192-bit KEK",
|
||||
"input": "00112233445566778899aabbccddeeff",
|
||||
"expectedOutput": "96778b25ae6ca435f92b5b97c050aed2468ab8a17ad84e5d",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Wrap: RFC Test Vector, 128-bit data, 192-bit KEK",
|
||||
input: "00112233445566778899aabbccddeeff",
|
||||
expectedOutput: "96778b25ae6ca435f92b5b97c050aed2468ab8a17ad84e5d",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Wrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Wrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f1011121314151617",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Wrap: RFC Test Vector, 128-bit data, 256-bit KEK",
|
||||
"input": "00112233445566778899aabbccddeeff",
|
||||
"expectedOutput": "64e8c3f9ce0f5ba263e9777905818a2a93c8191e7d6e8ae7",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Wrap: RFC Test Vector, 128-bit data, 256-bit KEK",
|
||||
input: "00112233445566778899aabbccddeeff",
|
||||
expectedOutput: "64e8c3f9ce0f5ba263e9777905818a2a93c8191e7d6e8ae7",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Wrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Wrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Wrap: RFC Test Vector, 192-bit data, 192-bit KEK",
|
||||
"input": "00112233445566778899aabbccddeeff0001020304050607",
|
||||
"expectedOutput": "031d33264e15d33268f24ec260743edce1c6c7ddee725a936ba814915c6762d2",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Wrap: RFC Test Vector, 192-bit data, 192-bit KEK",
|
||||
input: "00112233445566778899aabbccddeeff0001020304050607",
|
||||
expectedOutput:
|
||||
"031d33264e15d33268f24ec260743edce1c6c7ddee725a936ba814915c6762d2",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Wrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Wrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f1011121314151617",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Wrap: RFC Test Vector, 192-bit data, 256-bit KEK",
|
||||
"input": "00112233445566778899aabbccddeeff0001020304050607",
|
||||
"expectedOutput": "a8f9bc1612c68b3ff6e6f4fbe30e71e4769c8b80a32cb8958cd5d17d6b254da1",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Wrap: RFC Test Vector, 192-bit data, 256-bit KEK",
|
||||
input: "00112233445566778899aabbccddeeff0001020304050607",
|
||||
expectedOutput:
|
||||
"a8f9bc1612c68b3ff6e6f4fbe30e71e4769c8b80a32cb8958cd5d17d6b254da1",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Wrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Wrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Wrap: RFC Test Vector, 256-bit data, 256-bit KEK",
|
||||
"input": "00112233445566778899aabbccddeeff000102030405060708090a0b0c0d0e0f",
|
||||
"expectedOutput": "28c9f404c4b810f4cbccb35cfb87f8263f5786e2d80ed326cbc7f0e71a99f43bfb988b9b7a02dd21",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Wrap: RFC Test Vector, 256-bit data, 256-bit KEK",
|
||||
input: "00112233445566778899aabbccddeeff000102030405060708090a0b0c0d0e0f",
|
||||
expectedOutput:
|
||||
"28c9f404c4b810f4cbccb35cfb87f8263f5786e2d80ed326cbc7f0e71a99f43bfb988b9b7a02dd21",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Wrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Wrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 128-bit KEK",
|
||||
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
||||
"expectedOutput": "00112233445566778899aabbccddeeff",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Unwrap: RFC Test Vector, 128-bit data, 128-bit KEK",
|
||||
input: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
||||
expectedOutput: "00112233445566778899aabbccddeeff",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Unwrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Unwrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 192-bit KEK",
|
||||
"input": "96778b25ae6ca435f92b5b97c050aed2468ab8a17ad84e5d",
|
||||
"expectedOutput": "00112233445566778899aabbccddeeff",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Unwrap: RFC Test Vector, 128-bit data, 192-bit KEK",
|
||||
input: "96778b25ae6ca435f92b5b97c050aed2468ab8a17ad84e5d",
|
||||
expectedOutput: "00112233445566778899aabbccddeeff",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Unwrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Unwrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f1011121314151617",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 256-bit KEK",
|
||||
"input": "64e8c3f9ce0f5ba263e9777905818a2a93c8191e7d6e8ae7",
|
||||
"expectedOutput": "00112233445566778899aabbccddeeff",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Unwrap: RFC Test Vector, 128-bit data, 256-bit KEK",
|
||||
input: "64e8c3f9ce0f5ba263e9777905818a2a93c8191e7d6e8ae7",
|
||||
expectedOutput: "00112233445566778899aabbccddeeff",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Unwrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Unwrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Unwrap: RFC Test Vector, 192-bit data, 192-bit KEK",
|
||||
"input": "031d33264e15d33268f24ec260743edce1c6c7ddee725a936ba814915c6762d2",
|
||||
"expectedOutput": "00112233445566778899aabbccddeeff0001020304050607",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Unwrap: RFC Test Vector, 192-bit data, 192-bit KEK",
|
||||
input: "031d33264e15d33268f24ec260743edce1c6c7ddee725a936ba814915c6762d2",
|
||||
expectedOutput: "00112233445566778899aabbccddeeff0001020304050607",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Unwrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Unwrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f1011121314151617",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Unwrap: RFC Test Vector, 192-bit data, 256-bit KEK",
|
||||
"input": "a8f9bc1612c68b3ff6e6f4fbe30e71e4769c8b80a32cb8958cd5d17d6b254da1",
|
||||
"expectedOutput": "00112233445566778899aabbccddeeff0001020304050607",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Unwrap: RFC Test Vector, 192-bit data, 256-bit KEK",
|
||||
input: "a8f9bc1612c68b3ff6e6f4fbe30e71e4769c8b80a32cb8958cd5d17d6b254da1",
|
||||
expectedOutput: "00112233445566778899aabbccddeeff0001020304050607",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Unwrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Unwrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Unwrap: RFC Test Vector, 256-bit data, 256-bit KEK",
|
||||
"input": "28c9f404c4b810f4cbccb35cfb87f8263f5786e2d80ed326cbc7f0e71a99f43bfb988b9b7a02dd21",
|
||||
"expectedOutput": "00112233445566778899aabbccddeeff000102030405060708090a0b0c0d0e0f",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Unwrap: RFC Test Vector, 256-bit data, 256-bit KEK",
|
||||
input: "28c9f404c4b810f4cbccb35cfb87f8263f5786e2d80ed326cbc7f0e71a99f43bfb988b9b7a02dd21",
|
||||
expectedOutput:
|
||||
"00112233445566778899aabbccddeeff000102030405060708090a0b0c0d0e0f",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Unwrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Unwrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Wrap: invalid KEK length",
|
||||
"input": "00112233445566778899aabbccddeeff",
|
||||
"expectedOutput": "KEK must be either 16, 24, or 32 bytes (currently 10 bytes)",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Wrap: invalid KEK length",
|
||||
input: "00112233445566778899aabbccddeeff",
|
||||
expectedOutput:
|
||||
"KEK must be either 16, 24, or 32 bytes (currently 10 bytes)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Wrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00010203040506070809"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Wrap",
|
||||
args: [
|
||||
{ option: "Hex", string: "00010203040506070809" },
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Wrap: invalid IV length",
|
||||
"input": "00112233445566778899aabbccddeeff",
|
||||
"expectedOutput": "IV must be 8 bytes (currently 6 bytes)",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Wrap: invalid IV length",
|
||||
input: "00112233445566778899aabbccddeeff",
|
||||
expectedOutput: "IV must be 8 bytes (currently 6 bytes)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Wrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Wrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Wrap: input length not multiple of 8",
|
||||
"input": "00112233445566778899aabbccddeeff0102",
|
||||
"expectedOutput": "input must be 8n (n>=2) bytes (currently 18 bytes)",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Wrap: input length not multiple of 8",
|
||||
input: "00112233445566778899aabbccddeeff0102",
|
||||
expectedOutput: "input must be 8n (n>=2) bytes (currently 18 bytes)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Wrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Wrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Wrap: input too short",
|
||||
"input": "0011223344556677",
|
||||
"expectedOutput": "input must be 8n (n>=2) bytes (currently 8 bytes)",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Wrap: input too short",
|
||||
input: "0011223344556677",
|
||||
expectedOutput: "input must be 8n (n>=2) bytes (currently 8 bytes)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Wrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Wrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Unwrap: invalid KEK length",
|
||||
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
||||
"expectedOutput": "KEK must be either 16, 24, or 32 bytes (currently 10 bytes)",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Unwrap: invalid KEK length",
|
||||
input: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
||||
expectedOutput:
|
||||
"KEK must be either 16, 24, or 32 bytes (currently 10 bytes)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Unwrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00010203040506070809"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Unwrap",
|
||||
args: [
|
||||
{ option: "Hex", string: "00010203040506070809" },
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Unwrap: invalid IV length",
|
||||
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
||||
"expectedOutput": "IV must be 8 bytes (currently 6 bytes)",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Unwrap: invalid IV length",
|
||||
input: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
||||
expectedOutput: "IV must be 8 bytes (currently 6 bytes)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Unwrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Unwrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Unwrap: input length not multiple of 8",
|
||||
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5e621",
|
||||
"expectedOutput": "input must be 8n (n>=3) bytes (currently 26 bytes)",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Unwrap: input length not multiple of 8",
|
||||
input: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5e621",
|
||||
expectedOutput: "input must be 8n (n>=3) bytes (currently 26 bytes)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Unwrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Unwrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Unwrap: input too short",
|
||||
"input": "1fa68b0a8112b447aef34bd8fb5a7b82",
|
||||
"expectedOutput": "input must be 8n (n>=3) bytes (currently 16 bytes)",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Unwrap: input too short",
|
||||
input: "1fa68b0a8112b447aef34bd8fb5a7b82",
|
||||
expectedOutput: "input must be 8n (n>=3) bytes (currently 16 bytes)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Unwrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Unwrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "AES Key Unwrap: corrupted input",
|
||||
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe6",
|
||||
"expectedOutput": "IV mismatch",
|
||||
"recipeConfig": [
|
||||
name: "AES Key Unwrap: corrupted input",
|
||||
input: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe6",
|
||||
expectedOutput: "IV mismatch",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "AES Key Unwrap",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
||||
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
||||
"Hex", "Hex"
|
||||
op: "AES Key Unwrap",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "000102030405060708090a0b0c0d0e0f",
|
||||
},
|
||||
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -16,8 +16,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Avro to JSON",
|
||||
args: [true]
|
||||
}
|
||||
args: [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -27,40 +27,42 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Avro to JSON",
|
||||
args: [false]
|
||||
}
|
||||
args: [false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Avro to JSON: small (force JSON true)",
|
||||
input: "\x4f\x62\x6a\x01\x04\x16\x61\x76\x72\x6f\x2e\x73\x63\x68\x65\x6d\x61\x96\x01\x7b\x22\x74\x79\x70\x65\x22\x3a\x22\x72\x65" +
|
||||
input:
|
||||
"\x4f\x62\x6a\x01\x04\x16\x61\x76\x72\x6f\x2e\x73\x63\x68\x65\x6d\x61\x96\x01\x7b\x22\x74\x79\x70\x65\x22\x3a\x22\x72\x65" +
|
||||
"\x63\x6f\x72\x64\x22\x2c\x22\x6e\x61\x6d\x65\x22\x3a\x22\x73\x6d\x61\x6c\x6c\x22\x2c\x22\x66\x69\x65\x6c\x64\x73\x22\x3a" +
|
||||
"\x5b\x7b\x22\x6e\x61\x6d\x65\x22\x3a\x22\x6e\x61\x6d\x65\x22\x2c\x22\x74\x79\x70\x65\x22\x3a\x22\x73\x74\x72\x69\x6e\x67" +
|
||||
"\x22\x7d\x5d\x7d\x14\x61\x76\x72\x6f\x2e\x63\x6f\x64\x65\x63\x08\x6e\x75\x6c\x6c\x00\x4e\x02\x47\x63\x2e\x37\x02\xe5\xb7" +
|
||||
"\x5c\xda\xb9\xa6\x2f\x15\x41\x02\x0e\x0c\x6d\x79\x6e\x61\x6d\x65\x4e\x02\x47\x63\x2e\x37\x02\xe5\xb7\x5c\xda\xb9\xa6\x2f" +
|
||||
"\x15\x41",
|
||||
expectedOutput: "{\n \"name\": \"myname\"\n}",
|
||||
expectedOutput: '{\n "name": "myname"\n}',
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Avro to JSON",
|
||||
args: [true]
|
||||
}
|
||||
args: [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Avro to JSON: small (force JSON false)",
|
||||
input: "\x4f\x62\x6a\x01\x04\x16\x61\x76\x72\x6f\x2e\x73\x63\x68\x65\x6d\x61\x96\x01\x7b\x22\x74\x79\x70\x65\x22\x3a\x22\x72\x65" +
|
||||
input:
|
||||
"\x4f\x62\x6a\x01\x04\x16\x61\x76\x72\x6f\x2e\x73\x63\x68\x65\x6d\x61\x96\x01\x7b\x22\x74\x79\x70\x65\x22\x3a\x22\x72\x65" +
|
||||
"\x63\x6f\x72\x64\x22\x2c\x22\x6e\x61\x6d\x65\x22\x3a\x22\x73\x6d\x61\x6c\x6c\x22\x2c\x22\x66\x69\x65\x6c\x64\x73\x22\x3a" +
|
||||
"\x5b\x7b\x22\x6e\x61\x6d\x65\x22\x3a\x22\x6e\x61\x6d\x65\x22\x2c\x22\x74\x79\x70\x65\x22\x3a\x22\x73\x74\x72\x69\x6e\x67" +
|
||||
"\x22\x7d\x5d\x7d\x14\x61\x76\x72\x6f\x2e\x63\x6f\x64\x65\x63\x08\x6e\x75\x6c\x6c\x00\x4e\x02\x47\x63\x2e\x37\x02\xe5\xb7" +
|
||||
"\x5c\xda\xb9\xa6\x2f\x15\x41\x02\x0e\x0c\x6d\x79\x6e\x61\x6d\x65\x4e\x02\x47\x63\x2e\x37\x02\xe5\xb7\x5c\xda\xb9\xa6\x2f" +
|
||||
"\x15\x41",
|
||||
expectedOutput: "{\"name\":\"myname\"}\n",
|
||||
expectedOutput: '{"name":"myname"}\n',
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Avro to JSON",
|
||||
args: [false]
|
||||
}
|
||||
args: [false],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -14,21 +14,22 @@ TestRegister.addTests([
|
|||
expectedOutput: "0000",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To BCD",
|
||||
"args": ["8 4 2 1", true, false, "Nibbles"]
|
||||
}
|
||||
]
|
||||
op: "To BCD",
|
||||
args: ["8 4 2 1", true, false, "Nibbles"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To BCD: unpacked nibbles",
|
||||
input: "1234567890",
|
||||
expectedOutput: "0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 0111 0000 1000 0000 1001 0000 0000",
|
||||
expectedOutput:
|
||||
"0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 0111 0000 1000 0000 1001 0000 0000",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To BCD",
|
||||
"args": ["8 4 2 1", false, false, "Nibbles"]
|
||||
}
|
||||
]
|
||||
op: "To BCD",
|
||||
args: ["8 4 2 1", false, false, "Nibbles"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To BCD: packed, signed bytes",
|
||||
|
@ -36,21 +37,22 @@ TestRegister.addTests([
|
|||
expectedOutput: "00000001 00100011 01000101 01100111 10001001 00001100",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To BCD",
|
||||
"args": ["8 4 2 1", true, true, "Bytes"]
|
||||
}
|
||||
]
|
||||
op: "To BCD",
|
||||
args: ["8 4 2 1", true, true, "Bytes"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To BCD: packed, signed nibbles, 8 4 -2 -1",
|
||||
input: "-1234567890",
|
||||
expectedOutput: "0000 0111 0110 0101 0100 1011 1010 1001 1000 1111 0000 1101",
|
||||
expectedOutput:
|
||||
"0000 0111 0110 0101 0100 1011 1010 1001 1000 1111 0000 1101",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To BCD",
|
||||
"args": ["8 4 -2 -1", true, true, "Nibbles"]
|
||||
}
|
||||
]
|
||||
op: "To BCD",
|
||||
args: ["8 4 -2 -1", true, true, "Nibbles"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From BCD: default 0",
|
||||
|
@ -58,10 +60,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "0",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From BCD",
|
||||
"args": ["8 4 2 1", true, false, "Nibbles"]
|
||||
}
|
||||
]
|
||||
op: "From BCD",
|
||||
args: ["8 4 2 1", true, false, "Nibbles"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From BCD: packed, signed bytes",
|
||||
|
@ -69,10 +71,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "-1234567890",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From BCD",
|
||||
"args": ["8 4 2 1", true, true, "Bytes"]
|
||||
}
|
||||
]
|
||||
op: "From BCD",
|
||||
args: ["8 4 2 1", true, true, "Bytes"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From BCD: Excess-3, unpacked, unsigned",
|
||||
|
@ -80,10 +82,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "1234567890",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From BCD",
|
||||
"args": ["Excess-3", false, false, "Nibbles"]
|
||||
}
|
||||
]
|
||||
op: "From BCD",
|
||||
args: ["Excess-3", false, false, "Nibbles"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "BCD: raw 4 2 2 1, packed, signed",
|
||||
|
@ -91,13 +93,13 @@ TestRegister.addTests([
|
|||
expectedOutput: "1234567890",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To BCD",
|
||||
"args": ["4 2 2 1", true, true, "Raw"]
|
||||
op: "To BCD",
|
||||
args: ["4 2 2 1", true, true, "Raw"],
|
||||
},
|
||||
{
|
||||
"op": "From BCD",
|
||||
"args": ["4 2 2 1", true, true, "Raw"]
|
||||
}
|
||||
]
|
||||
op: "From BCD",
|
||||
args: ["4 2 2 1", true, true, "Raw"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -11,46 +11,63 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "BLAKE2b: 512 - Hello World",
|
||||
input: "Hello World",
|
||||
expectedOutput: "4386a08a265111c9896f56456e2cb61a64239115c4784cf438e36cc851221972da3fb0115f73cd02486254001f878ab1fd126aac69844ef1c1ca152379d0a9bd",
|
||||
expectedOutput:
|
||||
"4386a08a265111c9896f56456e2cb61a64239115c4784cf438e36cc851221972da3fb0115f73cd02486254001f878ab1fd126aac69844ef1c1ca152379d0a9bd",
|
||||
recipeConfig: [
|
||||
{ "op": "BLAKE2b",
|
||||
"args": ["512", "Hex", {string: "", option: "UTF8"}] }
|
||||
]
|
||||
{
|
||||
op: "BLAKE2b",
|
||||
args: ["512", "Hex", { string: "", option: "UTF8" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "BLAKE2b: 384 - Hello World",
|
||||
input: "Hello World",
|
||||
expectedOutput: "4d388e82ca8f866e606b6f6f0be910abd62ad6e98c0adfc27cf35acf948986d5c5b9c18b6f47261e1e679eb98edf8e2d",
|
||||
expectedOutput:
|
||||
"4d388e82ca8f866e606b6f6f0be910abd62ad6e98c0adfc27cf35acf948986d5c5b9c18b6f47261e1e679eb98edf8e2d",
|
||||
recipeConfig: [
|
||||
{ "op": "BLAKE2b",
|
||||
"args": ["384", "Hex", {string: "", option: "UTF8"}] }
|
||||
]
|
||||
{
|
||||
op: "BLAKE2b",
|
||||
args: ["384", "Hex", { string: "", option: "UTF8" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "BLAKE2b: 256 - Hello World",
|
||||
input: "Hello World",
|
||||
expectedOutput: "1dc01772ee0171f5f614c673e3c7fa1107a8cf727bdf5a6dadb379e93c0d1d00",
|
||||
expectedOutput:
|
||||
"1dc01772ee0171f5f614c673e3c7fa1107a8cf727bdf5a6dadb379e93c0d1d00",
|
||||
recipeConfig: [
|
||||
{ "op": "BLAKE2b",
|
||||
"args": ["256", "Hex", {string: "", option: "UTF8"}] }
|
||||
]
|
||||
{
|
||||
op: "BLAKE2b",
|
||||
args: ["256", "Hex", { string: "", option: "UTF8" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "BLAKE2b: 160 - Hello World",
|
||||
input: "Hello World",
|
||||
expectedOutput: "6a8489e6fd6e51fae12ab271ec7fc8134dd5d737",
|
||||
recipeConfig: [
|
||||
{ "op": "BLAKE2b",
|
||||
"args": ["160", "Hex", {string: "", option: "UTF8"}] }
|
||||
]
|
||||
{
|
||||
op: "BLAKE2b",
|
||||
args: ["160", "Hex", { string: "", option: "UTF8" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "BLAKE2b: Key Test",
|
||||
input: "message data",
|
||||
expectedOutput: "3d363ff7401e02026f4a4687d4863ced",
|
||||
recipeConfig: [
|
||||
{ "op": "BLAKE2b",
|
||||
"args": ["128", "Hex", {string: "pseudorandom key", option: "UTF8"}] }
|
||||
]
|
||||
}
|
||||
{
|
||||
op: "BLAKE2b",
|
||||
args: [
|
||||
"128",
|
||||
"Hex",
|
||||
{ string: "pseudorandom key", option: "UTF8" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -11,37 +11,46 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "BLAKE2s: 256 - Hello World",
|
||||
input: "Hello World",
|
||||
expectedOutput: "7706af019148849e516f95ba630307a2018bb7bf03803eca5ed7ed2c3c013513",
|
||||
expectedOutput:
|
||||
"7706af019148849e516f95ba630307a2018bb7bf03803eca5ed7ed2c3c013513",
|
||||
recipeConfig: [
|
||||
{ "op": "BLAKE2s",
|
||||
"args": ["256", "Hex", {string: "", option: "UTF8"}] }
|
||||
]
|
||||
{
|
||||
op: "BLAKE2s",
|
||||
args: ["256", "Hex", { string: "", option: "UTF8" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "BLAKE2s: 160 - Hello World",
|
||||
input: "Hello World",
|
||||
expectedOutput: "0e4fcfc2ee0097ac1d72d70b595a39e09a3c7c7e",
|
||||
recipeConfig: [
|
||||
{ "op": "BLAKE2s",
|
||||
"args": ["160", "Hex", {string: "", option: "UTF8"}] }
|
||||
]
|
||||
{
|
||||
op: "BLAKE2s",
|
||||
args: ["160", "Hex", { string: "", option: "UTF8" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "BLAKE2s: 128 - Hello World",
|
||||
input: "Hello World",
|
||||
expectedOutput: "9964ee6f36126626bf864363edfa96f6",
|
||||
recipeConfig: [
|
||||
{ "op": "BLAKE2s",
|
||||
"args": ["128", "Hex", {string: "", option: "UTF8"}] }
|
||||
]
|
||||
{
|
||||
op: "BLAKE2s",
|
||||
args: ["128", "Hex", { string: "", option: "UTF8" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "BLAKE2s: Key Test",
|
||||
input: "Hello World",
|
||||
expectedOutput: "9964ee6f36126626bf864363edfa96f6",
|
||||
recipeConfig: [
|
||||
{ "op": "BLAKE2s",
|
||||
"args": ["128", "Hex", {string: "", option: "UTF8"}] }
|
||||
]
|
||||
}
|
||||
{
|
||||
op: "BLAKE2s",
|
||||
args: ["128", "Hex", { string: "", option: "UTF8" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -22,8 +22,9 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
name: "BSON serialise: basic",
|
||||
input: "{\"hello\":\"world\"}",
|
||||
expectedOutput: "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00",
|
||||
input: '{"hello":"world"}',
|
||||
expectedOutput:
|
||||
"\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "BSON serialise",
|
||||
|
@ -45,7 +46,7 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "BSON deserialise: basic",
|
||||
input: "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00",
|
||||
expectedOutput: "{\n \"hello\": \"world\"\n}",
|
||||
expectedOutput: '{\n "hello": "world"\n}',
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "BSON deserialise",
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
import { BACON_ALPHABETS, BACON_TRANSLATIONS } from "../../../src/core/lib/Bacon.mjs";
|
||||
import {
|
||||
BACON_ALPHABETS,
|
||||
BACON_TRANSLATIONS,
|
||||
} from "../../../src/core/lib/Bacon.mjs";
|
||||
|
||||
const alphabets = Object.keys(BACON_ALPHABETS);
|
||||
const translations = BACON_TRANSLATIONS;
|
||||
|
@ -19,8 +22,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[0], translations[0], false]
|
||||
}
|
||||
args: [alphabets[0], translations[0], false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -30,8 +33,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[0], translations[0], false]
|
||||
}
|
||||
args: [alphabets[0], translations[0], false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -41,8 +44,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[0], translations[0], true]
|
||||
}
|
||||
args: [alphabets[0], translations[0], true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -52,8 +55,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[0], translations[1], false]
|
||||
}
|
||||
args: [alphabets[0], translations[1], false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -63,8 +66,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[0], translations[1], true]
|
||||
}
|
||||
args: [alphabets[0], translations[1], true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -74,8 +77,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[0], translations[1], false]
|
||||
}
|
||||
args: [alphabets[0], translations[1], false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -85,8 +88,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[0], translations[1], true]
|
||||
}
|
||||
args: [alphabets[0], translations[1], true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -96,8 +99,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[0], translations[2], false]
|
||||
}
|
||||
args: [alphabets[0], translations[2], false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -107,8 +110,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[0], translations[2], true]
|
||||
}
|
||||
args: [alphabets[0], translations[2], true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -118,8 +121,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[0], translations[3], false]
|
||||
}
|
||||
args: [alphabets[0], translations[3], false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -129,8 +132,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[0], translations[3], true]
|
||||
}
|
||||
args: [alphabets[0], translations[3], true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -140,8 +143,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[1], translations[0], false]
|
||||
}
|
||||
args: [alphabets[1], translations[0], false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -151,8 +154,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[1], translations[0], true]
|
||||
}
|
||||
args: [alphabets[1], translations[0], true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -162,8 +165,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[1], translations[1], false]
|
||||
}
|
||||
args: [alphabets[1], translations[1], false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -173,8 +176,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[1], translations[1], true]
|
||||
}
|
||||
args: [alphabets[1], translations[1], true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -184,8 +187,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[1], translations[1], false]
|
||||
}
|
||||
args: [alphabets[1], translations[1], false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -195,8 +198,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[1], translations[1], true]
|
||||
}
|
||||
args: [alphabets[1], translations[1], true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -206,8 +209,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[1], translations[2], false]
|
||||
}
|
||||
args: [alphabets[1], translations[2], false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -217,8 +220,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[1], translations[2], true]
|
||||
}
|
||||
args: [alphabets[1], translations[2], true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -228,8 +231,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[1], translations[3], false]
|
||||
}
|
||||
args: [alphabets[1], translations[3], false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -239,8 +242,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Decode",
|
||||
args: [alphabets[1], translations[3], true]
|
||||
}
|
||||
args: [alphabets[1], translations[3], true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -250,184 +253,200 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[0], translations[0], false, false]
|
||||
}
|
||||
args: [alphabets[0], translations[0], false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: reduced alphabet 0/1",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "10010 00111 00100 10000 00100 10001 00000 00101 01101 10101 00000 01100 00011 01000 10010 01000 10011 01011 01110 10001 01101 10011 00100 10000 10010 00111 00100 00101 00100 01100 00010 00100",
|
||||
expectedOutput:
|
||||
"10010 00111 00100 10000 00100 10001 00000 00101 01101 10101 00000 01100 00011 01000 10010 01000 10011 01011 01110 10001 01101 10011 00100 10000 10010 00111 00100 00101 00100 01100 00010 00100",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[0], translations[0], false, false]
|
||||
}
|
||||
args: [alphabets[0], translations[0], false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: reduced alphabet 0/1 inverse",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "01101 11000 11011 01111 11011 01110 11111 11010 10010 01010 11111 10011 11100 10111 01101 10111 01100 10100 10001 01110 10010 01100 11011 01111 01101 11000 11011 11010 11011 10011 11101 11011",
|
||||
expectedOutput:
|
||||
"01101 11000 11011 01111 11011 01110 11111 11010 10010 01010 11111 10011 11100 10111 01101 10111 01100 10100 10001 01110 10010 01100 11011 01111 01101 11000 11011 11010 11011 10011 11101 11011",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[0], translations[0], false, true]
|
||||
}
|
||||
args: [alphabets[0], translations[0], false, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: reduced alphabet 0/1, keeping extra characters",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "1001000111001001000000100'10001 00000 001010110110101, 000000110000011 0100010010 0100010011010110111010001 01101100110010010000 100100011100100 0010100100011000001000100.",
|
||||
expectedOutput:
|
||||
"1001000111001001000000100'10001 00000 001010110110101, 000000110000011 0100010010 0100010011010110111010001 01101100110010010000 100100011100100 0010100100011000001000100.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[0], translations[0], true, false]
|
||||
}
|
||||
args: [alphabets[0], translations[0], true, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: reduced alphabet 0/1 inverse, keeping extra characters",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "0110111000110110111111011'01110 11111 110101001001010, 111111001111100 1011101101 1011101100101001000101110 10010011001101101111 011011100011011 1101011011100111110111011.",
|
||||
expectedOutput:
|
||||
"0110111000110110111111011'01110 11111 110101001001010, 111111001111100 1011101101 1011101100101001000101110 10010011001101101111 011011100011011 1101011011100111110111011.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[0], translations[0], true, true]
|
||||
}
|
||||
args: [alphabets[0], translations[0], true, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: reduced alphabet A/B",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "BAABA AABBB AABAA BAAAA AABAA BAAAB AAAAA AABAB ABBAB BABAB AAAAA ABBAA AAABB ABAAA BAABA ABAAA BAABB ABABB ABBBA BAAAB ABBAB BAABB AABAA BAAAA BAABA AABBB AABAA AABAB AABAA ABBAA AAABA AABAA",
|
||||
expectedOutput:
|
||||
"BAABA AABBB AABAA BAAAA AABAA BAAAB AAAAA AABAB ABBAB BABAB AAAAA ABBAA AAABB ABAAA BAABA ABAAA BAABB ABABB ABBBA BAAAB ABBAB BAABB AABAA BAAAA BAABA AABBB AABAA AABAB AABAA ABBAA AAABA AABAA",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[0], translations[1], false, false]
|
||||
}
|
||||
args: [alphabets[0], translations[1], false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: reduced alphabet A/B inverse",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "ABBAB BBAAA BBABB ABBBB BBABB ABBBA BBBBB BBABA BAABA ABABA BBBBB BAABB BBBAA BABBB ABBAB BABBB ABBAA BABAA BAAAB ABBBA BAABA ABBAA BBABB ABBBB ABBAB BBAAA BBABB BBABA BBABB BAABB BBBAB BBABB",
|
||||
expectedOutput:
|
||||
"ABBAB BBAAA BBABB ABBBB BBABB ABBBA BBBBB BBABA BAABA ABABA BBBBB BAABB BBBAA BABBB ABBAB BABBB ABBAA BABAA BAAAB ABBBA BAABA ABBAA BBABB ABBBB ABBAB BBAAA BBABB BBABA BBABB BAABB BBBAB BBABB",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[0], translations[1], false, true]
|
||||
}
|
||||
args: [alphabets[0], translations[1], false, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: reduced alphabet A/B, keeping extra characters",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "BAABAAABBBAABAABAAAAAABAA'BAAAB AAAAA AABABABBABBABAB, AAAAAABBAAAAABB ABAAABAABA ABAAABAABBABABBABBBABAAAB ABBABBAABBAABAABAAAA BAABAAABBBAABAA AABABAABAAABBAAAAABAAABAA.",
|
||||
expectedOutput:
|
||||
"BAABAAABBBAABAABAAAAAABAA'BAAAB AAAAA AABABABBABBABAB, AAAAAABBAAAAABB ABAAABAABA ABAAABAABBABABBABBBABAAAB ABBABBAABBAABAABAAAA BAABAAABBBAABAA AABABAABAAABBAAAAABAAABAA.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[0], translations[1], true, false]
|
||||
}
|
||||
args: [alphabets[0], translations[1], true, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: reduced alphabet A/B inverse, keeping extra characters",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "ABBABBBAAABBABBABBBBBBABB'ABBBA BBBBB BBABABAABAABABA, BBBBBBAABBBBBAA BABBBABBAB BABBBABBAABABAABAAABABBBA BAABAABBAABBABBABBBB ABBABBBAAABBABB BBABABBABBBAABBBBBABBBABB.",
|
||||
expectedOutput:
|
||||
"ABBABBBAAABBABBABBBBBBABB'ABBBA BBBBB BBABABAABAABABA, BBBBBBAABBBBBAA BABBBABBAB BABBBABBAABABAABAAABABBBA BAABAABBAABBABBABBBB ABBABBBAAABBABB BBABABBABBBAABBBBBABBBABB.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[0], translations[1], true, true]
|
||||
}
|
||||
args: [alphabets[0], translations[1], true, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: complete alphabet 0/1",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "10011 00111 00100 10001 00100 10010 00000 00101 01110 10111 00000 01101 00011 01000 10011 01001 10100 01100 01111 10010 01110 10101 00100 10001 10011 00111 00100 00101 00100 01101 00010 00100",
|
||||
expectedOutput:
|
||||
"10011 00111 00100 10001 00100 10010 00000 00101 01110 10111 00000 01101 00011 01000 10011 01001 10100 01100 01111 10010 01110 10101 00100 10001 10011 00111 00100 00101 00100 01101 00010 00100",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[1], translations[0], false, false]
|
||||
}
|
||||
args: [alphabets[1], translations[0], false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: complete alphabet 0/1 inverse",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "01100 11000 11011 01110 11011 01101 11111 11010 10001 01000 11111 10010 11100 10111 01100 10110 01011 10011 10000 01101 10001 01010 11011 01110 01100 11000 11011 11010 11011 10010 11101 11011",
|
||||
expectedOutput:
|
||||
"01100 11000 11011 01110 11011 01101 11111 11010 10001 01000 11111 10010 11100 10111 01100 10110 01011 10011 10000 01101 10001 01010 11011 01110 01100 11000 11011 11010 11011 10010 11101 11011",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[1], translations[0], false, true]
|
||||
}
|
||||
args: [alphabets[1], translations[0], false, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: complete alphabet 0/1, keeping extra characters",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "1001100111001001000100100'10010 00000 001010111010111, 000000110100011 0100010011 0100110100011000111110010 01110101010010010001 100110011100100 0010100100011010001000100.",
|
||||
expectedOutput:
|
||||
"1001100111001001000100100'10010 00000 001010111010111, 000000110100011 0100010011 0100110100011000111110010 01110101010010010001 100110011100100 0010100100011010001000100.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[1], translations[0], true, false]
|
||||
}
|
||||
args: [alphabets[1], translations[0], true, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: complete alphabet 0/1 inverse, keeping extra characters",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "0110011000110110111011011'01101 11111 110101000101000, 111111001011100 1011101100 1011001011100111000001101 10001010101101101110 011001100011011 1101011011100101110111011.",
|
||||
expectedOutput:
|
||||
"0110011000110110111011011'01101 11111 110101000101000, 111111001011100 1011101100 1011001011100111000001101 10001010101101101110 011001100011011 1101011011100101110111011.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[1], translations[0], true, true]
|
||||
}
|
||||
args: [alphabets[1], translations[0], true, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: complete alphabet A/B",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "BAABB AABBB AABAA BAAAB AABAA BAABA AAAAA AABAB ABBBA BABBB AAAAA ABBAB AAABB ABAAA BAABB ABAAB BABAA ABBAA ABBBB BAABA ABBBA BABAB AABAA BAAAB BAABB AABBB AABAA AABAB AABAA ABBAB AAABA AABAA",
|
||||
expectedOutput:
|
||||
"BAABB AABBB AABAA BAAAB AABAA BAABA AAAAA AABAB ABBBA BABBB AAAAA ABBAB AAABB ABAAA BAABB ABAAB BABAA ABBAA ABBBB BAABA ABBBA BABAB AABAA BAAAB BAABB AABBB AABAA AABAB AABAA ABBAB AAABA AABAA",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[1], translations[1], false, false]
|
||||
}
|
||||
args: [alphabets[1], translations[1], false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: complete alphabet A/B inverse",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "ABBAA BBAAA BBABB ABBBA BBABB ABBAB BBBBB BBABA BAAAB ABAAA BBBBB BAABA BBBAA BABBB ABBAA BABBA ABABB BAABB BAAAA ABBAB BAAAB ABABA BBABB ABBBA ABBAA BBAAA BBABB BBABA BBABB BAABA BBBAB BBABB",
|
||||
expectedOutput:
|
||||
"ABBAA BBAAA BBABB ABBBA BBABB ABBAB BBBBB BBABA BAAAB ABAAA BBBBB BAABA BBBAA BABBB ABBAA BABBA ABABB BAABB BAAAA ABBAB BAAAB ABABA BBABB ABBBA ABBAA BBAAA BBABB BBABA BBABB BAABA BBBAB BBABB",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[1], translations[1], false, true]
|
||||
}
|
||||
args: [alphabets[1], translations[1], false, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: complete alphabet A/B, keeping extra characters",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "BAABBAABBBAABAABAAABAABAA'BAABA AAAAA AABABABBBABABBB, AAAAAABBABAAABB ABAAABAABB ABAABBABAAABBAAABBBBBAABA ABBBABABABAABAABAAAB BAABBAABBBAABAA AABABAABAAABBABAAABAAABAA.",
|
||||
expectedOutput:
|
||||
"BAABBAABBBAABAABAAABAABAA'BAABA AAAAA AABABABBBABABBB, AAAAAABBABAAABB ABAAABAABB ABAABBABAAABBAAABBBBBAABA ABBBABABABAABAABAAAB BAABBAABBBAABAA AABABAABAAABBABAAABAAABAA.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[1], translations[1], true, false]
|
||||
}
|
||||
args: [alphabets[1], translations[1], true, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bacon Encode: complete alphabet A/B inverse, keeping extra characters",
|
||||
input: "There's a fox, and it jumps over the fence.",
|
||||
expectedOutput: "ABBAABBAAABBABBABBBABBABB'ABBAB BBBBB BBABABAAABABAAA, BBBBBBAABABBBAA BABBBABBAA BABBAABABBBAABBBAAAAABBAB BAAABABABABBABBABBBA ABBAABBAAABBABB BBABABBABBBAABABBBABBBABB.",
|
||||
expectedOutput:
|
||||
"ABBAABBAAABBABBABBBABBABB'ABBAB BBBBB BBABABAAABABAAA, BBBBBBAABABBBAA BABBBABBAA BABBAABABBBAABBBAAAAABBAB BAAABABABABBABBABBBA ABBAABBAAABBABB BBABABBABBBAABABBBABBBABB.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bacon Cipher Encode",
|
||||
args: [alphabets[1], translations[1], true, true]
|
||||
}
|
||||
args: [alphabets[1], translations[1], true, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -16,7 +16,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Base58",
|
||||
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
||||
args: [
|
||||
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -27,7 +29,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Base58",
|
||||
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
|
||||
args: [
|
||||
"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -38,7 +42,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Base58",
|
||||
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
||||
args: [
|
||||
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -49,7 +55,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Base58",
|
||||
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
|
||||
args: [
|
||||
"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -60,7 +68,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Base58",
|
||||
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
||||
args: [
|
||||
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -71,7 +81,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Base58",
|
||||
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
||||
args: [
|
||||
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -82,7 +94,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Base58",
|
||||
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
||||
args: [
|
||||
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -93,7 +107,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Base58",
|
||||
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
|
||||
args: [
|
||||
"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -75,5 +75,5 @@ TestRegister.addTests([
|
|||
args: ["0-9A-Za-z"],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -64,7 +64,8 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "To Base64: All bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==",
|
||||
expectedOutput:
|
||||
"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Base64",
|
||||
|
|
|
@ -8,63 +8,52 @@
|
|||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
// Example from Wikipedia
|
||||
const wpExample = "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.";
|
||||
const wpExample =
|
||||
"Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.";
|
||||
// Escape newline, quote & backslash
|
||||
const wpOutput = "9jqo^BlbD-BleB1DJ+*+F(f,q/0JhKF<GL>Cj@.4Gp$d7F!,L7@<6@)/0JDEF<G%<+EV:2F!,O<\
|
||||
const wpOutput =
|
||||
"9jqo^BlbD-BleB1DJ+*+F(f,q/0JhKF<GL>Cj@.4Gp$d7F!,L7@<6@)/0JDEF<G%<+EV:2F!,O<\
|
||||
DJ+*.@<*K0@<6L(Df-\\0Ec5e;DffZ(EZee.Bl.9pF\"AGXBPCsi+DGm>@3BB/F*&OCAfu2/AKYi(\
|
||||
DIb:@FD,*)+C]U=@3BN#EcYf8ATD3s@q?d$AftVqCh[NqF<G:8+EV:.+Cf>-FD5W8ARlolDIal(\
|
||||
DId<j@<?3r@:F%a+D58'ATD4$Bl@l3De:,-DJs`8ARoFb/0JMK@qB4^F!,R<AKZ&-DfTqBG%G>u\
|
||||
D.RTpAKYo'+CT/5+Cei#DII?(E,9)oF*2M7/c";
|
||||
|
||||
const allZeroExample = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff";
|
||||
const allZeroExample =
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff";
|
||||
|
||||
const allZeroOutput = "zz!!*-'\"9eu7#RLhG$k3[W&.oNg'GVB\"(`=52*$$(B+<_pR,UFcb-n-Vr/1iJ-0JP==1c70M3&s#]4?Ykm5X@_(6q'R884cEH9MJ8X:f1+h<)lt#=BSg3>[:ZC?t!MSA7]@cBPD3sCi+'.E,fo>FEMbNG^4U^I!pHnJ:W<)KS>/9Ll%\"IN/`jYOHG]iPa.Q$R$jD4S=Q7DTV8*TUnsrdW2ZetXKAY/Yd(L?['d?O\\@K2_]Y2%o^qmn*`5Ta:aN;TJbg\"GZd*^:jeCE.%f\\,!5gtgiEi8N\\UjQ5OekiqBum-X60nF?)@o_%qPq\"ad`r;HWp";
|
||||
const allZeroOutput =
|
||||
"zz!!*-'\"9eu7#RLhG$k3[W&.oNg'GVB\"(`=52*$$(B+<_pR,UFcb-n-Vr/1iJ-0JP==1c70M3&s#]4?Ykm5X@_(6q'R884cEH9MJ8X:f1+h<)lt#=BSg3>[:ZC?t!MSA7]@cBPD3sCi+'.E,fo>FEMbNG^4U^I!pHnJ:W<)KS>/9Ll%\"IN/`jYOHG]iPa.Q$R$jD4S=Q7DTV8*TUnsrdW2ZetXKAY/Yd(L?['d?O\\@K2_]Y2%o^qmn*`5Ta:aN;TJbg\"GZd*^:jeCE.%f\\,!5gtgiEi8N\\UjQ5OekiqBum-X60nF?)@o_%qPq\"ad`r;HWp";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "To Base85",
|
||||
input: wpExample,
|
||||
expectedOutput: wpOutput,
|
||||
recipeConfig: [
|
||||
{ "op": "To Base85",
|
||||
"args": ["!-u"] }
|
||||
]
|
||||
recipeConfig: [{ op: "To Base85", args: ["!-u"] }],
|
||||
},
|
||||
{
|
||||
name: "From Base85",
|
||||
input: wpOutput + "\n",
|
||||
expectedOutput: wpExample,
|
||||
recipeConfig: [
|
||||
{ "op": "From Base85",
|
||||
"args": ["!-u", true] }
|
||||
]
|
||||
recipeConfig: [{ op: "From Base85", args: ["!-u", true] }],
|
||||
},
|
||||
{
|
||||
name: "From Base85",
|
||||
input: wpOutput + "v",
|
||||
expectedError: true,
|
||||
expectedOutput: "From Base85 - Invalid character 'v' at index 337",
|
||||
recipeConfig: [
|
||||
{ "op": "From Base85",
|
||||
"args": ["!-u", false] }
|
||||
]
|
||||
recipeConfig: [{ op: "From Base85", args: ["!-u", false] }],
|
||||
},
|
||||
{
|
||||
name: "To Base85",
|
||||
input: allZeroExample,
|
||||
expectedOutput: allZeroOutput,
|
||||
recipeConfig: [
|
||||
{ "op": "To Base85",
|
||||
"args": ["!-u"] }
|
||||
]
|
||||
recipeConfig: [{ op: "To Base85", args: ["!-u"] }],
|
||||
},
|
||||
{
|
||||
name: "From Base85",
|
||||
input: allZeroOutput,
|
||||
expectedOutput: allZeroExample,
|
||||
recipeConfig: [
|
||||
{ "op": "From Base85",
|
||||
"args": ["!-u", true, "z"] }
|
||||
]
|
||||
recipeConfig: [{ op: "From Base85", args: ["!-u", true, "z"] }],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -11,40 +11,34 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Bit shift left",
|
||||
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
|
||||
expectedOutput: "10101010 01010100 11111110 00000000 11100000 00011110 01100110 10011000",
|
||||
expectedOutput:
|
||||
"10101010 01010100 11111110 00000000 11100000 00011110 01100110 10011000",
|
||||
recipeConfig: [
|
||||
{ "op": "From Binary",
|
||||
"args": ["Space"] },
|
||||
{ "op": "Bit shift left",
|
||||
"args": [1] },
|
||||
{ "op": "To Binary",
|
||||
"args": ["Space"] }
|
||||
]
|
||||
{ op: "From Binary", args: ["Space"] },
|
||||
{ op: "Bit shift left", args: [1] },
|
||||
{ op: "To Binary", args: ["Space"] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bit shift right: Logical shift",
|
||||
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
|
||||
expectedOutput: "00101010 01010101 01111111 00000000 01111000 00000111 00011001 01100110",
|
||||
expectedOutput:
|
||||
"00101010 01010101 01111111 00000000 01111000 00000111 00011001 01100110",
|
||||
recipeConfig: [
|
||||
{ "op": "From Binary",
|
||||
"args": ["Space"] },
|
||||
{ "op": "Bit shift right",
|
||||
"args": [1, "Logical shift"] },
|
||||
{ "op": "To Binary",
|
||||
"args": ["Space"] }
|
||||
]
|
||||
{ op: "From Binary", args: ["Space"] },
|
||||
{ op: "Bit shift right", args: [1, "Logical shift"] },
|
||||
{ op: "To Binary", args: ["Space"] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bit shift right: Arithmetic shift",
|
||||
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
|
||||
expectedOutput: "00101010 11010101 11111111 00000000 11111000 00000111 00011001 11100110",
|
||||
expectedOutput:
|
||||
"00101010 11010101 11111111 00000000 11111000 00000111 00011001 11100110",
|
||||
recipeConfig: [
|
||||
{ "op": "From Binary",
|
||||
"args": ["Space"] },
|
||||
{ "op": "Bit shift right",
|
||||
"args": [1, "Arithmetic shift"] },
|
||||
{ "op": "To Binary",
|
||||
"args": ["Space"] }
|
||||
]
|
||||
{ op: "From Binary", args: ["Space"] },
|
||||
{ op: "Bit shift right", args: [1, "Arithmetic shift"] },
|
||||
{ op: "To Binary", args: ["Space"] },
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -11,98 +11,113 @@ TestRegister.addTests([
|
|||
// Plugboard for this test is BO LC KE GA
|
||||
name: "Bombe: 3 rotor (self-stecker)",
|
||||
input: "BBYFLTHHYIJQAYBBYS",
|
||||
expectedMatch: /<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
|
||||
expectedMatch:
|
||||
/<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bombe",
|
||||
"args": [
|
||||
op: "Bombe",
|
||||
args: [
|
||||
"3-rotor",
|
||||
"",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"THISISATESTMESSAGE", 0, false
|
||||
]
|
||||
}
|
||||
]
|
||||
"THISISATESTMESSAGE",
|
||||
0,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// This test produces a menu that doesn't use the first letter, which is also a good test
|
||||
name: "Bombe: 3 rotor (other stecker)",
|
||||
input: "JBYALIHDYNUAAVKBYM",
|
||||
expectedMatch: /<td>LGA<\/td> {2}<td>AG<\/td> {2}<td>QFIMUMAFKMQSKMYNGW<\/td>/,
|
||||
expectedMatch:
|
||||
/<td>LGA<\/td> {2}<td>AG<\/td> {2}<td>QFIMUMAFKMQSKMYNGW<\/td>/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bombe",
|
||||
"args": [
|
||||
op: "Bombe",
|
||||
args: [
|
||||
"3-rotor",
|
||||
"",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"THISISATESTMESSAGE", 0, false
|
||||
]
|
||||
}
|
||||
]
|
||||
"THISISATESTMESSAGE",
|
||||
0,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bombe: crib offset",
|
||||
input: "AAABBYFLTHHYIJQAYBBYS", // first three chars here are faked
|
||||
expectedMatch: /<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
|
||||
expectedMatch:
|
||||
/<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bombe",
|
||||
"args": [
|
||||
op: "Bombe",
|
||||
args: [
|
||||
"3-rotor",
|
||||
"",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"THISISATESTMESSAGE", 3, false
|
||||
]
|
||||
}
|
||||
]
|
||||
"THISISATESTMESSAGE",
|
||||
3,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bombe: multiple stops",
|
||||
input: "BBYFLTHHYIJQAYBBYS",
|
||||
expectedMatch: /<td>LGA<\/td> {2}<td>TT<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
|
||||
expectedMatch:
|
||||
/<td>LGA<\/td> {2}<td>TT<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bombe",
|
||||
"args": [
|
||||
op: "Bombe",
|
||||
args: [
|
||||
"3-rotor",
|
||||
"",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"THISISATESTM", 0, false
|
||||
]
|
||||
}
|
||||
]
|
||||
"THISISATESTM",
|
||||
0,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bombe: checking machine",
|
||||
input: "BBYFLTHHYIJQAYBBYS",
|
||||
expectedMatch: /<td>LGA<\/td> {2}<td>TT AG BO CL EK FF HH II JJ SS YY<\/td> {2}<td>THISISATESTMESSAGE<\/td>/,
|
||||
expectedMatch:
|
||||
/<td>LGA<\/td> {2}<td>TT AG BO CL EK FF HH II JJ SS YY<\/td> {2}<td>THISISATESTMESSAGE<\/td>/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bombe",
|
||||
"args": [
|
||||
op: "Bombe",
|
||||
args: [
|
||||
"3-rotor",
|
||||
"",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"THISISATESTM", 0, true
|
||||
]
|
||||
}
|
||||
]
|
||||
"THISISATESTM",
|
||||
0,
|
||||
true,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
// Takes a while to run, so disabling for general purpose testing. Re-enable if modifying this operation.
|
||||
// {
|
||||
|
@ -130,18 +145,20 @@ TestRegister.addTests([
|
|||
expectedMatch: /Crib cannot be empty/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bombe",
|
||||
"args": [
|
||||
op: "Bombe",
|
||||
args: [
|
||||
"3-rotor",
|
||||
"",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"", 0, false
|
||||
]
|
||||
}
|
||||
]
|
||||
"",
|
||||
0,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bombe: short crib",
|
||||
|
@ -149,18 +166,20 @@ TestRegister.addTests([
|
|||
expectedMatch: /Crib is too short/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bombe",
|
||||
"args": [
|
||||
op: "Bombe",
|
||||
args: [
|
||||
"3-rotor",
|
||||
"",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"A", 0, false
|
||||
]
|
||||
}
|
||||
]
|
||||
"A",
|
||||
0,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bombe: invalid crib",
|
||||
|
@ -168,18 +187,20 @@ TestRegister.addTests([
|
|||
expectedMatch: /Invalid crib: .* in both ciphertext and crib/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bombe",
|
||||
"args": [
|
||||
op: "Bombe",
|
||||
args: [
|
||||
"3-rotor",
|
||||
"",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"AAAAAAAA", 0, false
|
||||
]
|
||||
}
|
||||
]
|
||||
"AAAAAAAA",
|
||||
0,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bombe: long crib",
|
||||
|
@ -187,18 +208,20 @@ TestRegister.addTests([
|
|||
expectedMatch: /Crib overruns supplied ciphertext/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bombe",
|
||||
"args": [
|
||||
op: "Bombe",
|
||||
args: [
|
||||
"3-rotor",
|
||||
"",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"CCCCCCCCCCCCCCCCCCCCCC", 0, false
|
||||
]
|
||||
}
|
||||
]
|
||||
"CCCCCCCCCCCCCCCCCCCCCC",
|
||||
0,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bombe: really long crib",
|
||||
|
@ -206,18 +229,20 @@ TestRegister.addTests([
|
|||
expectedMatch: /Crib is too long/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bombe",
|
||||
"args": [
|
||||
op: "Bombe",
|
||||
args: [
|
||||
"3-rotor",
|
||||
"",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAA", 0, false
|
||||
]
|
||||
}
|
||||
]
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAA",
|
||||
0,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bombe: negative offset",
|
||||
|
@ -225,18 +250,20 @@ TestRegister.addTests([
|
|||
expectedMatch: /Offset cannot be negative/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bombe",
|
||||
"args": [
|
||||
op: "Bombe",
|
||||
args: [
|
||||
"3-rotor",
|
||||
"",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"BBBBB", -1, false
|
||||
]
|
||||
}
|
||||
]
|
||||
"BBBBB",
|
||||
-1,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
// Enigma tests cover validation of rotors and reflector
|
||||
]);
|
||||
|
|
|
@ -33,10 +33,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
op: "To Octal",
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Octal: nothing",
|
||||
|
@ -44,10 +44,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
op: "From Octal",
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Octal: hello world",
|
||||
|
@ -55,10 +55,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "150 145 154 154 157 40 167 157 162 154 144",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
op: "To Octal",
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Octal: hello world",
|
||||
|
@ -66,21 +66,22 @@ TestRegister.addTests([
|
|||
expectedOutput: "hello world",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
op: "From Octal",
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Octal: Γειά σου",
|
||||
input: "Γειά σου", // [206,147,206,181,206,185,206,172,32,207,131,206,191,207,133],
|
||||
expectedOutput: "316 223 316 265 316 271 316 254 40 317 203 316 277 317 205",
|
||||
expectedOutput:
|
||||
"316 223 316 265 316 271 316 254 40 317 203 316 277 317 205",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
op: "To Octal",
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Octal: Γειά σου",
|
||||
|
@ -88,10 +89,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "Γειά σου",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
op: "From Octal",
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Hex: nothing",
|
||||
|
@ -100,31 +101,33 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["Space"]
|
||||
args: ["Space"],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Hex: All bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
|
||||
expectedOutput:
|
||||
"00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["Space"]
|
||||
args: ["Space"],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Hex: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "e1839ce183a320e1839ee18390e1839ce18398e18399e18390e183a1",
|
||||
expectedOutput:
|
||||
"e1839ce183a320e1839ee18390e1839ce18398e18399e18390e183a1",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hex: nothing",
|
||||
|
@ -133,9 +136,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Space"]
|
||||
}
|
||||
]
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hex: All bytes",
|
||||
|
@ -144,9 +147,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Space"]
|
||||
}
|
||||
]
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hex: UTF-8",
|
||||
|
@ -155,9 +158,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
}
|
||||
]
|
||||
args: ["None"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Charcode: nothing",
|
||||
|
@ -166,20 +169,21 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Charcode",
|
||||
args: ["Space", 16]
|
||||
args: ["Space", 16],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Charcode: All bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
|
||||
expectedOutput:
|
||||
"00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Charcode",
|
||||
args: ["Space", 16]
|
||||
args: ["Space", 16],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Charcode: UTF-8",
|
||||
|
@ -188,9 +192,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Charcode",
|
||||
args: ["Space", 16]
|
||||
args: ["Space", 16],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Charcode: nothing",
|
||||
|
@ -199,9 +203,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Charcode",
|
||||
args: ["Space", 16]
|
||||
}
|
||||
]
|
||||
args: ["Space", 16],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Charcode: All bytes",
|
||||
|
@ -210,9 +214,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Charcode",
|
||||
args: ["Space", 16]
|
||||
}
|
||||
]
|
||||
args: ["Space", 16],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Charcode: UTF-8",
|
||||
|
@ -221,8 +225,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Charcode",
|
||||
args: ["Space", 16]
|
||||
}
|
||||
]
|
||||
args: ["Space", 16],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -16,13 +16,13 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "CBOR Decode",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CBOR Decode: Can decode decimal",
|
||||
|
@ -31,28 +31,28 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "CBOR Decode",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hex: Can decode text",
|
||||
input: "64 54 65 78 74",
|
||||
expectedOutput: "\"Text\"",
|
||||
expectedOutput: '"Text"',
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "CBOR Decode",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hex: Can decode boolean true",
|
||||
|
@ -61,13 +61,13 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "CBOR Decode",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hex: Can decode boolean false",
|
||||
|
@ -76,32 +76,32 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "CBOR Decode",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hex: Can decode map",
|
||||
input: "a3 61 61 01 61 62 02 61 63 03",
|
||||
expectedOutput: JSON.stringify({a: 1, b: 2, c: 3}),
|
||||
expectedOutput: JSON.stringify({ a: 1, b: 2, c: 3 }),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "CBOR Decode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "JSON Minify",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hex: Can decode list",
|
||||
|
@ -110,35 +110,35 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "CBOR Decode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "JSON Minify",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hex: Can round trip with encode",
|
||||
input: JSON.stringify({a: 1, b: false, c: [1, 2, 3]}),
|
||||
expectedOutput: JSON.stringify({a: 1, b: false, c: [1, 2, 3]}),
|
||||
input: JSON.stringify({ a: 1, b: false, c: [1, 2, 3] }),
|
||||
expectedOutput: JSON.stringify({ a: 1, b: false, c: [1, 2, 3] }),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "CBOR Encode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "CBOR Decode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "JSON Minify",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -16,13 +16,13 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "CBOR Encode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CBOR Decode: Can encode decimal",
|
||||
|
@ -31,28 +31,28 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "CBOR Encode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CBOR Encode: Can encode text",
|
||||
input: "\"Text\"",
|
||||
input: '"Text"',
|
||||
expectedOutput: "64 54 65 78 74",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "CBOR Encode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CBOR Encode: Can encode boolean true",
|
||||
|
@ -61,13 +61,13 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "CBOR Encode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CBOR Encode: Can encode boolean false",
|
||||
|
@ -76,28 +76,28 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "CBOR Encode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CBOR Encode: Can encode map",
|
||||
input: JSON.stringify({a: 1, b: 2, c: 3}),
|
||||
input: JSON.stringify({ a: 1, b: 2, c: 3 }),
|
||||
expectedOutput: "a3 61 61 01 61 62 02 61 63 03",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "CBOR Encode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CBOR Encode: Can encode list",
|
||||
|
@ -106,12 +106,12 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "CBOR Encode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -10,305 +10,439 @@ import TestRegister from "../../lib/TestRegister.mjs";
|
|||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
"name": "CMAC-AES128 NIST's CSRC Example #1",
|
||||
"input": "",
|
||||
"expectedOutput": "bb1d6929e95937287fa37d129b756746",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES128 NIST's CSRC Example #1",
|
||||
input: "",
|
||||
expectedOutput: "bb1d6929e95937287fa37d129b756746",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "2b7e151628aed2a6abf7158809cf4f3c",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES128 NIST's CSRC Example #2",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172a",
|
||||
"expectedOutput": "070a16b46b4d4144f79bdd9dd04a287c",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES128 NIST's CSRC Example #2",
|
||||
input: "6bc1bee22e409f96e93d7e117393172a",
|
||||
expectedOutput: "070a16b46b4d4144f79bdd9dd04a287c",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "2b7e151628aed2a6abf7158809cf4f3c",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES128 NIST's CSRC Example #3",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a57",
|
||||
"expectedOutput": "7d85449ea6ea19c823a7bf78837dfade",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES128 NIST's CSRC Example #3",
|
||||
input: "6bc1bee22e409f96e93d7e117393172aae2d8a57",
|
||||
expectedOutput: "7d85449ea6ea19c823a7bf78837dfade",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "2b7e151628aed2a6abf7158809cf4f3c",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES128 NIST's CSRC Example #4",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
|
||||
"expectedOutput": "51f0bebf7e3b9d92fc49741779363cfe",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES128 NIST's CSRC Example #4",
|
||||
input: "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
|
||||
expectedOutput: "51f0bebf7e3b9d92fc49741779363cfe",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "2b7e151628aed2a6abf7158809cf4f3c",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES192 NIST's CSRC Example #1",
|
||||
"input": "",
|
||||
"expectedOutput": "d17ddf46adaacde531cac483de7a9367",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES192 NIST's CSRC Example #1",
|
||||
input: "",
|
||||
expectedOutput: "d17ddf46adaacde531cac483de7a9367",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES192 NIST's CSRC Example #2",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172a",
|
||||
"expectedOutput": "9e99a7bf31e710900662f65e617c5184",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES192 NIST's CSRC Example #2",
|
||||
input: "6bc1bee22e409f96e93d7e117393172a",
|
||||
expectedOutput: "9e99a7bf31e710900662f65e617c5184",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES192 NIST's CSRC Example #3",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a57",
|
||||
"expectedOutput": "3d75c194ed96070444a9fa7ec740ecf8",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES192 NIST's CSRC Example #3",
|
||||
input: "6bc1bee22e409f96e93d7e117393172aae2d8a57",
|
||||
expectedOutput: "3d75c194ed96070444a9fa7ec740ecf8",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES192 NIST's CSRC Example #4",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
|
||||
"expectedOutput": "a1d5df0eed790f794d77589659f39a11",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES192 NIST's CSRC Example #4",
|
||||
input: "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
|
||||
expectedOutput: "a1d5df0eed790f794d77589659f39a11",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES256 NIST's CSRC Example #1",
|
||||
"input": "",
|
||||
"expectedOutput": "028962f61b7bf89efc6b551f4667d983",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES256 NIST's CSRC Example #1",
|
||||
input: "",
|
||||
expectedOutput: "028962f61b7bf89efc6b551f4667d983",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES256 NIST's CSRC Example #2",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172a",
|
||||
"expectedOutput": "28a7023f452e8f82bd4bf28d8c37c35c",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES256 NIST's CSRC Example #2",
|
||||
input: "6bc1bee22e409f96e93d7e117393172a",
|
||||
expectedOutput: "28a7023f452e8f82bd4bf28d8c37c35c",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES256 NIST's CSRC Example #3",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a57",
|
||||
"expectedOutput": "156727dc0878944a023c1fe03bad6d93",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES256 NIST's CSRC Example #3",
|
||||
input: "6bc1bee22e409f96e93d7e117393172aae2d8a57",
|
||||
expectedOutput: "156727dc0878944a023c1fe03bad6d93",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES256 NIST's CSRC Example #4",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
|
||||
"expectedOutput": "e1992190549f6ed5696a2c056c315410",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES256 NIST's CSRC Example #4",
|
||||
input: "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
|
||||
expectedOutput: "e1992190549f6ed5696a2c056c315410",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-TDES (1) NIST's CSRC Sample #1",
|
||||
"input": "",
|
||||
"expectedOutput": "7db0d37df936c550",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-TDES (1) NIST's CSRC Sample #1",
|
||||
input: "",
|
||||
expectedOutput: "7db0d37df936c550",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "0123456789abcdef23456789abcdef01456789abcdef0123",
|
||||
},
|
||||
"Triple DES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-TDES (1) NIST's CSRC Sample #2",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172a",
|
||||
"expectedOutput": "30239cf1f52e6609",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-TDES (1) NIST's CSRC Sample #2",
|
||||
input: "6bc1bee22e409f96e93d7e117393172a",
|
||||
expectedOutput: "30239cf1f52e6609",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "0123456789abcdef23456789abcdef01456789abcdef0123",
|
||||
},
|
||||
"Triple DES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-TDES (1) NIST's CSRC Sample #3",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a57",
|
||||
"expectedOutput": "6c9f3ee4923f6be2",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-TDES (1) NIST's CSRC Sample #3",
|
||||
input: "6bc1bee22e409f96e93d7e117393172aae2d8a57",
|
||||
expectedOutput: "6c9f3ee4923f6be2",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "0123456789abcdef23456789abcdef01456789abcdef0123",
|
||||
},
|
||||
"Triple DES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-TDES (1) NIST's CSRC Sample #4",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51",
|
||||
"expectedOutput": "99429bd0bf7904e5",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-TDES (1) NIST's CSRC Sample #4",
|
||||
input: "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51",
|
||||
expectedOutput: "99429bd0bf7904e5",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "0123456789abcdef23456789abcdef01456789abcdef0123",
|
||||
},
|
||||
"Triple DES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-TDES (2) NIST's CSRC Sample #1",
|
||||
"input": "",
|
||||
"expectedOutput": "79ce52a7f786a960",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-TDES (2) NIST's CSRC Sample #1",
|
||||
input: "",
|
||||
expectedOutput: "79ce52a7f786a960",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "0123456789abcdef23456789abcdef010123456789abcdef",
|
||||
},
|
||||
"Triple DES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-TDES (2) NIST's CSRC Sample #2",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172a",
|
||||
"expectedOutput": "cc18a0b79af2413b",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-TDES (2) NIST's CSRC Sample #2",
|
||||
input: "6bc1bee22e409f96e93d7e117393172a",
|
||||
expectedOutput: "cc18a0b79af2413b",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "0123456789abcdef23456789abcdef010123456789abcdef",
|
||||
},
|
||||
"Triple DES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-TDES (2) NIST's CSRC Sample #3",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a57",
|
||||
"expectedOutput": "c06d377ecd101969",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-TDES (2) NIST's CSRC Sample #3",
|
||||
input: "6bc1bee22e409f96e93d7e117393172aae2d8a57",
|
||||
expectedOutput: "c06d377ecd101969",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "0123456789abcdef23456789abcdef010123456789abcdef",
|
||||
},
|
||||
"Triple DES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-TDES (2) NIST's CSRC Sample #4",
|
||||
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51",
|
||||
"expectedOutput": "9cd33580f9b64dfb",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-TDES (2) NIST's CSRC Sample #4",
|
||||
input: "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51",
|
||||
expectedOutput: "9cd33580f9b64dfb",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "0123456789abcdef23456789abcdef010123456789abcdef",
|
||||
},
|
||||
"Triple DES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-AES: invalid key length",
|
||||
"input": "",
|
||||
"expectedOutput": "The key for AES must be either 16, 24, or 32 bytes (currently 20 bytes)",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-AES: invalid key length",
|
||||
input: "",
|
||||
expectedOutput:
|
||||
"The key for AES must be either 16, 24, or 32 bytes (currently 20 bytes)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "00112233445566778899aabbccddeeff01234567"}, "AES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00112233445566778899aabbccddeeff01234567",
|
||||
},
|
||||
"AES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "CMAC-TDES: invalid key length",
|
||||
"input": "",
|
||||
"expectedOutput": "The key for Triple DES must be 16 or 24 bytes (currently 20 bytes)",
|
||||
"recipeConfig": [
|
||||
name: "CMAC-TDES: invalid key length",
|
||||
input: "",
|
||||
expectedOutput:
|
||||
"The key for Triple DES must be 16 or 24 bytes (currently 20 bytes)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CMAC",
|
||||
"args": [{"option": "Hex", "string": "00112233445566778899aabbccddeeff01234567"}, "Triple DES"]
|
||||
op: "CMAC",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00112233445566778899aabbccddeeff01234567",
|
||||
},
|
||||
"Triple DES",
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -19,161 +19,113 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "CSV to JSON: Array of dictionaries",
|
||||
input: EXAMPLE_CSV,
|
||||
expectedOutput: JSON.stringify([
|
||||
{
|
||||
"A": "1",
|
||||
"B": "2",
|
||||
"C": "3",
|
||||
"D": "4",
|
||||
"E": "5",
|
||||
"F": "6"
|
||||
},
|
||||
{
|
||||
"A": ",",
|
||||
"B": ";",
|
||||
"C": "'",
|
||||
"D": "\"",
|
||||
"E": "",
|
||||
"F": ""
|
||||
},
|
||||
{
|
||||
"A": "\"hello\"",
|
||||
"B": "a\"1",
|
||||
"C": "multi\r\nline",
|
||||
"D": "",
|
||||
"E": "",
|
||||
"F": "end"
|
||||
}
|
||||
], null, 4),
|
||||
expectedOutput: JSON.stringify(
|
||||
[
|
||||
{
|
||||
A: "1",
|
||||
B: "2",
|
||||
C: "3",
|
||||
D: "4",
|
||||
E: "5",
|
||||
F: "6",
|
||||
},
|
||||
{
|
||||
A: ",",
|
||||
B: ";",
|
||||
C: "'",
|
||||
D: '"',
|
||||
E: "",
|
||||
F: "",
|
||||
},
|
||||
{
|
||||
A: '"hello"',
|
||||
B: 'a"1',
|
||||
C: "multi\r\nline",
|
||||
D: "",
|
||||
E: "",
|
||||
F: "end",
|
||||
},
|
||||
],
|
||||
null,
|
||||
4,
|
||||
),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "CSV to JSON",
|
||||
args: [",", "\r\n", "Array of dictionaries"],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CSV to JSON: Array of arrays",
|
||||
input: EXAMPLE_CSV,
|
||||
expectedOutput: JSON.stringify([
|
||||
expectedOutput: JSON.stringify(
|
||||
[
|
||||
"A",
|
||||
"B",
|
||||
"C",
|
||||
"D",
|
||||
"E",
|
||||
"F"
|
||||
["A", "B", "C", "D", "E", "F"],
|
||||
["1", "2", "3", "4", "5", "6"],
|
||||
[",", ";", "'", '"', "", ""],
|
||||
['"hello"', 'a"1', "multi\r\nline", "", "", "end"],
|
||||
],
|
||||
[
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6"
|
||||
],
|
||||
[
|
||||
",",
|
||||
";",
|
||||
"'",
|
||||
"\"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
[
|
||||
"\"hello\"",
|
||||
"a\"1",
|
||||
"multi\r\nline",
|
||||
"",
|
||||
"",
|
||||
"end"
|
||||
]
|
||||
], null, 4),
|
||||
null,
|
||||
4,
|
||||
),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "CSV to JSON",
|
||||
args: [",", "\r\n", "Array of arrays"],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: Array of dictionaries",
|
||||
input: JSON.stringify([
|
||||
{
|
||||
"A": "1",
|
||||
"B": "2",
|
||||
"C": "3",
|
||||
"D": "4",
|
||||
"E": "5",
|
||||
"F": "6"
|
||||
A: "1",
|
||||
B: "2",
|
||||
C: "3",
|
||||
D: "4",
|
||||
E: "5",
|
||||
F: "6",
|
||||
},
|
||||
{
|
||||
"A": ",",
|
||||
"B": ";",
|
||||
"C": "'",
|
||||
"D": "\"",
|
||||
"E": "",
|
||||
"F": ""
|
||||
A: ",",
|
||||
B: ";",
|
||||
C: "'",
|
||||
D: '"',
|
||||
E: "",
|
||||
F: "",
|
||||
},
|
||||
{
|
||||
"A": "\"hello\"",
|
||||
"B": "a\"1",
|
||||
"C": "multi\r\nline",
|
||||
"D": "",
|
||||
"E": "",
|
||||
"F": "end"
|
||||
}
|
||||
A: '"hello"',
|
||||
B: 'a"1',
|
||||
C: "multi\r\nline",
|
||||
D: "",
|
||||
E: "",
|
||||
F: "end",
|
||||
},
|
||||
]),
|
||||
expectedOutput: EXAMPLE_CSV,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\r\n"],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: Array of arrays",
|
||||
input: JSON.stringify([
|
||||
[
|
||||
"A",
|
||||
"B",
|
||||
"C",
|
||||
"D",
|
||||
"E",
|
||||
"F"
|
||||
],
|
||||
[
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6"
|
||||
],
|
||||
[
|
||||
",",
|
||||
";",
|
||||
"'",
|
||||
"\"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
[
|
||||
"\"hello\"",
|
||||
"a\"1",
|
||||
"multi\r\nline",
|
||||
"",
|
||||
"",
|
||||
"end"
|
||||
]
|
||||
["A", "B", "C", "D", "E", "F"],
|
||||
["1", "2", "3", "4", "5", "6"],
|
||||
[",", ";", "'", '"', "", ""],
|
||||
['"hello"', 'a"1', "multi\r\nline", "", "", "end"],
|
||||
]),
|
||||
expectedOutput: EXAMPLE_CSV,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\r\n"],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -41,5 +41,5 @@ TestRegister.addTests([
|
|||
args: ["4"],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -27,7 +27,8 @@ TestRegister.addTests([
|
|||
*/
|
||||
name: "Caret/M-decode: Full set",
|
||||
input: "^@^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\\^]^^^_ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~^?M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^ZM-^[M-^\\M-^]M-^^M-^_M- M-!M-\"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9M-:M-;M-<M-=M->M-?M-@M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-ZM-[M-\\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?",
|
||||
expectedOutput: "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x1f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\x8d\x2d\x5f\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
expectedOutput:
|
||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x1f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\x8d\x2d\x5f\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Caret/M-decode",
|
||||
|
@ -36,4 +37,3 @@ TestRegister.addTests([
|
|||
],
|
||||
},
|
||||
]);
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Cartesian Product",
|
||||
input: "1 2 3 4 5\n\na b c d e",
|
||||
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
|
||||
expectedOutput:
|
||||
"(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Cartesian Product",
|
||||
|
@ -23,7 +24,8 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Cartesian Product: too many on left",
|
||||
input: "1 2 3 4 5 6\n\na b c d e",
|
||||
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e) (6,a) (6,b) (6,c) (6,d) (6,e)",
|
||||
expectedOutput:
|
||||
"(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e) (6,a) (6,b) (6,c) (6,d) (6,e)",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Cartesian Product",
|
||||
|
@ -34,7 +36,8 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Cartesian Product: too many on right",
|
||||
input: "1 2 3 4 5\n\na b c d e f",
|
||||
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (1,f) (2,a) (2,b) (2,c) (2,d) (2,e) (2,f) (3,a) (3,b) (3,c) (3,d) (3,e) (3,f) (4,a) (4,b) (4,c) (4,d) (4,e) (4,f) (5,a) (5,b) (5,c) (5,d) (5,e) (5,f)",
|
||||
expectedOutput:
|
||||
"(1,a) (1,b) (1,c) (1,d) (1,e) (1,f) (2,a) (2,b) (2,c) (2,d) (2,e) (2,f) (3,a) (3,b) (3,c) (3,d) (3,e) (3,f) (4,a) (4,b) (4,c) (4,d) (4,e) (4,f) (5,a) (5,b) (5,c) (5,d) (5,e) (5,f)",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Cartesian Product",
|
||||
|
@ -45,7 +48,8 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Cartesian Product: item delimiter",
|
||||
input: "1-2-3-4-5\n\na-b-c-d-e",
|
||||
expectedOutput: "(1,a)-(1,b)-(1,c)-(1,d)-(1,e)-(2,a)-(2,b)-(2,c)-(2,d)-(2,e)-(3,a)-(3,b)-(3,c)-(3,d)-(3,e)-(4,a)-(4,b)-(4,c)-(4,d)-(4,e)-(5,a)-(5,b)-(5,c)-(5,d)-(5,e)",
|
||||
expectedOutput:
|
||||
"(1,a)-(1,b)-(1,c)-(1,d)-(1,e)-(2,a)-(2,b)-(2,c)-(2,d)-(2,e)-(3,a)-(3,b)-(3,c)-(3,d)-(3,e)-(4,a)-(4,b)-(4,c)-(4,d)-(4,e)-(5,a)-(5,b)-(5,c)-(5,d)-(5,e)",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Cartesian Product",
|
||||
|
@ -56,7 +60,8 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Cartesian Product: sample delimiter",
|
||||
input: "1 2 3 4 5_a b c d e",
|
||||
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
|
||||
expectedOutput:
|
||||
"(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Cartesian Product",
|
||||
|
|
|
@ -15,8 +15,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Cetacean Cipher Decode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -11,12 +11,13 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Cetacean Cipher Encode",
|
||||
input: "a b c で",
|
||||
expectedOutput: "EEEEEEEEEeeEEEEe EEEEEEEEEeeEEEeE EEEEEEEEEeeEEEee EEeeEEEEEeeEEeee",
|
||||
expectedOutput:
|
||||
"EEEEEEEEEeeEEEEe EEEEEEEEEeeEEEeE EEEEEEEEEeeEEEee EEeeEEEEEeeEEeee",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Cetacean Cipher Encode",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -17,13 +17,16 @@ TestRegister.addTests([
|
|||
ChaCha uses a key of 16 or 32 bytes (128 or 256 bits).`,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "ChaCha",
|
||||
"args": [
|
||||
{"option": "Hex", "string": ""},
|
||||
{"option": "Hex", "string": ""},
|
||||
0, "20", "Hex", "Hex",
|
||||
]
|
||||
}
|
||||
op: "ChaCha",
|
||||
args: [
|
||||
{ option: "Hex", string: "" },
|
||||
{ option: "Hex", string: "" },
|
||||
0,
|
||||
"20",
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -34,118 +37,176 @@ ChaCha uses a key of 16 or 32 bytes (128 or 256 bits).`,
|
|||
ChaCha uses a nonce of 8 or 12 bytes (64 or 96 bits).`,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "ChaCha",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
||||
{"option": "Hex", "string": ""},
|
||||
0, "20", "Hex", "Hex",
|
||||
]
|
||||
}
|
||||
op: "ChaCha",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00000000000000000000000000000000",
|
||||
},
|
||||
{ option: "Hex", string: "" },
|
||||
0,
|
||||
"20",
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ChaCha: RFC8439",
|
||||
input: "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.",
|
||||
expectedOutput: "6e 2e 35 9a 25 68 f9 80 41 ba 07 28 dd 0d 69 81 e9 7e 7a ec 1d 43 60 c2 0a 27 af cc fd 9f ae 0b f9 1b 65 c5 52 47 33 ab 8f 59 3d ab cd 62 b3 57 16 39 d6 24 e6 51 52 ab 8f 53 0c 35 9f 08 61 d8 07 ca 0d bf 50 0d 6a 61 56 a3 8e 08 8a 22 b6 5e 52 bc 51 4d 16 cc f8 06 81 8c e9 1a b7 79 37 36 5a f9 0b bf 74 a3 5b e6 b4 0b 8e ed f2 78 5e 42 87 4d",
|
||||
expectedOutput:
|
||||
"6e 2e 35 9a 25 68 f9 80 41 ba 07 28 dd 0d 69 81 e9 7e 7a ec 1d 43 60 c2 0a 27 af cc fd 9f ae 0b f9 1b 65 c5 52 47 33 ab 8f 59 3d ab cd 62 b3 57 16 39 d6 24 e6 51 52 ab 8f 53 0c 35 9f 08 61 d8 07 ca 0d bf 50 0d 6a 61 56 a3 8e 08 8a 22 b6 5e 52 bc 51 4d 16 cc f8 06 81 8c e9 1a b7 79 37 36 5a f9 0b bf 74 a3 5b e6 b4 0b 8e ed f2 78 5e 42 87 4d",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "ChaCha",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00:01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f:10:11:12:13:14:15:16:17:18:19:1a:1b:1c:1d:1e:1f"},
|
||||
{"option": "Hex", "string": "00:00:00:00:00:00:00:4a:00:00:00:00"},
|
||||
1, "20", "Raw", "Hex",
|
||||
]
|
||||
}
|
||||
op: "ChaCha",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00:01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f:10:11:12:13:14:15:16:17:18:19:1a:1b:1c:1d:1e:1f",
|
||||
},
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00:00:00:00:00:00:00:4a:00:00:00:00",
|
||||
},
|
||||
1,
|
||||
"20",
|
||||
"Raw",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.1",
|
||||
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
|
||||
expectedOutput: "29 56 0d 28 0b 45 28 40 0a 8f 4b 79 53 69 fb 3a 01 10 55 99 e9 f1 ed 58 27 9c fc 9e ce 2d c5 f9 9f 1c 2e 52 c9 82 38 f5 42 a5 c0 a8 81 d8 50 b6 15 d3 ac d9 fb db 02 6e 93 68 56 5d a5 0e 0d 49 dd 5b e8 ef 74 24 8b 3e 25 1d 96 5d 8f cb 21 e7 cf e2 04 d4 00 78 06 fb ee 3c e9 4c 74 bf ba d2 c1 1c 62 1b a0 48 14 7c 5c aa 94 d1 82 cc ff 6f d5 cf 44 ad f9 6e 3d 68 28 1b b4 96 76 af 87 e7",
|
||||
expectedOutput:
|
||||
"29 56 0d 28 0b 45 28 40 0a 8f 4b 79 53 69 fb 3a 01 10 55 99 e9 f1 ed 58 27 9c fc 9e ce 2d c5 f9 9f 1c 2e 52 c9 82 38 f5 42 a5 c0 a8 81 d8 50 b6 15 d3 ac d9 fb db 02 6e 93 68 56 5d a5 0e 0d 49 dd 5b e8 ef 74 24 8b 3e 25 1d 96 5d 8f cb 21 e7 cf e2 04 d4 00 78 06 fb ee 3c e9 4c 74 bf ba d2 c1 1c 62 1b a0 48 14 7c 5c aa 94 d1 82 cc ff 6f d5 cf 44 ad f9 6e 3d 68 28 1b b4 96 76 af 87 e7",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "ChaCha",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff"},
|
||||
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
|
||||
0, "8", "Hex", "Hex",
|
||||
]
|
||||
}
|
||||
op: "ChaCha",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff",
|
||||
},
|
||||
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
|
||||
0,
|
||||
"8",
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.2",
|
||||
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
|
||||
expectedOutput: "5e dd c2 d9 42 8f ce ee c5 0a 52 a9 64 ea e0 ff b0 4b 2d e0 06 a9 b0 4c ff 36 8f fa 92 11 16 b2 e8 e2 64 ba bd 2e fa 0d e4 3e f2 e3 b6 d0 65 e8 f7 c0 a1 78 37 b0 a4 0e b0 e2 c7 a3 74 2c 87 53 ed e5 f3 f6 d1 9b e5 54 67 5e 50 6a 77 5c 63 f0 94 d4 96 5c 31 93 19 dc d7 50 6f 45 7b 11 7b 84 b1 0b 24 6e 95 6c 2d a8 89 8a 65 6c ee f3 f7 b7 16 45 b1 9f 70 1d b8 44 85 ce 51 21 f0 f6 17 ef",
|
||||
expectedOutput:
|
||||
"5e dd c2 d9 42 8f ce ee c5 0a 52 a9 64 ea e0 ff b0 4b 2d e0 06 a9 b0 4c ff 36 8f fa 92 11 16 b2 e8 e2 64 ba bd 2e fa 0d e4 3e f2 e3 b6 d0 65 e8 f7 c0 a1 78 37 b0 a4 0e b0 e2 c7 a3 74 2c 87 53 ed e5 f3 f6 d1 9b e5 54 67 5e 50 6a 77 5c 63 f0 94 d4 96 5c 31 93 19 dc d7 50 6f 45 7b 11 7b 84 b1 0b 24 6e 95 6c 2d a8 89 8a 65 6c ee f3 f7 b7 16 45 b1 9f 70 1d b8 44 85 ce 51 21 f0 f6 17 ef",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "ChaCha",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff"},
|
||||
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
|
||||
0, "12", "Hex", "Hex",
|
||||
]
|
||||
}
|
||||
op: "ChaCha",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff",
|
||||
},
|
||||
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
|
||||
0,
|
||||
"12",
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.3",
|
||||
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
|
||||
expectedOutput: "d1 ab f6 30 46 7e b4 f6 7f 1c fb 47 cd 62 6a ae 8a fe db be 4f f8 fc 5f e9 cf ae 30 7e 74 ed 45 1f 14 04 42 5a d2 b5 45 69 d5 f1 81 48 93 99 71 ab b8 fa fc 88 ce 4a c7 fe 1c 3d 1f 7a 1e b7 ca e7 6c a8 7b 61 a9 71 35 41 49 77 60 dd 9a e0 59 35 0c ad 0d ce df aa 80 a8 83 11 9a 1a 6f 98 7f d1 ce 91 fd 8e e0 82 80 34 b4 11 20 0a 97 45 a2 85 55 44 75 d1 2a fc 04 88 7f ef 35 16 d1 2a 2c",
|
||||
expectedOutput:
|
||||
"d1 ab f6 30 46 7e b4 f6 7f 1c fb 47 cd 62 6a ae 8a fe db be 4f f8 fc 5f e9 cf ae 30 7e 74 ed 45 1f 14 04 42 5a d2 b5 45 69 d5 f1 81 48 93 99 71 ab b8 fa fc 88 ce 4a c7 fe 1c 3d 1f 7a 1e b7 ca e7 6c a8 7b 61 a9 71 35 41 49 77 60 dd 9a e0 59 35 0c ad 0d ce df aa 80 a8 83 11 9a 1a 6f 98 7f d1 ce 91 fd 8e e0 82 80 34 b4 11 20 0a 97 45 a2 85 55 44 75 d1 2a fc 04 88 7f ef 35 16 d1 2a 2c",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "ChaCha",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff"},
|
||||
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
|
||||
0, "20", "Hex", "Hex",
|
||||
]
|
||||
}
|
||||
op: "ChaCha",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff",
|
||||
},
|
||||
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
|
||||
0,
|
||||
"20",
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.4",
|
||||
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
|
||||
expectedOutput: "db 43 ad 9d 1e 84 2d 12 72 e4 53 0e 27 6b 3f 56 8f 88 59 b3 f7 cf 6d 9d 2c 74 fa 53 80 8c b5 15 7a 8e bf 46 ad 3d cc 4b 6c 7d ad de 13 17 84 b0 12 0e 0e 22 f6 d5 f9 ff a7 40 7d 4a 21 b6 95 d9 c5 dd 30 bf 55 61 2f ab 9b dd 11 89 20 c1 98 16 47 0c 7f 5d cd 42 32 5d bb ed 8c 57 a5 62 81 c1 44 cb 0f 03 e8 1b 30 04 62 4e 06 50 a1 ce 5a fa f9 a7 cd 81 63 f6 db d7 26 02 25 7d d9 6e 47 1e",
|
||||
expectedOutput:
|
||||
"db 43 ad 9d 1e 84 2d 12 72 e4 53 0e 27 6b 3f 56 8f 88 59 b3 f7 cf 6d 9d 2c 74 fa 53 80 8c b5 15 7a 8e bf 46 ad 3d cc 4b 6c 7d ad de 13 17 84 b0 12 0e 0e 22 f6 d5 f9 ff a7 40 7d 4a 21 b6 95 d9 c5 dd 30 bf 55 61 2f ab 9b dd 11 89 20 c1 98 16 47 0c 7f 5d cd 42 32 5d bb ed 8c 57 a5 62 81 c1 44 cb 0f 03 e8 1b 30 04 62 4e 06 50 a1 ce 5a fa f9 a7 cd 81 63 f6 db d7 26 02 25 7d d9 6e 47 1e",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "ChaCha",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00"},
|
||||
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
|
||||
0, "8", "Hex", "Hex",
|
||||
]
|
||||
}
|
||||
op: "ChaCha",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00",
|
||||
},
|
||||
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
|
||||
0,
|
||||
"8",
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.5",
|
||||
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
|
||||
expectedOutput: "7e d1 2a 3a 63 91 2a e9 41 ba 6d 4c 0d 5e 86 2e 56 8b 0e 55 89 34 69 35 50 5f 06 4b 8c 26 98 db f7 d8 50 66 7d 8e 67 be 63 9f 3b 4f 6a 16 f9 2e 65 ea 80 f6 c7 42 94 45 da 1f c2 c1 b9 36 50 40 e3 2e 50 c4 10 6f 3b 3d a1 ce 7c cb 1e 71 40 b1 53 49 3c 0f 3a d9 a9 bc ff 07 7e c4 59 6f 1d 0f 29 bf 9c ba a5 02 82 0f 73 2a f5 a9 3c 49 ee e3 3d 1c 4f 12 af 3b 42 97 af 91 fe 41 ea 9e 94 a2",
|
||||
expectedOutput:
|
||||
"7e d1 2a 3a 63 91 2a e9 41 ba 6d 4c 0d 5e 86 2e 56 8b 0e 55 89 34 69 35 50 5f 06 4b 8c 26 98 db f7 d8 50 66 7d 8e 67 be 63 9f 3b 4f 6a 16 f9 2e 65 ea 80 f6 c7 42 94 45 da 1f c2 c1 b9 36 50 40 e3 2e 50 c4 10 6f 3b 3d a1 ce 7c cb 1e 71 40 b1 53 49 3c 0f 3a d9 a9 bc ff 07 7e c4 59 6f 1d 0f 29 bf 9c ba a5 02 82 0f 73 2a f5 a9 3c 49 ee e3 3d 1c 4f 12 af 3b 42 97 af 91 fe 41 ea 9e 94 a2",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "ChaCha",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00"},
|
||||
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
|
||||
0, "12", "Hex", "Hex",
|
||||
]
|
||||
}
|
||||
op: "ChaCha",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00",
|
||||
},
|
||||
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
|
||||
0,
|
||||
"12",
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.6",
|
||||
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
|
||||
expectedOutput: "9f ad f4 09 c0 08 11 d0 04 31 d6 7e fb d8 8f ba 59 21 8d 5d 67 08 b1 d6 85 86 3f ab bb 0e 96 1e ea 48 0f d6 fb 53 2b fd 49 4b 21 51 01 50 57 42 3a b6 0a 63 fe 4f 55 f7 a2 12 e2 16 7c ca b9 31 fb fd 29 cf 7b c1 d2 79 ed df 25 dd 31 6b b8 84 3d 6e de e0 bd 1e f1 21 d1 2f a1 7c bc 2c 57 4c cc ab 5e 27 51 67 b0 8b d6 86 f8 a0 9d f8 7e c3 ff b3 53 61 b9 4e bf a1 3f ec 0e 48 89 d1 8d a5",
|
||||
expectedOutput:
|
||||
"9f ad f4 09 c0 08 11 d0 04 31 d6 7e fb d8 8f ba 59 21 8d 5d 67 08 b1 d6 85 86 3f ab bb 0e 96 1e ea 48 0f d6 fb 53 2b fd 49 4b 21 51 01 50 57 42 3a b6 0a 63 fe 4f 55 f7 a2 12 e2 16 7c ca b9 31 fb fd 29 cf 7b c1 d2 79 ed df 25 dd 31 6b b8 84 3d 6e de e0 bd 1e f1 21 d1 2f a1 7c bc 2c 57 4c cc ab 5e 27 51 67 b0 8b d6 86 f8 a0 9d f8 7e c3 ff b3 53 61 b9 4e bf a1 3f ec 0e 48 89 d1 8d a5",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "ChaCha",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00"},
|
||||
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
|
||||
0, "20", "Hex", "Hex",
|
||||
]
|
||||
}
|
||||
op: "ChaCha",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00",
|
||||
},
|
||||
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
|
||||
0,
|
||||
"20",
|
||||
"Hex",
|
||||
"Hex",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -18,7 +18,8 @@ TestRegister.addTests([
|
|||
args: ["Dotted Decimal", "Hex"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: "Change IP format: Decimal to Dotted Decimal",
|
||||
input: "3232235777",
|
||||
expectedOutput: "192.168.1.1",
|
||||
|
@ -28,7 +29,8 @@ TestRegister.addTests([
|
|||
args: ["Decimal", "Dotted Decimal"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: "Change IP format: Hex to Octal",
|
||||
input: "c0a80101",
|
||||
expectedOutput: "030052000401",
|
||||
|
@ -38,7 +40,8 @@ TestRegister.addTests([
|
|||
args: ["Hex", "Octal"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: "Change IP format: Octal to Decimal",
|
||||
input: "030052000401",
|
||||
expectedOutput: "3232235777",
|
||||
|
|
|
@ -14,12 +14,12 @@ TestRegister.addTests([
|
|||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Encode text",
|
||||
"args": ["UTF-8 (65001)"]
|
||||
op: "Encode text",
|
||||
args: ["UTF-8 (65001)"],
|
||||
},
|
||||
{
|
||||
"op": "Decode text",
|
||||
"args": ["UTF-8 (65001)"]
|
||||
op: "Decode text",
|
||||
args: ["UTF-8 (65001)"],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -29,12 +29,12 @@ TestRegister.addTests([
|
|||
expectedOutput: "hello",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Encode text",
|
||||
"args": ["UTF-8 (65001)"]
|
||||
op: "Encode text",
|
||||
args: ["UTF-8 (65001)"],
|
||||
},
|
||||
{
|
||||
"op": "Decode text",
|
||||
"args": ["UTF-8 (65001)"]
|
||||
op: "Decode text",
|
||||
args: ["UTF-8 (65001)"],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -44,12 +44,12 @@ TestRegister.addTests([
|
|||
expectedOutput: "88 85 93 93 96",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Encode text",
|
||||
"args": ["IBM EBCDIC International (500)"]
|
||||
op: "Encode text",
|
||||
args: ["IBM EBCDIC International (500)"],
|
||||
},
|
||||
{
|
||||
"op": "To Hex",
|
||||
"args": ["Space"]
|
||||
op: "To Hex",
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -59,31 +59,31 @@ TestRegister.addTests([
|
|||
expectedOutput: "hello",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Space"]
|
||||
op: "From Hex",
|
||||
args: ["Space"],
|
||||
},
|
||||
{
|
||||
"op": "Decode text",
|
||||
"args": ["IBM EBCDIC International (500)"]
|
||||
op: "Decode text",
|
||||
args: ["IBM EBCDIC International (500)"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Generate Base64 Windows PowerShell",
|
||||
input: "ZABpAHIAIAAiAGMAOgBcAHAAcgBvAGcAcgBhAG0AIABmAGkAbABlAHMAIgAgAA==",
|
||||
expectedOutput: "dir \"c:\\program files\" ",
|
||||
expectedOutput: 'dir "c:\\program files" ',
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Base64",
|
||||
"args": ["A-Za-z0-9+/=", true]
|
||||
op: "From Base64",
|
||||
args: ["A-Za-z0-9+/=", true],
|
||||
},
|
||||
{
|
||||
"op": "Decode text",
|
||||
"args": ["UTF-16LE (1200)"]
|
||||
op: "Decode text",
|
||||
args: ["UTF-16LE (1200)"],
|
||||
},
|
||||
{
|
||||
"op": "Encode text",
|
||||
"args": ["UTF-8 (65001)"]
|
||||
op: "Encode text",
|
||||
args: ["UTF-8 (65001)"],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -14,9 +14,18 @@ TestRegister.addTests([
|
|||
expectedMatch: /^<svg width/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Scatter chart",
|
||||
"args": ["Line feed", "Space", false, "time", "stress", "black", 5, false]
|
||||
}
|
||||
op: "Scatter chart",
|
||||
args: [
|
||||
"Line feed",
|
||||
"Space",
|
||||
false,
|
||||
"time",
|
||||
"stress",
|
||||
"black",
|
||||
5,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -25,9 +34,21 @@ TestRegister.addTests([
|
|||
expectedMatch: /^<svg width/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Hex Density chart",
|
||||
"args": ["Line feed", "Space", 25, 15, true, "", "", true, "white", "black", true]
|
||||
}
|
||||
op: "Hex Density chart",
|
||||
args: [
|
||||
"Line feed",
|
||||
"Space",
|
||||
25,
|
||||
15,
|
||||
true,
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
"white",
|
||||
"black",
|
||||
true,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -36,9 +57,15 @@ TestRegister.addTests([
|
|||
expectedMatch: /^<svg width/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Series chart",
|
||||
"args": ["Line feed", "Space", "", 1, "mediumseagreen, dodgerblue, tomato"]
|
||||
}
|
||||
op: "Series chart",
|
||||
args: [
|
||||
"Line feed",
|
||||
"Space",
|
||||
"",
|
||||
1,
|
||||
"mediumseagreen, dodgerblue, tomato",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -47,9 +74,20 @@ TestRegister.addTests([
|
|||
expectedMatch: /^<svg width/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Heatmap chart",
|
||||
"args": ["Line feed", "Space", 25, 25, true, "", "", false, "white", "black"]
|
||||
}
|
||||
op: "Heatmap chart",
|
||||
args: [
|
||||
"Line feed",
|
||||
"Space",
|
||||
25,
|
||||
25,
|
||||
true,
|
||||
"",
|
||||
"",
|
||||
false,
|
||||
"white",
|
||||
"black",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
const BASIC_STRING = "The ships hung in the sky in much the same way that bricks don't.";
|
||||
const BASIC_STRING =
|
||||
"The ships hung in the sky in much the same way that bricks don't.";
|
||||
const UTF8_STR = "ნუ პანიკას";
|
||||
const ALL_BYTES = [
|
||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
|
||||
|
@ -35,10 +36,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "00",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-8 Checksum",
|
||||
"args": ["CRC-8"]
|
||||
}
|
||||
]
|
||||
op: "CRC-8 Checksum",
|
||||
args: ["CRC-8"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-8: default check",
|
||||
|
@ -46,10 +47,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "f4",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-8 Checksum",
|
||||
"args": ["CRC-8"]
|
||||
}
|
||||
]
|
||||
op: "CRC-8 Checksum",
|
||||
args: ["CRC-8"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-8: CDMA2000",
|
||||
|
@ -57,10 +58,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "da",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-8 Checksum",
|
||||
"args": ["CRC-8/CDMA2000"]
|
||||
}
|
||||
]
|
||||
op: "CRC-8 Checksum",
|
||||
args: ["CRC-8/CDMA2000"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-8: DARC",
|
||||
|
@ -68,10 +69,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "15",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-8 Checksum",
|
||||
"args": ["CRC-8/DARC"]
|
||||
}
|
||||
]
|
||||
op: "CRC-8 Checksum",
|
||||
args: ["CRC-8/DARC"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-8: DVB-S2",
|
||||
|
@ -79,10 +80,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "bc",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-8 Checksum",
|
||||
"args": ["CRC-8/DVB-S2"]
|
||||
}
|
||||
]
|
||||
op: "CRC-8 Checksum",
|
||||
args: ["CRC-8/DVB-S2"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-8: EBU",
|
||||
|
@ -90,10 +91,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "97",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-8 Checksum",
|
||||
"args": ["CRC-8/EBU"]
|
||||
}
|
||||
]
|
||||
op: "CRC-8 Checksum",
|
||||
args: ["CRC-8/EBU"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-8: I-CODE",
|
||||
|
@ -101,10 +102,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "7e",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-8 Checksum",
|
||||
"args": ["CRC-8/I-CODE"]
|
||||
}
|
||||
]
|
||||
op: "CRC-8 Checksum",
|
||||
args: ["CRC-8/I-CODE"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-8: ITU",
|
||||
|
@ -112,10 +113,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "a1",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-8 Checksum",
|
||||
"args": ["CRC-8/ITU"]
|
||||
}
|
||||
]
|
||||
op: "CRC-8 Checksum",
|
||||
args: ["CRC-8/ITU"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-8: MAXIM",
|
||||
|
@ -123,10 +124,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "a1",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-8 Checksum",
|
||||
"args": ["CRC-8/MAXIM"]
|
||||
}
|
||||
]
|
||||
op: "CRC-8 Checksum",
|
||||
args: ["CRC-8/MAXIM"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-8: ROHC",
|
||||
|
@ -134,10 +135,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "d0",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-8 Checksum",
|
||||
"args": ["CRC-8/ROHC"]
|
||||
}
|
||||
]
|
||||
op: "CRC-8 Checksum",
|
||||
args: ["CRC-8/ROHC"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-8: WCDMA",
|
||||
|
@ -145,10 +146,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "25",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-8 Checksum",
|
||||
"args": ["CRC-8/WCDMA"]
|
||||
}
|
||||
]
|
||||
op: "CRC-8 Checksum",
|
||||
args: ["CRC-8/WCDMA"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-16: nothing",
|
||||
|
@ -156,10 +157,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "0000",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-16 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
op: "CRC-16 Checksum",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-16: basic string",
|
||||
|
@ -167,10 +168,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "0c70",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-16 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
op: "CRC-16 Checksum",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-16: UTF-8",
|
||||
|
@ -178,10 +179,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "dcf6",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-16 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
op: "CRC-16 Checksum",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-16: all bytes",
|
||||
|
@ -189,10 +190,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "bad3",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-16 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
op: "CRC-16 Checksum",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-32: nothing",
|
||||
|
@ -200,10 +201,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "00000000",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-32 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
op: "CRC-32 Checksum",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-32: basic string",
|
||||
|
@ -211,10 +212,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "bf4b739c",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-32 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
op: "CRC-32 Checksum",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-32: UTF-8",
|
||||
|
@ -222,10 +223,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "87553290",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-32 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
op: "CRC-32 Checksum",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CRC-32: all bytes",
|
||||
|
@ -233,9 +234,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "29058c73",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-32 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
}
|
||||
op: "CRC-32 Checksum",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -16,7 +16,7 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "CipherSaber2 Encrypt",
|
||||
args: [{ "option": "Latin1", "string": "test" }, 20],
|
||||
args: [{ option: "Latin1", string: "test" }, 20],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -27,7 +27,7 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "CipherSaber2 Decrypt",
|
||||
args: [{ "option": "Latin1", "string": "test" }, 20],
|
||||
args: [{ option: "Latin1", string: "test" }, 20],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -38,7 +38,7 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "CipherSaber2 Encrypt",
|
||||
args: [{ "option": "Latin1", "string": "" }, 20],
|
||||
args: [{ option: "Latin1", string: "" }, 20],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Affine Encode: no input",
|
||||
|
@ -18,8 +17,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Encode",
|
||||
args: [1, 0]
|
||||
}
|
||||
args: [1, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -29,8 +28,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Encode",
|
||||
args: [0.1, 0.00001]
|
||||
}
|
||||
args: [0.1, 0.00001],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -40,8 +39,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Encode",
|
||||
args: [1, 0]
|
||||
}
|
||||
args: [1, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -51,8 +50,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Encode",
|
||||
args: [23, 23]
|
||||
}
|
||||
args: [23, 23],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -62,8 +61,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Decode",
|
||||
args: [1, 0]
|
||||
}
|
||||
args: [1, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -73,8 +72,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Decode",
|
||||
args: [0.1, 0.00001]
|
||||
}
|
||||
args: [0.1, 0.00001],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -84,8 +83,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Decode",
|
||||
args: [8, 23]
|
||||
}
|
||||
args: [8, 23],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -95,8 +94,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Decode",
|
||||
args: [1, 0]
|
||||
}
|
||||
args: [1, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -106,8 +105,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Decode",
|
||||
args: [23, 23]
|
||||
}
|
||||
args: [23, 23],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -117,8 +116,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "A1Z26 Cipher Encode",
|
||||
args: ["Space"]
|
||||
}
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -128,8 +127,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "A1Z26 Cipher Decode",
|
||||
args: ["Space"]
|
||||
}
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -139,8 +138,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "A1Z26 Cipher Decode",
|
||||
args: ["Space"]
|
||||
}
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -150,8 +149,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Atbash Cipher",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -161,8 +160,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Atbash Cipher",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -171,42 +170,45 @@ TestRegister.addTests([
|
|||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Encode",
|
||||
"args": ["nothing"]
|
||||
}
|
||||
op: "Bifid Cipher Encode",
|
||||
args: ["nothing"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Encode: no key",
|
||||
input: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
expectedOutput: "Vq daqcliho rmltofvlnc qbdhlcr nt qdq Fbm-Rdkkm vuoottnoi aitp al axf tdtmvt owppkaodtx.",
|
||||
expectedOutput:
|
||||
"Vq daqcliho rmltofvlnc qbdhlcr nt qdq Fbm-Rdkkm vuoottnoi aitp al axf tdtmvt owppkaodtx.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Encode",
|
||||
"args": [""]
|
||||
}
|
||||
op: "Bifid Cipher Encode",
|
||||
args: [""],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Encode: invalid key (non-alphabetic)",
|
||||
input: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
expectedOutput: "The key must consist only of letters in the English alphabet",
|
||||
expectedOutput:
|
||||
"The key must consist only of letters in the English alphabet",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Encode",
|
||||
"args": ["abc123"]
|
||||
}
|
||||
op: "Bifid Cipher Encode",
|
||||
args: ["abc123"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Encode: normal",
|
||||
input: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
expectedOutput: "Wc snpsigdd cpfrrcxnfi hikdnnp dm crc Fcb-Pdeug vueageacc vtyl sa zxm crebzp lyoeuaiwpv.",
|
||||
expectedOutput:
|
||||
"Wc snpsigdd cpfrrcxnfi hikdnnp dm crc Fcb-Pdeug vueageacc vtyl sa zxm crebzp lyoeuaiwpv.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Encode",
|
||||
"args": ["Schrodinger"]
|
||||
}
|
||||
op: "Bifid Cipher Encode",
|
||||
args: ["Schrodinger"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -215,42 +217,45 @@ TestRegister.addTests([
|
|||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Decode",
|
||||
"args": ["nothing"]
|
||||
}
|
||||
op: "Bifid Cipher Decode",
|
||||
args: ["nothing"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Decode: no key",
|
||||
input: "Vq daqcliho rmltofvlnc qbdhlcr nt qdq Fbm-Rdkkm vuoottnoi aitp al axf tdtmvt owppkaodtx.",
|
||||
expectedOutput: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
expectedOutput:
|
||||
"We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Decode",
|
||||
"args": [""]
|
||||
}
|
||||
op: "Bifid Cipher Decode",
|
||||
args: [""],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Decode: invalid key (non-alphabetic)",
|
||||
input: "Vq daqcliho rmltofvlnc qbdhlcr nt qdq Fbm-Rdkkm vuoottnoi aitp al axf tdtmvt owppkaodtx.",
|
||||
expectedOutput: "The key must consist only of letters in the English alphabet",
|
||||
expectedOutput:
|
||||
"The key must consist only of letters in the English alphabet",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Decode",
|
||||
"args": ["abc123"]
|
||||
}
|
||||
op: "Bifid Cipher Decode",
|
||||
args: ["abc123"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Decode: normal",
|
||||
input: "Wc snpsigdd cpfrrcxnfi hikdnnp dm crc Fcb-Pdeug vueageacc vtyl sa zxm crebzp lyoeuaiwpv.",
|
||||
expectedOutput: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
expectedOutput:
|
||||
"We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Decode",
|
||||
"args": ["Schrodinger"]
|
||||
}
|
||||
op: "Bifid Cipher Decode",
|
||||
args: ["Schrodinger"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -259,9 +264,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "PFFAJEDBOHECJEDBODEGIMCJPOFLJKDPKLAO",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Citrix CTX1 Encode",
|
||||
"args": []
|
||||
}
|
||||
op: "Citrix CTX1 Encode",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -270,9 +275,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "Password1",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Citrix CTX1 Decode",
|
||||
"args": []
|
||||
}
|
||||
op: "Citrix CTX1 Decode",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -281,9 +286,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "Incorrect hash length",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Citrix CTX1 Decode",
|
||||
"args": []
|
||||
}
|
||||
op: "Citrix CTX1 Decode",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -292,9 +297,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Encode",
|
||||
"args": ["nothing"]
|
||||
}
|
||||
op: "Vigenère Encode",
|
||||
args: ["nothing"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -303,9 +308,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "No key entered",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Encode",
|
||||
"args": [""]
|
||||
}
|
||||
op: "Vigenère Encode",
|
||||
args: [""],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -314,20 +319,21 @@ TestRegister.addTests([
|
|||
expectedOutput: "The key must consist only of letters",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Encode",
|
||||
"args": ["abc123"]
|
||||
}
|
||||
op: "Vigenère Encode",
|
||||
args: ["abc123"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Vigenère Encode: normal",
|
||||
input: "LUGGAGEBASEMENTVARENNESALLIESCANBECLOTHEDASENEMIESENEMIESCANBECLOTHEDASALLIESALWAYSUSEID",
|
||||
expectedOutput: "PXCGRJIEWSVPIQPVRUIQJEJDPOEEJFEQXETOSWDEUDWHJEDLIVANVPMHOCRQFHYLFWLHZAJDPOEEJDPZWYJXWHED",
|
||||
expectedOutput:
|
||||
"PXCGRJIEWSVPIQPVRUIQJEJDPOEEJFEQXETOSWDEUDWHJEDLIVANVPMHOCRQFHYLFWLHZAJDPOEEJDPZWYJXWHED",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Encode",
|
||||
"args": ["Edward"]
|
||||
}
|
||||
op: "Vigenère Encode",
|
||||
args: ["Edward"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -336,9 +342,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Decode",
|
||||
"args": ["nothing"]
|
||||
}
|
||||
op: "Vigenère Decode",
|
||||
args: ["nothing"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -347,9 +353,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "No key entered",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Decode",
|
||||
"args": [""]
|
||||
}
|
||||
op: "Vigenère Decode",
|
||||
args: [""],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -358,20 +364,21 @@ TestRegister.addTests([
|
|||
expectedOutput: "The key must consist only of letters",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Decode",
|
||||
"args": ["abc123"]
|
||||
}
|
||||
op: "Vigenère Decode",
|
||||
args: ["abc123"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Vigenère Decode: normal",
|
||||
input: "PXCGRJIEWSVPIQPVRUIQJEJDPOEEJFEQXETOSWDEUDWHJEDLIVANVPMHOCRQFHYLFWLHZAJDPOEEJDPZWYJXWHED",
|
||||
expectedOutput: "LUGGAGEBASEMENTVARENNESALLIESCANBECLOTHEDASENEMIESENEMIESCANBECLOTHEDASALLIESALWAYSUSEID",
|
||||
expectedOutput:
|
||||
"LUGGAGEBASEMENTVARENNESALLIESCANBECLOTHEDASENEMIESENEMIESCANBECLOTHEDASALLIESALWAYSUSEID",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Decode",
|
||||
"args": ["Edward"]
|
||||
}
|
||||
op: "Vigenère Decode",
|
||||
args: ["Edward"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -380,9 +387,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "flee at once. we are discovered!",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["", ""]
|
||||
}
|
||||
op: "Substitute",
|
||||
args: ["", ""],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -391,20 +398,27 @@ TestRegister.addTests([
|
|||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwxy"]
|
||||
}
|
||||
op: "Substitute",
|
||||
args: [
|
||||
"abcdefghijklmnopqrstuvwxyz",
|
||||
"zebrascdfghijklmnopqtuvwxy",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Substitute: uneven pt/ct",
|
||||
input: "flee at once. we are discovered!",
|
||||
expectedOutput: "Warning: Plaintext and Ciphertext lengths differ\n\nsiaa zq lkba. va zoa rfpbluaoar!",
|
||||
expectedOutput:
|
||||
"Warning: Plaintext and Ciphertext lengths differ\n\nsiaa zq lkba. va zoa rfpbluaoar!",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwx"]
|
||||
}
|
||||
op: "Substitute",
|
||||
args: [
|
||||
"abcdefghijklmnopqrstuvwxyz",
|
||||
"zebrascdfghijklmnopqtuvwx",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -413,9 +427,12 @@ TestRegister.addTests([
|
|||
expectedOutput: "siaa zq lkba. va zoa rfpbluaoar!",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwxy"]
|
||||
}
|
||||
op: "Substitute",
|
||||
args: [
|
||||
"abcdefghijklmnopqrstuvwxyz",
|
||||
"zebrascdfghijklmnopqtuvwxy",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -424,9 +441,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "Cryptography is THE Art of Writing or solving codes",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rail Fence Cipher Decode",
|
||||
"args": [2, 0]
|
||||
}
|
||||
op: "Rail Fence Cipher Decode",
|
||||
args: [2, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -435,9 +452,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "Key has to be bigger than 2",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rail Fence Cipher Decode",
|
||||
"args": [1, 0]
|
||||
}
|
||||
op: "Rail Fence Cipher Decode",
|
||||
args: [1, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -446,9 +463,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "Key should be smaller than the cipher's length",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rail Fence Cipher Decode",
|
||||
"args": [22, 0]
|
||||
}
|
||||
op: "Rail Fence Cipher Decode",
|
||||
args: [22, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -457,9 +474,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "Offset has to be a positive integer",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rail Fence Cipher Decode",
|
||||
"args": [2, -1]
|
||||
}
|
||||
op: "Rail Fence Cipher Decode",
|
||||
args: [2, -1],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -468,9 +485,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "12345678901234567890",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rail Fence Cipher Decode",
|
||||
"args": [4, 2]
|
||||
}
|
||||
op: "Rail Fence Cipher Decode",
|
||||
args: [4, 2],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -479,9 +496,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "Cytgah sTEAto rtn rsligcdsrporpyi H r fWiigo ovn oe",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rail Fence Cipher Encode",
|
||||
"args": [2, 0]
|
||||
}
|
||||
op: "Rail Fence Cipher Encode",
|
||||
args: [2, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -490,9 +507,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "Key has to be bigger than 2",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rail Fence Cipher Encode",
|
||||
"args": [1, 0]
|
||||
}
|
||||
op: "Rail Fence Cipher Encode",
|
||||
args: [1, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -501,9 +518,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "Key should be smaller than the plain text's length",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rail Fence Cipher Encode",
|
||||
"args": [22, 0]
|
||||
}
|
||||
op: "Rail Fence Cipher Encode",
|
||||
args: [22, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -512,9 +529,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "Offset has to be a positive integer",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rail Fence Cipher Encode",
|
||||
"args": [2, -1]
|
||||
}
|
||||
op: "Rail Fence Cipher Encode",
|
||||
args: [2, -1],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -523,9 +540,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "51746026813793592840",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rail Fence Cipher Encode",
|
||||
"args": [4, 2]
|
||||
}
|
||||
op: "Rail Fence Cipher Encode",
|
||||
args: [4, 2],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -10,44 +10,52 @@
|
|||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
const JSON_TEST_DATA = {
|
||||
"store": {
|
||||
"book": [{
|
||||
"category": "reference",
|
||||
"author": "Nigel Rees",
|
||||
"title": "Sayings of the Century",
|
||||
"price": 8.95
|
||||
}, {
|
||||
"category": "fiction",
|
||||
"author": "Evelyn Waugh",
|
||||
"title": "Sword of Honour",
|
||||
"price": 12.99
|
||||
}, {
|
||||
"category": "fiction",
|
||||
"author": "Herman Melville",
|
||||
"title": "Moby Dick",
|
||||
"isbn": "0-553-21311-3",
|
||||
"price": 8.99
|
||||
}, {
|
||||
"category": "fiction",
|
||||
"author": "J. R. R. Tolkien",
|
||||
"title": "The Lord of the Rings",
|
||||
"isbn": "0-395-19395-8",
|
||||
"price": 22.99
|
||||
}],
|
||||
"bicycle": {
|
||||
"color": "red",
|
||||
"price": 19.95
|
||||
store: {
|
||||
book: [
|
||||
{
|
||||
category: "reference",
|
||||
author: "Nigel Rees",
|
||||
title: "Sayings of the Century",
|
||||
price: 8.95,
|
||||
},
|
||||
{
|
||||
category: "fiction",
|
||||
author: "Evelyn Waugh",
|
||||
title: "Sword of Honour",
|
||||
price: 12.99,
|
||||
},
|
||||
{
|
||||
category: "fiction",
|
||||
author: "Herman Melville",
|
||||
title: "Moby Dick",
|
||||
isbn: "0-553-21311-3",
|
||||
price: 8.99,
|
||||
},
|
||||
{
|
||||
category: "fiction",
|
||||
author: "J. R. R. Tolkien",
|
||||
title: "The Lord of the Rings",
|
||||
isbn: "0-395-19395-8",
|
||||
price: 22.99,
|
||||
},
|
||||
],
|
||||
bicycle: {
|
||||
color: "red",
|
||||
price: 19.95,
|
||||
},
|
||||
"newspaper": [{
|
||||
"format": "broadsheet",
|
||||
"title": "Financial Times",
|
||||
"price": 2.75
|
||||
}, {
|
||||
"format": "tabloid",
|
||||
"title": "The Guardian",
|
||||
"price": 2.00
|
||||
}]
|
||||
}
|
||||
newspaper: [
|
||||
{
|
||||
format: "broadsheet",
|
||||
title: "Financial Times",
|
||||
price: 2.75,
|
||||
},
|
||||
{
|
||||
format: "tabloid",
|
||||
title: "The Guardian",
|
||||
price: 2.0,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
TestRegister.addTests([
|
||||
|
@ -57,9 +65,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "helloWorld",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Camel case",
|
||||
"args": [false]
|
||||
}
|
||||
op: "To Camel case",
|
||||
args: [false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -68,9 +76,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "hello_world",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Snake case",
|
||||
"args": [false]
|
||||
}
|
||||
op: "To Snake case",
|
||||
args: [false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -79,9 +87,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "hello-world",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Kebab case",
|
||||
"args": [false]
|
||||
}
|
||||
op: "To Kebab case",
|
||||
args: [false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -93,7 +101,7 @@ TestRegister.addTests([
|
|||
"$a_camel_case_variable;",
|
||||
"function function_name() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
' console.log("things inside quotes do not get broken");',
|
||||
"}",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
|
@ -103,14 +111,14 @@ TestRegister.addTests([
|
|||
"$aCamelCaseVariable;",
|
||||
"function functionName() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
' console.log("things inside quotes do not get broken");',
|
||||
"}",
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Camel case",
|
||||
"args": [true]
|
||||
}
|
||||
op: "To Camel case",
|
||||
args: [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -122,7 +130,7 @@ TestRegister.addTests([
|
|||
"$aSnakeCaseVariable;",
|
||||
"function functionName() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
' console.log("things inside quotes do not get broken");',
|
||||
"}",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
|
@ -132,14 +140,14 @@ TestRegister.addTests([
|
|||
"$a_snake_case_variable;",
|
||||
"function function_name() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
' console.log("things inside quotes do not get broken");',
|
||||
"}",
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Snake case",
|
||||
"args": [true]
|
||||
}
|
||||
op: "To Snake case",
|
||||
args: [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -151,7 +159,7 @@ TestRegister.addTests([
|
|||
"$aKebabCaseVariable;",
|
||||
"function functionName() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
' console.log("things inside quotes do not get broken");',
|
||||
"}",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
|
@ -161,14 +169,14 @@ TestRegister.addTests([
|
|||
"$a-kebab-case-variable;",
|
||||
"function function-name() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
' console.log("things inside quotes do not get broken");',
|
||||
"}",
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Kebab case",
|
||||
"args": [true]
|
||||
}
|
||||
op: "To Kebab case",
|
||||
args: [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -177,9 +185,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "Invalid input JSON: Unexpected end of JSON input",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["", "\n"]
|
||||
}
|
||||
op: "JPath expression",
|
||||
args: ["", "\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -188,126 +196,131 @@ TestRegister.addTests([
|
|||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["", "\n", true]
|
||||
}
|
||||
op: "JPath expression",
|
||||
args: ["", "\n", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: Fetch of values from specific object",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"\"Nigel Rees\"",
|
||||
"\"Evelyn Waugh\"",
|
||||
"\"Herman Melville\"",
|
||||
"\"J. R. R. Tolkien\""
|
||||
'"Nigel Rees"',
|
||||
'"Evelyn Waugh"',
|
||||
'"Herman Melville"',
|
||||
'"J. R. R. Tolkien"',
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$.store.book[*].author", "\n", true]
|
||||
}
|
||||
op: "JPath expression",
|
||||
args: ["$.store.book[*].author", "\n", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: Fetch of all values with matching key",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"\"Sayings of the Century\"",
|
||||
"\"Sword of Honour\"",
|
||||
"\"Moby Dick\"",
|
||||
"\"The Lord of the Rings\"",
|
||||
"\"Financial Times\"",
|
||||
"\"The Guardian\""
|
||||
'"Sayings of the Century"',
|
||||
'"Sword of Honour"',
|
||||
'"Moby Dick"',
|
||||
'"The Lord of the Rings"',
|
||||
'"Financial Times"',
|
||||
'"The Guardian"',
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..title", "\n", true]
|
||||
}
|
||||
op: "JPath expression",
|
||||
args: ["$..title", "\n", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: All data in object",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95},{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99},{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99},{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}]",
|
||||
"{\"color\":\"red\",\"price\":19.95}",
|
||||
"[{\"format\":\"broadsheet\",\"title\":\"Financial Times\",\"price\":2.75},{\"format\":\"tabloid\",\"title\":\"The Guardian\",\"price\":2}]"
|
||||
'[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}]',
|
||||
'{"color":"red","price":19.95}',
|
||||
'[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]',
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$.store.*", "\n", true]
|
||||
}
|
||||
op: "JPath expression",
|
||||
args: ["$.store.*", "\n", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: Last element in array",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: "{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}",
|
||||
expectedOutput:
|
||||
'{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}',
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..book[-1:]", "\n", true]
|
||||
}
|
||||
op: "JPath expression",
|
||||
args: ["$..book[-1:]", "\n", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: First 2 elements in array",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95}",
|
||||
"{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99}"
|
||||
'{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95}',
|
||||
'{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99}',
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..book[:2]", "\n", true]
|
||||
}
|
||||
op: "JPath expression",
|
||||
args: ["$..book[:2]", "\n", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: All elements in array with property",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99}",
|
||||
"{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}"
|
||||
'{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99}',
|
||||
'{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}',
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..book[?(@.isbn)]", "\n", false]
|
||||
}
|
||||
op: "JPath expression",
|
||||
args: ["$..book[?(@.isbn)]", "\n", false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: All elements in array which meet condition",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99}",
|
||||
"{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99}",
|
||||
"{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}"
|
||||
'{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99}',
|
||||
'{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99}',
|
||||
'{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}',
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..book[?(@.price<30 && @.category==\"fiction\")]", "\n", false]
|
||||
}
|
||||
op: "JPath expression",
|
||||
args: [
|
||||
'$..book[?(@.price<30 && @.category=="fiction")]',
|
||||
"\n",
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: All elements in object",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95}",
|
||||
"{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99}"
|
||||
'{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95}',
|
||||
'{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99}',
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..book[?(@.price<10)]", "\n", false]
|
||||
}
|
||||
op: "JPath expression",
|
||||
args: ["$..book[?(@.price<10)]", "\n", false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -315,15 +328,16 @@ TestRegister.addTests([
|
|||
input: "[{}]",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": [
|
||||
op: "JPath expression",
|
||||
args: [
|
||||
"$..[?(({__proto__:[].constructor}).constructor(\"self.postMessage({action:'bakeComplete',data:{bakeId:1,dish:{type:1,value:''},duration:1,error:false,id:undefined,inputNum:2,progress:1,result:'<iframe/onload=debugger>',type: 'html'}});\")();)]",
|
||||
"\n",
|
||||
true
|
||||
]
|
||||
}
|
||||
true,
|
||||
],
|
||||
},
|
||||
],
|
||||
expectedOutput: "Invalid JPath expression: Eval [?(expr)] prevented in JSONPath expression."
|
||||
expectedOutput:
|
||||
"Invalid JPath expression: Eval [?(expr)] prevented in JSONPath expression.",
|
||||
},
|
||||
{
|
||||
name: "CSS selector",
|
||||
|
@ -331,10 +345,10 @@ TestRegister.addTests([
|
|||
expectedOutput: '<p class="a">hello</p>\n<p class="a">again</p>',
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CSS selector",
|
||||
"args": ["#test p.a", "\\n"]
|
||||
}
|
||||
]
|
||||
op: "CSS selector",
|
||||
args: ["#test p.a", "\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "XPath expression",
|
||||
|
@ -342,10 +356,10 @@ TestRegister.addTests([
|
|||
expectedOutput: '<p class="a">hello</p>\n<p class="a">again</p>',
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "XPath expression",
|
||||
"args": ["/div/p[@class=\"a\"]", "\\n"]
|
||||
}
|
||||
]
|
||||
op: "XPath expression",
|
||||
args: ['/div/p[@class="a"]', "\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To MessagePack: no content",
|
||||
|
@ -353,40 +367,42 @@ TestRegister.addTests([
|
|||
expectedMatch: /Unexpected end of JSON input/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To MessagePack",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
op: "To MessagePack",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From MessagePack: no content",
|
||||
input: "",
|
||||
expectedOutput: "Could not decode MessagePack to JSON: Error: Could not parse",
|
||||
expectedOutput:
|
||||
"Could not decode MessagePack to JSON: Error: Could not parse",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Space"]
|
||||
op: "From Hex",
|
||||
args: ["Space"],
|
||||
},
|
||||
{
|
||||
"op": "From MessagePack",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
op: "From MessagePack",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To MessagePack: valid json",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: "81 a5 73 74 6f 72 65 83 a4 62 6f 6f 6b 94 84 a8 63 61 74 65 67 6f 72 79 a9 72 65 66 65 72 65 6e 63 65 a6 61 75 74 68 6f 72 aa 4e 69 67 65 6c 20 52 65 65 73 a5 74 69 74 6c 65 b6 53 61 79 69 6e 67 73 20 6f 66 20 74 68 65 20 43 65 6e 74 75 72 79 a5 70 72 69 63 65 cb 40 21 e6 66 66 66 66 66 84 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 ac 45 76 65 6c 79 6e 20 57 61 75 67 68 a5 74 69 74 6c 65 af 53 77 6f 72 64 20 6f 66 20 48 6f 6e 6f 75 72 a5 70 72 69 63 65 cb 40 29 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 af 48 65 72 6d 61 6e 20 4d 65 6c 76 69 6c 6c 65 a5 74 69 74 6c 65 a9 4d 6f 62 79 20 44 69 63 6b a4 69 73 62 6e ad 30 2d 35 35 33 2d 32 31 33 31 31 2d 33 a5 70 72 69 63 65 cb 40 21 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 b0 4a 2e 20 52 2e 20 52 2e 20 54 6f 6c 6b 69 65 6e a5 74 69 74 6c 65 b5 54 68 65 20 4c 6f 72 64 20 6f 66 20 74 68 65 20 52 69 6e 67 73 a4 69 73 62 6e ad 30 2d 33 39 35 2d 31 39 33 39 35 2d 38 a5 70 72 69 63 65 cb 40 36 fd 70 a3 d7 0a 3d a7 62 69 63 79 63 6c 65 82 a5 63 6f 6c 6f 72 a3 72 65 64 a5 70 72 69 63 65 cb 40 33 f3 33 33 33 33 33 a9 6e 65 77 73 70 61 70 65 72 92 83 a6 66 6f 72 6d 61 74 aa 62 72 6f 61 64 73 68 65 65 74 a5 74 69 74 6c 65 af 46 69 6e 61 6e 63 69 61 6c 20 54 69 6d 65 73 a5 70 72 69 63 65 cb 40 06 00 00 00 00 00 00 83 a6 66 6f 72 6d 61 74 a7 74 61 62 6c 6f 69 64 a5 74 69 74 6c 65 ac 54 68 65 20 47 75 61 72 64 69 61 6e a5 70 72 69 63 65 02",
|
||||
expectedOutput:
|
||||
"81 a5 73 74 6f 72 65 83 a4 62 6f 6f 6b 94 84 a8 63 61 74 65 67 6f 72 79 a9 72 65 66 65 72 65 6e 63 65 a6 61 75 74 68 6f 72 aa 4e 69 67 65 6c 20 52 65 65 73 a5 74 69 74 6c 65 b6 53 61 79 69 6e 67 73 20 6f 66 20 74 68 65 20 43 65 6e 74 75 72 79 a5 70 72 69 63 65 cb 40 21 e6 66 66 66 66 66 84 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 ac 45 76 65 6c 79 6e 20 57 61 75 67 68 a5 74 69 74 6c 65 af 53 77 6f 72 64 20 6f 66 20 48 6f 6e 6f 75 72 a5 70 72 69 63 65 cb 40 29 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 af 48 65 72 6d 61 6e 20 4d 65 6c 76 69 6c 6c 65 a5 74 69 74 6c 65 a9 4d 6f 62 79 20 44 69 63 6b a4 69 73 62 6e ad 30 2d 35 35 33 2d 32 31 33 31 31 2d 33 a5 70 72 69 63 65 cb 40 21 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 b0 4a 2e 20 52 2e 20 52 2e 20 54 6f 6c 6b 69 65 6e a5 74 69 74 6c 65 b5 54 68 65 20 4c 6f 72 64 20 6f 66 20 74 68 65 20 52 69 6e 67 73 a4 69 73 62 6e ad 30 2d 33 39 35 2d 31 39 33 39 35 2d 38 a5 70 72 69 63 65 cb 40 36 fd 70 a3 d7 0a 3d a7 62 69 63 79 63 6c 65 82 a5 63 6f 6c 6f 72 a3 72 65 64 a5 70 72 69 63 65 cb 40 33 f3 33 33 33 33 33 a9 6e 65 77 73 70 61 70 65 72 92 83 a6 66 6f 72 6d 61 74 aa 62 72 6f 61 64 73 68 65 65 74 a5 74 69 74 6c 65 af 46 69 6e 61 6e 63 69 61 6c 20 54 69 6d 65 73 a5 70 72 69 63 65 cb 40 06 00 00 00 00 00 00 83 a6 66 6f 72 6d 61 74 a7 74 61 62 6c 6f 69 64 a5 74 69 74 6c 65 ac 54 68 65 20 47 75 61 72 64 69 61 6e a5 70 72 69 63 65 02",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To MessagePack",
|
||||
"args": []
|
||||
op: "To MessagePack",
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
"op": "To Hex",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
op: "To Hex",
|
||||
args: ["Space"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From MessagePack: valid msgpack",
|
||||
|
@ -394,13 +410,13 @@ TestRegister.addTests([
|
|||
expectedOutput: JSON.stringify(JSON_TEST_DATA, null, 4),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Space"]
|
||||
op: "From Hex",
|
||||
args: ["Space"],
|
||||
},
|
||||
{
|
||||
"op": "From MessagePack",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
}
|
||||
op: "From MessagePack",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -13,26 +13,68 @@ TestRegister.addTests([
|
|||
expectedMatch: /00 00 : a30/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Colossus",
|
||||
"args": [
|
||||
op: "Colossus",
|
||||
args: [
|
||||
"",
|
||||
"KH Pattern",
|
||||
"Z", "", "",
|
||||
"None", "Select Program", "Letter Count",
|
||||
"Z",
|
||||
"",
|
||||
"",
|
||||
"None",
|
||||
"Select Program",
|
||||
"Letter Count",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"", "", "", "", "", false, "",
|
||||
"", "", "", "", "", false, "",
|
||||
"", "", "", "", "", false, "",
|
||||
false,
|
||||
"",
|
||||
false, false, false, false, false,
|
||||
"", false, false, "",
|
||||
"",
|
||||
0, "", "",
|
||||
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1"
|
||||
]
|
||||
}
|
||||
]
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
// Takes a while to run, so disabling for general purpose testing. Re-enable if modifying this operation.
|
||||
// {
|
||||
|
|
|
@ -34,10 +34,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Comment",
|
||||
"args": [""]
|
||||
}
|
||||
]
|
||||
op: "Comment",
|
||||
args: [""],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fork, Comment, Base64",
|
||||
|
@ -45,18 +45,18 @@ TestRegister.addTests([
|
|||
expectedOutput: "Y2F0\nc2F0\nbWF0",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Fork",
|
||||
"args": ["\\n", "\\n", false]
|
||||
op: "Fork",
|
||||
args: ["\\n", "\\n", false],
|
||||
},
|
||||
{
|
||||
"op": "Comment",
|
||||
"args": ["Testing 123"]
|
||||
op: "Comment",
|
||||
args: ["Testing 123"],
|
||||
},
|
||||
{
|
||||
"op": "To Base64",
|
||||
"args": ["A-Za-z0-9+/="]
|
||||
}
|
||||
]
|
||||
op: "To Base64",
|
||||
args: ["A-Za-z0-9+/="],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Label, Comment: Complex content",
|
||||
|
@ -65,12 +65,12 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Label",
|
||||
args: [""]
|
||||
args: [""],
|
||||
},
|
||||
{
|
||||
op: "Comment",
|
||||
args: [""]
|
||||
}
|
||||
]
|
||||
}
|
||||
args: [""],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -14,13 +14,13 @@ TestRegister.addTests([
|
|||
expectedOutput: "The cat sat on the mat.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Space"]
|
||||
op: "From Hex",
|
||||
args: ["Space"],
|
||||
},
|
||||
{
|
||||
"op": "Bzip2 Decompress",
|
||||
"args": []
|
||||
}
|
||||
op: "Bzip2 Decompress",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -30,12 +30,12 @@ TestRegister.addTests([
|
|||
expectedOutput: "The cat sat on the mat.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "LZMA Compress",
|
||||
"args": ["6"]
|
||||
op: "LZMA Compress",
|
||||
args: ["6"],
|
||||
},
|
||||
{
|
||||
"op": "LZMA Decompress",
|
||||
"args": []
|
||||
op: "LZMA Decompress",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -46,17 +46,17 @@ TestRegister.addTests([
|
|||
expectedOutput: "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Space"]
|
||||
op: "From Hex",
|
||||
args: ["Space"],
|
||||
},
|
||||
{
|
||||
"op": "LZMA Decompress",
|
||||
"args": []
|
||||
op: "LZMA Decompress",
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
"op": "To Hex",
|
||||
"args": ["Space", 0]
|
||||
}
|
||||
op: "To Hex",
|
||||
args: ["Space", 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -66,28 +66,29 @@ TestRegister.addTests([
|
|||
expectedOutput: "The cat sat on the mat.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Space"]
|
||||
op: "From Hex",
|
||||
args: ["Space"],
|
||||
},
|
||||
{
|
||||
"op": "LZMA Decompress",
|
||||
"args": []
|
||||
}
|
||||
op: "LZMA Decompress",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "LZ4 Compress",
|
||||
input: "The cat sat on the mat.",
|
||||
expectedOutput: "04224d184070df170000805468652063617420736174206f6e20746865206d61742e00000000",
|
||||
expectedOutput:
|
||||
"04224d184070df170000805468652063617420736174206f6e20746865206d61742e00000000",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "LZ4 Compress",
|
||||
"args": []
|
||||
op: "LZ4 Compress",
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
"op": "To Hex",
|
||||
"args": ["None", 0]
|
||||
}
|
||||
op: "To Hex",
|
||||
args: ["None", 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -96,13 +97,13 @@ TestRegister.addTests([
|
|||
expectedOutput: "The cat sat on the mat.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "LZ4 Decompress",
|
||||
"args": []
|
||||
}
|
||||
op: "LZ4 Decompress",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -11,12 +11,8 @@ import TestRegister from "../../lib/TestRegister.mjs";
|
|||
TestRegister.addTests([
|
||||
{
|
||||
name: "Conditional Jump: Skips 0",
|
||||
input: [
|
||||
"should be changed",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
"YzJodmRXeGtJR0psSUdOb1lXNW5aV1E9"
|
||||
].join("\n"),
|
||||
input: ["should be changed"].join("\n"),
|
||||
expectedOutput: ["YzJodmRXeGtJR0psSUdOb1lXNW5aV1E9"].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Conditional Jump",
|
||||
|
@ -34,13 +30,9 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
name: "Conditional Jump: Skips 1",
|
||||
input: [
|
||||
"should be changed",
|
||||
].join("\n"),
|
||||
input: ["should be changed"].join("\n"),
|
||||
// Expecting base32, not base64 output
|
||||
expectedOutput: [
|
||||
"ONUG65LMMQQGEZJAMNUGC3THMVSA====",
|
||||
].join("\n"),
|
||||
expectedOutput: ["ONUG65LMMQQGEZJAMNUGC3THMVSA===="].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Conditional Jump",
|
||||
|
@ -51,7 +43,8 @@ TestRegister.addTests([
|
|||
args: ["A-Za-z0-9+/="],
|
||||
},
|
||||
{
|
||||
op: "Label", args: ["skip match"],
|
||||
op: "Label",
|
||||
args: ["skip match"],
|
||||
},
|
||||
{
|
||||
op: "To Base32",
|
||||
|
@ -61,12 +54,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
name: "Conditional Jump: Skips backwards",
|
||||
input: [
|
||||
"match",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
"f7cf556f7f4fc6635db8c314f7a81f2a",
|
||||
].join("\n"),
|
||||
input: ["match"].join("\n"),
|
||||
expectedOutput: ["f7cf556f7f4fc6635db8c314f7a81f2a"].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Label",
|
||||
|
@ -89,5 +78,5 @@ TestRegister.addTests([
|
|||
args: ["match", false, "back to the beginning", 10],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -28,7 +28,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Decimal Degrees", "Comma", "Degrees Minutes Seconds", "Comma", "None", 1]
|
||||
args: [
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Degrees Minutes Seconds",
|
||||
"Comma",
|
||||
"None",
|
||||
1,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -39,7 +46,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Degrees Minutes Seconds", "Comma", "Decimal Degrees", "Comma", "None", 3]
|
||||
args: [
|
||||
"Degrees Minutes Seconds",
|
||||
"Comma",
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"None",
|
||||
3,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -50,9 +64,16 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Decimal Degrees", "Comma", "Degrees Decimal Minutes", "Comma", "None", 2]
|
||||
}
|
||||
]
|
||||
args: [
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Degrees Decimal Minutes",
|
||||
"Comma",
|
||||
"None",
|
||||
2,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Co-ordinates: From Degrees Decimal Minutes to Decimal Degrees",
|
||||
|
@ -61,9 +82,16 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Degrees Decimal Minutes", "Comma", "Decimal Degrees", "Comma", "None", 3]
|
||||
}
|
||||
]
|
||||
args: [
|
||||
"Degrees Decimal Minutes",
|
||||
"Comma",
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"None",
|
||||
3,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Co-ordinates: From Decimal Degrees to Decimal Degrees",
|
||||
|
@ -72,9 +100,16 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "None", 3]
|
||||
}
|
||||
]
|
||||
args: [
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"None",
|
||||
3,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Co-ordinates: From Decimal Degrees to Geohash",
|
||||
|
@ -83,7 +118,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Decimal Degrees", "Comma", "Geohash", "Comma", "None", 9]
|
||||
args: [
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Geohash",
|
||||
"Comma",
|
||||
"None",
|
||||
9,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -94,7 +136,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Geohash", "Comma", "Decimal Degrees", "Comma", "None", 3]
|
||||
args: [
|
||||
"Geohash",
|
||||
"Comma",
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"None",
|
||||
3,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -105,7 +154,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Decimal Degrees", "Comma", "Military Grid Reference System", "Comma", "None", 10]
|
||||
args: [
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Military Grid Reference System",
|
||||
"Comma",
|
||||
"None",
|
||||
10,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -116,9 +172,16 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Military Grid Reference System", "Comma", "Decimal Degrees", "Comma", "None", 3]
|
||||
}
|
||||
]
|
||||
args: [
|
||||
"Military Grid Reference System",
|
||||
"Comma",
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"None",
|
||||
3,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Co-ordinates: From Decimal Degrees to OSNG",
|
||||
|
@ -127,7 +190,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Decimal Degrees", "Comma", "Ordnance Survey National Grid", "Comma", "None", 10]
|
||||
args: [
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Ordnance Survey National Grid",
|
||||
"Comma",
|
||||
"None",
|
||||
10,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -138,7 +208,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Ordnance Survey National Grid", "Comma", "Decimal Degrees", "Comma", "None", 3]
|
||||
args: [
|
||||
"Ordnance Survey National Grid",
|
||||
"Comma",
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"None",
|
||||
3,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -149,7 +226,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Decimal Degrees", "Comma", "Universal Transverse Mercator", "Comma", "None", 0]
|
||||
args: [
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Universal Transverse Mercator",
|
||||
"Comma",
|
||||
"None",
|
||||
0,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -160,7 +244,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Universal Transverse Mercator", "Comma", "Decimal Degrees", "Comma", "None", 3]
|
||||
args: [
|
||||
"Universal Transverse Mercator",
|
||||
"Comma",
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"None",
|
||||
3,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -171,7 +262,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "None", 3]
|
||||
args: [
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"None",
|
||||
3,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -182,7 +280,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "Before", 3]
|
||||
args: [
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Before",
|
||||
3,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -193,7 +298,14 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "Before", 3]
|
||||
args: [
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Before",
|
||||
3,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -204,8 +316,15 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert co-ordinate format",
|
||||
args: ["Decimal Degrees", "Comma", "Degrees Minutes Seconds", "Comma", "Before", 3]
|
||||
args: [
|
||||
"Decimal Degrees",
|
||||
"Comma",
|
||||
"Degrees Minutes Seconds",
|
||||
"Comma",
|
||||
"Before",
|
||||
3,
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -14,19 +14,20 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Convert to NATO alphabet",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Convert to NATO alphabet: full alphabet with numbers",
|
||||
input: "abcdefghijklmnopqrstuvwxyz0123456789,/.",
|
||||
expectedOutput: "Alfa Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliett Kilo Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whiskey X-ray Yankee Zulu Zero One Two Three Four Five Six Seven Eight Nine Comma Fraction bar Full stop ",
|
||||
expectedOutput:
|
||||
"Alfa Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliett Kilo Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whiskey X-ray Yankee Zulu Zero One Two Three Four Five Six Seven Eight Nine Comma Fraction bar Full stop ",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Convert to NATO alphabet",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,7 +19,8 @@ TestRegister.addTests([
|
|||
args: [],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: "Defang IP: Valid IPV6",
|
||||
input: "2001:0db8:85a3:0000:0000:8a2e:0370:7343",
|
||||
expectedOutput: "2001[:]0db8[:]85a3[:]0000[:]0000[:]8a2e[:]0370[:]7343",
|
||||
|
@ -29,7 +30,8 @@ TestRegister.addTests([
|
|||
args: [],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: "Defang IP: Valid IPV6 Shorthand",
|
||||
input: "2001:db8:3c4d:15::1a2f:1a2b",
|
||||
expectedOutput: "2001[:]db8[:]3c4d[:]15[:][:]1a2f[:]1a2b",
|
||||
|
|
|
@ -4,12 +4,21 @@
|
|||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
import {ELF32_LE, ELF32_BE, ELF64_LE, ELF64_BE} from "../../samples/Executables.mjs";
|
||||
import {
|
||||
ELF32_LE,
|
||||
ELF32_BE,
|
||||
ELF64_LE,
|
||||
ELF64_BE,
|
||||
} from "../../samples/Executables.mjs";
|
||||
|
||||
const ELF32_LE_OUTPUT = "============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 32-bit\nEndianness: Little\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: x86\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x34\nEntry SHOFF: 0x54\nFlags: 00000000\nELF Header Size: 52 bytes\nProgram Header Size: 32 bytes\nProgram Header Entries: 1\nSection Header Size: 40 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\nFlags: Execute,Read\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 204\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 230\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 245\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
|
||||
const ELF32_BE_OUTPUT = "============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 32-bit\nEndianness: Big\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: x86\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x34\nEntry SHOFF: 0x54\nFlags: 00000000\nELF Header Size: 52 bytes\nProgram Header Size: 32 bytes\nProgram Header Entries: 1\nSection Header Size: 40 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\nFlags: Execute,Read\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 204\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 230\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 245\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
|
||||
const ELF64_LE_OUTPUT = "============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 64-bit\nEndianness: Little\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: AMD x86-64\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x40\nEntry SHOFF: 0x78\nFlags: 00000000\nELF Header Size: 64 bytes\nProgram Header Size: 56 bytes\nProgram Header Entries: 1\nSection Header Size: 64 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nFlags: Execute,Read\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 312\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 336\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 361\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
|
||||
const ELF64_BE_OUTPUT = "============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 64-bit\nEndianness: Big\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: AMD x86-64\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x40\nEntry SHOFF: 0x78\nFlags: 00000000\nELF Header Size: 64 bytes\nProgram Header Size: 56 bytes\nProgram Header Entries: 1\nSection Header Size: 64 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nFlags: Execute,Read\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 312\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 336\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 361\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
|
||||
const ELF32_LE_OUTPUT =
|
||||
"============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 32-bit\nEndianness: Little\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: x86\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x34\nEntry SHOFF: 0x54\nFlags: 00000000\nELF Header Size: 52 bytes\nProgram Header Size: 32 bytes\nProgram Header Entries: 1\nSection Header Size: 40 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\nFlags: Execute,Read\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 204\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 230\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 245\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
|
||||
const ELF32_BE_OUTPUT =
|
||||
"============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 32-bit\nEndianness: Big\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: x86\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x34\nEntry SHOFF: 0x54\nFlags: 00000000\nELF Header Size: 52 bytes\nProgram Header Size: 32 bytes\nProgram Header Entries: 1\nSection Header Size: 40 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\nFlags: Execute,Read\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 204\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 230\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 245\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
|
||||
const ELF64_LE_OUTPUT =
|
||||
"============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 64-bit\nEndianness: Little\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: AMD x86-64\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x40\nEntry SHOFF: 0x78\nFlags: 00000000\nELF Header Size: 64 bytes\nProgram Header Size: 56 bytes\nProgram Header Entries: 1\nSection Header Size: 64 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nFlags: Execute,Read\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 312\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 336\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 361\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
|
||||
const ELF64_BE_OUTPUT =
|
||||
"============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 64-bit\nEndianness: Big\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: AMD x86-64\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x40\nEntry SHOFF: 0x78\nFlags: 00000000\nELF Header Size: 64 bytes\nProgram Header Size: 56 bytes\nProgram Header Entries: 1\nSection Header Size: 64 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nFlags: Execute,Read\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 312\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 336\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 361\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -11,44 +11,48 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Extract email address",
|
||||
input: "email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com email@example.name\nemail@example.museum email@example.co.jp firstname-lastname@example.com",
|
||||
expectedOutput: "email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
|
||||
expectedOutput:
|
||||
"email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract email addresses",
|
||||
"args": [false]
|
||||
op: "Extract email addresses",
|
||||
args: [false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Extract email address - Display total",
|
||||
input: "email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com email@example.name\nemail@example.museum email@example.co.jp firstname-lastname@example.com",
|
||||
expectedOutput: "Total found: 11\n\nemail@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
|
||||
expectedOutput:
|
||||
"Total found: 11\n\nemail@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract email addresses",
|
||||
"args": [true]
|
||||
op: "Extract email addresses",
|
||||
args: [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Extract email address (Internationalized)",
|
||||
input: "\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9 \u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c \u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc Jos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com and Jos\u1ec5Silva@google.com\nFoO@BaR.CoM, john@192.168.10.100\ng\xf3mez@junk.br and Abc.123@example.com.\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
|
||||
expectedOutput: "\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
|
||||
expectedOutput:
|
||||
"\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract email addresses",
|
||||
"args": [false]
|
||||
op: "Extract email addresses",
|
||||
args: [false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Extract email address - Display total (Internationalized)",
|
||||
input: "\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9 \u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c \u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc Jos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com and Jos\u1ec5Silva@google.com\nFoO@BaR.CoM, john@192.168.10.100\ng\xf3mez@junk.br and Abc.123@example.com.\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
|
||||
expectedOutput: "Total found: 19\n\n\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
|
||||
expectedOutput:
|
||||
"Total found: 19\n\n\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract email addresses",
|
||||
"args": [true]
|
||||
op: "Extract email addresses",
|
||||
args: [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -15,19 +15,20 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Fernet Decrypt",
|
||||
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
|
||||
}
|
||||
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fernet Decrypt: no secret",
|
||||
input: "gAAAAABce-Tycae8klRxhDX2uenJ-uwV8-A1XZ2HRnfOXlNzkKKfRxviNLlgtemhT_fd1Fw5P_zFUAjd69zaJBQyWppAxVV00SExe77ql8c5n62HYJOnoIU=",
|
||||
expectedOutput: "Error: Secret must be 32 url-safe base64-encoded bytes.",
|
||||
expectedOutput:
|
||||
"Error: Secret must be 32 url-safe base64-encoded bytes.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Fernet Decrypt",
|
||||
args: [""]
|
||||
}
|
||||
args: [""],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -37,10 +38,10 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Fernet Decrypt",
|
||||
args: ["VGhpc0lzVGhpcnR5VHdvQ2hhcmFjdGVyc0xvbmdLZXk="]
|
||||
}
|
||||
args: ["VGhpc0lzVGhpcnR5VHdvQ2hhcmFjdGVyc0xvbmdLZXk="],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
||||
TestRegister.addTests([
|
||||
|
@ -51,19 +52,20 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Fernet Encrypt",
|
||||
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
|
||||
}
|
||||
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fernet Encrypt: no secret",
|
||||
input: "This is a secret message.\n",
|
||||
expectedOutput: "Error: Secret must be 32 url-safe base64-encoded bytes.",
|
||||
expectedOutput:
|
||||
"Error: Secret must be 32 url-safe base64-encoded bytes.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Fernet Encrypt",
|
||||
args: [""]
|
||||
}
|
||||
args: [""],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -73,8 +75,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Fernet Encrypt",
|
||||
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
|
||||
}
|
||||
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -9,14 +9,15 @@ import TestRegister from "../../lib/TestRegister.mjs";
|
|||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
"name": "File Tree: basic example",
|
||||
"input": "/test_dir1/test_file1.txt\n/test_dir1/test_file2.txt\n/test_dir2/test_file1.txt",
|
||||
"expectedOutput": "test_dir1\n|---test_file1.txt\n|---test_file2.txt\ntest_dir2\n|---test_file1.txt",
|
||||
"recipeConfig": [
|
||||
name: "File Tree: basic example",
|
||||
input: "/test_dir1/test_file1.txt\n/test_dir1/test_file2.txt\n/test_dir2/test_file1.txt",
|
||||
expectedOutput:
|
||||
"test_dir1\n|---test_file1.txt\n|---test_file2.txt\ntest_dir2\n|---test_file1.txt",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "File Tree",
|
||||
"args": ["/", "Line feed"],
|
||||
op: "File Tree",
|
||||
args: ["/", "Line feed"],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -38,7 +38,8 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Fork, (expect) Error, Merge",
|
||||
input: "1,2,3,4\n\n3,4,5,6",
|
||||
expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
|
||||
expectedOutput:
|
||||
"Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Fork",
|
||||
|
@ -57,25 +58,26 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Fork, Conditional Jump, Encodings",
|
||||
input: "Some data with a 1 in it\nSome data with a 2 in it",
|
||||
expectedOutput: "U29tZSBkYXRhIHdpdGggYSAxIGluIGl0\n53 6f 6d 65 20 64 61 74 61 20 77 69 74 68 20 61 20 32 20 69 6e 20 69 74",
|
||||
expectedOutput:
|
||||
"U29tZSBkYXRhIHdpdGggYSAxIGluIGl0\n53 6f 6d 65 20 64 61 74 61 20 77 69 74 68 20 61 20 32 20 69 6e 20 69 74",
|
||||
recipeConfig: [
|
||||
{"op": "Fork", "args": ["\\n", "\\n", false]},
|
||||
{"op": "Conditional Jump", "args": ["1", false, "skipReturn", "10"]},
|
||||
{"op": "To Hex", "args": ["Space"]},
|
||||
{"op": "Return", "args": []},
|
||||
{"op": "Label", "args": ["skipReturn"]},
|
||||
{"op": "To Base64", "args": ["A-Za-z0-9+/="]}
|
||||
]
|
||||
{ op: "Fork", args: ["\\n", "\\n", false] },
|
||||
{ op: "Conditional Jump", args: ["1", false, "skipReturn", "10"] },
|
||||
{ op: "To Hex", args: ["Space"] },
|
||||
{ op: "Return", args: [] },
|
||||
{ op: "Label", args: ["skipReturn"] },
|
||||
{ op: "To Base64", args: ["A-Za-z0-9+/="] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fork, Partial Merge",
|
||||
input: "Hello World",
|
||||
expectedOutput: "48656c6c6f 576f726c64",
|
||||
recipeConfig: [
|
||||
{ "op": "Fork", "args": [" ", " ", false] },
|
||||
{ "op": "Fork", "args": ["l", "l", false] },
|
||||
{ "op": "Merge", "args": [false] },
|
||||
{ "op": "To Hex", "args": ["None", 0] },
|
||||
]
|
||||
{ op: "Fork", args: [" ", " ", false] },
|
||||
{ op: "Fork", args: ["l", "l", false] },
|
||||
{ op: "Merge", args: [false] },
|
||||
{ op: "To Hex", args: ["None", 0] },
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -15,7 +15,7 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Decimal",
|
||||
args: ["Space", false]
|
||||
args: ["Space", false],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -26,7 +26,7 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Decimal",
|
||||
args: ["Comma", true]
|
||||
args: ["Comma", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -21,8 +21,8 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "GOST Encrypt",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "0011223344556677" },
|
||||
{ option: "Hex", string: "00112233" },
|
||||
{ option: "Hex", string: "0011223344556677" },
|
||||
"Raw",
|
||||
"Hex",
|
||||
"GOST 28147 (Magma, 1989)",
|
||||
|
@ -30,9 +30,9 @@ TestRegister.addTests([
|
|||
"E-SC",
|
||||
"OFB",
|
||||
"CP",
|
||||
"ZERO"
|
||||
]
|
||||
}
|
||||
"ZERO",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -43,8 +43,11 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "GOST Encrypt",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" },
|
||||
{ option: "Hex", string: "00112233" },
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00112233445566778899aabbccddeeff",
|
||||
},
|
||||
"Raw",
|
||||
"Hex",
|
||||
"GOST R 34.12 (Kuznyechik, 2015)",
|
||||
|
@ -52,9 +55,9 @@ TestRegister.addTests([
|
|||
"E-SC",
|
||||
"CBC",
|
||||
"CP",
|
||||
"PKCS5"
|
||||
]
|
||||
}
|
||||
"PKCS5",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -65,8 +68,8 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "GOST Decrypt",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "0011223344556677" },
|
||||
{ option: "Hex", string: "00112233" },
|
||||
{ option: "Hex", string: "0011223344556677" },
|
||||
"Hex",
|
||||
"Raw",
|
||||
"GOST 28147 (Magma, 1989)",
|
||||
|
@ -74,9 +77,9 @@ TestRegister.addTests([
|
|||
"E-SC",
|
||||
"OFB",
|
||||
"CP",
|
||||
"ZERO"
|
||||
]
|
||||
}
|
||||
"ZERO",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -87,8 +90,11 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "GOST Decrypt",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" },
|
||||
{ option: "Hex", string: "00112233" },
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00112233445566778899aabbccddeeff",
|
||||
},
|
||||
"Hex",
|
||||
"Raw",
|
||||
"GOST R 34.12 (Kuznyechik, 2015)",
|
||||
|
@ -96,9 +102,9 @@ TestRegister.addTests([
|
|||
"E-TEST",
|
||||
"CBC",
|
||||
"CP",
|
||||
"PKCS5"
|
||||
]
|
||||
}
|
||||
"PKCS5",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -109,16 +115,16 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "GOST Sign",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "0011223344556677" },
|
||||
{ option: "Hex", string: "00112233" },
|
||||
{ option: "Hex", string: "0011223344556677" },
|
||||
"Raw",
|
||||
"Hex",
|
||||
"GOST 28147 (Magma, 1989)",
|
||||
"64",
|
||||
"E-C",
|
||||
48
|
||||
]
|
||||
}
|
||||
48,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -129,35 +135,39 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "GOST Verify",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" },
|
||||
{ "option": "Hex", "string": "42b77fb3d6f6bf04" },
|
||||
{ option: "Hex", string: "00112233" },
|
||||
{
|
||||
option: "Hex",
|
||||
string: "00112233445566778899aabbccddeeff",
|
||||
},
|
||||
{ option: "Hex", string: "42b77fb3d6f6bf04" },
|
||||
"Raw",
|
||||
"GOST R 34.12 (Kuznyechik, 2015)",
|
||||
"128",
|
||||
"E-TEST"
|
||||
]
|
||||
}
|
||||
"E-TEST",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "GOST Key Wrap",
|
||||
input: "Hello, World!123",
|
||||
expectedOutput: "0bb706e92487fceef97589911faeb28200000000000000000000000000000000\r\n6b7bfd16",
|
||||
expectedOutput:
|
||||
"0bb706e92487fceef97589911faeb28200000000000000000000000000000000\r\n6b7bfd16",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "GOST Key Wrap",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "0011223344556677" },
|
||||
{ option: "Hex", string: "00112233" },
|
||||
{ option: "Hex", string: "0011223344556677" },
|
||||
"Raw",
|
||||
"Hex",
|
||||
"GOST R 34.12 (Kuznyechik, 2015)",
|
||||
"64",
|
||||
"E-TEST",
|
||||
"CP"
|
||||
]
|
||||
}
|
||||
"CP",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -168,16 +178,16 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "GOST Key Unwrap",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "" },
|
||||
{ "option": "Latin1", "string": "00112233" },
|
||||
{ option: "Hex", string: "" },
|
||||
{ option: "Latin1", string: "00112233" },
|
||||
"Hex",
|
||||
"Raw",
|
||||
"GOST 28147 (Magma, 1989)",
|
||||
"64",
|
||||
"E-Z",
|
||||
"CP"
|
||||
]
|
||||
}
|
||||
"CP",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -67,10 +67,10 @@ CRC-32: d87f7e0c
|
|||
`,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Generate all hashes",
|
||||
"args": ["All", true]
|
||||
}
|
||||
]
|
||||
op: "Generate all hashes",
|
||||
args: ["All", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Hashes with length 32",
|
||||
|
@ -86,10 +86,10 @@ NT Hash: 0CB6948805F797BF2A82807973B89537
|
|||
`,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Generate all hashes",
|
||||
"args": ["128", true]
|
||||
}
|
||||
]
|
||||
op: "Generate all hashes",
|
||||
args: ["128", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Hashes without names",
|
||||
|
@ -107,9 +107,9 @@ ee67303696d205ddd2b2363e8e01b4b7199a80957d94d7678eaad3fc834c5a27
|
|||
`,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Generate all hashes",
|
||||
"args": ["256", false]
|
||||
}
|
||||
]
|
||||
}
|
||||
op: "Generate all hashes",
|
||||
args: ["256", false],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -14,20 +14,21 @@ TestRegister.addTests([
|
|||
expectedOutput: "00010111",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Generate De Bruijn Sequence",
|
||||
"args": [2, 3]
|
||||
}
|
||||
]
|
||||
op: "Generate De Bruijn Sequence",
|
||||
args: [2, 3],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Generate De Bruijn Sequence: Long Sequence",
|
||||
input: "",
|
||||
expectedOutput: "0000010000200003000110001200013000210002200023000310003200033001010010200103001110011200113001210012200123001310013200133002010020200203002110021200213002210022200223002310023200233003010030200303003110031200313003210032200323003310033200333010110101201013010210102201023010310103201033011020110301111011120111301121011220112301131011320113301202012030121101212012130122101222012230123101232012330130201303013110131201313013210132201323013310133201333020210202202023020310203202033021030211102112021130212102122021230213102132021330220302211022120221302221022220222302231022320223302303023110231202313023210232202323023310233202333030310303203033031110311203113031210312203123031310313203133032110321203213032210322203223032310323203233033110331203313033210332203323033310333203333111112111131112211123111321113311212112131122211223112321123311312113131132211323113321133312122121231213212133122131222212223122321223312313123221232312332123331313213133132221322313232132331332213323133321333322222322233223232233323233233333",
|
||||
expectedOutput:
|
||||
"0000010000200003000110001200013000210002200023000310003200033001010010200103001110011200113001210012200123001310013200133002010020200203002110021200213002210022200223002310023200233003010030200303003110031200313003210032200323003310033200333010110101201013010210102201023010310103201033011020110301111011120111301121011220112301131011320113301202012030121101212012130122101222012230123101232012330130201303013110131201313013210132201323013310133201333020210202202023020310203202033021030211102112021130212102122021230213102132021330220302211022120221302221022220222302231022320223302303023110231202313023210232202323023310233202333030310303203033031110311203113031210312203123031310313203133032110321203213032210322203223032310323203233033110331203313033210332203323033310333203333111112111131112211123111321113311212112131122211223112321123311312113131132211323113321133312122121231213212133122131222212223122321223312313123221232312332123331313213133132221322313232132331332213323133321333322222322233223232233323233233333",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Generate De Bruijn Sequence",
|
||||
"args": [4, 5]
|
||||
}
|
||||
]
|
||||
}
|
||||
op: "Generate De Bruijn Sequence",
|
||||
args: [4, 5],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -11,13 +11,14 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "All casings of test",
|
||||
input: "test",
|
||||
expectedOutput: "test\nTest\ntEst\nTEst\nteSt\nTeSt\ntESt\nTESt\ntesT\nTesT\ntEsT\nTEsT\nteST\nTeST\ntEST\nTEST",
|
||||
expectedOutput:
|
||||
"test\nTest\ntEst\nTEst\nteSt\nTeSt\ntESt\nTESt\ntesT\nTesT\ntEsT\nTEsT\nteST\nTeST\ntEST\nTEST",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Get All Casings",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
op: "Get All Casings",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "All casings of t",
|
||||
|
@ -25,10 +26,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "t\nT",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Get All Casings",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
op: "Get All Casings",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "All casings of null",
|
||||
|
@ -36,9 +37,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Get All Casings",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
}
|
||||
op: "Get All Casings",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -17,13 +17,13 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
op: "Gunzip",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Gunzip: No comment, no checksum and filename",
|
||||
|
@ -32,13 +32,13 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
op: "Gunzip",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Gunzip: Has a comment, no checksum and has a filename",
|
||||
|
@ -47,12 +47,12 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
op: "Gunzip",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -13,77 +13,81 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Gzip: No comment, no checksum and no filename",
|
||||
input: "The quick brown fox jumped over the slow dog",
|
||||
expectedOutput: "0dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
|
||||
expectedOutput:
|
||||
"0dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Gzip",
|
||||
args: ["Dynamic Huffman Coding", "", "", false]
|
||||
args: ["Dynamic Huffman Coding", "", "", false],
|
||||
},
|
||||
{
|
||||
op: "Drop bytes",
|
||||
args: [0, 10, false]
|
||||
args: [0, 10, false],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None"]
|
||||
}
|
||||
]
|
||||
args: ["None"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Gzip: No comment, no checksum and has a filename",
|
||||
input: "The quick brown fox jumped over the slow dog",
|
||||
expectedOutput: "636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
|
||||
expectedOutput:
|
||||
"636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Gzip",
|
||||
args: ["Dynamic Huffman Coding", "comment", "", false]
|
||||
args: ["Dynamic Huffman Coding", "comment", "", false],
|
||||
},
|
||||
{
|
||||
op: "Drop bytes",
|
||||
args: [0, 10, false]
|
||||
args: [0, 10, false],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None"]
|
||||
}
|
||||
]
|
||||
args: ["None"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Gzip: Has a comment, no checksum and no filename",
|
||||
input: "The quick brown fox jumped over the slow dog",
|
||||
expectedOutput: "636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
|
||||
expectedOutput:
|
||||
"636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Gzip",
|
||||
args: ["Dynamic Huffman Coding", "", "comment", false]
|
||||
args: ["Dynamic Huffman Coding", "", "comment", false],
|
||||
},
|
||||
{
|
||||
op: "Drop bytes",
|
||||
args: [0, 10, false]
|
||||
args: [0, 10, false],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None"]
|
||||
}
|
||||
]
|
||||
args: ["None"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Gzip: Has a comment, no checksum and has a filename",
|
||||
input: "The quick brown fox jumped over the slow dog",
|
||||
expectedOutput: "66696c656e616d6500636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
|
||||
expectedOutput:
|
||||
"66696c656e616d6500636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Gzip",
|
||||
args: ["Dynamic Huffman Coding", "filename", "comment", false]
|
||||
args: ["Dynamic Huffman Coding", "filename", "comment", false],
|
||||
},
|
||||
{
|
||||
op: "Drop bytes",
|
||||
args: [0, 10, false]
|
||||
args: [0, 10, false],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None"]
|
||||
}
|
||||
]
|
||||
args: ["None"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -14,9 +14,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "21b457a327ce7a2d4fce5ef2c42400bd",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "HASSH Client Fingerprint",
|
||||
"args": ["Hex", "Hash digest"]
|
||||
}
|
||||
op: "HASSH Client Fingerprint",
|
||||
args: ["Hex", "Hash digest"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -25,9 +25,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "f430cd6761697a6a658ee1d45ed22e49",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "HASSH Server Fingerprint",
|
||||
"args": ["Hex", "Hash digest"]
|
||||
}
|
||||
op: "HASSH Server Fingerprint",
|
||||
args: ["Hex", "Hash digest"],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -7,172 +7,210 @@ import TestRegister from "../../lib/TestRegister.mjs";
|
|||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
"name": "HKDF: RFC5869 Test Case 1",
|
||||
"input": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
|
||||
"expectedOutput": "3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865",
|
||||
"recipeConfig": [
|
||||
name: "HKDF: RFC5869 Test Case 1",
|
||||
input: "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
|
||||
expectedOutput:
|
||||
"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"],
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "Derive HKDF key",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c"},
|
||||
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
|
||||
"SHA256", "with salt", 42,
|
||||
op: "Derive HKDF key",
|
||||
args: [
|
||||
{ option: "Hex", string: "000102030405060708090a0b0c" },
|
||||
{ option: "Hex", string: "f0f1f2f3f4f5f6f7f8f9" },
|
||||
"SHA256",
|
||||
"with salt",
|
||||
42,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "HKDF: RFC5869 Test Case 2",
|
||||
"input": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
|
||||
"expectedOutput": "b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87",
|
||||
"recipeConfig": [
|
||||
name: "HKDF: RFC5869 Test Case 2",
|
||||
input: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
|
||||
expectedOutput:
|
||||
"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"],
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "Derive HKDF key",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf"},
|
||||
{"option": "Hex", "string": "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"},
|
||||
"SHA256", "with salt", 82,
|
||||
op: "Derive HKDF key",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf",
|
||||
},
|
||||
{
|
||||
option: "Hex",
|
||||
string: "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
|
||||
},
|
||||
"SHA256",
|
||||
"with salt",
|
||||
82,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "HKDF: RFC5869 Test Case 3",
|
||||
"input": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
|
||||
"expectedOutput": "8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8",
|
||||
"recipeConfig": [
|
||||
name: "HKDF: RFC5869 Test Case 3",
|
||||
input: "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
|
||||
expectedOutput:
|
||||
"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"],
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "Derive HKDF key",
|
||||
"args": [
|
||||
{"option": "Hex", "string": ""},
|
||||
{"option": "Hex", "string": ""},
|
||||
"SHA256", "with salt", 42,
|
||||
op: "Derive HKDF key",
|
||||
args: [
|
||||
{ option: "Hex", string: "" },
|
||||
{ option: "Hex", string: "" },
|
||||
"SHA256",
|
||||
"with salt",
|
||||
42,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "HKDF: RFC5869 Test Case 4",
|
||||
"input": "0b0b0b0b0b0b0b0b0b0b0b",
|
||||
"expectedOutput": "085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896",
|
||||
"recipeConfig": [
|
||||
name: "HKDF: RFC5869 Test Case 4",
|
||||
input: "0b0b0b0b0b0b0b0b0b0b0b",
|
||||
expectedOutput:
|
||||
"085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"],
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "Derive HKDF key",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c"},
|
||||
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
|
||||
"SHA1", "with salt", 42,
|
||||
op: "Derive HKDF key",
|
||||
args: [
|
||||
{ option: "Hex", string: "000102030405060708090a0b0c" },
|
||||
{ option: "Hex", string: "f0f1f2f3f4f5f6f7f8f9" },
|
||||
"SHA1",
|
||||
"with salt",
|
||||
42,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "HKDF: RFC5869 Test Case 5",
|
||||
"input": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
|
||||
"expectedOutput": "0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4",
|
||||
"recipeConfig": [
|
||||
name: "HKDF: RFC5869 Test Case 5",
|
||||
input: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
|
||||
expectedOutput:
|
||||
"0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"],
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "Derive HKDF key",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf"},
|
||||
{"option": "Hex", "string": "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"},
|
||||
"SHA1", "with salt", 82,
|
||||
op: "Derive HKDF key",
|
||||
args: [
|
||||
{
|
||||
option: "Hex",
|
||||
string: "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf",
|
||||
},
|
||||
{
|
||||
option: "Hex",
|
||||
string: "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
|
||||
},
|
||||
"SHA1",
|
||||
"with salt",
|
||||
82,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "HKDF: RFC5869 Test Case 6",
|
||||
"input": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
|
||||
"expectedOutput": "0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918",
|
||||
"recipeConfig": [
|
||||
name: "HKDF: RFC5869 Test Case 6",
|
||||
input: "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
|
||||
expectedOutput:
|
||||
"0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"],
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "Derive HKDF key",
|
||||
"args": [
|
||||
{"option": "Hex", "string": ""},
|
||||
{"option": "Hex", "string": ""},
|
||||
"SHA1", "with salt", 42,
|
||||
op: "Derive HKDF key",
|
||||
args: [
|
||||
{ option: "Hex", string: "" },
|
||||
{ option: "Hex", string: "" },
|
||||
"SHA1",
|
||||
"with salt",
|
||||
42,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "HKDF: RFC5869 Test Case 7",
|
||||
"input": "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c",
|
||||
"expectedOutput": "2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48",
|
||||
"recipeConfig": [
|
||||
name: "HKDF: RFC5869 Test Case 7",
|
||||
input: "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c",
|
||||
expectedOutput:
|
||||
"2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"],
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "Derive HKDF key",
|
||||
"args": [
|
||||
{"option": "Hex", "string": ""},
|
||||
{"option": "Hex", "string": ""},
|
||||
"SHA1", "no salt", 42,
|
||||
op: "Derive HKDF key",
|
||||
args: [
|
||||
{ option: "Hex", string: "" },
|
||||
{ option: "Hex", string: "" },
|
||||
"SHA1",
|
||||
"no salt",
|
||||
42,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "HKDF: RFC5869 Test Case 1 with skip extract",
|
||||
"input": "077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5",
|
||||
"expectedOutput": "3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865",
|
||||
"recipeConfig": [
|
||||
name: "HKDF: RFC5869 Test Case 1 with skip extract",
|
||||
input: "077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5",
|
||||
expectedOutput:
|
||||
"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"],
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "Derive HKDF key",
|
||||
"args": [
|
||||
{"option": "Hex", "string": ""},
|
||||
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
|
||||
"SHA256", "skip", 42,
|
||||
op: "Derive HKDF key",
|
||||
args: [
|
||||
{ option: "Hex", string: "" },
|
||||
{ option: "Hex", string: "f0f1f2f3f4f5f6f7f8f9" },
|
||||
"SHA256",
|
||||
"skip",
|
||||
42,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "HKDF: too large L",
|
||||
"input": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
|
||||
"expectedOutput": "L too large (maximum length for SHA256 is 8160)",
|
||||
"recipeConfig": [
|
||||
name: "HKDF: too large L",
|
||||
input: "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
|
||||
expectedOutput: "L too large (maximum length for SHA256 is 8160)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"],
|
||||
op: "From Hex",
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
"op": "Derive HKDF key",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "000102030405060708090a0b0c"},
|
||||
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
|
||||
"SHA256", "with salt", 8161,
|
||||
op: "Derive HKDF key",
|
||||
args: [
|
||||
{ option: "Hex", string: "000102030405060708090a0b0c" },
|
||||
{ option: "Hex", string: "f0f1f2f3f4f5f6f7f8f9" },
|
||||
"SHA256",
|
||||
"with salt",
|
||||
8161,
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,9 +14,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "5902542.836307819",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Haversine distance",
|
||||
"args": []
|
||||
}
|
||||
op: "Haversine distance",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -25,9 +25,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "0",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Haversine distance",
|
||||
"args": []
|
||||
}
|
||||
op: "Haversine distance",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -7,13 +7,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "6162657279737477797468",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Hex",
|
||||
"args": [
|
||||
"None",
|
||||
0
|
||||
]
|
||||
op: "To Hex",
|
||||
args: ["None", 0],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ASCII to Hex with colon deliminator ",
|
||||
|
@ -21,41 +18,34 @@ TestRegister.addTests([
|
|||
expectedOutput: "61:62:65:72:79:73:74:77:79:74:68",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Hex",
|
||||
"args": [
|
||||
"Colon",
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
op: "To Hex",
|
||||
args: ["Colon", 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ASCII to 0x Hex with comma",
|
||||
input: "aberystwyth",
|
||||
expectedOutput: "0x61,0x62,0x65,0x72,0x79,0x73,0x74,0x77,0x79,0x74,0x68",
|
||||
expectedOutput:
|
||||
"0x61,0x62,0x65,0x72,0x79,0x73,0x74,0x77,0x79,0x74,0x68",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Hex",
|
||||
"args": [
|
||||
"0x with comma",
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
op: "To Hex",
|
||||
args: ["0x with comma", 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ASCII to 0x Hex with comma and line breaks",
|
||||
input: "aberystwyth",
|
||||
expectedOutput: "0x61,0x62,0x65,0x72,\n0x79,0x73,0x74,0x77,\n0x79,0x74,0x68",
|
||||
expectedOutput:
|
||||
"0x61,0x62,0x65,0x72,\n0x79,0x73,0x74,0x77,\n0x79,0x74,0x68",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Hex",
|
||||
"args": [
|
||||
"0x with comma",
|
||||
4
|
||||
]
|
||||
}
|
||||
]
|
||||
op: "To Hex",
|
||||
args: ["0x with comma", 4],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Hex stream to UTF-8",
|
||||
|
@ -63,13 +53,10 @@ TestRegister.addTests([
|
|||
expectedOutput: "救救孩子",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": [
|
||||
"Auto"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
op: "From Hex",
|
||||
args: ["Auto"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Multiline 0x hex to ASCII",
|
||||
|
@ -83,15 +70,14 @@ TestRegister.addTests([
|
|||
0x75,0x70,0x20,0x6d,0x79,0x20,0x6d,0x69,0x6e,0x64,0x20,0x77,0x68,0x69,0x63,\
|
||||
0x68,0x20,0x6f,0x66,0x20,0x74,0x68,0x65,0x20,0x66,0x69,0x67,0x73,0x20,0x49,\
|
||||
0x20,0x77,0x6f,0x75,0x6c,0x64,0x20,0x63,0x68,0x6f,0x6f,0x73,0x65,0x2e",
|
||||
expectedOutput: "I saw myself sitting in the crotch of the this fig tree, starving to death, just because I couldn't make up my mind which of the figs I would choose.",
|
||||
expectedOutput:
|
||||
"I saw myself sitting in the crotch of the this fig tree, starving to death, just because I couldn't make up my mind which of the figs I would choose.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": [
|
||||
"Auto"
|
||||
]
|
||||
}
|
||||
]
|
||||
op: "From Hex",
|
||||
args: ["Auto"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "0x with Comma to Ascii",
|
||||
|
@ -99,12 +85,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "test string",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": [
|
||||
"0x with comma"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
op: "From Hex",
|
||||
args: ["0x with comma"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -35,12 +35,12 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
args: [16, false, false],
|
||||
},
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -50,12 +50,12 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
args: [16, false, false],
|
||||
},
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -65,12 +65,12 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
args: [16, false, false],
|
||||
},
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -80,12 +80,12 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
args: [16, false, false],
|
||||
},
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -96,8 +96,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
}
|
||||
args: [16, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -122,8 +122,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
}
|
||||
args: [16, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -148,8 +148,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -175,8 +175,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -201,8 +201,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -227,8 +227,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -254,8 +254,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -9,41 +9,44 @@
|
|||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
import { GIF_ANIMATED_HEX, PNG_HEX, JPG_B64, EXIF_JPG_HEX, NO_EXIF_JPG_HEX } from "../../samples/Images.mjs";
|
||||
import {
|
||||
GIF_ANIMATED_HEX,
|
||||
PNG_HEX,
|
||||
JPG_B64,
|
||||
EXIF_JPG_HEX,
|
||||
NO_EXIF_JPG_HEX,
|
||||
} from "../../samples/Images.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Render Image: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{ op: "Render Image", args: ["Raw"] }
|
||||
]
|
||||
recipeConfig: [{ op: "Render Image", args: ["Raw"] }],
|
||||
},
|
||||
{
|
||||
name: "Render Image: raw gif",
|
||||
input: GIF_ANIMATED_HEX,
|
||||
expectedOutput: "<img src='data:image/gif;base64,R0lGODlhDwAPALMLAEJCQv/nAP/vAP/OAAAAAP+1AP+cAP//lP//EP//xv//7////wAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFMgALACwAAAAADwAPAAAEWnBJCWqdeFWVzhkXBnAIEgTCYAAT0J3oma7UERCEgOIp65o4GU9VOZgESFRyUCjGYjoUs3J86nRTwEBAkHkJRM22q+QOQJQzFxcMp8/wgrsFKNgLK1aGYtFPIgAh+QQFCgALACwDAAkACQABAAAEBTBIMWUEACH5BAUKAAsALAQACgAHAAEAAAQFMKw5QwQAIfkEBQoACwAsBAAEAAcAAQAABAVQBClDBAAh+QQFCgALACwDAAQACQACAAAECjAQIoKYV1xZSQQAIfkEBQoACwAsAwAEAAkAAgAABAkwCEkpIUFeEQEAIfkEBTIACwAsBAAEAAcAAQAABAWQkEVlBAAh+QQFGQALACwDAAQACAACAAAECZCssJYMUtQbAQAh+QQFGQALACwDAAQACQACAAAECTAIQmSgEotJIgAh+QQFCgALACwEAAQACAACAAAECXAFseoksmIRAQAh+QQFCgALACwDAAQACQACAAAECjAQIoKYV1xZSQQAIfkEBQoACwAsAwAEAAkAAgAABAkwCEkpIUFeEQEAIfkEBTIACwAsBAAEAAcAAQAABAWQkEVlBAAh+QQFGQALACwEAAMABwADAAAECpCQRSW9VIgrQgQAIfkEBRkACwAsAwADAAgAAgAABAmQrLCWFJLaGQEAIfkEBRkACwAsAwADAAkAAgAABArwBEJEmCQIqnEEACH5BAUZAAsALAUAAwAHAAMAAAQKMIRFxaCYEoJ3BAAh+QQFHgALACwEAAQACAACAAAECZAssZYUMtQbAQAh+QQFCgALACwEAAoABwABAAAEBZCsOUkEACH5BAUKAAsALAMACQAJAAEAAAQFkKxJF4kAOw=='>",
|
||||
expectedOutput:
|
||||
"<img src='data:image/gif;base64,R0lGODlhDwAPALMLAEJCQv/nAP/vAP/OAAAAAP+1AP+cAP//lP//EP//xv//7////wAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFMgALACwAAAAADwAPAAAEWnBJCWqdeFWVzhkXBnAIEgTCYAAT0J3oma7UERCEgOIp65o4GU9VOZgESFRyUCjGYjoUs3J86nRTwEBAkHkJRM22q+QOQJQzFxcMp8/wgrsFKNgLK1aGYtFPIgAh+QQFCgALACwDAAkACQABAAAEBTBIMWUEACH5BAUKAAsALAQACgAHAAEAAAQFMKw5QwQAIfkEBQoACwAsBAAEAAcAAQAABAVQBClDBAAh+QQFCgALACwDAAQACQACAAAECjAQIoKYV1xZSQQAIfkEBQoACwAsAwAEAAkAAgAABAkwCEkpIUFeEQEAIfkEBTIACwAsBAAEAAcAAQAABAWQkEVlBAAh+QQFGQALACwDAAQACAACAAAECZCssJYMUtQbAQAh+QQFGQALACwDAAQACQACAAAECTAIQmSgEotJIgAh+QQFCgALACwEAAQACAACAAAECXAFseoksmIRAQAh+QQFCgALACwDAAQACQACAAAECjAQIoKYV1xZSQQAIfkEBQoACwAsAwAEAAkAAgAABAkwCEkpIUFeEQEAIfkEBTIACwAsBAAEAAcAAQAABAWQkEVlBAAh+QQFGQALACwEAAMABwADAAAECpCQRSW9VIgrQgQAIfkEBRkACwAsAwADAAgAAgAABAmQrLCWFJLaGQEAIfkEBRkACwAsAwADAAkAAgAABArwBEJEmCQIqnEEACH5BAUZAAsALAUAAwAHAAMAAAQKMIRFxaCYEoJ3BAAh+QQFHgALACwEAAQACAACAAAECZAssZYUMtQbAQAh+QQFCgALACwEAAoABwABAAAEBZCsOUkEACH5BAUKAAsALAMACQAJAAEAAAQFkKxJF4kAOw=='>",
|
||||
recipeConfig: [
|
||||
{ op: "From Hex", args: ["Space"] },
|
||||
{ op: "Render Image", args: ["Raw"] }
|
||||
]
|
||||
{ op: "Render Image", args: ["Raw"] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Render Image: hex png",
|
||||
input: PNG_HEX,
|
||||
expectedOutput: "<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAFGElEQVRYw8VXXWwUVRT+7szszKzb3bbglqXbzbbQbYDQYJBGbWlTRUq1KtCmVYmECsHQKjE8mJrwYoIPpmIQEw2aaLA2PDRhATVpCxiLcYPBP0RQbIEVulNatt3SYX9mf2auD7QVlt3uLq3xPE3mnnvPd8/5zs8luD9hOzs7l1sslvJQKMR6PJ4fWlpafgWgAWAA0MnvlELSNEimDt65c6dpx44dB3JychplWUYgEGAAUFmWvxofHz9nNpvrwuHw72vXrt0KQJ0tAOJ0Oh8pKSlpFQRhmaZpAQB6o9FYBgATExPaJAAAAKWUEkKIqqq3Kisr7R0dHY+Lojhvw4YNnyXzyEwAiMvlai0sLNxHCNElUogHcKcoijIoCIIVADwez9aNGzd+nkiPS2bd6XSustvtSY2nElEUbVOO0bTkdGCS3d7hcLQwDKPDLCUcDt/YvHnz0WTeTgaAEQRheUoCEZKSxIIgLDh+/PhvPT09exOBSBYCSilV5iqLRFG0q6r62OSF1XQ8oAUCgVNpnE3TDIMUCoV+TJQJyQCgu7v7w2g0OjSjdUppOhxYt27d8tra2l2JACcFsHv37uEzZ848qyhK/2xIKAhCXmdn5wvJ6gAz0+bGxsZf1qxZU6FpWjRTw6FQyE0pVSmlmqZpkUzTcFrcbreSbqynRFXVYFVV1cMDAwP1kiS9Ul9ffzCZLof/QDRNUyilyqZNm75MpcvgfxZmrlItrkCl3Y7TCUHI5XJ9YzQan4pfGBoawvDwcCICngIQnSsAuuLiYgfLsvcs8DyPnJycRBxYDIBNxwszAli2wCC+uHrJq+y1n4sIc3e09PMKaLbeSCVJopIk3bUWi8Uc1dXVT/b19XXPppYz7euXHHji0ZXbBV53z7ai6q24FuW1n/r7GafTCVVV46tkNBqNlvb29v51XyR8adVCq9nAvTxw+QpijDD9X1ZULFxVD8ODdgBAbm4uyp4uQzg3/O/AyLLgef57n8/nq6mpKWYTxS9VCErMhkoCcBOyjIKKLTDoBby+Zw+sS1dA9akoWxjGoNtNqMGA/cb9sDXYUMVVoXSkFIQQuFyucpPJdEKn05U2NDQ0d3V1fZG2B1oqbEXWbOGDaSWGhd5kRlnZavRf+ANF+fkIyTKCExPE7/djm20bBoODWCQsgtlshiiKvlgs5uZ5fgUhhHAcl5eRB5bmGXaxDJkf/397UxO2NzVB1TQEJtNvdHQU5cZylGeVA6HpBjTm9XrbrFbrsUAg8OmhQ4fez4QDjI4jK1O0WIjcbexjY2OJ0pDJyspaPQmmoqampigTAFTTMJKixSJyu+RRWZYRPxYoirLIZDK9AQAcxy21WCyvZRIC6vVHPn6A168nBAnZyzIMDGYzHKWlYCwWJBgNSSQSOSvL8ttGo/E5SZL2ZcSBt3ovn3jnGUdrXhb/LgDTHa6FJMsw6PVgOQ7nLl4kPX19NBaLwWAwqHV1dSzLsgQAotHot0eOHDkM4PD9VEL65tcDnzQ9ZDlWNF9fy/H6/QCyGYaBRa/HjUuXEBobgzoyQm02G83Pz4fNZmOnpmSe5wclSXpvrt6G5MLJk88XFxbu5XU6650Lf16/rl32epm4YWTo5s2brc3NzcfSeuWmo/RRR8d5TdMOLlm8+JbA84Ucy+YCwKjfT8eDQTJp2BMMBvedPn16S1tb29m0W3fGAwTD8N91dS2zFxSs+Nvny77i9fr9fv/59vb2s1evXo1ket4/oXgLrXNMZZcAAAAASUVORK5CYII='>",
|
||||
recipeConfig: [
|
||||
{ op: "Render Image", args: ["Hex"] }
|
||||
]
|
||||
expectedOutput:
|
||||
"<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAFGElEQVRYw8VXXWwUVRT+7szszKzb3bbglqXbzbbQbYDQYJBGbWlTRUq1KtCmVYmECsHQKjE8mJrwYoIPpmIQEw2aaLA2PDRhATVpCxiLcYPBP0RQbIEVulNatt3SYX9mf2auD7QVlt3uLq3xPE3mnnvPd8/5zs8luD9hOzs7l1sslvJQKMR6PJ4fWlpafgWgAWAA0MnvlELSNEimDt65c6dpx44dB3JychplWUYgEGAAUFmWvxofHz9nNpvrwuHw72vXrt0KQJ0tAOJ0Oh8pKSlpFQRhmaZpAQB6o9FYBgATExPaJAAAAKWUEkKIqqq3Kisr7R0dHY+Lojhvw4YNnyXzyEwAiMvlai0sLNxHCNElUogHcKcoijIoCIIVADwez9aNGzd+nkiPS2bd6XSustvtSY2nElEUbVOO0bTkdGCS3d7hcLQwDKPDLCUcDt/YvHnz0WTeTgaAEQRheUoCEZKSxIIgLDh+/PhvPT09exOBSBYCSilV5iqLRFG0q6r62OSF1XQ8oAUCgVNpnE3TDIMUCoV+TJQJyQCgu7v7w2g0OjSjdUppOhxYt27d8tra2l2JACcFsHv37uEzZ848qyhK/2xIKAhCXmdn5wvJ6gAz0+bGxsZf1qxZU6FpWjRTw6FQyE0pVSmlmqZpkUzTcFrcbreSbqynRFXVYFVV1cMDAwP1kiS9Ul9ffzCZLof/QDRNUyilyqZNm75MpcvgfxZmrlItrkCl3Y7TCUHI5XJ9YzQan4pfGBoawvDwcCICngIQnSsAuuLiYgfLsvcs8DyPnJycRBxYDIBNxwszAli2wCC+uHrJq+y1n4sIc3e09PMKaLbeSCVJopIk3bUWi8Uc1dXVT/b19XXPppYz7euXHHji0ZXbBV53z7ai6q24FuW1n/r7GafTCVVV46tkNBqNlvb29v51XyR8adVCq9nAvTxw+QpijDD9X1ZULFxVD8ODdgBAbm4uyp4uQzg3/O/AyLLgef57n8/nq6mpKWYTxS9VCErMhkoCcBOyjIKKLTDoBby+Zw+sS1dA9akoWxjGoNtNqMGA/cb9sDXYUMVVoXSkFIQQuFyucpPJdEKn05U2NDQ0d3V1fZG2B1oqbEXWbOGDaSWGhd5kRlnZavRf+ANF+fkIyTKCExPE7/djm20bBoODWCQsgtlshiiKvlgs5uZ5fgUhhHAcl5eRB5bmGXaxDJkf/397UxO2NzVB1TQEJtNvdHQU5cZylGeVA6HpBjTm9XrbrFbrsUAg8OmhQ4fez4QDjI4jK1O0WIjcbexjY2OJ0pDJyspaPQmmoqampigTAFTTMJKixSJyu+RRWZYRPxYoirLIZDK9AQAcxy21WCyvZRIC6vVHPn6A168nBAnZyzIMDGYzHKWlYCwWJBgNSSQSOSvL8ttGo/E5SZL2ZcSBt3ovn3jnGUdrXhb/LgDTHa6FJMsw6PVgOQ7nLl4kPX19NBaLwWAwqHV1dSzLsgQAotHot0eOHDkM4PD9VEL65tcDnzQ9ZDlWNF9fy/H6/QCyGYaBRa/HjUuXEBobgzoyQm02G83Pz4fNZmOnpmSe5wclSXpvrt6G5MLJk88XFxbu5XU6650Lf16/rl32epm4YWTo5s2brc3NzcfSeuWmo/RRR8d5TdMOLlm8+JbA84Ucy+YCwKjfT8eDQTJp2BMMBvedPn16S1tb29m0W3fGAwTD8N91dS2zFxSs+Nvny77i9fr9fv/59vb2s1evXo1ket4/oXgLrXNMZZcAAAAASUVORK5CYII='>",
|
||||
recipeConfig: [{ op: "Render Image", args: ["Hex"] }],
|
||||
},
|
||||
{
|
||||
name: "Render Image: base64 jpg",
|
||||
input: JPG_B64,
|
||||
expectedOutput: "<img src='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQVFBQUFBQUFP/AABEIACAAIAMBEQACEQEDEQH/xAAbAAACAQUAAAAAAAAAAAAAAAAGBwkAAQIDCP/EAC4QAAIBAwIFAQcFAQAAAAAAAAECAwQFEQYSAAcIITFxIjJBQlJhwQkUFSORE//EABwBAAEFAQEBAAAAAAAAAAAAAAYAAgQFBwgDAf/EADARAAECBAQEBAYDAQAAAAAAAAECEQMEBSEABhIxQVFhoRMicZEUMnKBwdEVUrFC/9oADAMBAAIRAxEAPwCTPU+qDZ3jo6REnuUy71WQ4SJPG98d8Z7ADuT6EgSrlc/jiJaWAVHUHAPypG2pTXZ7AC6i4BDEi3kZETAMWKWQOW5PIfk8PYYDqif9y264XKrrZD5AnaGMeiIQMeuT9+M0jTJjHVOzK4iuiihP2SggN9Wo8ycESEaA0CGlI9AT7qfsw6YqmnFMwe33GropB4BnaaM+qOSP8wfvw6BM+CrVJTC4avqUtP3SsqDemk8iMJadYaPDSoegB90sfd/TBjpjU5u7yUdWiQ3GJd5EZ9iVPG9M98Z7EHuCR5yCdJolc/kSZaZATHSHt8qhtqS92exBukkAkggkdnpES4EWEXQbX3B5H8Hj7jEX/Vf1Xc3eTHUPqakm1HHTaZuGysskcNrp3V6YFoiju6FiyMhBAb5g3beBxT02VpmY/iJxST4mtSVeYuyCUp9BpD8nKuL4kzMSZp5hwQfKACLc7nv2bA5yz/UZ1fe9W2qyXOwUurDcqlKSCOywtR1gduynEkjRP385MQUZJOBwPZgyZLS8pEnJeaMMIDnXdLDqkBQ6WUSbAYnSFYiLiphRIYU9rWPe3cYy5m/qPatseqbrZLVp2k0q9tqWpJ0vkbVlWXXs3sxSLHH38ENKGGCDgjhZfyZLx5WHOTE0YgWHGiyWO11Ak9bJI2wp+sRERFQocPS1r3PYt3OC3pD6sObHO/n3Z6c32kk0xakasu8clrjT+pmWJY43UBgzFye5IxGx77cG6q0tTsufDTUMHxPESlPm4KISt+mk++nESUiTFQ8SEW06STbiLjv2fD16oemzTvO6WosGpoqilnt9VJNb7nQsq1FOshDEKWBBVht3KQQdo8FQRhs1WqpkrME1Dl2YqJ0lylSVEqSeFwDuNi4uHwZiVlqvIwlxN2FxuCLH/MKrp46NNBcnNe19xpbpcNRaqtka7P5IIgpI5lYCWONQM7gJE3kkZWRRghuPLMmdatXpFEGIhMOCs/8ALnUUnYknhYt1BNmxHkaXLSMXxASVDnwxr6jOjHQnN3Xdtu1XdblpzUt4YwN/GxrKlX/yiLGSRCp27URUMmQuTGpyzLl2Wc7VWhyS5eGhMSDDv5nGnUWYF7uS+lifmOwOPk9S5aejeIVFKjy44anS50zac5HVEVj00tVV1Nyqopbhcq5w086xkkA7QFVVBfCgfMckk54fArdTztX5SFMABIUCEpcBKQQpR4lyE7k8hbEn4SWpEjFWjdtzxOw7nHXWt9DQ6qRJ4isNwhG1JG911+lvwfhk8bpnLJ0LM0IRYJCJhAYE7Ef1VxZ9jdr2L4B6XVFSBKFXQe3UYTuqeVUFynhe8Wab93TKyQV9M0kM8KtjcI6iIh1DbVyFYZ2jPgcczR6RXqEtUGLLrAO/l1oLbHZSD0e4fg+DFM3LzI1IWPdj+8W0vyop7dUyy2izVD1s6CKW4VcktRUSICSqvUTMzlQSSFLYGTgcKBSa9XFJgwZdZHDyaEDrslAPc9cJU1Ly3mWse7n94cWiNCxaWR6iVlmuEq7WdfdRfpX8n44HHS+TMmw8swjGjELmFhiRskf1TxZ9zZ7WDYD6pVVT5CE2QO55nH//2Q=='>",
|
||||
recipeConfig: [
|
||||
{ op: "Render Image", args: ["Base64"] }
|
||||
]
|
||||
expectedOutput:
|
||||
"<img src='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQVFBQUFBQUFP/AABEIACAAIAMBEQACEQEDEQH/xAAbAAACAQUAAAAAAAAAAAAAAAAGBwkAAQIDCP/EAC4QAAIBAwIFAQcFAQAAAAAAAAECAwQFEQYSAAcIITFxIjJBQlJhwQkUFSORE//EABwBAAEFAQEBAAAAAAAAAAAAAAYAAgQFBwgDAf/EADARAAECBAQEBAYDAQAAAAAAAAECEQMEBSEABhIxQVFhoRMicZEUMnKBwdEVUrFC/9oADAMBAAIRAxEAPwCTPU+qDZ3jo6REnuUy71WQ4SJPG98d8Z7ADuT6EgSrlc/jiJaWAVHUHAPypG2pTXZ7AC6i4BDEi3kZETAMWKWQOW5PIfk8PYYDqif9y264XKrrZD5AnaGMeiIQMeuT9+M0jTJjHVOzK4iuiihP2SggN9Wo8ycESEaA0CGlI9AT7qfsw6YqmnFMwe33GropB4BnaaM+qOSP8wfvw6BM+CrVJTC4avqUtP3SsqDemk8iMJadYaPDSoegB90sfd/TBjpjU5u7yUdWiQ3GJd5EZ9iVPG9M98Z7EHuCR5yCdJolc/kSZaZATHSHt8qhtqS92exBukkAkggkdnpES4EWEXQbX3B5H8Hj7jEX/Vf1Xc3eTHUPqakm1HHTaZuGysskcNrp3V6YFoiju6FiyMhBAb5g3beBxT02VpmY/iJxST4mtSVeYuyCUp9BpD8nKuL4kzMSZp5hwQfKACLc7nv2bA5yz/UZ1fe9W2qyXOwUurDcqlKSCOywtR1gduynEkjRP385MQUZJOBwPZgyZLS8pEnJeaMMIDnXdLDqkBQ6WUSbAYnSFYiLiphRIYU9rWPe3cYy5m/qPatseqbrZLVp2k0q9tqWpJ0vkbVlWXXs3sxSLHH38ENKGGCDgjhZfyZLx5WHOTE0YgWHGiyWO11Ak9bJI2wp+sRERFQocPS1r3PYt3OC3pD6sObHO/n3Z6c32kk0xakasu8clrjT+pmWJY43UBgzFye5IxGx77cG6q0tTsufDTUMHxPESlPm4KISt+mk++nESUiTFQ8SEW06STbiLjv2fD16oemzTvO6WosGpoqilnt9VJNb7nQsq1FOshDEKWBBVht3KQQdo8FQRhs1WqpkrME1Dl2YqJ0lylSVEqSeFwDuNi4uHwZiVlqvIwlxN2FxuCLH/MKrp46NNBcnNe19xpbpcNRaqtka7P5IIgpI5lYCWONQM7gJE3kkZWRRghuPLMmdatXpFEGIhMOCs/8ALnUUnYknhYt1BNmxHkaXLSMXxASVDnwxr6jOjHQnN3Xdtu1XdblpzUt4YwN/GxrKlX/yiLGSRCp27URUMmQuTGpyzLl2Wc7VWhyS5eGhMSDDv5nGnUWYF7uS+lifmOwOPk9S5aejeIVFKjy44anS50zac5HVEVj00tVV1Nyqopbhcq5w086xkkA7QFVVBfCgfMckk54fArdTztX5SFMABIUCEpcBKQQpR4lyE7k8hbEn4SWpEjFWjdtzxOw7nHXWt9DQ6qRJ4isNwhG1JG911+lvwfhk8bpnLJ0LM0IRYJCJhAYE7Ef1VxZ9jdr2L4B6XVFSBKFXQe3UYTuqeVUFynhe8Wab93TKyQV9M0kM8KtjcI6iIh1DbVyFYZ2jPgcczR6RXqEtUGLLrAO/l1oLbHZSD0e4fg+DFM3LzI1IWPdj+8W0vyop7dUyy2izVD1s6CKW4VcktRUSICSqvUTMzlQSSFLYGTgcKBSa9XFJgwZdZHDyaEDrslAPc9cJU1Ly3mWse7n94cWiNCxaWR6iVlmuEq7WdfdRfpX8n44HHS+TMmw8swjGjELmFhiRskf1TxZ9zZ7WDYD6pVVT5CE2QO55nH//2Q=='>",
|
||||
recipeConfig: [{ op: "Render Image", args: ["Base64"] }],
|
||||
},
|
||||
{
|
||||
name: "Extract EXIF: nothing",
|
||||
|
@ -59,7 +62,8 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Extract EXIF: hello world text (error)",
|
||||
input: "hello world",
|
||||
expectedOutput: "Could not extract EXIF data from image: Error: Invalid JPEG section offset",
|
||||
expectedOutput:
|
||||
"Could not extract EXIF data from image: Error: Invalid JPEG section offset",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Extract EXIF",
|
||||
|
@ -105,7 +109,7 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
op: "Extract EXIF",
|
||||
|
@ -120,7 +124,7 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
op: "Extract EXIF",
|
||||
|
@ -131,7 +135,8 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Remove EXIF: hello world text (error)",
|
||||
input: "hello world",
|
||||
expectedOutput: "Could not remove EXIF data from image: Given data is not jpeg.",
|
||||
expectedOutput:
|
||||
"Could not remove EXIF data from image: Given data is not jpeg.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Remove EXIF",
|
||||
|
@ -146,7 +151,7 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
op: "Remove EXIF",
|
||||
|
@ -165,7 +170,7 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
op: "Remove EXIF",
|
||||
|
@ -180,74 +185,78 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Extract RGBA",
|
||||
input: "424d460400000000000036040000280000000400000004000000010008000000000010000000120b0000120b0000000100000001000000c8000000cf000000d7000000df000000e7000000ef000000f7000000ff000083000000ac000000d5000000ff000000000083000000ac000000d5000000ff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f070d05030b01090c040e060008020a",
|
||||
expectedOutput: "0 200 0 0 0 131 0 215 0 0 0 213 131 0 0 0 231 0 213 0 0 0 247 0 0 223 0 0 0 255 0 207 0 0 0 172 255 0 0 0 255 0 172 0 0 0 239 0",
|
||||
expectedOutput:
|
||||
"0 200 0 0 0 131 0 215 0 0 0 213 131 0 0 0 231 0 213 0 0 0 247 0 0 223 0 0 0 255 0 207 0 0 0 172 255 0 0 0 255 0 172 0 0 0 239 0",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
op: "Extract RGBA",
|
||||
args: [" ", false]
|
||||
}
|
||||
]
|
||||
args: [" ", false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Extract LSB",
|
||||
input: PNG_HEX,
|
||||
expectedOutput: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000208000000000000000000008000000000000000000000000248000000200240000000208908000000200240000000200821000000200240000000061249000000240000000000209b69000001a49b00000000a204a1200001a49b00000009800414000001a49b0000000035db6c00000094924000000086dffc20000df6dec8000001e10014a0000df6dec800002564924b00000df6dec80000009a6db20000007edb4124804177fffba0002fffff69249044e0924bc4002fffff6924905fb2db6d04002fffff692490416d2490040001bfffcc92030dbffffdc00037fffffdb6d302c6db6d700037fffffdb6d327eb6db6148037fffffdb6d30db4000014800dffffeb6d9aefffffff640",
|
||||
expectedOutput:
|
||||
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000208000000000000000000008000000000000000000000000248000000200240000000208908000000200240000000200821000000200240000000061249000000240000000000209b69000001a49b00000000a204a1200001a49b00000009800414000001a49b0000000035db6c00000094924000000086dffc20000df6dec8000001e10014a0000df6dec800002564924b00000df6dec80000009a6db20000007edb4124804177fffba0002fffff69249044e0924bc4002fffff6924905fb2db6d04002fffff692490416d2490040001bfffcc92030dbffffdc00037fffffdb6d302c6db6d700037fffffdb6d327eb6db6148037fffffdb6d30db4000014800dffffeb6d9aefffffff640",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
op: "Extract LSB",
|
||||
args: ["B", "G", "A", "", "Column", 2]
|
||||
args: ["B", "G", "A", "", "Column", 2],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None"]
|
||||
}
|
||||
]
|
||||
args: ["None"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "View Bit Plane",
|
||||
input: PNG_HEX,
|
||||
expectedOutput: "89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af400000140494441547801c5c1416ea3400000c1ee11ffff726fe6808410186ce26c95fde0432a154f0cdea4b2aa505151519954ee1a5c50995454aea8ac54ae2c5ca8982a3ea132551c199c507942e58ec1898adf50f1cae084ca15952b2a152a47067f40a5e2c8e00f54a81c199ca8b85271a542a5e2c8e005159527542ace0c5ea8a8f844c54ae5ccc217555c197c41c55d83ff6cf0052a772ddca052b1a752b1a772d7c2432a4f2c3c50f1d4c20b2a1593ca918a4965afe2cac29b2a562a93ca56c55d0b2754b62a269555c554b15251a9b8637040e5884ac54a654ba5a2624be5cce040c5918a55c55ec5a4a232a9549c197c48655239523155bc3278a862af624be5ccc2072aaea854a8549c5978834a85ca5ec5918a57ec076f50a958a9546ca94c1557ec071754a68a2d958a270637544c2a2abf69e1a68a95ca54b152a978d73f2e08bd57b6f839a00000000049454e44ae426082",
|
||||
expectedOutput:
|
||||
"89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af400000140494441547801c5c1416ea3400000c1ee11ffff726fe6808410186ce26c95fde0432a154f0cdea4b2aa505151519954ee1a5c50995454aea8ac54ae2c5ca8982a3ea132551c199c507942e58ec1898adf50f1cae084ca15952b2a152a47067f40a5e2c8e00f54a81c199ca8b85271a542a5e2c8e005159527542ace0c5ea8a8f844c54ae5ccc217555c197c41c55d83ff6cf0052a772ddca052b1a752b1a772d7c2432a4f2c3c50f1d4c20b2a1593ca918a4965afe2cac29b2a562a93ca56c55d0b2754b62a269555c554b15251a9b8637040e5884ac54a654ba5a2624be5cce040c5918a55c55ec5a4a232a9549c197c48655239523155bc3278a862af624be5ccc2072aaea854a8549c5978834a85ca5ec5918a57ec076f50a958a9546ca94c1557ec071754a68a2d958a270637544c2a2abf69e1a68a95ca54b152a978d73f2e08bd57b6f839a00000000049454e44ae426082",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
op: "View Bit Plane",
|
||||
args: ["Green", 3]
|
||||
args: ["Green", 3],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None"]
|
||||
}
|
||||
]
|
||||
args: ["None"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Randomize Colour Palette",
|
||||
"input": PNG_HEX,
|
||||
expectedOutput: "89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af4000004f3494441547801c5c10b50cf0700c0f16fbfff8f0ae5f157ed9f1e446358ab28b3913f29b3f89f65deab9859c624cafbf557b6eb3662799c8a285c541479ed3c125d2d2cba52e45d4da8bc66b99d1ebbff6ddd75ddeff7efef75fb7c8c5cb5b10dbc869ccbd1ac4f0c67dfc55cba1f9ec32dd303bc0e854aadd1f20ace5f29e1c9346b4c3982aada03b3285b540f4b099f664ca5720321a34c582466b2f38f3e1842a1526bb4e811efe64a56403a465dc270a998cb517b47e62f7842870b6aaabc5b519627a253784e606a8e25470fbbe358a0c2fd692f9c9668b8bda084e77d5f2247448f790f42a9b9da915d415a6020508a3e49e207e8ec7961cb9594545657e5e26e0fdaf9df5014998a141119f16eae24b4db84f7d775bc8e3e3e9e24f12fabaccf282210292232ce6a5e12dab58e37656be7cf8893916498d72345404681d7365ae217b18b969495261019998f8569145204e47c3e99b7a58f8f278fa76e478a808c522f23de165b3b7f3aee9c8e14011956e9b6841c29419f5d8bfd6889ad9d3fc1c9c654be08428a808cfc9a0c02e7d711973a823751569ac0c79dd72347408fb9ee3d102f4c616d9c82579596dd8df1b5c58caf2d26625d2fe488b420b16c129e3d7825534ccbb01a3881f0803354adba49c5853ce488bc037ba66b48c93586e20298885e02ff338177c0a1ed600c256200973699b0f130cd9dafcd20c87a3bcd9d29d90b1462081103c4d444d1bee2139aab9b7c87ec50479adbd47f13a0c610227a94af8a6565ce118ce72dc1618d3b4ded6f678465840dd905bd519f3e455305e67eb4f1db8ed94fdeb444448f0dbb94740bcec029db9fa636fc99cbf176a708b9e44198af3573469b323cb992469694b031bd133b2a955cb2a8461f0119a3b6f810fcac81619ea1c42cbf43a3711393d8727b1ee37ad6a263b1388cc8a872264cc8a7d1c97116d407ede1ab9c44ac3de610e5f32372142ab5468b84d091d984d79a90147e8dfb8322e8bcf71cdf370ce07ae6158606ee479c164c8794ddf88f76664c5d3d96579ee171db85d9917524b996102e2e65d882753c4c28e690714f9e3ffa1b2902122a0e6571a3c8864657b304ee2e4d6579e1038e0879cc0c716765c67ec2ee1d63cbaa9154db0760ffcc8e0fd7f643d3ba9c31ce69fc3c68124507bae060eb8379dc45e4884850aa4730ca2e97e68a572ca178055c7ff411cb56c4002bf86ef6717c53f94f3c3a4ff72590d6fa09ef134ae0a983ec1efc2b720424fc55b8107dbea8fe81134ecee8687c4d68ae62de45bc636ad099782b126b8f39c81190b0f292127d5295cb98f2b415aa2a055dcb2fb035b081a686f48ee5f4d37ee80c9d91498855007204240cc9ea89efeabec871ec5443c381b1980c9a4f456d1233a38d68ce667c2ee7c2927019e1ce8bb84ce48848f832d10bb1f50dd6540d03d268d4677d39ed1d52514407d3b6d8830327dc49b0984574507b3a3b0573fb5806f762afa37379790e7783ab0849ee0f66fd91a350a9355a24d4bb754239ca02df597598d52dc5c2bb339503cde95213cff3a089240d7f48fd522f9c943eec1db088e53b0412631ea193dec188e4b3a7d9d6eb535a62e4aa8d6da005bfe4d9125de082dbcd6f69ca6ecc66c2166ca329eb198ee4bf5780a5ba3b861030c05cd732eea4acc3c42106671f0d52ac6738727064325b8ff5c752dd1d4329546a8d1603bc2c51f2bbf3356eae2c64b379374c964561b5f53c36d65e14fd3683c7f7179232d686bdf9777915ff00ec08ae8ecb66a3370000000049454e44ae426082",
|
||||
input: PNG_HEX,
|
||||
expectedOutput:
|
||||
"89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af4000004f3494441547801c5c10b50cf0700c0f16fbfff8f0ae5f157ed9f1e446358ab28b3913f29b3f89f65deab9859c624cafbf557b6eb3662799c8a285c541479ed3c125d2d2cba52e45d4da8bc66b99d1ebbff6ddd75ddeff7efef75fb7c8c5cb5b10dbc869ccbd1ac4f0c67dfc55cba1f9ec32dd303bc0e854aadd1f20ace5f29e1c9346b4c3982aada03b3285b540f4b099f664ca5720321a34c582466b2f38f3e1842a1526bb4e811efe64a56403a465dc270a998cb517b47e62f7842870b6aaabc5b519627a253784e606a8e25470fbbe358a0c2fd692f9c9668b8bda084e77d5f2247448f790f42a9b9da915d415a6020508a3e49e207e8ec7961cb9594545657e5e26e0fdaf9df5014998a141119f16eae24b4db84f7d775bc8e3e3e9e24f12fabaccf282210292232ce6a5e12dab58e37656be7cf8893916498d72345404681d7365ae217b18b969495261019998f8569145204e47c3e99b7a58f8f278fa76e478a808c522f23de165b3b7f3aee9c8e14011956e9b6841c29419f5d8bfd6889ad9d3fc1c9c654be08428a808cfc9a0c02e7d711973a823751569ac0c79dd72347408fb9ee3d102f4c616d9c82579596dd8df1b5c58caf2d26625d2fe488b420b16c129e3d7825534ccbb01a3881f0803354adba49c5853ce488bc037ba66b48c93586e20298885e02ff338177c0a1ed600c256200973699b0f130cd9dafcd20c87a3bcd9d29d90b1462081103c4d444d1bee2139aab9b7c87ec50479adbd47f13a0c610227a94af8a6565ce118ce72dc1618d3b4ded6f678465840dd905bd519f3e455305e67eb4f1db8ed94fdeb444448f0dbb94740bcec029db9fa636fc99cbf176a708b9e44198af3573469b323cb992469694b031bd133b2a955cb2a8461f0119a3b6f810fcac81619ea1c42cbf43a3711393d8727b1ee37ad6a263b1388cc8a872264cc8a7d1c97116d407ede1ab9c44ac3de610e5f32372142ab5468b84d091d984d79a90147e8dfb8322e8bcf71cdf370ce07ae6158606ee479c164c8794ddf88f76664c5d3d96579ee171db85d9917524b996102e2e65d882753c4c28e690714f9e3ffa1b2902122a0e6571a3c8864657b304ee2e4d6579e1038e0879cc0c716765c67ec2ee1d63cbaa9154db0760ffcc8e0fd7f643d3ba9c31ce69fc3c68124507bae060eb8379dc45e4884850aa4730ca2e97e68a572ca178055c7ff411cb56c4002bf86ef6717c53f94f3c3a4ff72590d6fa09ef134ae0a983ec1efc2b720424fc55b8107dbea8fe81134ecee8687c4d68ae62de45bc636ad099782b126b8f39c81190b0f292127d5295cb98f2b415aa2a055dcb2fb035b081a686f48ee5f4d37ee80c9d91498855007204240cc9ea89efeabec871ec5443c381b1980c9a4f456d1233a38d68ce667c2ee7c2927019e1ce8bb84ce48848f832d10bb1f50dd6540d03d268d4677d39ed1d52514407d3b6d8830327dc49b0984574507b3a3b0573fb5806f762afa37379790e7783ab0849ee0f66fd91a350a9355a24d4bb754239ca02df597598d52dc5c2bb339503cde95213cff3a089240d7f48fd522f9c943eec1db088e53b0412631ea193dec188e4b3a7d9d6eb535a62e4aa8d6da005bfe4d9125de082dbcd6f69ca6ecc66c2166ca329eb198ee4bf5780a5ba3b861030c05cd732eea4acc3c42106671f0d52ac6738727064325b8ff5c752dd1d4329546a8d1603bc2c51f2bbf3356eae2c64b379374c964561b5f53c36d65e14fd3683c7f7179232d686bdf9777915ff00ec08ae8ecb66a3370000000049454e44ae426082",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
args: ["None"],
|
||||
},
|
||||
{
|
||||
op: "Randomize Colour Palette",
|
||||
args: ["myseed"]
|
||||
args: ["myseed"],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None"]
|
||||
}
|
||||
]
|
||||
args: ["None"],
|
||||
},
|
||||
],
|
||||
},
|
||||
/* { This operation only works in a browser
|
||||
name: "Optical Character Recognition",
|
||||
|
|
|
@ -11,11 +11,12 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Index of Coincidence",
|
||||
input: "Hello world, this is a test to determine the correct IC value.",
|
||||
expectedMatch: /^Index of Coincidence: 0\.07142857142857142\nNormalized: 1\.857142857142857/,
|
||||
expectedMatch:
|
||||
/^Index of Coincidence: 0\.07142857142857142\nNormalized: 1\.857142857142857/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Index of Coincidence",
|
||||
"args": []
|
||||
op: "Index of Coincidence",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -14,9 +14,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "503053a0c5b2bd9b9334bf7f3d3b8852",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JA3 Fingerprint",
|
||||
"args": ["Hex", "Hash digest"]
|
||||
}
|
||||
op: "JA3 Fingerprint",
|
||||
args: ["Hex", "Hash digest"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -25,9 +25,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "a314eb64cee6cb832aaaa372c8295bab",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JA3 Fingerprint",
|
||||
"args": ["Hex", "Hash digest"]
|
||||
}
|
||||
op: "JA3 Fingerprint",
|
||||
args: ["Hex", "Hash digest"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -36,9 +36,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "c1a36e1a870786cc75edddc0009eaf3a",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JA3 Fingerprint",
|
||||
"args": ["Hex", "Hash digest"]
|
||||
}
|
||||
op: "JA3 Fingerprint",
|
||||
args: ["Hex", "Hash digest"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -47,9 +47,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "4826a90ec2daf4f7b4b64cc1c8bd343b",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JA3 Fingerprint",
|
||||
"args": ["Hex", "Hash digest"]
|
||||
}
|
||||
op: "JA3 Fingerprint",
|
||||
args: ["Hex", "Hash digest"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -14,9 +14,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "bed95e1b525d2f41db3a6d68fac5b566",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JA3S Fingerprint",
|
||||
"args": ["Hex", "Hash digest"]
|
||||
}
|
||||
op: "JA3S Fingerprint",
|
||||
args: ["Hex", "Hash digest"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -25,9 +25,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "130fac2dc19b142500acb0abc63b6379",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JA3S Fingerprint",
|
||||
"args": ["Hex", "Hash digest"]
|
||||
}
|
||||
op: "JA3S Fingerprint",
|
||||
args: ["Hex", "Hash digest"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -36,9 +36,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "ccc514751b175866924439bdbb5bba34",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JA3S Fingerprint",
|
||||
"args": ["Hex", "Hash digest"]
|
||||
}
|
||||
op: "JA3S Fingerprint",
|
||||
args: ["Hex", "Hash digest"],
|
||||
},
|
||||
],
|
||||
},
|
||||
// This Server Hello was based on draft 18 of the TLS1.3 spec which does not include a Session ID field, leading it to fail.
|
||||
|
|
|
@ -33,8 +33,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
name: "JSON Beautify: space, string",
|
||||
input: "\"string\"",
|
||||
expectedOutput: "\"string\"",
|
||||
input: '"string"',
|
||||
expectedOutput: '"string"',
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON Beautify",
|
||||
|
@ -42,8 +42,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
op: "HTML To Text",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -92,8 +92,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
name: "JSON Beautify: space, object",
|
||||
input: "{\"second\":2,\"first\":3}",
|
||||
expectedOutput: "{\n \"second\": 2,\n \"first\": 3\n}",
|
||||
input: '{"second":2,"first":3}',
|
||||
expectedOutput: '{\n "second": 2,\n "first": 3\n}',
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON Beautify",
|
||||
|
@ -101,14 +101,15 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
op: "HTML To Text",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON Beautify: tab, nested",
|
||||
input: "[2,{\"second\":2,\"first\":3,\"beginning\":{\"j\":\"3\",\"i\":[2,3,false]}},1,2,3]",
|
||||
expectedOutput: "[\n\t2,\n\t{\n\t\t\"second\": 2,\n\t\t\"first\": 3,\n\t\t\"beginning\": {\n\t\t\t\"j\": \"3\",\n\t\t\t\"i\": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t]\n\t\t}\n\t},\n\t1,\n\t2,\n\t3\n]",
|
||||
input: '[2,{"second":2,"first":3,"beginning":{"j":"3","i":[2,3,false]}},1,2,3]',
|
||||
expectedOutput:
|
||||
'[\n\t2,\n\t{\n\t\t"second": 2,\n\t\t"first": 3,\n\t\t"beginning": {\n\t\t\t"j": "3",\n\t\t\t"i": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t]\n\t\t}\n\t},\n\t1,\n\t2,\n\t3\n]',
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON Beautify",
|
||||
|
@ -116,14 +117,15 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
op: "HTML To Text",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON Beautify: tab, nested, sorted",
|
||||
input: "[2,{\"second\":2,\"first\":3,\"beginning\":{\"j\":\"3\",\"i\":[2,3,false]}},1,2,3]",
|
||||
expectedOutput: "[\n\t2,\n\t{\n\t\t\"beginning\": {\n\t\t\t\"i\": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t],\n\t\t\t\"j\": \"3\"\n\t\t},\n\t\t\"first\": 3,\n\t\t\"second\": 2\n\t},\n\t1,\n\t2,\n\t3\n]",
|
||||
input: '[2,{"second":2,"first":3,"beginning":{"j":"3","i":[2,3,false]}},1,2,3]',
|
||||
expectedOutput:
|
||||
'[\n\t2,\n\t{\n\t\t"beginning": {\n\t\t\t"i": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t],\n\t\t\t"j": "3"\n\t\t},\n\t\t"first": 3,\n\t\t"second": 2\n\t},\n\t1,\n\t2,\n\t3\n]',
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON Beautify",
|
||||
|
@ -131,8 +133,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
op: "HTML To Text",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -44,8 +44,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
name: "JSON Minify: string",
|
||||
input: "\"string\"",
|
||||
expectedOutput: "\"string\"",
|
||||
input: '"string"',
|
||||
expectedOutput: '"string"',
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON Minify",
|
||||
|
@ -88,8 +88,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
name: "JSON Minify: object",
|
||||
input: "{\n \"second\": 2,\n \"first\": 3\n}",
|
||||
expectedOutput: "{\"second\":2,\"first\":3}",
|
||||
input: '{\n "second": 2,\n "first": 3\n}',
|
||||
expectedOutput: '{"second":2,"first":3}',
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON Minify",
|
||||
|
@ -99,8 +99,9 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
name: "JSON Minify: tab, nested",
|
||||
input: "[\n\t2,\n\t{\n\t\t\"second\": 2,\n\t\t\"first\": 3,\n\t\t\"beginning\": {\n\t\t\t\"j\": \"3\",\n\t\t\t\"i\": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t]\n\t\t}\n\t},\n\t1,\n\t2,\n\t3\n]",
|
||||
expectedOutput: "[2,{\"second\":2,\"first\":3,\"beginning\":{\"j\":\"3\",\"i\":[2,3,false]}},1,2,3]",
|
||||
input: '[\n\t2,\n\t{\n\t\t"second": 2,\n\t\t"first": 3,\n\t\t"beginning": {\n\t\t\t"j": "3",\n\t\t\t"i": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t]\n\t\t}\n\t},\n\t1,\n\t2,\n\t3\n]',
|
||||
expectedOutput:
|
||||
'[2,{"second":2,"first":3,"beginning":{"j":"3","i":[2,3,false]}},1,2,3]',
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON Minify",
|
||||
|
|
|
@ -15,67 +15,70 @@ const EXPECTED_CSV_EMPTY = "\r\n\r\n";
|
|||
TestRegister.addTests([
|
||||
{
|
||||
name: "JSON to CSV: strings as values",
|
||||
input: JSON.stringify({a: "1", b: "2", c: "3"}),
|
||||
input: JSON.stringify({ a: "1", b: "2", c: "3" }),
|
||||
expectedOutput: EXPECTED_CSV_SINGLE,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: numbers as values",
|
||||
input: JSON.stringify({a: 1, b: 2, c: 3}),
|
||||
input: JSON.stringify({ a: 1, b: 2, c: 3 }),
|
||||
expectedOutput: EXPECTED_CSV_SINGLE,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: numbers and strings as values",
|
||||
input: JSON.stringify({a: 1, b: "2", c: 3}),
|
||||
input: JSON.stringify({ a: 1, b: "2", c: 3 }),
|
||||
expectedOutput: EXPECTED_CSV_SINGLE,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: boolean and null as values",
|
||||
input: JSON.stringify({a: false, b: null, c: 3}),
|
||||
input: JSON.stringify({ a: false, b: null, c: 3 }),
|
||||
expectedOutput: "a,b,c\r\nfalse,null,3\r\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: JSON as an array",
|
||||
input: JSON.stringify([{a: 1, b: "2", c: 3}]),
|
||||
input: JSON.stringify([{ a: 1, b: "2", c: 3 }]),
|
||||
expectedOutput: EXPECTED_CSV_SINGLE,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: multiple JSON values in an array",
|
||||
input: JSON.stringify([{a: 1, b: "2", c: 3}, {a: 1, b: "2", c: 3}]),
|
||||
input: JSON.stringify([
|
||||
{ a: 1, b: "2", c: 3 },
|
||||
{ a: 1, b: "2", c: 3 },
|
||||
]),
|
||||
expectedOutput: EXPECTED_CSV_MULTIPLE,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -86,7 +89,7 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -97,74 +100,74 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: nested JSON",
|
||||
input: JSON.stringify({a: 1, b: {c: 2, d: 3}}),
|
||||
input: JSON.stringify({ a: 1, b: { c: 2, d: 3 } }),
|
||||
expectedOutput: "a,b.c,b.d\r\n1,2,3\r\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: nested array",
|
||||
input: JSON.stringify({a: 1, b: [2, 3]}),
|
||||
input: JSON.stringify({ a: 1, b: [2, 3] }),
|
||||
expectedOutput: "a,b.0,b.1\r\n1,2,3\r\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: nested JSON, nested array",
|
||||
input: JSON.stringify({a: 1, b: {c: [2, 3], d: 4}}),
|
||||
input: JSON.stringify({ a: 1, b: { c: [2, 3], d: 4 } }),
|
||||
expectedOutput: "a,b.c.0,b.c.1,b.d\r\n1,2,3,4\r\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: nested array, nested JSON",
|
||||
input: JSON.stringify({a: 1, b: [{c: 3, d: 4}]}),
|
||||
input: JSON.stringify({ a: 1, b: [{ c: 3, d: 4 }] }),
|
||||
expectedOutput: "a,b.0.c,b.0.d\r\n1,3,4\r\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: nested array, nested array",
|
||||
input: JSON.stringify({a: 1, b: [[2, 3]]}),
|
||||
input: JSON.stringify({ a: 1, b: [[2, 3]] }),
|
||||
expectedOutput: "a,b.0.0,b.0.1\r\n1,2,3\r\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JSON to CSV: nested JSON, nested JSON",
|
||||
input: JSON.stringify({a: 1, b: { c: { d: 2, e: 3}}}),
|
||||
input: JSON.stringify({ a: 1, b: { c: { d: 2, e: 3 } } }),
|
||||
expectedOutput: "a,b.c.d,b.c.e\r\n1,2,3\r\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JSON to CSV",
|
||||
args: [",", "\\r\\n"]
|
||||
args: [",", "\\r\\n"],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -8,11 +8,15 @@
|
|||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
const outputObject = JSON.stringify({
|
||||
String: "SomeString",
|
||||
Number: 42,
|
||||
iat: 1
|
||||
}, null, 4);
|
||||
const outputObject = JSON.stringify(
|
||||
{
|
||||
String: "SomeString",
|
||||
Number: 42,
|
||||
iat: 1,
|
||||
},
|
||||
null,
|
||||
4,
|
||||
);
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
|
@ -23,7 +27,7 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "JWT Decode",
|
||||
args: [],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -34,7 +38,7 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "JWT Decode",
|
||||
args: [],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -45,7 +49,7 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "JWT Decode",
|
||||
args: [],
|
||||
}
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -8,11 +8,15 @@
|
|||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
const inputObject = JSON.stringify({
|
||||
String: "SomeString",
|
||||
Number: 42,
|
||||
iat: 1
|
||||
}, null, 4);
|
||||
const inputObject = JSON.stringify(
|
||||
{
|
||||
String: "SomeString",
|
||||
Number: 42,
|
||||
iat: 1,
|
||||
},
|
||||
null,
|
||||
4,
|
||||
);
|
||||
|
||||
const hsKey = "secret_cat";
|
||||
const rsKey = `-----BEGIN RSA PRIVATE KEY-----
|
||||
|
@ -40,34 +44,37 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "JWT Sign: HS256",
|
||||
input: inputObject,
|
||||
expectedOutput: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.0ha6-j4FwvEIKPVZ-hf3S_R9Hy_UtXzq4dnedXcUrXk",
|
||||
expectedOutput:
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.0ha6-j4FwvEIKPVZ-hf3S_R9Hy_UtXzq4dnedXcUrXk",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [hsKey, "HS256"],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Sign: HS384",
|
||||
input: inputObject,
|
||||
expectedOutput: "eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ._bPK-Y3mIACConbJqkGFMQ_L3vbxgKXy9gSxtL9hA5XTganozTSXxD0vX0N1yT5s",
|
||||
expectedOutput:
|
||||
"eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ._bPK-Y3mIACConbJqkGFMQ_L3vbxgKXy9gSxtL9hA5XTganozTSXxD0vX0N1yT5s",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [hsKey, "HS384"],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Sign: HS512",
|
||||
input: inputObject,
|
||||
expectedOutput: "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.vZIJU4XYMFt3FLE1V_RZOxEetmV4RvxtPZQGzJthK_d47pjwlEb6pQE23YxHFmOj8H5RLEdqqLPw4jNsOyHRzA",
|
||||
expectedOutput:
|
||||
"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.vZIJU4XYMFt3FLE1V_RZOxEetmV4RvxtPZQGzJthK_d47pjwlEb6pQE23YxHFmOj8H5RLEdqqLPw4jNsOyHRzA",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [hsKey, "HS512"],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -81,8 +88,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -96,8 +103,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -111,8 +118,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -126,8 +133,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -141,8 +148,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -156,8 +163,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -8,11 +8,15 @@
|
|||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
const outputObject = JSON.stringify({
|
||||
String: "SomeString",
|
||||
Number: 42,
|
||||
iat: 1
|
||||
}, null, 4);
|
||||
const outputObject = JSON.stringify(
|
||||
{
|
||||
String: "SomeString",
|
||||
Number: 42,
|
||||
iat: 1,
|
||||
},
|
||||
null,
|
||||
4,
|
||||
);
|
||||
|
||||
const hsKey = "secret_cat";
|
||||
/* Retaining private key as a comment
|
||||
|
@ -59,7 +63,7 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "JWT Verify",
|
||||
args: [hsKey],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -70,7 +74,7 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "JWT Verify",
|
||||
args: [rsPub],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -81,7 +85,7 @@ TestRegister.addTests([
|
|||
{
|
||||
op: "JWT Verify",
|
||||
args: [esPub],
|
||||
}
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -11,12 +11,8 @@ import TestRegister from "../../lib/TestRegister.mjs";
|
|||
TestRegister.addTests([
|
||||
{
|
||||
name: "Jump: Empty Label",
|
||||
input: [
|
||||
"should be changed",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
"c2hvdWxkIGJlIGNoYW5nZWQ=",
|
||||
].join("\n"),
|
||||
input: ["should be changed"].join("\n"),
|
||||
expectedOutput: ["c2hvdWxkIGJlIGNoYW5nZWQ="].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Jump",
|
||||
|
@ -30,12 +26,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
name: "Jump: skips 1",
|
||||
input: [
|
||||
"shouldnt be changed",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
"shouldnt be changed",
|
||||
].join("\n"),
|
||||
input: ["shouldnt be changed"].join("\n"),
|
||||
expectedOutput: ["shouldnt be changed"].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Jump",
|
||||
|
@ -47,8 +39,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
op: "Label",
|
||||
args: ["skipReplace"]
|
||||
args: ["skipReplace"],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -41,5 +41,5 @@ TestRegister.addTests([
|
|||
args: ["Helloworld", 0, "test"],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -15,8 +15,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "LZNT1 Decompress",
|
||||
args: []
|
||||
}
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -14,9 +14,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "BYUwNmD2AEDukCcwBMg=",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "LZString Compress",
|
||||
"args": ["Base64"]
|
||||
}
|
||||
op: "LZString Compress",
|
||||
args: ["Base64"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -25,9 +25,9 @@ TestRegister.addTests([
|
|||
expectedOutput: "hello world",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "LZString Decompress",
|
||||
"args": ["Base64"]
|
||||
}
|
||||
op: "LZString Decompress",
|
||||
args: ["Base64"],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -7,158 +7,136 @@ import TestRegister from "../../lib/TestRegister.mjs";
|
|||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
"name": "Levenshtein Distance: Wikipedia example 1",
|
||||
"input": "kitten\nsitting",
|
||||
"expectedOutput": "3",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: Wikipedia example 1",
|
||||
input: "kitten\nsitting",
|
||||
expectedOutput: "3",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
"\\n", 1, 1, 1,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: ["\\n", 1, 1, 1],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Levenshtein Distance: Wikipedia example 2",
|
||||
"input": "saturday\nsunday",
|
||||
"expectedOutput": "3",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: Wikipedia example 2",
|
||||
input: "saturday\nsunday",
|
||||
expectedOutput: "3",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
"\\n", 1, 1, 1,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: ["\\n", 1, 1, 1],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Levenshtein Distance: Wikipedia example 1 with substitution cost 2",
|
||||
"input": "kitten\nsitting",
|
||||
"expectedOutput": "5",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: Wikipedia example 1 with substitution cost 2",
|
||||
input: "kitten\nsitting",
|
||||
expectedOutput: "5",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
"\\n", 1, 1, 2,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: ["\\n", 1, 1, 2],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Levenshtein Distance: varied costs 1",
|
||||
"input": "kitten\nsitting",
|
||||
"expectedOutput": "230",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: varied costs 1",
|
||||
input: "kitten\nsitting",
|
||||
expectedOutput: "230",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
"\\n", 10, 100, 1000,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: ["\\n", 10, 100, 1000],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Levenshtein Distance: varied costs 2",
|
||||
"input": "kitten\nsitting",
|
||||
"expectedOutput": "1020",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: varied costs 2",
|
||||
input: "kitten\nsitting",
|
||||
expectedOutput: "1020",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
"\\n", 1000, 100, 10,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: ["\\n", 1000, 100, 10],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Levenshtein Distance: another delimiter",
|
||||
"input": "kitten sitting",
|
||||
"expectedOutput": "3",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: another delimiter",
|
||||
input: "kitten sitting",
|
||||
expectedOutput: "3",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
" ", 1, 1, 1,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: [" ", 1, 1, 1],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Levenshtein Distance: too few samples",
|
||||
"input": "kitten",
|
||||
"expectedOutput": "Incorrect number of samples. Check your input and/or delimiter.",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: too few samples",
|
||||
input: "kitten",
|
||||
expectedOutput:
|
||||
"Incorrect number of samples. Check your input and/or delimiter.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
"\\n", 1, 1, 1,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: ["\\n", 1, 1, 1],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Levenshtein Distance: too many samples",
|
||||
"input": "kitten\nsitting\nkitchen",
|
||||
"expectedOutput": "Incorrect number of samples. Check your input and/or delimiter.",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: too many samples",
|
||||
input: "kitten\nsitting\nkitchen",
|
||||
expectedOutput:
|
||||
"Incorrect number of samples. Check your input and/or delimiter.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
"\\n", 1, 1, 1,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: ["\\n", 1, 1, 1],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Levenshtein Distance: negative insertion cost",
|
||||
"input": "kitten\nsitting",
|
||||
"expectedOutput": "Negative costs are not allowed.",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: negative insertion cost",
|
||||
input: "kitten\nsitting",
|
||||
expectedOutput: "Negative costs are not allowed.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
"\\n", -1, 1, 1,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: ["\\n", -1, 1, 1],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Levenshtein Distance: negative deletion cost",
|
||||
"input": "kitten\nsitting",
|
||||
"expectedOutput": "Negative costs are not allowed.",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: negative deletion cost",
|
||||
input: "kitten\nsitting",
|
||||
expectedOutput: "Negative costs are not allowed.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
"\\n", 1, -1, 1,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: ["\\n", 1, -1, 1],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Levenshtein Distance: negative substitution cost",
|
||||
"input": "kitten\nsitting",
|
||||
"expectedOutput": "Negative costs are not allowed.",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: negative substitution cost",
|
||||
input: "kitten\nsitting",
|
||||
expectedOutput: "Negative costs are not allowed.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
"\\n", 1, 1, -1,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: ["\\n", 1, 1, -1],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Levenshtein Distance: cost zero",
|
||||
"input": "kitten\nsitting",
|
||||
"expectedOutput": "0",
|
||||
"recipeConfig": [
|
||||
name: "Levenshtein Distance: cost zero",
|
||||
input: "kitten\nsitting",
|
||||
expectedOutput: "0",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Levenshtein Distance",
|
||||
"args": [
|
||||
"\\n", 0, 0, 0,
|
||||
],
|
||||
op: "Levenshtein Distance",
|
||||
args: ["\\n", 0, 0, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,33 +11,36 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Luhn Checksum on standard data",
|
||||
input: "35641709012469",
|
||||
expectedOutput: "Checksum: 7\nCheckdigit: 0\nLuhn Validated String: 356417090124690",
|
||||
expectedOutput:
|
||||
"Checksum: 7\nCheckdigit: 0\nLuhn Validated String: 356417090124690",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Luhn Checksum",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Luhn Checksum on standard data 2",
|
||||
input: "896101950123440000",
|
||||
expectedOutput: "Checksum: 5\nCheckdigit: 1\nLuhn Validated String: 8961019501234400001",
|
||||
expectedOutput:
|
||||
"Checksum: 5\nCheckdigit: 1\nLuhn Validated String: 8961019501234400001",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Luhn Checksum",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Luhn Checksum on standard data 3",
|
||||
input: "35726908971331",
|
||||
expectedOutput: "Checksum: 6\nCheckdigit: 7\nLuhn Validated String: 357269089713317",
|
||||
expectedOutput:
|
||||
"Checksum: 6\nCheckdigit: 7\nLuhn Validated String: 357269089713317",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Luhn Checksum",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -48,7 +51,7 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Luhn Checksum",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -59,8 +62,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Luhn Checksum",
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -11,11 +11,12 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Microsoft Script Decoder",
|
||||
input: "#@~^RQAAAA==-mD~sX|:/TP{~J:+dYbxL~@!F@*@!+@*@!&@*eEI@#@&@#@&\x7fjm.raY 214Wv:zms/obI0xEAAA==^#~@",
|
||||
expectedOutput: "var my_msg = \"Testing <1><2><3>!\";\r\n\r\nWScript.Echo(my_msg);",
|
||||
expectedOutput:
|
||||
'var my_msg = "Testing <1><2><3>!";\r\n\r\nWScript.Echo(my_msg);',
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Microsoft Script Decoder",
|
||||
"args": []
|
||||
op: "Microsoft Script Decoder",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -13,12 +13,13 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Magic: nothing",
|
||||
input: "",
|
||||
expectedOutput: "Nothing of interest could be detected about the input data.\nHave you tried modifying the operation arguments?",
|
||||
expectedOutput:
|
||||
"Nothing of interest could be detected about the input data.\nHave you tried modifying the operation arguments?",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, false, false]
|
||||
}
|
||||
args: [3, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -28,8 +29,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, false, false]
|
||||
}
|
||||
args: [3, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -39,8 +40,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, false, false]
|
||||
}
|
||||
args: [3, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -50,8 +51,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [1, true, false]
|
||||
}
|
||||
args: [1, true, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -61,41 +62,44 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [1, false, true]
|
||||
}
|
||||
args: [1, false, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Magic Chain: Base64",
|
||||
input: "WkVkV2VtUkRRbnBrU0Vwd1ltMWpQUT09",
|
||||
expectedMatch: /From_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Base64\('A-Za-z0-9\+\/=',true,false\)/,
|
||||
expectedMatch:
|
||||
/From_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Base64\('A-Za-z0-9\+\/=',true,false\)/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, false, false]
|
||||
}
|
||||
args: [3, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Magic Chain: Hex -> Hexdump -> Base64",
|
||||
input: "MDAwMDAwMDAgIDM3IDM0IDIwIDM2IDM1IDIwIDM3IDMzIDIwIDM3IDM0IDIwIDMyIDMwIDIwIDM3ICB8NzQgNjUgNzMgNzQgMjAgN3wKMDAwMDAwMTAgIDMzIDIwIDM3IDM0IDIwIDM3IDMyIDIwIDM2IDM5IDIwIDM2IDY1IDIwIDM2IDM3ICB8MyA3NCA3MiA2OSA2ZSA2N3w=",
|
||||
expectedMatch: /From_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Hexdump\(\)\nFrom_Hex\('Space'\)/,
|
||||
expectedMatch:
|
||||
/From_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Hexdump\(\)\nFrom_Hex\('Space'\)/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, false, false]
|
||||
}
|
||||
args: [3, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Magic Chain: Charcode -> Octal -> Base32",
|
||||
input: "GY3SANRUEA2DAIBWGYQDMNJAGQYCANRXEA3DGIBUGAQDMNZAGY2CANBQEA3DEIBWGAQDIMBAGY3SANRTEA2DAIBWG4QDMNBAGQYCANRXEA3DEIBUGAQDMNRAG4YSANBQEA3DMIBRGQ2SANBQEA3DMIBWG4======",
|
||||
expectedMatch: /From_Base32\('A-Z2-7=',false\)\nFrom_Octal\('Space'\)\nFrom_Hex\('Space'\)/,
|
||||
expectedMatch:
|
||||
/From_Base32\('A-Z2-7=',false\)\nFrom_Octal\('Space'\)\nFrom_Hex\('Space'\)/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, false, false]
|
||||
}
|
||||
args: [3, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -105,8 +109,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, false, false]
|
||||
}
|
||||
args: [3, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -116,20 +120,21 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, false, false]
|
||||
}
|
||||
args: [3, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Magic: Raw Inflate",
|
||||
input: "\x4d\x52\xb1\x6e\xdc\x30\x0c\xdd\xf3\x15\x44\x80\x6e\xae\x91\x02\x4d\x80\x8e\x4d\x9a\x21\x53\x8b\xa6\x43\x56\x5a\xe2\x9d\x84\x93\x25\x43\x94\xed\xf8\xef\xf3\xe8\x6b\x0e\xb7\x1c\xce\xd4\x7b\x8f\x8f\x7c\x7c\xda\x06\xa9\x4f\x41\x0e\x14\x95\x98\x34\x8e\x53\x92\x8e\x62\x6e\x73\x6c\x71\x11\x5a\x65\x20\x9e\x26\x3a\x94\x4a\x8e\x6b\xdd\x62\x3e\x52\x99\x1b\x71\x4a\x34\x72\xce\x52\xa9\x1c\xe8\xd6\x99\xd0\x2d\x95\x49\x2a\xb7\x58\xb2\xd2\x1a\x5b\x88\x19\xa2\x26\x31\xd4\xb2\xaa\xd4\x9e\xfe\x05\x51\xb9\x86\xc5\xec\xd2\xec\xe5\x7f\x6b\x92\xec\x8a\xb7\x1e\x29\x9e\x84\xde\x7e\xff\x25\x34\x7e\x64\x95\x87\xef\x1d\x8d\xa5\x0a\xb9\x62\xc0\x77\x43\xd6\x6d\x32\x91\x33\xf6\xe7\xf3\x6b\x47\xbf\x9e\x5f\x89\xb3\xa7\xc7\x54\xd6\x43\xd4\xd0\x91\xab\x82\x4e\x10\x1c\x62\xe6\xba\xed\xaf\x41\xde\xfd\x3c\x4e\x8a\x57\x88\x55\x51\x35\x15\x7b\xf1\x72\x5d\xc1\x60\x9e\x1b\x03\xc6\xc9\xcd\xe9\xac\x13\x58\x31\xc3\x8e\x76\x41\xdc\x49\xe7\x11\x42\x2f\x7f\x96\x87\xbd\xf6\xd6\xdf\xdf\xfd\xa0\x89\xab\x02\x0c\x66\xe0\x7c\x34\x1a\xfe\x54\x76\x0d\xeb\xfa\x1c\x11\x2c\x23\x8c\xb3\x0b\xfb\x64\xfd\xcd\x0d\xb6\x43\xad\x94\x64\x69\x78\xd1\x78\xcc\xe2\x51\x00\x85\x07\x2c\x67\x28\x2d\x50\x13\x17\x72\x84\xa3\x9d\x9d\x4b\xfe\x7a\x5d\xe1\xb4\x69\x53\xe3\x20\x9c\x38\x99\x69\xd9\x87\xc0\xa2\x2f\xab\x5b\x79\x3b\xe7\x63\x41\x06\x5e\xcc\x1f\x18\x5e\x20\x61\xe5\x0b\xd0\xbc\xa8\x25\xc0\xe9\x58\x2a\x5e\x46\xed\xe9\xa5\x41\x40\x81\xc9\x4e\x70\x22\xbe\xbb\x58\xed\x68\x98\x63\xc2\x6d\xc0\x18\x72\xad\x32\x4a\x6e\x38\x94\x8d\x10\x6e\x2d\xc0\xd2\x60\x09\x7c\xfa\x34\x4f\x2d\x48\xac\xf4\xed\xee\x0b\x3e\x72\x59\xf6\xab\xa0\x16\x47\x1c\xc9\x82\x65\xa9\xe0\x17\xb6\x36\xc1\x46\xfb\x0f",
|
||||
expectedMatch: /#recipe=Raw_Inflate(.|\n)+CyberChef is a simple, intuitive web app for carrying out all manner of /,
|
||||
expectedMatch:
|
||||
/#recipe=Raw_Inflate(.|\n)+CyberChef is a simple, intuitive web app for carrying out all manner of /,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [1, false, false]
|
||||
}
|
||||
]
|
||||
args: [1, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Magic: Defang IP Address, valid",
|
||||
|
@ -138,9 +143,9 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [1, false, false]
|
||||
}
|
||||
]
|
||||
args: [1, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Magic: Defang IP Address, invalid",
|
||||
|
@ -149,8 +154,8 @@ TestRegister.addTests([
|
|||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [1, false, false]
|
||||
}
|
||||
]
|
||||
}
|
||||
args: [1, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -10,20 +10,23 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Multi-Bombe: 3 rotor",
|
||||
input: "BBYFLTHHYIJQAYBBYS",
|
||||
expectedMatch: /<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
|
||||
expectedMatch:
|
||||
/<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Multiple Bombe",
|
||||
"args": [
|
||||
op: "Multiple Bombe",
|
||||
args: [
|
||||
// I, II and III
|
||||
"User defined",
|
||||
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R\nAJDKSIRUXBLHWTMCQGZNPYFVOE<F\nBDFHJLCPRTXVZNYEIWGAKMUSQO<W",
|
||||
"",
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
|
||||
"THISISATESTMESSAGE", 0, false
|
||||
]
|
||||
}
|
||||
]
|
||||
"THISISATESTMESSAGE",
|
||||
0,
|
||||
false,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
/*
|
||||
* This is too slow to run regularly
|
||||
|
|
|
@ -73,5 +73,5 @@ TestRegister.addTests([
|
|||
args: [0, true],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -30,5 +30,4 @@ TestRegister.addTests([
|
|||
},
|
||||
],
|
||||
},
|
||||
|
||||
]);
|
||||
|
|
|
@ -19,7 +19,8 @@ TestRegister.addTests([
|
|||
args: ["NFD"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: "Normalise Unicode - NFC",
|
||||
input: "\u00c7\u0043\u0327\u2160",
|
||||
expectedMatch: /\u00C7\u00C7\u2160/,
|
||||
|
@ -29,7 +30,8 @@ TestRegister.addTests([
|
|||
args: ["NFC"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: "Normalise Unicode - NFKD",
|
||||
input: "\u00c7\u0043\u0327\u2160",
|
||||
expectedMatch: /C\u0327C\u0327I/,
|
||||
|
@ -39,7 +41,8 @@ TestRegister.addTests([
|
|||
args: ["NFKD"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: "Normalise Unicode - NFKC",
|
||||
input: "\u00c7\u0043\u0327\u2160",
|
||||
expectedMatch: /\u00C7\u00C7I/,
|
||||
|
@ -51,4 +54,3 @@ TestRegister.addTests([
|
|||
],
|
||||
},
|
||||
]);
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue