adding prettier

This commit is contained in:
Hare Sudhan 2024-02-25 16:31:23 -05:00
parent c5a1b69c30
commit ab0bc52d3c
717 changed files with 29324 additions and 18602 deletions

View file

@ -9,20 +9,16 @@
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);
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,7 +32,7 @@ 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;
@ -58,14 +54,12 @@ module.exports = {
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
@ -76,23 +70,17 @@ module.exports = {
.doubleClick("xpath", toHex);
// Confirm that it has been added to the recipe
browser
.useCss()
.waitForElementVisible(op, 100)
.expect.element(op).text.to.contain("To Hex");
browser.useCss().waitForElementVisible(op, 100).expect.element(op).text.to.contain("To Hex");
// Enter input
browser
.useCss()
.sendKeys("#input-text .cm-content", "Don't Panic.")
.pause(1000)
.click("#bake");
browser.useCss().sendKeys("#input-text .cm-content", "Don't Panic.").pause(1000).click("#bake");
// Check output
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 +91,77 @@ 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 => {
"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,12 +174,13 @@ 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()
@ -223,7 +190,7 @@ module.exports = {
.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,7 +200,8 @@ 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
@ -242,7 +210,7 @@ module.exports = {
.waitForElementNotVisible("#snackbar-container");
},
after: browser => {
after: (browser) => {
browser.end();
}
};

View file

@ -48,12 +48,12 @@ const ALL_BYTES = [
"\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",
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
].join("");
const PUA_CHARS = "\ue000\ue001\uf8fe\uf8ff";
const MULTI_LINE_STRING =`"You know," said Arthur, "it's at times like this, when I'm trapped in a Vogon airlock with a man from Betelgeuse, and about to die of asphyxiation in deep space that I really wish I'd listened to what my mother told me when I was young."
const MULTI_LINE_STRING = `"You know," said Arthur, "it's at times like this, when I'm trapped in a Vogon airlock with a man from Betelgeuse, and about to die of asphyxiation in deep space that I really wish I'd listened to what my mother told me when I was young."
"Why, what did she tell you?"
"I don't know, I didn't listen."`;
@ -91,7 +91,7 @@ const CONTROL_CHAR_NAMES = {
};
module.exports = {
before: browser => {
before: (browser) => {
browser
.resizeWindow(1280, 800)
.url(browser.launchUrl)
@ -100,7 +100,7 @@ module.exports = {
.click("#auto-bake-label");
},
"CodeMirror has loaded correctly": browser => {
"CodeMirror has loaded correctly": (browser) => {
/* Editor has initialised */
browser
.useCss()
@ -121,29 +121,45 @@ module.exports = {
browser // Input
.waitForElementVisible("#input-text .cm-status-bar")
.waitForElementVisible("#input-text .cm-status-bar .stats-length-value")
.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("0");
browser.waitForElementVisible("#input-text .cm-status-bar .stats-lines-value")
.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("1");
browser.waitForElementVisible("#input-text .cm-status-bar .chr-enc-value")
.expect.element("#input-text .cm-status-bar .chr-enc-value").text.to.equal("Raw Bytes");
browser.waitForElementVisible("#input-text .cm-status-bar .eol-value")
.expect.element("#input-text .cm-status-bar .eol-value").text.to.equal("LF");
.expect.element("#input-text .cm-status-bar .stats-length-value")
.text.to.equal("0");
browser
.waitForElementVisible("#input-text .cm-status-bar .stats-lines-value")
.expect.element("#input-text .cm-status-bar .stats-lines-value")
.text.to.equal("1");
browser
.waitForElementVisible("#input-text .cm-status-bar .chr-enc-value")
.expect.element("#input-text .cm-status-bar .chr-enc-value")
.text.to.equal("Raw Bytes");
browser
.waitForElementVisible("#input-text .cm-status-bar .eol-value")
.expect.element("#input-text .cm-status-bar .eol-value")
.text.to.equal("LF");
browser // Output
.waitForElementVisible("#output-text .cm-status-bar")
.waitForElementVisible("#output-text .cm-status-bar .stats-length-value")
.expect.element("#output-text .cm-status-bar .stats-length-value").text.to.equal("0");
browser.waitForElementVisible("#output-text .cm-status-bar .stats-lines-value")
.expect.element("#output-text .cm-status-bar .stats-lines-value").text.to.equal("1");
browser.waitForElementVisible("#output-text .cm-status-bar .baking-time-info")
.expect.element("#output-text .cm-status-bar .baking-time-info").text.to.contain("ms");
browser.waitForElementVisible("#output-text .cm-status-bar .chr-enc-value")
.expect.element("#output-text .cm-status-bar .chr-enc-value").text.to.equal("Raw Bytes");
browser.waitForElementVisible("#output-text .cm-status-bar .eol-value")
.expect.element("#output-text .cm-status-bar .eol-value").text.to.equal("LF");
.expect.element("#output-text .cm-status-bar .stats-length-value")
.text.to.equal("0");
browser
.waitForElementVisible("#output-text .cm-status-bar .stats-lines-value")
.expect.element("#output-text .cm-status-bar .stats-lines-value")
.text.to.equal("1");
browser
.waitForElementVisible("#output-text .cm-status-bar .baking-time-info")
.expect.element("#output-text .cm-status-bar .baking-time-info")
.text.to.contain("ms");
browser
.waitForElementVisible("#output-text .cm-status-bar .chr-enc-value")
.expect.element("#output-text .cm-status-bar .chr-enc-value")
.text.to.equal("Raw Bytes");
browser
.waitForElementVisible("#output-text .cm-status-bar .eol-value")
.expect.element("#output-text .cm-status-bar .eol-value")
.text.to.equal("LF");
},
"Adding content": browser => {
"Adding content": (browser) => {
/* Status bar updates correctly */
utils.setInput(browser, MULTI_LINE_STRING);
@ -167,23 +183,32 @@ module.exports = {
browser.expect.element("#output-text .cm-status-bar .eol-value").text.to.equal("LF");
},
"Special content": browser => {
"Special content": (browser) => {
/* Special characters are rendered correctly */
utils.setInput(browser, SPECIAL_CHARS, false);
// First line
for (let i = 0x0; i <= 0x8; i++) {
browser.expect.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
.to.have.property("title").equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
browser.expect.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
browser.expect
.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
.to.have.property("title")
.equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
browser.expect
.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
.text.to.equal(String.fromCharCode(0x2400 + i));
}
// Tab \u0009
browser.expect.element(`#input-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/\u0009$/);
browser.expect
.element(`#input-text .cm-line:nth-of-type(1)`)
.to.have.property("textContent")
.match(/\u0009$/);
// Line feed \u000a
browser.expect.element(`#input-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/^.{10}$/);
browser.expect
.element(`#input-text .cm-line:nth-of-type(1)`)
.to.have.property("textContent")
.match(/^.{10}$/);
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
// Second line
@ -192,9 +217,12 @@ module.exports = {
const name = CONTROL_CHAR_NAMES[index] || "0x" + index.toString(16);
const value = index >= 32 ? "\u2022" : String.fromCharCode(0x2400 + index);
browser.expect.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
.to.have.property("title").equals(`Control character ${name}`);
browser.expect.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
browser.expect
.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
.to.have.property("title")
.equals(`Control character ${name}`);
browser.expect
.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
.text.to.equal(value);
}
@ -204,17 +232,26 @@ module.exports = {
// First line
for (let i = 0x0; i <= 0x8; i++) {
browser.expect.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
.to.have.property("title").equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
browser.expect.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
browser.expect
.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
.to.have.property("title")
.equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
browser.expect
.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
.text.to.equal(String.fromCharCode(0x2400 + i));
}
// Tab \u0009
browser.expect.element(`#output-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/\u0009$/);
browser.expect
.element(`#output-text .cm-line:nth-of-type(1)`)
.to.have.property("textContent")
.match(/\u0009$/);
// Line feed \u000a
browser.expect.element(`#output-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/^.{10}$/);
browser.expect
.element(`#output-text .cm-line:nth-of-type(1)`)
.to.have.property("textContent")
.match(/^.{10}$/);
browser.expect.element("#output-text .cm-status-bar .stats-lines-value").text.to.equal("2");
// Second line
@ -223,20 +260,25 @@ module.exports = {
const name = CONTROL_CHAR_NAMES[index] || "0x" + index.toString(16);
const value = index >= 32 ? "\u2022" : String.fromCharCode(0x2400 + index);
browser.expect.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
.to.have.property("title").equals(`Control character ${name}`);
browser.expect.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
browser.expect
.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
.to.have.property("title")
.equals(`Control character ${name}`);
browser.expect
.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
.text.to.equal(value);
}
/* Bytes are rendered correctly */
utils.setInput(browser, ALL_BYTES, false);
// Expect length to be 255, since one character is creating a newline
browser.expect.element(`#input-text .cm-content`).to.have.property("textContent").match(/^.{255}$/);
browser.expect
.element(`#input-text .cm-content`)
.to.have.property("textContent")
.match(/^.{255}$/);
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("256");
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
/* PUA \ue000-\uf8ff */
utils.setInput(browser, PUA_CHARS, false);
utils.setChrEnc(browser, "output", "UTF-8");
@ -250,8 +292,14 @@ module.exports = {
Therefore, PUA characters should be rendered normally in the Input but as control character
pictures in the output.
*/
browser.expect.element(`#input-text .cm-content`).to.have.property("textContent").match(/^\ue000\ue001\uf8fe\uf8ff$/);
browser.expect.element(`#output-text .cm-content`).to.have.property("textContent").match(/^\u2400\u2401\u3cfe\u3cff$/);
browser.expect
.element(`#input-text .cm-content`)
.to.have.property("textContent")
.match(/^\ue000\ue001\uf8fe\uf8ff$/);
browser.expect
.element(`#output-text .cm-content`)
.to.have.property("textContent")
.match(/^\u2400\u2401\u3cfe\u3cff$/);
/* Can be copied */
utils.setInput(browser, SPECIAL_CHARS, false);
@ -266,28 +314,28 @@ module.exports = {
utils.paste(browser, "#search"); // Paste into search box as this won't mess with the values
// Ensure that the values are as expected
browser.expect.element("#search").to.have.value.that.equals("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008");
browser.expect
.element("#search")
.to.have.value.that.equals("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008");
browser.clearValue("#search");
// Raw copy
browser
.click("#copy-output")
.pause(100);
browser.click("#copy-output").pause(100);
utils.paste(browser, "#search"); // Paste into search box as this won't mess with the values
// Ensure that the values are as expected
browser.expect.element("#search").to.have.value.that.matches(/^\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009/);
browser.expect
.element("#search")
.to.have.value.that.matches(/^\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009/);
browser.clearValue("#search");
},
"HTML output": browser => {
"HTML output": (browser) => {
/* Displays correctly */
utils.loadRecipe(browser, "Entropy", ALL_BYTES);
utils.bake(browser);
browser
.waitForElementVisible("#output-html")
.waitForElementVisible("#output-html #chart-area");
browser.waitForElementVisible("#output-html").waitForElementVisible("#output-html #chart-area");
/* Status bar widgets are disabled */
browser.expect.element("#output-text .cm-status-bar .disabled .stats-length-value").to.be.visible;
@ -300,17 +348,18 @@ module.exports = {
utils.bake(browser);
for (let i = 0x0; i <= 0x4; i++) {
browser.expect.element(`#output-html .cm-specialChar:nth-of-type(${i+1})`)
.to.have.property("title").equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
browser.expect.element(`#output-html .cm-specialChar:nth-of-type(${i+1})`)
browser.expect
.element(`#output-html .cm-specialChar:nth-of-type(${i + 1})`)
.to.have.property("title")
.equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
browser.expect
.element(`#output-html .cm-specialChar:nth-of-type(${i + 1})`)
.text.to.equal(String.fromCharCode(0x2400 + i));
}
/* Can be copied */
// Raw copy
browser
.click("#copy-output")
.pause(100);
browser.click("#copy-output").pause(100);
utils.paste(browser, "#search"); // Paste into search box as this won't mess with the values
// Ensure that the values are as expected
@ -318,7 +367,7 @@ module.exports = {
browser.clearValue("#search");
},
"Highlighting": browser => {
"Highlighting": (browser) => {
utils.setInput(browser, SELECTABLE_STRING);
utils.bake(browser);
@ -376,14 +425,17 @@ module.exports = {
browser.click("#auto-bake-label");
},
"Character encoding": browser => {
"Character encoding": (browser) => {
const CHINESE_CHARS = "不要恐慌。";
/* Dropup works */
/* Selecting changes output correctly */
utils.setInput(browser, CHINESE_CHARS, false);
utils.setChrEnc(browser, "input", "UTF-8");
utils.bake(browser);
utils.expectOutput(browser, "\u00E4\u00B8\u008D\u00E8\u00A6\u0081\u00E6\u0081\u0090\u00E6\u0085\u008C\u00E3\u0080\u0082");
utils.expectOutput(
browser,
"\u00E4\u00B8\u008D\u00E8\u00A6\u0081\u00E6\u0081\u0090\u00E6\u0085\u008C\u00E3\u0080\u0082"
);
/* Changing output to match input works as expected */
utils.setChrEnc(browser, "output", "UTF-8");
@ -395,9 +447,7 @@ module.exports = {
browser.assert.urlContains("oenc=65001");
/* Preserved when changing tabs */
browser
.click("#btn-new-tab")
.waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
browser.click("#btn-new-tab").waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
browser.expect.element("#input-text .chr-enc-value").text.that.equals("Raw Bytes");
browser.expect.element("#output-text .chr-enc-value").text.that.equals("Raw Bytes");
@ -435,7 +485,7 @@ module.exports = {
utils.expectOutput(browser, "\u00A4\u0408\u00ADn\u00AE\u0408\u00B7W\u040EC");
},
"Line endings": browser => {
"Line endings": (browser) => {
/* Dropup works */
/* Selecting changes view in input */
utils.setInput(browser, MULTI_LINE_STRING);
@ -530,7 +580,9 @@ module.exports = {
.waitForElementPresent("#input-text .cm-content .cm-line:nth-of-type(2)")
.waitForElementNotPresent("#input-text .cm-content .cm-line:nth-of-type(3)")
.waitForElementPresent("#input-text .cm-content .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(3)");
browser.expect.element("#input-text .cm-content .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(3)").text.to.equal("␋");
browser.expect
.element("#input-text .cm-content .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(3)")
.text.to.equal("␋");
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("304");
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
@ -549,9 +601,7 @@ module.exports = {
browser.assert.urlContains("oeol=%0D");
/* Preserved when changing tabs */
browser
.click("#btn-new-tab")
.waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
browser.click("#btn-new-tab").waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
browser.expect.element("#input-text .eol-value").text.that.equals("LF");
browser.expect.element("#output-text .eol-value").text.that.equals("LF");
@ -565,7 +615,7 @@ module.exports = {
browser.expect.element("#output-text .eol-value").text.that.equals("CR");
},
"File inputs": browser => {
"File inputs": (browser) => {
utils.clear(browser);
/* Side panel displays correct info */
@ -589,16 +639,20 @@ module.exports = {
.click("#input-text .cm-file-details .file-details-toggle-shown")
.waitForElementNotPresent("#input-text .cm-file-details .file-details-toggle-shown")
.waitForElementVisible("#input-text .cm-file-details .file-details-toggle-hidden")
.expect.element("#input-text .cm-file-details").to.have.css("width").which.equals("1px");
.expect.element("#input-text .cm-file-details")
.to.have.css("width")
.which.equals("1px");
browser
.click("#input-text .cm-file-details .file-details-toggle-hidden")
.waitForElementNotPresent("#input-text .cm-file-details .file-details-toggle-hidden")
.waitForElementVisible("#input-text .cm-file-details .file-details-toggle-shown")
.expect.element("#input-text .cm-file-details").to.have.css("width").which.equals("200px");
.expect.element("#input-text .cm-file-details")
.to.have.css("width")
.which.equals("200px");
},
"Folder inputs": browser => {
"Folder inputs": (browser) => {
utils.clear(browser);
/* Side panel displays correct info */
@ -619,19 +673,35 @@ module.exports = {
.waitForElementVisible("#input-text .cm-file-details .file-details-type")
.waitForElementVisible("#input-text .cm-file-details .file-details-loaded");
browser.getText("#input-text .cm-file-details .file-details-name", function(result) {
browser.getText("#input-text .cm-file-details .file-details-name", function (result) {
switch (result.value) {
case "TowelDay.jpeg":
browser.expect.element("#input-text .cm-file-details .file-details-name").text.that.equals("TowelDay.jpeg");
browser.expect.element("#input-text .cm-file-details .file-details-size").text.that.equals("61,379 bytes");
browser.expect.element("#input-text .cm-file-details .file-details-type").text.that.equals("image/jpeg");
browser.expect.element("#input-text .cm-file-details .file-details-loaded").text.that.equals("100%");
browser.expect
.element("#input-text .cm-file-details .file-details-name")
.text.that.equals("TowelDay.jpeg");
browser.expect
.element("#input-text .cm-file-details .file-details-size")
.text.that.equals("61,379 bytes");
browser.expect
.element("#input-text .cm-file-details .file-details-type")
.text.that.equals("image/jpeg");
browser.expect
.element("#input-text .cm-file-details .file-details-loaded")
.text.that.equals("100%");
break;
case "Hitchhikers_Guide.jpeg":
browser.expect.element("#input-text .cm-file-details .file-details-name").text.that.equals("Hitchhikers_Guide.jpeg");
browser.expect.element("#input-text .cm-file-details .file-details-size").text.that.equals("36,595 bytes");
browser.expect.element("#input-text .cm-file-details .file-details-type").text.that.equals("image/jpeg");
browser.expect.element("#input-text .cm-file-details .file-details-loaded").text.that.equals("100%");
browser.expect
.element("#input-text .cm-file-details .file-details-name")
.text.that.equals("Hitchhikers_Guide.jpeg");
browser.expect
.element("#input-text .cm-file-details .file-details-size")
.text.that.equals("36,595 bytes");
browser.expect
.element("#input-text .cm-file-details .file-details-type")
.text.that.equals("image/jpeg");
browser.expect
.element("#input-text .cm-file-details .file-details-loaded")
.text.that.equals("100%");
break;
default:
break;
@ -640,13 +710,18 @@ module.exports = {
}
},
"Loading from URL": browser => {
"Loading from URL": (browser) => {
/* Complex deep link populates the input correctly (encoding, eol, input) */
browser
.urlHash("recipe=To_Base64('A-Za-z0-9%2B/%3D')&input=VGhlIHNoaXBzIGh1bmcgaW4gdGhlIHNreSBpbiBtdWNoIHRoZSBzYW1lIHdheSB0aGF0IGJyaWNrcyBkb24ndC4M&ienc=21866&oenc=1201&ieol=%0C&oeol=%E2%80%A9")
.urlHash(
"recipe=To_Base64('A-Za-z0-9%2B/%3D')&input=VGhlIHNoaXBzIGh1bmcgaW4gdGhlIHNreSBpbiBtdWNoIHRoZSBzYW1lIHdheSB0aGF0IGJyaWNrcyBkb24ndC4M&ienc=21866&oenc=1201&ieol=%0C&oeol=%E2%80%A9"
)
.waitForElementVisible("#rec-list li.operation");
browser.expect.element(`#input-text .cm-content`).to.have.property("textContent").match(/^.{65}$/);
browser.expect
.element(`#input-text .cm-content`)
.to.have.property("textContent")
.match(/^.{65}$/);
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("66");
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
@ -658,14 +733,21 @@ module.exports = {
utils.bake(browser);
browser.expect.element(`#output-text .cm-content`).to.have.property("textContent").match(/^.{44}$/);
browser.expect
.element(`#output-text .cm-content`)
.to.have.property("textContent")
.match(/^.{44}$/);
browser.expect.element("#output-text .cm-status-bar .stats-length-value").text.to.equal("44");
browser.expect.element("#output-text .cm-status-bar .stats-lines-value").text.to.equal("1");
},
"Replace input with output": browser => {
"Replace input with output": (browser) => {
/* Input is correctly populated */
utils.loadRecipe(browser, "XOR", "The ships hung in the sky in much the same way that bricks don't.", [{ "option": "Hex", "string": "65" }, "Standard", false]);
utils.loadRecipe(browser, "XOR", "The ships hung in the sky in much the same way that bricks don't.", [
{ "option": "Hex", "string": "65" },
"Standard",
false
]);
utils.setChrEnc(browser, "input", "UTF-32LE");
utils.setChrEnc(browser, "output", "UTF-7");
utils.setEOLSeq(browser, "input", "CRLF");
@ -673,7 +755,8 @@ module.exports = {
browser
.sendKeys("#input-text .cm-content", browser.Keys.RETURN)
.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
.expect.element("#input-text .cm-status-bar .stats-lines-value")
.text.to.equal("2");
utils.bake(browser);
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("67");
@ -682,9 +765,7 @@ module.exports = {
browser.expect.element("#input-text .eol-value").text.that.equals("CRLF");
browser.expect.element("#output-text .cm-status-bar .stats-length-value").text.to.equal("268");
browser
.click("#switch")
.waitForElementVisible("#stale-indicator");
browser.click("#switch").waitForElementVisible("#stale-indicator");
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("268");
@ -693,12 +774,13 @@ module.exports = {
browser.expect.element("#input-text .chr-enc-value").text.that.equals("UTF-7");
browser.expect.element("#input-text .eol-value").text.that.equals("LS");
browser.expect.element("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(1)").text.to.equal("␍");
browser.expect.element("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(49)").text.to.equal("␑");
browser.expect
.element("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(49)")
.text.to.equal("␑");
browser.waitForElementNotPresent("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(50)");
},
after: browser => {
after: (browser) => {
browser.end();
}
};

View file

@ -16,7 +16,7 @@
const utils = require("./browserUtils.js");
module.exports = {
before: browser => {
before: (browser) => {
browser
.resizeWindow(1280, 800)
.url(browser.launchUrl)
@ -25,16 +25,33 @@ 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, "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]);
@ -43,35 +60,97 @@ module.exports = {
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 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, "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");
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,14 +158,72 @@ 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");
@ -96,7 +233,7 @@ module.exports = {
// 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,24 +245,37 @@ 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");
// 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 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");
@ -143,7 +293,7 @@ module.exports = {
// testOp(browser, "Format MAC addresses", "test input", "test_output");
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 +308,26 @@ 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");
// 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");
@ -195,31 +345,31 @@ module.exports = {
testOpImage(browser, "Image Opacity", "files/Hitchhikers_Guide.jpeg");
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");
// 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");
// 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/);
@ -231,44 +381,56 @@ 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");
// 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");
// 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");
// 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");
@ -276,10 +438,20 @@ module.exports = {
// 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");
// 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");
@ -293,14 +465,14 @@ module.exports = {
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 +481,18 @@ 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 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,7 +505,7 @@ 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]");
@ -335,7 +513,13 @@ module.exports = {
// 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 +529,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 +537,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");
@ -381,27 +565,30 @@ module.exports = {
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 +597,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 +615,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,7 +630,7 @@ 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") {
@ -462,7 +649,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 +659,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 +675,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);

View file

@ -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]
);
}
}
@ -69,7 +70,8 @@ function setChrEnc(browser, io, enc) {
.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);
.expect.element(io + " .chr-enc-value")
.text.that.equals(enc);
}
/** @function
@ -87,7 +89,8 @@ function setEOLSeq(browser, io, eol) {
.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);
.expect.element(io + " .eol-value")
.text.that.equals(eol);
}
/** @function
@ -96,8 +99,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 +120,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,11 +144,13 @@ 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) => {
@ -156,14 +161,12 @@ function loadRecipe(browser, opName, input, args) {
})
);
} 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);
setInput(browser, input, false);
browser
.urlHash("recipe=" + recipeConfig)
.waitForElementPresent("#rec-list li.operation");
browser.urlHash("recipe=" + recipeConfig).waitForElementPresent("#rec-list li.operation");
}
/** @function
@ -173,14 +176,17 @@ 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
@ -197,10 +203,7 @@ function uploadFile(browser, filename) {
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";
});
@ -221,17 +224,13 @@ function uploadFolder(browser, foldername) {
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,

View file

@ -21,7 +21,6 @@ import log from "loglevel";
* @constructor
*/
class TestRegister {
/**
* initialise with no tests
*/
@ -50,14 +49,17 @@ 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...");
@ -71,11 +73,7 @@ class TestRegister {
});
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,
@ -94,7 +92,7 @@ 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 {
@ -113,15 +111,18 @@ class TestRegister {
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"),
"Received",
"\t" + result.result.replace(/\n/g, "\n\t"),
"\t" + result.result.replace(/\n/g, "\n\t")
].join("\n");
}
}
@ -140,10 +141,13 @@ 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...");
@ -178,7 +182,6 @@ class TestRegister {
}
}
/**
* Formatter for the progress bar
*
@ -188,8 +191,9 @@ 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);

View file

@ -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] || "?"
);
}
/**
@ -46,7 +47,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 +59,15 @@ 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(" "));
results
.filter((res) => res.status !== "passing")
.forEach((testResult) => {
console.log([statusToIcon(testResult.status), testResult.test.name].join(" "));
if (testResult.output) {
console.log(
testResult.output
.trim()
.replace(/^/, "\t")
.replace(/\n/g, "\n\t")
);
}
});
if (testResult.output) {
console.log(testResult.output.trim().replace(/^/, "\t").replace(/\n/g, "\n\t"));
}
});
console.log();
process.exit(testStatus.allTestsPassing ? 0 : 1);
@ -83,7 +78,7 @@ export function logTestReport(testStatus, results) {
*/
export function setLongTestFailure() {
const timeLimit = 120;
setTimeout(function() {
setTimeout(function () {
console.log(`Tests took longer than ${timeLimit} seconds to run, returning.`);
process.exit(1);
}, timeLimit * 1000);

View file

@ -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
@ -53,7 +51,7 @@ const wrapRun = (run) => async () => {
export function it(name, run) {
return {
name: `Node API: ${name}`,
run: wrapRun(run),
run: wrapRun(run)
};
}

View file

@ -8,25 +8,23 @@
const assert = require("assert");
require("cyberchef").then(chef => {
require("cyberchef").then((chef) => {
const d = chef.bake("Testing, 1 2 3", [
chef.toHex,
chef.reverse,
{
op: chef.unique,
args: {
delimiter: "Space",
delimiter: "Space"
}
},
{
op: chef.multiply,
args: {
delimiter: "Space",
delimiter: "Space"
}
}
]);
assert.equal(d.value, "630957449041920");
});

View file

@ -15,13 +15,13 @@ const a = bake("Testing, 1 2 3", [
{
op: unique,
args: {
delimiter: "Space",
delimiter: "Space"
}
},
{
op: multiply,
args: {
delimiter: "Space",
delimiter: "Space"
}
}
]);
@ -34,13 +34,13 @@ const b = chef.bake("Testing, 1 2 3", [
{
op: chef.unique,
args: {
delimiter: "Space",
delimiter: "Space"
}
},
{
op: chef.multiply,
args: {
delimiter: "Space",
delimiter: "Space"
}
}
]);

View file

@ -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";
@ -27,7 +24,7 @@ import "./tests/Categories.mjs";
const testStatus = {
allTestsPassing: true,
counts: {
total: 0,
total: 0
}
};
@ -35,7 +32,7 @@ setLongTestFailure();
const logOpsTestReport = logTestReport.bind(null, testStatus);
(async function() {
(async function () {
const results = await TestRegister.runApiTests();
logOpsTestReport(results);
})();

View file

@ -1,19 +1,18 @@
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`);
}
}),
})
]);

View file

@ -7,6 +7,5 @@ TestRegister.addApiTests([
it("Dish - presentAs: should exist", () => {
const dish = new Dish();
assert(dish.presentAs);
}),
})
]);

View file

@ -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);
}
})
]);

View file

@ -30,7 +30,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);
@ -44,7 +43,7 @@ TestRegister.addApiTests([
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,12 +55,12 @@ TestRegister.addApiTests([
}),
it("Composable Dish: apply should allow set of arguments for operation", () => {
const result = new Dish("input").apply(SHA3, {size: "256"});
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"});
const result = new Dish("input").apply(toBase32).apply(SHA3, { size: "224" });
assert.strictEqual(result.toString(), "493e8136b759370a415ef2cf2f7a69690441ff86592aba082bc2e2e0");
}),
@ -77,7 +76,10 @@ 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");
@ -144,14 +146,17 @@ TestRegister.addApiTests([
// 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);
@ -170,7 +175,10 @@ TestRegister.addApiTests([
// 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 +195,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");
}),
})
]);

View file

@ -18,6 +18,5 @@ TestRegister.addApiTests([
it("Utils: should parse escaped quotes and escaped backslashes correctly", () => {
assert.equal(Utils.parseEscapedChars("\\\\\\'"), "\\'");
}),
})
]);

View file

@ -16,7 +16,7 @@ import chef from "../../../src/node/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([
@ -69,7 +69,7 @@ TestRegister.addApiTests([
it("should accept just some of the optional arguments being overriden", () => {
const result = chef.setIntersection("1 2 3 4 5\\n\\n3 4 5", {
itemDelimiter: " ",
itemDelimiter: " "
});
assert.equal(result.value, "3 4 5");
@ -101,7 +101,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 +119,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);
}),
@ -196,7 +199,10 @@ TestRegister.addApiTests([
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");
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", () => {
@ -207,16 +213,30 @@ TestRegister.addApiTests([
}),
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=");
}),
@ -228,8 +248,15 @@ TestRegister.addApiTests([
}),
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", () => {
@ -251,7 +278,7 @@ TestRegister.addApiTests([
it("chef.bake: should take single JSON object desribing op with optional args", () => {
const result = chef.bake("some input", {
op: chef.toHex,
op: chef.toHex
});
assert.strictEqual(result.toString(), "73 6f 6d 65 20 69 6e 70 75 74");
}),
@ -265,13 +292,17 @@ TestRegister.addApiTests([
}),
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", () => {
@ -283,26 +314,32 @@ TestRegister.addApiTests([
{
op: "to octal",
args: {
delimiter: "Semi-colon",
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", () => {
const result = chef.bake("some input", [
{
op: chef.toHex,
op: chef.toHex
},
{
op: "to octal",
args: {
delimiter: "Semi-colon",
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", () => {
@ -311,36 +348,44 @@ TestRegister.addApiTests([
args: {
formatOptions: "Dash/Dot",
wordDelimiter: "Comma",
letterDelimiter: "Backslash",
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": "Hex to PEM", "args": ["SOMETHING"] },
{ "op": "To Snake case", "args": [false] }
]);
assert.strictEqual(result.toString(), "begin_something_aaaaaaaaaaaaaa_end_something");
}),
@ -348,31 +393,42 @@ TestRegister.addApiTests([
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"
);
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"
@ -384,11 +440,11 @@ TestRegister.addApiTests([
assert.deepEqual(chef.unzip.args, {
password: {
type: "binaryString",
value: "",
value: ""
},
verifyResult: {
type: "boolean",
value: false,
value: false
}
});
}),
@ -401,13 +457,11 @@ 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.defangURL.args.process.options[1], "Only full URLs");
}),
})
]);

View file

@ -40,7 +40,6 @@ import File from "../../../src/node/File.mjs";
global.File = File;
TestRegister.addApiTests([
it("ADD: toggleString argument", () => {
const result = chef.ADD("sample input", {
key: {
@ -51,10 +50,9 @@ TestRegister.addApiTests([
assert.equal(result.toString(), "\xe6\xd0\xda\xd5\x8c\xd0\x85\xe2\xe1\xdf\xe2\xd9");
}),
it("ADD: default option toggleString argument", () => {
const result = chef.ADD(3, {
key: "4",
key: "4"
});
assert.strictEqual(result.toString(), "7");
}),
@ -73,13 +71,13 @@ TestRegister.addApiTests([
const result = AESDecrypt("4a123af235a507bbc9d5871721d61b98504d569a9a5a7847e2d78315fec7", {
key: {
string: "some longer key1",
option: "utf8",
option: "utf8"
},
iv: {
string: "some iv some iv1",
option: "utf8",
option: "utf8"
},
mode: "OFB",
mode: "OFB"
});
assert.equal(result.toString(), "a slightly longer sampleinput?");
}),
@ -121,7 +119,7 @@ Tiger-128`;
const result = chef.AND("Scot-free", {
key: {
string: "Raining Cats and Dogs",
option: "utf8",
option: "utf8"
}
});
assert.strictEqual(result.toString(), "Raid)fb A");
@ -130,7 +128,6 @@ Tiger-128`;
it("atBash Cipher", () => {
const result = chef.atbashCipher("Happy as a Clam");
assert.strictEqual(result.toString(), "Szkkb zh z Xozn");
}),
it("Bcrypt", async () => {
@ -140,9 +137,9 @@ Tiger-128`;
assert.equal(strResult.slice(0, 7), "$2a$10$");
}),
it("bcryptCompare", async() => {
it("bcryptCompare", async () => {
const result = await chef.bcryptCompare("Put a Sock In It", {
hash: "$2a$10$2rT4a3XnIecBsd1H33dMTuyYE1HJ1n9F.V2rjQtAH73rh1qvOf/ae",
hash: "$2a$10$2rT4a3XnIecBsd1H33dMTuyYE1HJ1n9F.V2rjQtAH73rh1qvOf/ae"
});
assert.strictEqual(result.toString(), "Match: Put a Sock In It");
}),
@ -158,14 +155,14 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
it("bifid cipher decode", () => {
const result = chef.bifidCipherDecode("Vhef Qnte Ke Xfhz Mxon Bmgf", {
keyword: "Alpha",
keyword: "Alpha"
});
assert.strictEqual(result.toString(), "What Goes Up Must Come Down");
}),
it("bifid cipher encode: string option", () => {
const result = bifidCipherEncode("some input", {
keyword: "mykeyword",
keyword: "mykeyword"
});
assert.strictEqual(result.toString(), "nmhs zmsdo");
}),
@ -178,7 +175,7 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
it("bitShiftRight: number and option", () => {
const result = bitShiftRight("some bits to shift", {
type: "Arithmetic shift",
amount: 1,
amount: 1
});
assert.strictEqual(result.toString(), "9762\u001014:9\u0010:7\u00109443:");
}),
@ -187,7 +184,7 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
const result = chef.blowfishEncrypt("Fool's Gold", {
key: {
string: "0011223344556677",
option: "hex",
option: "hex"
},
iv: {
string: "exparrot",
@ -202,11 +199,11 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
const result = chef.blowfishDecrypt("55a2838980078ffe1722b08d5fa1d481", {
key: {
string: "0011223344556677",
option: "hex",
option: "hex"
},
iv: {
string: "exparrot",
option: "utf8",
option: "utf8"
},
mode: "CBC"
});
@ -214,20 +211,25 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
}),
it("BSON Serialise / Deserialise", () => {
const result = chef.BSONDeserialise(chef.BSONSerialise("{\"phrase\": \"Mouth-watering\"}"));
assert.strictEqual(result.toString(), `{
const result = chef.BSONDeserialise(chef.BSONSerialise('{"phrase": "Mouth-watering"}'));
assert.strictEqual(
result.toString(),
`{
"phrase": "Mouth-watering"
}`);
}`
);
}),
it("Bzip2 Decompress", async () => {
const result = await chef.bzip2Decompress(chef.fromBase64("QlpoOTFBWSZTWUdQlt0AAAIVgEAAAQAmJAwAIAAxBkxA0A2pTL6U2CozxdyRThQkEdQlt0A="));
const result = await chef.bzip2Decompress(
chef.fromBase64("QlpoOTFBWSZTWUdQlt0AAAIVgEAAAQAmJAwAIAAxBkxA0A2pTL6U2CozxdyRThQkEdQlt0A=")
);
assert.strictEqual(result.toString(), "Fit as a Fiddle");
}),
it("cartesianProduct: binary string", () => {
const result = cartesianProduct("1:2\\n\\n3:4", {
itemDelimiter: ":",
itemDelimiter: ":"
});
assert.strictEqual(result.toString(), "(1,3):(1,4):(2,3):(2,4)");
}),
@ -235,7 +237,7 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
it("Change IP format", () => {
const result = chef.changeIPFormat("172.20.23.54", {
inputFormat: "Dotted Decimal",
outputFormat: "Hex",
outputFormat: "Hex"
});
assert.strictEqual(result.toString(), "ac141736");
}),
@ -266,7 +268,7 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
it("Convert data units", () => {
const result = chef.convertDataUnits("12345", {
inputUnits: "Bits (b)",
outputUnits: "Kilobytes (KB)",
outputUnits: "Kilobytes (KB)"
});
assert.strictEqual(result.toString(), "1.543125");
}),
@ -274,7 +276,7 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
it("Convert distance", () => {
const result = chef.convertDistance("1234567", {
inputUnits: "Nanometres (nm)",
outputUnits: "Furlongs (fur)",
outputUnits: "Furlongs (fur)"
});
assert.strictEqual(result.toString(), "0.00000613699494949495");
}),
@ -282,7 +284,7 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
it("Convert mass", () => {
const result = chef.convertMass("123", {
inputUnits: "Earth mass (M⊕)",
outputUnits: "Great Pyramid of Giza (6,000,000 tonnes)",
outputUnits: "Great Pyramid of Giza (6,000,000 tonnes)"
});
assert.strictEqual(result.toString(), "122429895000000000");
}),
@ -290,7 +292,7 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
it("Convert speed", () => {
const result = chef.convertSpeed("123", {
inputUnits: "Lunar escape velocity",
outputUnits: "Jet airliner cruising speed",
outputUnits: "Jet airliner cruising speed"
});
assert.strictEqual(result.toString(), "1168.5");
}),
@ -299,7 +301,7 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
const result = chef.countOccurrences("Talk the Talk", {
searchString: {
string: "Tal",
option: "Simple string",
option: "Simple string"
}
});
assert.strictEqual(result.toString(), "2");
@ -332,14 +334,14 @@ width: 100%;
color: white;
}`;
const result = CSSMinify(input, {
preserveComments: true,
preserveComments: true
});
assert.strictEqual(result.toString(), "header {// comment width: 100%;color: white;}");
}),
it("CSS Selector", () => {
const result = chef.CSSSelector("<html><header><h1>Hello</h1></header></html>", {
cssSelector: "h1",
cssSelector: "h1"
});
assert.strictEqual(result.toString(), "<h1>Hello</h1>");
}),
@ -355,10 +357,10 @@ color: white;
it("Decode text", () => {
const encoded = chef.encodeText("Ugly Duckling", {
encoding: "UTF-16LE (1200)",
encoding: "UTF-16LE (1200)"
});
const result = chef.decodeText(encoded, {
encoding: "UTF-16LE (1200)",
encoding: "UTF-16LE (1200)"
});
assert.strictEqual(result.toString(), "Ugly Duckling");
}),
@ -367,12 +369,12 @@ color: white;
const result = chef.deriveEVPKey("", {
passphrase: {
string: "46 6c 65 61 20 4d 61 72 6b 65 74",
option: "Hex",
option: "Hex"
},
salt: {
string: "Market",
option: "utf8",
},
option: "utf8"
}
});
assert.strictEqual(result.toString(), "4930d5d200e80f18c96b5550d13c6af8");
}),
@ -381,7 +383,7 @@ color: white;
const result = chef.derivePBKDF2Key("", {
passphrase: {
string: "Jack of All Trades Master of None",
option: "utf8",
option: "utf8"
},
keySize: 256,
iterations: 2,
@ -398,13 +400,13 @@ color: white;
const result = chef.DESDecrypt("713081c66db781c323965ba8f166fd8c230c3bb48504a913", {
key: {
string: "onetwoth",
option: "utf8",
option: "utf8"
},
iv: {
string: "threetwo",
option: "utf8",
option: "utf8"
},
mode: "ECB",
mode: "ECB"
});
assert.strictEqual(result.toString(), "Put a Sock In It");
}),
@ -413,13 +415,13 @@ color: white;
const result = chef.DESEncrypt("Put a Sock In It", {
key: {
string: "onetwoth",
option: "utf8",
option: "utf8"
},
iv: {
string: "threetwo",
option: "utf8",
option: "utf8"
},
mode: "ECB",
mode: "ECB"
});
assert.strictEqual(result.toString(), "713081c66db781c323965ba8f166fd8c230c3bb48504a913");
}),
@ -455,7 +457,7 @@ color: white;
escapeLevel: "Everything",
JSONCompatible: false,
ES6Compatible: true,
uppercaseHex: true,
uppercaseHex: true
});
assert.strictEqual(result.toString(), "\\x4B\\x6E\\x6F\\x77\\x20\\x74\\x68\\x65\\x20\\x52\\x6F\\x70\\x65\\x73");
}),
@ -466,37 +468,44 @@ color: white;
it("Expand alphabet range", () => {
assert.strictEqual(
chef.expandAlphabetRange("Fight Fire With Fire", {delimiter: "t"}).toString(),
"Ftitgthttt tFtitrtet tWtitttht tFtitrte");
chef.expandAlphabetRange("Fight Fire With Fire", { delimiter: "t" }).toString(),
"Ftitgthttt tFtitrtet tWtitttht tFtitrte"
);
}),
it("Extract dates", () => {
assert.strictEqual(chef.extractDates("Don't Look a Gift Horse In The Mouth 01/02/1992").toString(), "01/02/1992");
assert.strictEqual(
chef.extractDates("Don't Look a Gift Horse In The Mouth 01/02/1992").toString(),
"01/02/1992"
);
}),
it("Filter", () => {
const result = chef.filter(
`I Smell a Rat
Every Cloud Has a Silver Lining
Top Drawer`, {
regex: "Every",
});
Top Drawer`,
{
regex: "Every"
}
);
const expected = "Every Cloud Has a Silver Lining";
assert.strictEqual(result.toString(), expected);
}),
it("Find / Replace", () => {
assert.strictEqual(
chef.findReplace(
"Curiosity Killed The Cat",
{
chef
.findReplace("Curiosity Killed The Cat", {
find: {
string: "l",
option: "Regex",
option: "Regex"
},
replace: "s",
}).toString(),
"Curiosity Kissed The Cat");
replace: "s"
})
.toString(),
"Curiosity Kissed The Cat"
);
}),
it("Fletcher8 Checksum", () => {
@ -517,17 +526,18 @@ Top Drawer`, {
it("Frequency distribution", () => {
const result = chef.frequencyDistribution("Don't Count Your Chickens Before They Hatch");
const expected = "{\"dataLength\":43,\"percentages\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13.953488372093023,0,0,0,0,0,0,2.3255813953488373,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2.3255813953488373,4.651162790697675,2.3255813953488373,0,0,0,2.3255813953488373,0,0,0,0,0,0,0,0,0,0,0,2.3255813953488373,0,0,0,0,2.3255813953488373,0,0,0,0,0,0,0,2.3255813953488373,0,4.651162790697675,0,9.30232558139535,2.3255813953488373,0,6.976744186046512,2.3255813953488373,0,2.3255813953488373,0,0,6.976744186046512,9.30232558139535,0,0,4.651162790697675,2.3255813953488373,6.976744186046512,4.651162790697675,0,0,0,2.3255813953488373,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"distribution\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,2,0,4,1,0,3,1,0,1,0,0,3,4,0,0,2,1,3,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"bytesRepresented\":22}";
const expected
= '{"dataLength":43,"percentages":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13.953488372093023,0,0,0,0,0,0,2.3255813953488373,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2.3255813953488373,4.651162790697675,2.3255813953488373,0,0,0,2.3255813953488373,0,0,0,0,0,0,0,0,0,0,0,2.3255813953488373,0,0,0,0,2.3255813953488373,0,0,0,0,0,0,0,2.3255813953488373,0,4.651162790697675,0,9.30232558139535,2.3255813953488373,0,6.976744186046512,2.3255813953488373,0,2.3255813953488373,0,0,6.976744186046512,9.30232558139535,0,0,4.651162790697675,2.3255813953488373,6.976744186046512,4.651162790697675,0,0,0,2.3255813953488373,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"distribution":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,2,0,4,1,0,3,1,0,1,0,0,3,4,0,0,2,1,3,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"bytesRepresented":22}';
// Whacky formatting, but the data is all there
assert.strictEqual(result.toString().replace(/\r?\n|\r|\s/g, ""), expected);
}),
it("From base", () => {
assert.strictEqual(chef.fromBase("11", {radix: 13}).toString(), "14");
assert.strictEqual(chef.fromBase("11", { radix: 13 }).toString(), "14");
}),
it("From BCD", () => {
assert.strictEqual(chef.fromBCD("1143", { inputFormat: "Raw", scheme: "7 4 2 1"}).toString(), "31313433");
assert.strictEqual(chef.fromBCD("1143", { inputFormat: "Raw", scheme: "7 4 2 1" }).toString(), "31313433");
}),
it("From binary", () => {
@ -535,7 +545,10 @@ Top Drawer`, {
}),
it("From Charcode", () => {
assert.strictEqual(chef.fromCharcode("4c 6f 6e 67 20 49 6e 20 54 68 65 20 54 6f 6f 74 68 0a").toString(), "Long In The Tooth\n");
assert.strictEqual(
chef.fromCharcode("4c 6f 6e 67 20 49 6e 20 54 68 65 20 54 6f 6f 74 68 0a").toString(),
"Long In The Tooth\n"
);
}),
it("From decimal", () => {
@ -563,7 +576,10 @@ Top Drawer`, {
}),
it("From octal", () => {
assert.strictEqual(chef.fromOctal("113 156 157 167 40 164 150 145 40 122 157 160 145 163").toString(), "Know the Ropes");
assert.strictEqual(
chef.fromOctal("113 156 157 167 40 164 150 145 40 122 157 160 145 163").toString(),
"Know the Ropes"
);
}),
it("To, From punycode", () => {
@ -576,7 +592,7 @@ Top Drawer`, {
it("Generate HOTP", () => {
const result = chef.generateHOTP("Cut The Mustard", {
name: "colonel",
name: "colonel"
});
const expected = `URI: otpauth://hotp/colonel?secret=IN2XIICUNBSSATLVON2GC4TE
@ -586,7 +602,7 @@ Password: 034148`;
it("Generate PGP Key Pair", async () => {
const result = await chef.generatePGPKeyPair("Back To the Drawing Board", {
keyType: "ECC-256",
keyType: "ECC-256"
});
assert.strictEqual(result.toString().substr(0, 37), "-----BEGIN PGP PRIVATE KEY BLOCK-----");
}),
@ -604,7 +620,8 @@ Password: 034148`;
it("Hex to Object Identifier", () => {
assert.strictEqual(
chef.hexToObjectIdentifier(chef.toHex("You Can't Teach an Old Dog New Tricks")).toString(),
"2.9.111.117.32.67.97.110.39.116.32.84.101.97.99.104.32.97.110.32.79.108.100.32.68.111.103.32.78.101.119.32.84.114.105.99.107.115");
"2.9.111.117.32.67.97.110.39.116.32.84.101.97.99.104.32.97.110.32.79.108.100.32.68.111.103.32.78.101.119.32.84.114.105.99.107.115"
);
}),
it("Hex to PEM", () => {
@ -616,35 +633,48 @@ WWFkYSBZYWRh\r
}),
it("HMAC", () => {
assert.strictEqual(chef.HMAC("On Cloud Nine", {key: "idea"}).toString(), "e15c268b4ee755c9e52db094ed50add7");
assert.strictEqual(chef.HMAC("On Cloud Nine", { key: "idea" }).toString(), "e15c268b4ee755c9e52db094ed50add7");
}),
it("JPathExpression", () => {
assert.strictEqual(chef.JPathExpression("{\"key\" : \"value\"}", {query: "$.key"}).toString(), "\"value\"");
assert.strictEqual(chef.JPathExpression('{"key" : "value"}', { query: "$.key" }).toString(), '"value"');
}),
it("JSON Beautify", () => {
assert.strictEqual(
chef.JSONBeautify("{\"key\" : \"value\"}").toString(),
chef.JSONBeautify('{"key" : "value"}').toString(),
`{
"key": "value"
}`);
}`
);
}),
it("Keccak", () => {
assert.strictEqual(chef.keccak("Flea Market").toString(), "c2a06880b19e453ee5440e8bd4c2024bedc15a6630096aa3f609acfd2b8f15f27cd293e1cc73933e81432269129ce954a6138889ce87831179d55dcff1cc7587");
assert.strictEqual(
chef.keccak("Flea Market").toString(),
"c2a06880b19e453ee5440e8bd4c2024bedc15a6630096aa3f609acfd2b8f15f27cd293e1cc73933e81432269129ce954a6138889ce87831179d55dcff1cc7587"
);
}),
it("LZNT1 Decompress", () => {
assert.strictEqual(chef.LZNT1Decompress("\x1a\xb0\x00compress\x00edtestda\x04ta\x07\x88alot").toString(), "compressedtestdatacompressedalot");
assert.strictEqual(
chef.LZNT1Decompress("\x1a\xb0\x00compress\x00edtestda\x04ta\x07\x88alot").toString(),
"compressedtestdatacompressedalot"
);
}),
it("MD6", () => {
assert.strictEqual(chef.MD6("Head Over Heels", {key: "arty"}).toString(), "d8f7fe4931fbaa37316f76283d5f615f50ddd54afdc794b61da522556aee99ad");
assert.strictEqual(
chef.MD6("Head Over Heels", { key: "arty" }).toString(),
"d8f7fe4931fbaa37316f76283d5f615f50ddd54afdc794b61da522556aee99ad"
);
}),
it("Parse ASN.1 Hex string", () => {
assert.strictEqual(chef.parseASN1HexString(chef.toHex("Mouth-watering")).toString(), "UNKNOWN(77) 7574682d7761746572696e67\n");
assert.strictEqual(
chef.parseASN1HexString(chef.toHex("Mouth-watering")).toString(),
"UNKNOWN(77) 7574682d7761746572696e67\n"
);
}),
it("Parse DateTime", () => {
@ -687,7 +717,9 @@ Arguments:
}),
it("Parse user agent", () => {
const result = chef.parseUserAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 ");
const result = chef.parseUserAgent(
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 "
);
const expected = `Browser
Name: Firefox
Version: 47.0
@ -798,33 +830,55 @@ pCGTErs=
const message = "A Fool and His Money are Soon Parted";
const encrypted = await chef.PGPEncrypt(message, {
publicKeyOfRecipient: pbkey,
publicKeyOfRecipient: pbkey
});
const result = await chef.PGPDecrypt(encrypted, {
privateKeyOfRecipient: privateKey,
privateKeyOfRecipient: privateKey
});
assert.strictEqual(result.toString(), message);
}),
it("Raw deflate", () => {
assert.strictEqual(chef.rawInflate(chef.rawDeflate("Like Father Like Son", { compressionType: "Fixed Huffman Coding"})).toString(), "Like Father Like Son");
assert.strictEqual(
chef
.rawInflate(chef.rawDeflate("Like Father Like Son", { compressionType: "Fixed Huffman Coding" }))
.toString(),
"Like Father Like Son"
);
}),
it("RC4", () => {
assert.strictEqual(
chef.RC4("Go Out On a Limb", {passphrase: {string: "Under Your Nose", option: "UTF8"}, inputFormat: "UTF8", outputFormat: "Hex"}).toString(),
"7d17e60d9bc94b7f4095851c729e69a2");
chef
.RC4("Go Out On a Limb", {
passphrase: { string: "Under Your Nose", option: "UTF8" },
inputFormat: "UTF8",
outputFormat: "Hex"
})
.toString(),
"7d17e60d9bc94b7f4095851c729e69a2"
);
}),
it("RC4 Drop", () => {
assert.strictEqual(
chef.RC4Drop("Go Out On a Limb", {passphrase: {string: "Under Your Nose", option: "UTF8"}, inputFormat: "UTF8", outputFormat: "Hex"}).toString(),
"b85cb1c4ed6bed8f260ab92829bba942");
chef
.RC4Drop("Go Out On a Limb", {
passphrase: { string: "Under Your Nose", option: "UTF8" },
inputFormat: "UTF8",
outputFormat: "Hex"
})
.toString(),
"b85cb1c4ed6bed8f260ab92829bba942"
);
}),
it("Regular Expression", () => {
assert.strictEqual(chef.regularExpression("Wouldn't Harm a Fly", {regex: "\\'[a-z]"}).toString(), "Wouldn't Harm a Fly");
assert.strictEqual(
chef.regularExpression("Wouldn't Harm a Fly", { regex: "\\'[a-z]" }).toString(),
"Wouldn't Harm a Fly"
);
}),
it("Remove EXIF", () => {
@ -840,26 +894,30 @@ pCGTErs=
it("Scrypt", () => {
assert.strictEqual(
chef.scrypt("Playing For Keeps", {salt: {string: "salty", option: "Hex"}}).toString(),
"5446b6d86d88515894a163201765bceed0bc39610b1506cdc4d939ffc638bc46e051bce756e2865165d89d955a43a7eb5504502567dea8bfc9e7d49aaa894c07");
chef.scrypt("Playing For Keeps", { salt: { string: "salty", option: "Hex" } }).toString(),
"5446b6d86d88515894a163201765bceed0bc39610b1506cdc4d939ffc638bc46e051bce756e2865165d89d955a43a7eb5504502567dea8bfc9e7d49aaa894c07"
);
}),
it("SHA3", () => {
assert.strictEqual(
chef.SHA3("benign gravel").toString(),
"2b1e36e0dbe151a89887be08da3bad141908cce62327f678161bcf058627e87abe57e3c5fce6581678714e6705a207acbd5c1f37f7a812280bc2cc558f00bed9");
"2b1e36e0dbe151a89887be08da3bad141908cce62327f678161bcf058627e87abe57e3c5fce6581678714e6705a207acbd5c1f37f7a812280bc2cc558f00bed9"
);
}),
it("Shake", () => {
assert.strictEqual(
chef.shake("murderous bloodshed").toString(),
"b79b3bb88099330bc6a15122f8dfaededf57a33b51c748d5a94e8122ff18d21e12f83412926b7e4a77a85ba6f36aa4841685e78296036337175e40096b5ac000");
"b79b3bb88099330bc6a15122f8dfaededf57a33b51c748d5a94e8122ff18d21e12f83412926b7e4a77a85ba6f36aa4841685e78296036337175e40096b5ac000"
);
}),
it("Snefru", () => {
assert.strictEqual(
chef.snefru("demeaning milestone", {size: 256, rounds: 8}).toString(),
"a671b48770fe073ce49e9259cc2f47d345a53712639f8ae23c5ad3fec19540a5");
chef.snefru("demeaning milestone", { size: 256, rounds: 8 }).toString(),
"a671b48770fe073ce49e9259cc2f47d345a53712639f8ae23c5ad3fec19540a5"
);
}),
it("SQL Beautify", () => {
@ -874,13 +932,11 @@ FROM STATS;`;
}),
it("SSDEEP", () => {
assert.strictEqual(
chef.SSDEEP("shotgun tyranny snugly").toString(),
"3:DLIXzMQCJc:XERKc");
assert.strictEqual(chef.SSDEEP("shotgun tyranny snugly").toString(), "3:DLIXzMQCJc:XERKc");
}),
it("strings", () => {
const result = chef.strings("smothering ampersand abreast", {displayTotal: true});
const result = chef.strings("smothering ampersand abreast", { displayTotal: true });
const expected = `Total found: 1
smothering ampersand abreast`;
@ -891,14 +947,14 @@ smothering ampersand abreast`;
const result = toBase64("some input", {
alphabet: {
value: "0-9A-W+/a-zXYZ="
},
}
});
assert.strictEqual(result.toString(), "StXkPI1gRe1sT0==");
}),
it("toBase64: editableOptions key is value", () => {
const result = toBase64("some input", {
alphabet: "0-9A-W+/a-zXYZ=",
alphabet: "0-9A-W+/a-zXYZ="
});
assert.strictEqual(result.toString(), "StXkPI1gRe1sT0==");
}),
@ -918,7 +974,7 @@ smothering ampersand abreast`;
it("toHex: accepts args", () => {
const result = toHex("some input", {
delimiter: "Colon",
delimiter: "Colon"
});
assert.strictEqual(result.toString(), "73:6f:6d:65:20:69:6e:70:75:74");
}),
@ -940,20 +996,34 @@ smothering ampersand abreast`;
}),
it("Translate DateTime format", () => {
assert.strictEqual(chef.translateDateTimeFormat("01/04/1999 22:33:01").toString(), "Thursday 1st April 1999 22:33:01 +00:00 UTC");
assert.strictEqual(
chef.translateDateTimeFormat("01/04/1999 22:33:01").toString(),
"Thursday 1st April 1999 22:33:01 +00:00 UTC"
);
}),
it("Triple DES encrypt / decrypt", () => {
assert.strictEqual(
chef.tripleDESDecrypt(
chef.tripleDESEncrypt("Destroy Money", {
key: {string: "30 31 2f 30 34 2f 31 39 39 39 20 32 32 3a 33 33 3a 30 3130 31 2f 30 34", option: "Hex"},
iv: {string: "00 00 00 00 00 00 00 00", option: "Hex"}}),
{
key: {string: "30 31 2f 30 34 2f 31 39 39 39 20 32 32 3a 33 33 3a 30 3130 31 2f 30 34", option: "Hex"},
iv: {string: "00 00 00 00 00 00 00 00", option: "Hex"}
}).toString(),
"Destroy Money");
chef
.tripleDESDecrypt(
chef.tripleDESEncrypt("Destroy Money", {
key: {
string: "30 31 2f 30 34 2f 31 39 39 39 20 32 32 3a 33 33 3a 30 3130 31 2f 30 34",
option: "Hex"
},
iv: { string: "00 00 00 00 00 00 00 00", option: "Hex" }
}),
{
key: {
string: "30 31 2f 30 34 2f 31 39 39 39 20 32 32 3a 33 33 3a 30 3130 31 2f 30 34",
option: "Hex"
},
iv: { string: "00 00 00 00 00 00 00 00", option: "Hex" }
}
)
.toString(),
"Destroy Money"
);
}),
it("UNIX Timestamp to Windows Filetime", () => {
@ -965,34 +1035,51 @@ smothering ampersand abreast`;
chef.XMLBeautify("<contact-info><company>abc</company></contact-info>").toString(),
`<contact-info>
\\t<company>abc</company>
</contact-info>`);
</contact-info>`
);
}),
it("XOR: toggleString with default option", () => {
assert.strictEqual(chef.XOR("fe023da5", {
key: "73 6f 6d 65"
}).toString(),
"\u0015\n]W@\u000b\fP");
assert.strictEqual(
chef
.XOR("fe023da5", {
key: "73 6f 6d 65"
})
.toString(),
"\u0015\n]W@\u000b\fP"
);
}),
it("XOR: toggleString with custom option", () => {
assert.strictEqual(chef.XOR("fe023da5", {
key: {
string: "73 6f 6d 65",
option: "utf8",
}
}).toString(),
"QV\u0010\u0004UDWQ");
assert.strictEqual(
chef
.XOR("fe023da5", {
key: {
string: "73 6f 6d 65",
option: "utf8"
}
})
.toString(),
"QV\u0010\u0004UDWQ"
);
}),
it("XPath expression", () => {
assert.strictEqual(
chef.XPathExpression("<contact-info><company>abc</company></contact-info>", {xPath: "contact-info/company"}).toString(),
"<company>abc</company>");
chef
.XPathExpression("<contact-info><company>abc</company></contact-info>", {
xPath: "contact-info/company"
})
.toString(),
"<company>abc</company>"
);
}),
it("Zlib deflate / inflate", () => {
assert.strictEqual(chef.zlibInflate(chef.zlibDeflate("cut homer wile rooky grits dizen")).toString(), "cut homer wile rooky grits dizen");
assert.strictEqual(
chef.zlibInflate(chef.zlibDeflate("cut homer wile rooky grits dizen")).toString(),
"cut homer wile rooky grits dizen"
);
}),
it("extract EXIF", () => {
@ -1006,7 +1093,8 @@ YResolution: 72
ResolutionUnit: 2
ColorSpace: 1
ExifImageWidth: 57
ExifImageHeight: 57`);
ExifImageHeight: 57`
);
}),
it("Tar", () => {
@ -1020,7 +1108,7 @@ ExifImageHeight: 57`);
it("Untar", () => {
const tarred = chef.tar("some file content", {
filename: "filename.txt",
filename: "filename.txt"
});
const untarred = chef.untar(tarred);
assert.strictEqual(untarred.type, 8);
@ -1033,7 +1121,7 @@ ExifImageHeight: 57`);
const zipped = chef.zip("some file content", {
filename: "sample.zip",
comment: "added",
operatingSystem: "Unix",
operatingSystem: "Unix"
});
assert.strictEqual(zipped.type, 7);
@ -1044,7 +1132,7 @@ ExifImageHeight: 57`);
it("Unzip", () => {
const zipped = chef.zip("some file content", {
filename: "zipped.zip",
comment: "zippy",
comment: "zippy"
});
const unzipped = chef.unzip(zipped);
@ -1055,10 +1143,10 @@ ExifImageHeight: 57`);
it("Unzip with password", () => {
const zipped = chef.zip("some content", {
password: "abcd",
password: "abcd"
});
const unzipped = chef.unzip(zipped, {
password: "abcd",
password: "abcd"
});
assert.equal(unzipped.value[0].data, "some content");
@ -1066,7 +1154,8 @@ ExifImageHeight: 57`);
it("YARA Rule Matching", async () => {
const input = "foobar foobar bar foo foobar";
const output = "Rule \"foo\" matches (4 times):\nPos 0, length 3, identifier $re1, data: \"foo\"\nPos 7, length 3, identifier $re1, data: \"foo\"\nPos 18, length 3, identifier $re1, data: \"foo\"\nPos 22, length 3, identifier $re1, data: \"foo\"\nRule \"bar\" matches (4 times):\nPos 3, length 3, identifier $re1, data: \"bar\"\nPos 10, length 3, identifier $re1, data: \"bar\"\nPos 14, length 3, identifier $re1, data: \"bar\"\nPos 25, length 3, identifier $re1, data: \"bar\"\n";
const output
= 'Rule "foo" matches (4 times):\nPos 0, length 3, identifier $re1, data: "foo"\nPos 7, length 3, identifier $re1, data: "foo"\nPos 18, length 3, identifier $re1, data: "foo"\nPos 22, length 3, identifier $re1, data: "foo"\nRule "bar" matches (4 times):\nPos 3, length 3, identifier $re1, data: "bar"\nPos 10, length 3, identifier $re1, data: "bar"\nPos 14, length 3, identifier $re1, data: "bar"\nPos 25, length 3, identifier $re1, data: "bar"\n';
const res = await chef.YARARules(input, {
rules: "rule foo {strings: $re1 = /foo/ condition: $re1} rule bar {strings: $re1 = /bar/ condition: $re1}",
@ -1079,16 +1168,17 @@ ExifImageHeight: 57`);
}),
it("performs MAGIC", async () => {
const input = "WUagwsiae6mP8gNtCCLUFpCpCB26RmBDoDD8PacdAmzAzBVjkK2QstFXaKhpC6iUS7RHqXrJtFisoRSgoJ4whjm1arm864qaNq4RcfUmLHrcsAaZc5TXCYifNdgS83gDeejGX46gaiMyuBV6EskHt1scgJ88x2tNSotQDwbGY1mmCob2ARGFvCKYNqiN9ipMq1ZU1mgkdbNuGcb76aRtYWhCGUc8g93UJudhb8htsheZnwTpgqhx83SVJSZXMXUjJT2zmpC7uXWtumqokbdSi88YtkWDAc1Toouh2oH4D4ddmNKJWUDpMwmngUmK14xwmomccPQE9hM172APnSqwxdKQ172RkcAsysnmj5gGtRmVNNh2s359wr6mS2QRP";
const input
= "WUagwsiae6mP8gNtCCLUFpCpCB26RmBDoDD8PacdAmzAzBVjkK2QstFXaKhpC6iUS7RHqXrJtFisoRSgoJ4whjm1arm864qaNq4RcfUmLHrcsAaZc5TXCYifNdgS83gDeejGX46gaiMyuBV6EskHt1scgJ88x2tNSotQDwbGY1mmCob2ARGFvCKYNqiN9ipMq1ZU1mgkdbNuGcb76aRtYWhCGUc8g93UJudhb8htsheZnwTpgqhx83SVJSZXMXUjJT2zmpC7uXWtumqokbdSi88YtkWDAc1Toouh2oH4D4ddmNKJWUDpMwmngUmK14xwmomccPQE9hM172APnSqwxdKQ172RkcAsysnmj5gGtRmVNNh2s359wr6mS2QRP";
const depth = 1;
const res = await chef.magic(input, {
depth,
depth
});
// assert against the structure of the output, rather than the values.
assert.strictEqual(res.value.length, depth + 1);
res.value.forEach(row => {
res.value.forEach((row) => {
assert.ok(row.recipe);
assert.ok(row.data);
assert.ok(row.languageScores);
@ -1098,40 +1188,63 @@ ExifImageHeight: 57`);
assert.ok(Object.prototype.hasOwnProperty.call(row, "useful"));
assert.ok(Object.prototype.hasOwnProperty.call(row, "matchesCrib"));
row.recipe.forEach(item => {
assert.ok(Object.prototype.hasOwnProperty.call(item, "op"), `No 'op' property in item ${item}`);
row.recipe.forEach((item) => {
assert.ok(Object.prototype.hasOwnProperty.call(item, "op"), `No 'op' property in item ${item}`);
assert.strictEqual(typeof item.op, "string");
assert.ok(Object.prototype.hasOwnProperty.call(item, "args"), `No 'args' property in item ${item}`);
assert.ok(Object.prototype.hasOwnProperty.call(item, "args"), `No 'args' property in item ${item}`);
assert.ok(Array.isArray(item.args));
});
row.languageScores.forEach(score => {
assert.ok(Object.prototype.hasOwnProperty.call(score, "lang"), `No 'lang' property in languageScore ${score}`);
row.languageScores.forEach((score) => {
assert.ok(
Object.prototype.hasOwnProperty.call(score, "lang"),
`No 'lang' property in languageScore ${score}`
);
assert.strictEqual(typeof score.lang, "string");
assert.ok(Object.prototype.hasOwnProperty.call(score, "score"), `No 'score' property in languageScore ${score}`);
assert.ok(
Object.prototype.hasOwnProperty.call(score, "score"),
`No 'score' property in languageScore ${score}`
);
assert.strictEqual(typeof score.score, "number");
assert.ok(Object.prototype.hasOwnProperty.call(score, "probability"), `No 'probability' property in languageScore ${score}`);
assert.ok(
Object.prototype.hasOwnProperty.call(score, "probability"),
`No 'probability' property in languageScore ${score}`
);
assert.strictEqual(typeof score.probability, "number");
});
row.matchingOps.forEach(op => {
assert.ok(Object.prototype.hasOwnProperty.call(op, "op"), `No 'op' property in matchingOp ${JSON.stringify(op)}`);
row.matchingOps.forEach((op) => {
assert.ok(
Object.prototype.hasOwnProperty.call(op, "op"),
`No 'op' property in matchingOp ${JSON.stringify(op)}`
);
assert.strictEqual(typeof op.op, "string");
assert.ok(Object.prototype.hasOwnProperty.call(op, "pattern"), `No 'pattern' property in matchingOp ${JSON.stringify(op)}`);
assert.ok(
Object.prototype.hasOwnProperty.call(op, "pattern"),
`No 'pattern' property in matchingOp ${JSON.stringify(op)}`
);
assert.ok(op.pattern instanceof RegExp);
assert.ok(Object.prototype.hasOwnProperty.call(op, "args"), `No 'args' property in matchingOp ${JSON.stringify(op)}`);
assert.ok(
Object.prototype.hasOwnProperty.call(op, "args"),
`No 'args' property in matchingOp ${JSON.stringify(op)}`
);
assert.ok(Array.isArray(op.args));
assert.ok(Object.prototype.hasOwnProperty.call(op, "useful"), `No 'useful' property in matchingOp ${JSON.stringify(op)}`);
assert.ok(
Object.prototype.hasOwnProperty.call(op, "useful"),
`No 'useful' property in matchingOp ${JSON.stringify(op)}`
);
assert.ifError(op.useful); // Expect this to be undefined
assert.ok(Object.prototype.hasOwnProperty.call(op, "entropyRange"), `No 'entropyRange' property in matchingOp ${JSON.stringify(op)}`);
assert.ok(
Object.prototype.hasOwnProperty.call(op, "entropyRange"),
`No 'entropyRange' property in matchingOp ${JSON.stringify(op)}`
);
assert.ifError(op.entropyRange); // Expect this to be undefined
assert.ok(Object.prototype.hasOwnProperty.call(op, "output"), `No 'output' property in matchingOp ${JSON.stringify(op)}`);
assert.ok(
Object.prototype.hasOwnProperty.call(op, "output"),
`No 'output' property in matchingOp ${JSON.stringify(op)}`
);
assert.ifError(op.output); // Expect this to be undefined
});
});
}),
})
]);

View file

@ -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";
@ -147,7 +144,7 @@ import "./tests/YARA.mjs";
const testStatus = {
allTestsPassing: true,
counts: {
total: 0,
total: 0
}
};
@ -155,7 +152,7 @@ setLongTestFailure();
const logOpsTestReport = logTestReport.bind(null, testStatus);
(async function() {
(async function () {
const results = await TestRegister.runTests();
logOpsTestReport(results);
})();

View file

@ -14,12 +14,13 @@ TestRegister.addTests([
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Wrap: RFC Test Vector, 128-bit data, 192-bit KEK",
@ -29,12 +30,13 @@ TestRegister.addTests([
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Wrap: RFC Test Vector, 128-bit data, 256-bit KEK",
@ -44,12 +46,13 @@ TestRegister.addTests([
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Wrap: RFC Test Vector, 192-bit data, 192-bit KEK",
@ -59,12 +62,13 @@ TestRegister.addTests([
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Wrap: RFC Test Vector, 192-bit data, 256-bit KEK",
@ -74,12 +78,13 @@ TestRegister.addTests([
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Wrap: RFC Test Vector, 256-bit data, 256-bit KEK",
@ -89,12 +94,13 @@ TestRegister.addTests([
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 128-bit KEK",
@ -104,12 +110,13 @@ TestRegister.addTests([
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 192-bit KEK",
@ -119,12 +126,13 @@ TestRegister.addTests([
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 256-bit KEK",
@ -134,12 +142,13 @@ TestRegister.addTests([
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Unwrap: RFC Test Vector, 192-bit data, 192-bit KEK",
@ -149,12 +158,13 @@ TestRegister.addTests([
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Unwrap: RFC Test Vector, 192-bit data, 256-bit KEK",
@ -164,12 +174,13 @@ TestRegister.addTests([
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Unwrap: RFC Test Vector, 256-bit data, 256-bit KEK",
@ -179,12 +190,13 @@ TestRegister.addTests([
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Wrap: invalid KEK length",
@ -194,12 +206,13 @@ TestRegister.addTests([
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "00010203040506070809"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "00010203040506070809" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Wrap: invalid IV length",
@ -209,12 +222,13 @@ TestRegister.addTests([
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Wrap: input length not multiple of 8",
@ -224,12 +238,13 @@ TestRegister.addTests([
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Wrap: input too short",
@ -239,12 +254,13 @@ TestRegister.addTests([
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Unwrap: invalid KEK length",
@ -254,12 +270,13 @@ TestRegister.addTests([
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "00010203040506070809"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "00010203040506070809" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Unwrap: invalid IV length",
@ -269,12 +286,13 @@ TestRegister.addTests([
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Unwrap: input length not multiple of 8",
@ -284,12 +302,13 @@ TestRegister.addTests([
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Unwrap: input too short",
@ -299,12 +318,13 @@ TestRegister.addTests([
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
},
{
"name": "AES Key Unwrap: corrupted input",
@ -314,11 +334,12 @@ TestRegister.addTests([
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
],
},
],
},
{ "option": "Hex", "string": "000102030405060708090a0b0c0d0e0f" },
{ "option": "Hex", "string": "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex"
]
}
]
}
]);

View file

@ -18,7 +18,7 @@ TestRegister.addTests([
op: "Avro to JSON",
args: [true]
}
],
]
},
{
name: "Avro to JSON: no input (force JSON false)",
@ -29,38 +29,40 @@ TestRegister.addTests([
op: "Avro to JSON",
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" +
"\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}",
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}',
recipeConfig: [
{
op: "Avro to JSON",
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" +
"\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",
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',
recipeConfig: [
{
op: "Avro to JSON",
args: [false]
}
],
]
}
]);

View file

@ -22,7 +22,8 @@ TestRegister.addTests([
{
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",
@ -99,5 +100,5 @@ TestRegister.addTests([
"args": ["4 2 2 1", true, true, "Raw"]
}
]
},
}
]);

View file

@ -11,46 +11,33 @@ TestRegister.addTests([
{
name: "BLAKE2b: 512 - Hello World",
input: "Hello World",
expectedOutput: "4386a08a265111c9896f56456e2cb61a64239115c4784cf438e36cc851221972da3fb0115f73cd02486254001f878ab1fd126aac69844ef1c1ca152379d0a9bd",
recipeConfig: [
{ "op": "BLAKE2b",
"args": ["512", "Hex", {string: "", option: "UTF8"}] }
]
expectedOutput:
"4386a08a265111c9896f56456e2cb61a64239115c4784cf438e36cc851221972da3fb0115f73cd02486254001f878ab1fd126aac69844ef1c1ca152379d0a9bd",
recipeConfig: [{ "op": "BLAKE2b", "args": ["512", "Hex", { string: "", option: "UTF8" }] }]
},
{
name: "BLAKE2b: 384 - Hello World",
input: "Hello World",
expectedOutput: "4d388e82ca8f866e606b6f6f0be910abd62ad6e98c0adfc27cf35acf948986d5c5b9c18b6f47261e1e679eb98edf8e2d",
recipeConfig: [
{ "op": "BLAKE2b",
"args": ["384", "Hex", {string: "", option: "UTF8"}] }
]
expectedOutput:
"4d388e82ca8f866e606b6f6f0be910abd62ad6e98c0adfc27cf35acf948986d5c5b9c18b6f47261e1e679eb98edf8e2d",
recipeConfig: [{ "op": "BLAKE2b", "args": ["384", "Hex", { string: "", option: "UTF8" }] }]
},
{
name: "BLAKE2b: 256 - Hello World",
input: "Hello World",
expectedOutput: "1dc01772ee0171f5f614c673e3c7fa1107a8cf727bdf5a6dadb379e93c0d1d00",
recipeConfig: [
{ "op": "BLAKE2b",
"args": ["256", "Hex", {string: "", option: "UTF8"}] }
]
recipeConfig: [{ "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"}] }
]
recipeConfig: [{ "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"}] }
]
recipeConfig: [{ "op": "BLAKE2b", "args": ["128", "Hex", { string: "pseudorandom key", option: "UTF8" }] }]
}
]);

View file

@ -12,36 +12,24 @@ TestRegister.addTests([
name: "BLAKE2s: 256 - Hello World",
input: "Hello World",
expectedOutput: "7706af019148849e516f95ba630307a2018bb7bf03803eca5ed7ed2c3c013513",
recipeConfig: [
{ "op": "BLAKE2s",
"args": ["256", "Hex", {string: "", option: "UTF8"}] }
]
recipeConfig: [{ "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"}] }
]
recipeConfig: [{ "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"}] }
]
recipeConfig: [{ "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"}] }
]
recipeConfig: [{ "op": "BLAKE2s", "args": ["128", "Hex", { string: "", option: "UTF8" }] }]
}
]);

View file

@ -16,20 +16,20 @@ TestRegister.addTests([
recipeConfig: [
{
op: "BSON serialise",
args: [],
},
],
args: []
}
]
},
{
name: "BSON serialise: basic",
input: "{\"hello\":\"world\"}",
input: '{"hello":"world"}',
expectedOutput: "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00",
recipeConfig: [
{
op: "BSON serialise",
args: [],
},
],
args: []
}
]
},
{
name: "BSON deserialise: nothing",
@ -38,19 +38,19 @@ TestRegister.addTests([
recipeConfig: [
{
op: "BSON deserialise",
args: [],
},
],
args: []
}
]
},
{
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",
args: [],
},
],
},
args: []
}
]
}
]);

View file

@ -21,7 +21,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[0], false]
}
],
]
},
{
name: "Bacon Decode: reduced alphabet 0/1",
@ -32,7 +32,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[0], false]
}
],
]
},
{
name: "Bacon Decode: reduced alphabet 0/1 inverse",
@ -43,7 +43,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[0], true]
}
],
]
},
{
name: "Bacon Decode: reduced alphabet A/B lower case",
@ -54,7 +54,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[1], false]
}
],
]
},
{
name: "Bacon Decode: reduced alphabet A/B lower case inverse",
@ -65,7 +65,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[1], true]
}
],
]
},
{
name: "Bacon Decode: reduced alphabet A/B upper case",
@ -76,7 +76,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[1], false]
}
],
]
},
{
name: "Bacon Decode: reduced alphabet A/B upper case inverse",
@ -87,7 +87,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[1], true]
}
],
]
},
{
name: "Bacon Decode: reduced alphabet case code",
@ -98,7 +98,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[2], false]
}
],
]
},
{
name: "Bacon Decode: reduced alphabet case code inverse",
@ -109,7 +109,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[2], true]
}
],
]
},
{
name: "Bacon Decode: reduced alphabet case code",
@ -120,7 +120,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[3], false]
}
],
]
},
{
name: "Bacon Decode: reduced alphabet case code inverse",
@ -131,7 +131,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[3], true]
}
],
]
},
{
name: "Bacon Decode: complete alphabet 0/1",
@ -142,7 +142,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[0], false]
}
],
]
},
{
name: "Bacon Decode: complete alphabet 0/1 inverse",
@ -153,7 +153,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[0], true]
}
],
]
},
{
name: "Bacon Decode: complete alphabet A/B lower case",
@ -164,7 +164,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[1], false]
}
],
]
},
{
name: "Bacon Decode: complete alphabet A/B lower case inverse",
@ -175,7 +175,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[1], true]
}
],
]
},
{
name: "Bacon Decode: complete alphabet A/B upper case",
@ -186,7 +186,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[1], false]
}
],
]
},
{
name: "Bacon Decode: complete alphabet A/B upper case inverse",
@ -197,7 +197,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[1], true]
}
],
]
},
{
name: "Bacon Decode: complete alphabet case code",
@ -208,7 +208,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[2], false]
}
],
]
},
{
name: "Bacon Decode: complete alphabet case code inverse",
@ -219,7 +219,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[2], true]
}
],
]
},
{
name: "Bacon Decode: complete alphabet case code",
@ -230,7 +230,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[3], false]
}
],
]
},
{
name: "Bacon Decode: complete alphabet case code inverse",
@ -241,7 +241,7 @@ TestRegister.addTests([
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[3], true]
}
],
]
},
{
name: "Bacon Encode: no input",
@ -252,182 +252,198 @@ TestRegister.addTests([
op: "Bacon Cipher Encode",
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
},
]
}
]);

View file

@ -19,9 +19,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base45",
args: [defaultB45Alph],
},
],
args: [defaultB45Alph]
}
]
},
{
name: "To Base45: Spec encoding example 1",
@ -30,9 +30,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base45",
args: [defaultB45Alph],
},
],
args: [defaultB45Alph]
}
]
},
{
name: "To Base45: Spec encoding example 2",
@ -41,9 +41,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base45",
args: [defaultB45Alph],
},
],
args: [defaultB45Alph]
}
]
},
{
name: "To Base45: Spec encoding example 3",
@ -52,9 +52,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base45",
args: [defaultB45Alph],
},
],
args: [defaultB45Alph]
}
]
},
{
name: "From Base45: nothing",
@ -63,9 +63,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base45",
args: [defaultB45Alph],
},
],
args: [defaultB45Alph]
}
]
},
{
name: "From Base45: Spec decoding example 1",
@ -74,9 +74,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base45",
args: [defaultB45Alph],
},
],
args: [defaultB45Alph]
}
]
},
{
name: "From Base45: Invalid character",
@ -85,9 +85,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base45",
args: [defaultB45Alph],
},
],
args: [defaultB45Alph]
}
]
},
{
name: "From Base45: Invalid triplet value",
@ -96,8 +96,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base45",
args: [defaultB45Alph],
},
],
},
args: [defaultB45Alph]
}
]
}
]);

View file

@ -16,9 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base58",
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
},
],
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"]
}
]
},
{
name: "To Base58 (Ripple): nothing",
@ -27,9 +27,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base58",
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
},
],
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"]
}
]
},
{
name: "To Base58 (Bitcoin): 'hello world'",
@ -38,9 +38,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base58",
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
},
],
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"]
}
]
},
{
name: "To Base58 (Ripple): 'hello world'",
@ -49,9 +49,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base58",
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
},
],
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"]
}
]
},
{
name: "To Base58 with null prefix and suffix",
@ -60,9 +60,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base58",
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
},
],
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"]
}
]
},
{
name: "From Base58 with null prefix and suffix",
@ -71,9 +71,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base58",
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
},
],
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"]
}
]
},
{
name: "From Base58 (Bitcoin): 'StV1DL6CwTryKyV'",
@ -82,9 +82,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base58",
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
},
],
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"]
}
]
},
{
name: "From Base58 (Ripple): 'StVrDLaUATiyKyV'",
@ -93,8 +93,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base58",
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
},
],
},
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"]
}
]
}
]);

View file

@ -17,9 +17,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base62",
args: ["0-9A-Za-z"],
},
],
args: ["0-9A-Za-z"]
}
]
},
{
name: "To Base62: Hello, World!",
@ -28,9 +28,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base62",
args: ["0-9A-Za-z"],
},
],
args: ["0-9A-Za-z"]
}
]
},
{
name: "To Base62: UTF-8",
@ -39,9 +39,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base62",
args: ["0-9A-Za-z"],
},
],
args: ["0-9A-Za-z"]
}
]
},
{
name: "From Base62: nothing",
@ -50,9 +50,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base62",
args: ["0-9A-Za-z"],
},
],
args: ["0-9A-Za-z"]
}
]
},
{
name: "From Base62: Hello, World!",
@ -61,9 +61,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base62",
args: ["0-9A-Za-z"],
},
],
args: ["0-9A-Za-z"]
}
]
},
{
name: "From Base62: UTF-8",
@ -72,8 +72,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base62",
args: ["0-9A-Za-z"],
},
],
args: ["0-9A-Za-z"]
}
]
}
]);

View file

@ -24,7 +24,7 @@ const ALL_BYTES = [
"\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",
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
].join("");
TestRegister.addTests([
@ -35,9 +35,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base64",
args: ["A-Za-z0-9+/="],
},
],
args: ["A-Za-z0-9+/="]
}
]
},
{
name: "To Base64: Hello, World!",
@ -46,9 +46,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base64",
args: ["A-Za-z0-9+/="],
},
],
args: ["A-Za-z0-9+/="]
}
]
},
{
name: "To Base64: UTF-8",
@ -57,20 +57,21 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base64",
args: ["A-Za-z0-9+/="],
},
],
args: ["A-Za-z0-9+/="]
}
]
},
{
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",
args: ["A-Za-z0-9+/="],
},
],
args: ["A-Za-z0-9+/="]
}
]
},
{
name: "From Base64: nothing",
@ -79,9 +80,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base64",
args: ["A-Za-z0-9+/=", true],
},
],
args: ["A-Za-z0-9+/=", true]
}
]
},
{
name: "From Base64: Hello, World!",
@ -90,9 +91,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base64",
args: ["A-Za-z0-9+/=", true],
},
],
args: ["A-Za-z0-9+/=", true]
}
]
},
{
name: "From Base64: UTF-8",
@ -101,9 +102,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base64",
args: ["A-Za-z0-9+/=", true],
},
],
args: ["A-Za-z0-9+/=", true]
}
]
},
{
name: "From Base64: All bytes",
@ -112,8 +113,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base64",
args: ["A-Za-z0-9+/=", true],
},
],
},
args: ["A-Za-z0-9+/=", true]
}
]
}
]);

View file

@ -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"] }]
}
]);

View file

@ -16,9 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base92",
args: [],
},
],
args: []
}
]
},
{
name: "To Base92: Spec encoding example 1",
@ -27,9 +27,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base92",
args: [],
},
],
args: []
}
]
},
{
name: "To Base92: Spec encoding example 2",
@ -38,9 +38,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base92",
args: [],
},
],
args: []
}
]
},
{
name: "To Base92: Spec encoding example 3",
@ -49,9 +49,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base92",
args: [],
},
],
args: []
}
]
},
{
name: "From Base92: nothing",
@ -60,9 +60,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base92",
args: [],
},
],
args: []
}
]
},
{
name: "From Base92: Spec decoding example 1",
@ -71,9 +71,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base92",
args: [],
},
],
args: []
}
]
},
{
name: "From Base92: Invalid character",
@ -82,8 +82,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base92",
args: [],
},
],
},
args: []
}
]
}
]);

View file

@ -13,12 +13,9 @@ TestRegister.addTests([
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
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"] }
]
},
{
@ -26,12 +23,9 @@ TestRegister.addTests([
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
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"] }
]
},
{
@ -39,12 +33,9 @@ TestRegister.addTests([
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
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"] }
]
},
}
]);

View file

@ -22,7 +22,9 @@ TestRegister.addTests([
"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
]
}
]
@ -42,7 +44,9 @@ TestRegister.addTests([
"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
]
}
]
@ -61,7 +65,9 @@ TestRegister.addTests([
"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
]
}
]
@ -80,7 +86,9 @@ TestRegister.addTests([
"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
]
}
]
@ -99,7 +107,9 @@ TestRegister.addTests([
"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
]
}
]
@ -138,7 +148,9 @@ TestRegister.addTests([
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"", 0, false
"",
0,
false
]
}
]
@ -157,7 +169,9 @@ TestRegister.addTests([
"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
]
}
]
@ -176,7 +190,9 @@ TestRegister.addTests([
"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
]
}
]
@ -195,7 +211,9 @@ TestRegister.addTests([
"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
]
}
]
@ -214,7 +232,9 @@ TestRegister.addTests([
"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
]
}
]
@ -233,10 +253,12 @@ TestRegister.addTests([
"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
]);

View file

@ -23,7 +23,7 @@ const ALL_BYTES = [
"\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",
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
].join("");
TestRegister.addTests([
@ -101,18 +101,19 @@ TestRegister.addTests([
{
op: "To Hex",
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"]
},
}
]
},
{
@ -123,7 +124,7 @@ TestRegister.addTests([
{
op: "To Hex",
args: ["None"]
},
}
]
},
{
@ -167,18 +168,19 @@ TestRegister.addTests([
{
op: "To Charcode",
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]
},
}
]
},
{
@ -189,7 +191,7 @@ TestRegister.addTests([
{
op: "To Charcode",
args: ["Space", 16]
},
}
]
},
{
@ -224,5 +226,5 @@ TestRegister.addTests([
args: ["Space", 16]
}
]
},
}
]);

View file

@ -42,7 +42,7 @@ TestRegister.addTests([
{
name: "From Hex: Can decode text",
input: "64 54 65 78 74",
expectedOutput: "\"Text\"",
expectedOutput: '"Text"',
recipeConfig: [
{
op: "From Hex",
@ -87,7 +87,7 @@ TestRegister.addTests([
{
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",
@ -124,8 +124,8 @@ TestRegister.addTests([
},
{
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",

View file

@ -41,7 +41,7 @@ TestRegister.addTests([
},
{
name: "CBOR Encode: Can encode text",
input: "\"Text\"",
input: '"Text"',
expectedOutput: "64 54 65 78 74",
recipeConfig: [
{
@ -86,7 +86,7 @@ TestRegister.addTests([
},
{
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: [
{

View file

@ -16,8 +16,8 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
},
"args": [{ "option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c" }, "AES"]
}
]
},
{
@ -31,8 +31,8 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
},
"args": [{ "option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c" }, "AES"]
}
]
},
{
@ -46,13 +46,14 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
},
"args": [{ "option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c" }, "AES"]
}
]
},
{
"name": "CMAC-AES128 NIST's CSRC Example #4",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
"input":
"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
"expectedOutput": "51f0bebf7e3b9d92fc49741779363cfe",
"recipeConfig": [
{
@ -61,8 +62,8 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
},
"args": [{ "option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c" }, "AES"]
}
]
},
{
@ -72,8 +73,8 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
},
"args": [{ "option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b" }, "AES"]
}
]
},
{
@ -87,8 +88,8 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
},
"args": [{ "option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b" }, "AES"]
}
]
},
{
@ -102,13 +103,14 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
},
"args": [{ "option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b" }, "AES"]
}
]
},
{
"name": "CMAC-AES192 NIST's CSRC Example #4",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
"input":
"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
"expectedOutput": "a1d5df0eed790f794d77589659f39a11",
"recipeConfig": [
{
@ -117,8 +119,8 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
},
"args": [{ "option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b" }, "AES"]
}
]
},
{
@ -128,8 +130,11 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
},
"args": [
{ "option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4" },
"AES"
]
}
]
},
{
@ -143,8 +148,11 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
},
"args": [
{ "option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4" },
"AES"
]
}
]
},
{
@ -158,13 +166,17 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
},
"args": [
{ "option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4" },
"AES"
]
}
]
},
{
"name": "CMAC-AES256 NIST's CSRC Example #4",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
"input":
"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
"expectedOutput": "e1992190549f6ed5696a2c056c315410",
"recipeConfig": [
{
@ -173,8 +185,11 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
},
"args": [
{ "option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4" },
"AES"
]
}
]
},
{
@ -184,8 +199,11 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
},
"args": [
{ "option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123" },
"Triple DES"
]
}
]
},
{
@ -199,8 +217,11 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
},
"args": [
{ "option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123" },
"Triple DES"
]
}
]
},
{
@ -214,8 +235,11 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
},
"args": [
{ "option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123" },
"Triple DES"
]
}
]
},
{
@ -229,8 +253,11 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
},
"args": [
{ "option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123" },
"Triple DES"
]
}
]
},
{
@ -240,8 +267,11 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
},
"args": [
{ "option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef" },
"Triple DES"
]
}
]
},
{
@ -255,8 +285,11 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
},
"args": [
{ "option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef" },
"Triple DES"
]
}
]
},
{
@ -270,8 +303,11 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
},
"args": [
{ "option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef" },
"Triple DES"
]
}
]
},
{
@ -285,8 +321,11 @@ TestRegister.addTests([
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
},
"args": [
{ "option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef" },
"Triple DES"
]
}
]
},
{
@ -296,8 +335,8 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "00112233445566778899aabbccddeeff01234567"}, "AES"]
},
"args": [{ "option": "Hex", "string": "00112233445566778899aabbccddeeff01234567" }, "AES"]
}
]
},
{
@ -307,8 +346,8 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "00112233445566778899aabbccddeeff01234567"}, "Triple DES"]
},
"args": [{ "option": "Hex", "string": "00112233445566778899aabbccddeeff01234567" }, "Triple DES"]
}
]
},
}
]);

View file

@ -19,82 +19,62 @@ 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"],
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"],
args: [",", "\r\n", "Array of arrays"]
}
],
]
},
{
name: "JSON to CSV: Array of dictionaries",
@ -111,13 +91,13 @@ TestRegister.addTests([
"A": ",",
"B": ";",
"C": "'",
"D": "\"",
"D": '"',
"E": "",
"F": ""
},
{
"A": "\"hello\"",
"B": "a\"1",
"A": '"hello"',
"B": 'a"1',
"C": "multi\r\nline",
"D": "",
"E": "",
@ -128,52 +108,24 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\r\n"],
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"],
args: [",", "\r\n"]
}
],
},
]
}
]);

View file

@ -16,9 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Caesar Box Cipher",
args: ["1"],
},
],
args: ["1"]
}
]
},
{
name: "Caesar Box Cipher: Hello World!",
@ -27,9 +27,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Caesar Box Cipher",
args: ["3"],
},
],
args: ["3"]
}
]
},
{
name: "Caesar Box Cipher: Hello World!",
@ -38,8 +38,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Caesar Box Cipher",
args: ["4"],
},
],
args: ["4"]
}
]
}
]);

View file

@ -16,9 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Caret/M-decode",
args: [],
},
],
args: []
}
]
},
{
/*
@ -27,13 +27,13 @@ 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",
args: [],
},
],
},
args: []
}
]
}
]);

View file

@ -12,56 +12,61 @@ 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",
args: ["\n\n", " "],
},
],
args: ["\n\n", " "]
}
]
},
{
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",
args: ["\n\n", " "],
},
],
args: ["\n\n", " "]
}
]
},
{
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",
args: ["\n\n", " "],
},
],
args: ["\n\n", " "]
}
]
},
{
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",
args: ["\n\n", "-"],
},
],
args: ["\n\n", "-"]
}
]
},
{
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",
args: ["_", " "],
},
],
},
args: ["_", " "]
}
]
}
]);

View file

@ -16,7 +16,7 @@ TestRegister.addTests([
{
op: "Cetacean Cipher Decode",
args: []
},
],
}
]
}
]);

View file

@ -16,7 +16,7 @@ TestRegister.addTests([
{
op: "Cetacean Cipher Encode",
args: []
},
],
}
]
}
]);

View file

@ -18,13 +18,9 @@ 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",
]
"args": [{ "option": "Hex", "string": "" }, { "option": "Hex", "string": "" }, 0, "20", "Hex", "Hex"]
}
],
]
},
{
name: "ChaCha: no nonce",
@ -36,116 +32,163 @@ ChaCha uses a nonce of 8 or 12 bytes (64 or 96 bits).`,
{
"op": "ChaCha",
"args": [
{"option": "Hex", "string": "00000000000000000000000000000000"},
{"option": "Hex", "string": ""},
0, "20", "Hex", "Hex",
{ "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",
{
"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",
{ "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",
{ "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",
{ "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",
{
"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",
{
"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",
{
"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"
]
}
],
},
]
}
]);

View file

@ -15,38 +15,41 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Change IP format",
args: ["Dotted Decimal", "Hex"],
},
],
}, {
args: ["Dotted Decimal", "Hex"]
}
]
},
{
name: "Change IP format: Decimal to Dotted Decimal",
input: "3232235777",
expectedOutput: "192.168.1.1",
recipeConfig: [
{
op: "Change IP format",
args: ["Decimal", "Dotted Decimal"],
},
],
}, {
args: ["Decimal", "Dotted Decimal"]
}
]
},
{
name: "Change IP format: Hex to Octal",
input: "c0a80101",
expectedOutput: "030052000401",
recipeConfig: [
{
op: "Change IP format",
args: ["Hex", "Octal"],
},
],
}, {
args: ["Hex", "Octal"]
}
]
},
{
name: "Change IP format: Octal to Decimal",
input: "030052000401",
expectedOutput: "3232235777",
recipeConfig: [
{
op: "Change IP format",
args: ["Octal", "Decimal"],
},
],
},
args: ["Octal", "Decimal"]
}
]
}
]);

View file

@ -20,8 +20,8 @@ TestRegister.addTests([
{
"op": "Decode text",
"args": ["UTF-8 (65001)"]
},
],
}
]
},
{
name: "Encode text, Decode text: hello",
@ -35,8 +35,8 @@ TestRegister.addTests([
{
"op": "Decode text",
"args": ["UTF-8 (65001)"]
},
],
}
]
},
{
name: "Encode text (EBCDIC): hello",
@ -50,8 +50,8 @@ TestRegister.addTests([
{
"op": "To Hex",
"args": ["Space"]
},
],
}
]
},
{
name: "Decode text (EBCDIC): 88 85 93 93 96",
@ -65,13 +65,13 @@ TestRegister.addTests([
{
"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",
@ -84,7 +84,7 @@ TestRegister.addTests([
{
"op": "Encode text",
"args": ["UTF-8 (65001)"]
},
],
},
}
]
}
]);

View file

@ -17,7 +17,7 @@ TestRegister.addTests([
"op": "Scatter chart",
"args": ["Line feed", "Space", false, "time", "stress", "black", 5, false]
}
],
]
},
{
name: "Hex density chart",
@ -28,7 +28,7 @@ TestRegister.addTests([
"op": "Hex Density chart",
"args": ["Line feed", "Space", 25, 15, true, "", "", true, "white", "black", true]
}
],
]
},
{
name: "Series chart",
@ -39,7 +39,7 @@ TestRegister.addTests([
"op": "Series chart",
"args": ["Line feed", "Space", "", 1, "mediumseagreen, dodgerblue, tomato"]
}
],
]
},
{
name: "Heatmap chart",
@ -50,6 +50,6 @@ TestRegister.addTests([
"op": "Heatmap chart",
"args": ["Line feed", "Space", 25, 25, true, "", "", false, "white", "black"]
}
],
},
]
}
]);

View file

@ -25,7 +25,7 @@ const ALL_BYTES = [
"\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",
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
].join("");
TestRegister.addTests([

View file

@ -16,9 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "CipherSaber2 Encrypt",
args: [{ "option": "Latin1", "string": "test" }, 20],
},
],
args: [{ "option": "Latin1", "string": "test" }, 20]
}
]
},
{
name: "CipherSaber2 Decrypt",
@ -27,9 +27,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "CipherSaber2 Decrypt",
args: [{ "option": "Latin1", "string": "test" }, 20],
},
],
args: [{ "option": "Latin1", "string": "test" }, 20]
}
]
},
{
name: "CipherSaber2 Encrypt",
@ -38,8 +38,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "CipherSaber2 Encrypt",
args: [{ "option": "Latin1", "string": "" }, 20],
},
],
},
args: [{ "option": "Latin1", "string": "" }, 20]
}
]
}
]);

View file

@ -9,7 +9,6 @@
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Affine Encode: no input",
@ -20,7 +19,7 @@ TestRegister.addTests([
op: "Affine Cipher Encode",
args: [1, 0]
}
],
]
},
{
name: "Affine Encode: invalid a & b (non-integer)",
@ -31,7 +30,7 @@ TestRegister.addTests([
op: "Affine Cipher Encode",
args: [0.1, 0.00001]
}
],
]
},
{
name: "Affine Encode: no effect",
@ -42,7 +41,7 @@ TestRegister.addTests([
op: "Affine Cipher Encode",
args: [1, 0]
}
],
]
},
{
name: "Affine Encode: normal",
@ -53,7 +52,7 @@ TestRegister.addTests([
op: "Affine Cipher Encode",
args: [23, 23]
}
],
]
},
{
name: "Affine Decode: no input",
@ -64,7 +63,7 @@ TestRegister.addTests([
op: "Affine Cipher Decode",
args: [1, 0]
}
],
]
},
{
name: "Affine Decode: invalid a & b (non-integer)",
@ -75,7 +74,7 @@ TestRegister.addTests([
op: "Affine Cipher Decode",
args: [0.1, 0.00001]
}
],
]
},
{
name: "Affine Decode: invalid a (coprime)",
@ -86,7 +85,7 @@ TestRegister.addTests([
op: "Affine Cipher Decode",
args: [8, 23]
}
],
]
},
{
name: "Affine Decode: no effect",
@ -97,7 +96,7 @@ TestRegister.addTests([
op: "Affine Cipher Decode",
args: [1, 0]
}
],
]
},
{
name: "Affine Decode: normal",
@ -108,7 +107,7 @@ TestRegister.addTests([
op: "Affine Cipher Decode",
args: [23, 23]
}
],
]
},
{
name: "A1Z26 Encode: normal",
@ -119,7 +118,7 @@ TestRegister.addTests([
op: "A1Z26 Cipher Encode",
args: ["Space"]
}
],
]
},
{
name: "A1Z26 Decode: normal",
@ -130,7 +129,7 @@ TestRegister.addTests([
op: "A1Z26 Cipher Decode",
args: ["Space"]
}
],
]
},
{
name: "A1Z26 Decode: error",
@ -141,7 +140,7 @@ TestRegister.addTests([
op: "A1Z26 Cipher Decode",
args: ["Space"]
}
],
]
},
{
name: "Atbash: no input",
@ -152,7 +151,7 @@ TestRegister.addTests([
op: "Atbash Cipher",
args: []
}
],
]
},
{
name: "Atbash: normal",
@ -163,7 +162,7 @@ TestRegister.addTests([
op: "Atbash Cipher",
args: []
}
],
]
},
{
name: "Bifid Cipher Encode: no input",
@ -174,7 +173,7 @@ TestRegister.addTests([
"op": "Bifid Cipher Encode",
"args": ["nothing"]
}
],
]
},
{
name: "Bifid Cipher Encode: no key",
@ -185,7 +184,7 @@ TestRegister.addTests([
"op": "Bifid Cipher Encode",
"args": [""]
}
],
]
},
{
name: "Bifid Cipher Encode: invalid key (non-alphabetic)",
@ -196,7 +195,7 @@ TestRegister.addTests([
"op": "Bifid Cipher Encode",
"args": ["abc123"]
}
],
]
},
{
name: "Bifid Cipher Encode: normal",
@ -207,7 +206,7 @@ TestRegister.addTests([
"op": "Bifid Cipher Encode",
"args": ["Schrodinger"]
}
],
]
},
{
name: "Bifid Cipher Decode: no input",
@ -218,7 +217,7 @@ TestRegister.addTests([
"op": "Bifid Cipher Decode",
"args": ["nothing"]
}
],
]
},
{
name: "Bifid Cipher Decode: no key",
@ -229,7 +228,7 @@ TestRegister.addTests([
"op": "Bifid Cipher Decode",
"args": [""]
}
],
]
},
{
name: "Bifid Cipher Decode: invalid key (non-alphabetic)",
@ -240,7 +239,7 @@ TestRegister.addTests([
"op": "Bifid Cipher Decode",
"args": ["abc123"]
}
],
]
},
{
name: "Bifid Cipher Decode: normal",
@ -251,7 +250,7 @@ TestRegister.addTests([
"op": "Bifid Cipher Decode",
"args": ["Schrodinger"]
}
],
]
},
{
name: "Citrix CTX1 Encode",
@ -262,7 +261,7 @@ TestRegister.addTests([
"op": "Citrix CTX1 Encode",
"args": []
}
],
]
},
{
name: "Citrix CTX1 Decode: normal",
@ -273,7 +272,7 @@ TestRegister.addTests([
"op": "Citrix CTX1 Decode",
"args": []
}
],
]
},
{
name: "Citrix CTX1 Decode: invalid length",
@ -284,7 +283,7 @@ TestRegister.addTests([
"op": "Citrix CTX1 Decode",
"args": []
}
],
]
},
{
name: "Vigenère Encode: no input",
@ -295,7 +294,7 @@ TestRegister.addTests([
"op": "Vigenère Encode",
"args": ["nothing"]
}
],
]
},
{
name: "Vigenère Encode: no key",
@ -306,7 +305,7 @@ TestRegister.addTests([
"op": "Vigenère Encode",
"args": [""]
}
],
]
},
{
name: "Vigenère Encode: invalid key",
@ -317,7 +316,7 @@ TestRegister.addTests([
"op": "Vigenère Encode",
"args": ["abc123"]
}
],
]
},
{
name: "Vigenère Encode: normal",
@ -328,7 +327,7 @@ TestRegister.addTests([
"op": "Vigenère Encode",
"args": ["Edward"]
}
],
]
},
{
name: "Vigenère Decode: no input",
@ -339,7 +338,7 @@ TestRegister.addTests([
"op": "Vigenère Decode",
"args": ["nothing"]
}
],
]
},
{
name: "Vigenère Decode: no key",
@ -350,7 +349,7 @@ TestRegister.addTests([
"op": "Vigenère Decode",
"args": [""]
}
],
]
},
{
name: "Vigenère Decode: invalid key",
@ -361,7 +360,7 @@ TestRegister.addTests([
"op": "Vigenère Decode",
"args": ["abc123"]
}
],
]
},
{
name: "Vigenère Decode: normal",
@ -372,7 +371,7 @@ TestRegister.addTests([
"op": "Vigenère Decode",
"args": ["Edward"]
}
],
]
},
{
name: "Substitute: no pt/ct",
@ -383,7 +382,7 @@ TestRegister.addTests([
"op": "Substitute",
"args": ["", ""]
}
],
]
},
{
name: "Substitute: no input",
@ -394,7 +393,7 @@ TestRegister.addTests([
"op": "Substitute",
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwxy"]
}
],
]
},
{
name: "Substitute: uneven pt/ct",
@ -405,7 +404,7 @@ TestRegister.addTests([
"op": "Substitute",
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwx"]
}
],
]
},
{
name: "Substitute: normal",
@ -416,7 +415,7 @@ TestRegister.addTests([
"op": "Substitute",
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwxy"]
}
],
]
},
{
name: "Rail Fence Cipher Decode: normal",
@ -427,7 +426,7 @@ TestRegister.addTests([
"op": "Rail Fence Cipher Decode",
"args": [2, 0]
}
],
]
},
{
name: "Rail Fence Cipher Decode: key has to be bigger than 2",
@ -438,7 +437,7 @@ TestRegister.addTests([
"op": "Rail Fence Cipher Decode",
"args": [1, 0]
}
],
]
},
{
name: "Rail Fence Cipher Decode: key has to be smaller than input's length",
@ -449,7 +448,7 @@ TestRegister.addTests([
"op": "Rail Fence Cipher Decode",
"args": [22, 0]
}
],
]
},
{
name: "Rail Fence Cipher Decode: offset should be positive",
@ -460,7 +459,7 @@ TestRegister.addTests([
"op": "Rail Fence Cipher Decode",
"args": [2, -1]
}
],
]
},
{
name: "Rail Fence Cipher Decode: Normal with Offset non-null",
@ -471,7 +470,7 @@ TestRegister.addTests([
"op": "Rail Fence Cipher Decode",
"args": [4, 2]
}
],
]
},
{
name: "Rail Fence Cipher Encode: normal",
@ -482,7 +481,7 @@ TestRegister.addTests([
"op": "Rail Fence Cipher Encode",
"args": [2, 0]
}
],
]
},
{
name: "Rail Fence Cipher Encode: key has to be bigger than 2",
@ -493,7 +492,7 @@ TestRegister.addTests([
"op": "Rail Fence Cipher Encode",
"args": [1, 0]
}
],
]
},
{
name: "Rail Fence Cipher Encode: key has to be smaller than input's length",
@ -504,7 +503,7 @@ TestRegister.addTests([
"op": "Rail Fence Cipher Encode",
"args": [22, 0]
}
],
]
},
{
name: "Rail Fence Cipher Encode: offset should be positive",
@ -515,7 +514,7 @@ TestRegister.addTests([
"op": "Rail Fence Cipher Encode",
"args": [2, -1]
}
],
]
},
{
name: "Rail Fence Cipher Encode: Normal with Offset non-null",
@ -526,6 +525,6 @@ TestRegister.addTests([
"op": "Rail Fence Cipher Encode",
"args": [4, 2]
}
],
},
]
}
]);

View file

@ -11,42 +11,50 @@ 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
}],
"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
}
]
}
};
@ -60,7 +68,7 @@ TestRegister.addTests([
"op": "To Camel case",
"args": [false]
}
],
]
},
{
name: "To Snake case (dumb)",
@ -71,7 +79,7 @@ TestRegister.addTests([
"op": "To Snake case",
"args": [false]
}
],
]
},
{
name: "To Kebab case (dumb)",
@ -82,7 +90,7 @@ TestRegister.addTests([
"op": "To Kebab case",
"args": [false]
}
],
]
},
{
name: "To Camel case (smart)",
@ -93,8 +101,8 @@ 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: [
"test='hello'",
@ -103,15 +111,15 @@ 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]
}
],
]
},
{
name: "To Snake case (smart)",
@ -122,8 +130,8 @@ 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: [
"test='hello'",
@ -132,15 +140,15 @@ 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]
}
],
]
},
{
name: "To Kebab case (smart)",
@ -151,8 +159,8 @@ 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: [
"test='hello'",
@ -161,15 +169,15 @@ 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]
}
],
]
},
{
name: "JPath Expression: Empty JSON",
@ -180,7 +188,7 @@ TestRegister.addTests([
"op": "JPath expression",
"args": ["", "\n"]
}
],
]
},
{
name: "JPath Expression: Empty expression",
@ -191,124 +199,120 @@ TestRegister.addTests([
"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\""
].join("\n"),
expectedOutput: ['"Nigel Rees"', '"Evelyn Waugh"', '"Herman Melville"', '"J. R. R. Tolkien"'].join("\n"),
recipeConfig: [
{
"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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
}
],
]
},
{
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]
"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]
}
],
]
},
{
name: "JPath Expression: Script-based expression",
@ -343,7 +347,7 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "XPath expression",
"args": ["/div/p[@class=\"a\"]", "\\n"]
"args": ['/div/p[@class="a"]', "\\n"]
}
]
},
@ -376,7 +380,8 @@ TestRegister.addTests([
{
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",

View file

@ -17,23 +17,65 @@ TestRegister.addTests([
"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.
// {
// name: "Colossus 1+2=.",

View file

@ -24,7 +24,7 @@ const ALL_BYTES = [
"\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",
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
].join("");
TestRegister.addTests([

View file

@ -21,7 +21,7 @@ TestRegister.addTests([
"op": "Bzip2 Decompress",
"args": []
}
],
]
},
{
name: "LZMA compress & decompress",
@ -36,8 +36,8 @@ TestRegister.addTests([
{
"op": "LZMA Decompress",
"args": []
},
],
}
]
},
{
name: "LZMA decompress: binary",
@ -57,7 +57,7 @@ TestRegister.addTests([
"op": "To Hex",
"args": ["Space", 0]
}
],
]
},
{
name: "LZMA decompress: string",
@ -73,7 +73,7 @@ TestRegister.addTests([
"op": "LZMA Decompress",
"args": []
}
],
]
},
{
name: "LZ4 Compress",
@ -88,7 +88,7 @@ TestRegister.addTests([
"op": "To Hex",
"args": ["None", 0]
}
],
]
},
{
name: "LZ4 Decompress",
@ -103,6 +103,6 @@ TestRegister.addTests([
"op": "LZ4 Decompress",
"args": []
}
],
},
]
}
]);

View file

@ -11,83 +11,72 @@ 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",
args: ["match", false, "", 0],
args: ["match", false, "", 0]
},
{
op: "To Base64",
args: ["A-Za-z0-9+/="],
args: ["A-Za-z0-9+/="]
},
{
op: "To Base64",
args: ["A-Za-z0-9+/="],
},
],
args: ["A-Za-z0-9+/="]
}
]
},
{
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",
args: ["should", false, "skip match", 10],
args: ["should", false, "skip match", 10]
},
{
op: "To Base64",
args: ["A-Za-z0-9+/="],
args: ["A-Za-z0-9+/="]
},
{
op: "Label", args: ["skip match"],
op: "Label",
args: ["skip match"]
},
{
op: "To Base32",
args: ["A-Z2-7="],
},
],
args: ["A-Z2-7="]
}
]
},
{
name: "Conditional Jump: Skips backwards",
input: [
"match",
].join("\n"),
expectedOutput: [
"f7cf556f7f4fc6635db8c314f7a81f2a",
].join("\n"),
input: ["match"].join("\n"),
expectedOutput: ["f7cf556f7f4fc6635db8c314f7a81f2a"].join("\n"),
recipeConfig: [
{
op: "Label",
args: ["back to the beginning"],
args: ["back to the beginning"]
},
{
op: "Jump",
args: ["skip replace"],
args: ["skip replace"]
},
{
op: "MD2",
args: [],
args: []
},
{
op: "Label",
args: ["skip replace"],
args: ["skip replace"]
},
{
op: "Conditional Jump",
args: ["match", false, "back to the beginning", 10],
},
],
args: ["match", false, "back to the beginning", 10]
}
]
}
]);

View file

@ -29,8 +29,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Degrees Minutes Seconds", "Comma", "None", 1]
},
],
}
]
},
{
name: "Co-ordinates: From Degrees Minutes Seconds to Decimal Degrees",
@ -40,8 +40,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Degrees Minutes Seconds", "Comma", "Decimal Degrees", "Comma", "None", 3]
},
],
}
]
},
{
name: "Co-ordinates: From Decimal Degrees to Degrees Decimal Minutes",
@ -84,8 +84,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Geohash", "Comma", "None", 9]
},
],
}
]
},
{
name: "Co-ordinates: From Geohash to Decimal Degrees",
@ -95,8 +95,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Geohash", "Comma", "Decimal Degrees", "Comma", "None", 3]
},
],
}
]
},
{
name: "Co-ordinates: From Decimal Degrees to MGRS",
@ -106,8 +106,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Military Grid Reference System", "Comma", "None", 10]
},
],
}
]
},
{
name: "Co-ordinates: From MGRS to Decimal Degrees",
@ -128,8 +128,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Ordnance Survey National Grid", "Comma", "None", 10]
},
],
}
]
},
{
name: "Co-ordinates: From OSNG to Decimal Degrees",
@ -139,8 +139,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Ordnance Survey National Grid", "Comma", "Decimal Degrees", "Comma", "None", 3]
},
],
}
]
},
{
name: "Co-ordinates: From Decimal Degrees to UTM",
@ -150,8 +150,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Universal Transverse Mercator", "Comma", "None", 0]
},
],
}
]
},
{
name: "Co-ordinates: From UTM to Decimal Degrees",
@ -161,8 +161,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Universal Transverse Mercator", "Comma", "Decimal Degrees", "Comma", "None", 3]
},
],
}
]
},
{
name: "Co-ordinates: Directions in input, not output",
@ -172,8 +172,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "None", 3]
},
],
}
]
},
{
name: "Co-ordinates: Directions in input and output",
@ -183,8 +183,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "Before", 3]
},
],
}
]
},
{
name: "Co-ordinates: Directions not in input, in output",
@ -194,8 +194,8 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "Before", 3]
},
],
}
]
},
{
name: "Co-ordinates: Directions not in input, in converted output",
@ -205,7 +205,7 @@ TestRegister.addTests([
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Degrees Minutes Seconds", "Comma", "Before", 3]
},
],
}
]
}
]);

View file

@ -21,7 +21,8 @@ TestRegister.addTests([
{
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",

File diff suppressed because it is too large Load diff

View file

@ -16,9 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Windows Filetime to UNIX Timestamp",
args: ["Nanoseconds (ns)", "Decimal"],
},
],
args: ["Nanoseconds (ns)", "Decimal"]
}
]
},
{
name: "Unix to Filetime",
@ -27,8 +27,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "UNIX Timestamp to Windows Filetime",
args: ["Nanoseconds (ns)", "Decimal"],
},
],
},
args: ["Nanoseconds (ns)", "Decimal"]
}
]
}
]);

View file

@ -16,28 +16,30 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Defang IP Addresses",
args: [],
},
],
}, {
args: []
}
]
},
{
name: "Defang IP: Valid IPV6",
input: "2001:0db8:85a3:0000:0000:8a2e:0370:7343",
expectedOutput: "2001[:]0db8[:]85a3[:]0000[:]0000[:]8a2e[:]0370[:]7343",
recipeConfig: [
{
op: "Defang IP Addresses",
args: [],
},
],
}, {
args: []
}
]
},
{
name: "Defang IP: Valid IPV6 Shorthand",
input: "2001:db8:3c4d:15::1a2f:1a2b",
expectedOutput: "2001[:]db8[:]3c4d[:]15[:][:]1a2f[:]1a2b",
recipeConfig: [
{
op: "Defang IP Addresses",
args: [],
},
],
},
args: []
}
]
}
]);

View file

@ -4,12 +4,16 @@
* @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([
{
@ -19,9 +23,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "ELF Info",
args: [],
},
],
args: []
}
]
},
{
name: "ELF Info 32-bit ELF Little Endian.",
@ -30,13 +34,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"],
args: ["None"]
},
{
op: "ELF Info",
args: [],
},
],
args: []
}
]
},
{
name: "ELF Info 32-bit ELF Big Endian.",
@ -45,13 +49,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"],
args: ["None"]
},
{
op: "ELF Info",
args: [],
},
],
args: []
}
]
},
{
name: "ELF Info 64-bit ELF Little Endian.",
@ -60,13 +64,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"],
args: ["None"]
},
{
op: "ELF Info",
args: [],
},
],
args: []
}
]
},
{
name: "ELF Info 64-bit ELF Big Endian.",
@ -75,12 +79,12 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"],
args: ["None"]
},
{
op: "ELF Info",
args: [],
},
],
},
args: []
}
]
}
]);

View file

@ -18,11 +18,19 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"",
"A",
"A",
// Note: start on Z because it steps when the key is pressed
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "Z", // III
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"Z", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
""
]
@ -40,10 +48,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "N",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "F",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "W",
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"N",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"F",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"W",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
""
]
@ -62,10 +78,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "B", "Z",
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"B",
"Z",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
""
]
@ -83,10 +107,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "N", "A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "F", "A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "W", "Z",
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"N",
"A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"F",
"A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"W",
"Z",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
""
]
@ -104,10 +136,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "Z",
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"Z",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
""
]
@ -124,10 +164,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "Z",
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"Z",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
""
]
@ -136,10 +184,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "Z",
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"Z",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
""
]
@ -157,10 +213,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "D",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "U",
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"D",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"U",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
""
]
@ -178,10 +242,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "E",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "U",
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"E",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"U",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
""
]
@ -199,10 +271,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "D",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "S",
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"D",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"S",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
""
]
@ -219,10 +299,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "H", "Z",
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"H",
"Z",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
""
]
@ -239,10 +327,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "Q", "A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "C", "D",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "H", "F",
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"Q",
"A",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"C",
"D",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"H",
"F",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
""
]
@ -259,10 +355,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"4-rotor",
"LEYJVCNIXWPBQMDRTAKZGFUHOS", "A", "X", // Beta
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "O", "E",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "P", "F",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "D", "Q",
"LEYJVCNIXWPBQMDRTAKZGFUHOS",
"A",
"X", // Beta
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"O",
"E",
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"P",
"F",
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"D",
"Q",
"AE BN CK DQ FU GY HW IJ LO MP RX SZ TV", // B thin
""
]
@ -279,10 +383,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"4-rotor",
"FSOKANUERHMBTIYCWLQPZXVGJD", "A", "L", // Gamma
"JPGVOUMFYQBENHZRDKASXLICTW<AN", "A", "J", // VI
"VZBRGITYUPSDNHLXAWMJQOFECK<A", "M", "G", // V
"ESOVPZJAYQUIRHXLNFTGKDCMWB<K", "W", "U", // IV
"FSOKANUERHMBTIYCWLQPZXVGJD",
"A",
"L", // Gamma
"JPGVOUMFYQBENHZRDKASXLICTW<AN",
"A",
"J", // VI
"VZBRGITYUPSDNHLXAWMJQOFECK<A",
"M",
"G", // V
"ESOVPZJAYQUIRHXLNFTGKDCMWB<K",
"W",
"U", // IV
"AR BD CO EJ FN GT HK IV LM PW QZ SX UY", // C thin
""
]
@ -299,10 +411,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"4-rotor",
"FSOKANUERHMBTIYCWLQPZXVGJD", "A", "I", // Gamma
"NZJHGRCXMYSWBOUFAIVLPEKQDT<AN", "I", "V", // VII
"ESOVPZJAYQUIRHXLNFTGKDCMWB<K", "O", "O", // IV
"FKQHTLXOCBJSPDZRAMEWNIUYGV<AN", "U", "Z", // VIII
"FSOKANUERHMBTIYCWLQPZXVGJD",
"A",
"I", // Gamma
"NZJHGRCXMYSWBOUFAIVLPEKQDT<AN",
"I",
"V", // VII
"ESOVPZJAYQUIRHXLNFTGKDCMWB<K",
"O",
"O", // IV
"FKQHTLXOCBJSPDZRAMEWNIUYGV<AN",
"U",
"Z", // VIII
"AE BN CK DQ FU GY HW IJ LO MP RX SZ TV", // B thin
"WN MJ LX YB FP QD US IH CE GR"
]
@ -319,10 +439,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"4-rotor",
"FSOKANUERHMBTIYCWLQPZXVGJD", "A", "I", // Gamma
"NZJHGRCXMYSWBOUFAIVLPEKQDT<AN", "I", "V", // VII
"ESOVPZJAYQUIRHXLNFTGKDCMWB<K", "O", "O", // IV
"FKQHTLXOCBJSPDZRAMEWNIUYGV<AN", "U", "Z", // VIII
"FSOKANUERHMBTIYCWLQPZXVGJD",
"A",
"I", // Gamma
"NZJHGRCXMYSWBOUFAIVLPEKQDT<AN",
"I",
"V", // VII
"ESOVPZJAYQUIRHXLNFTGKDCMWB<K",
"O",
"O", // IV
"FKQHTLXOCBJSPDZRAMEWNIUYGV<AN",
"U",
"Z", // VIII
"AE BN CK DQ FU GY HW IJ LO MP RX SZ TV", // B thin
"WN MJ LX YB FP QD US IH CE GR"
]
@ -333,16 +461,25 @@ TestRegister.addTests([
// Decryption test on real message
name: "Enigma: decryption 2",
input: "LANOTCTOUARBBFPMHPHGCZXTDYGAHGUFXGEWKBLKGJWLQXXTGPJJAVTOCKZFSLPPQIHZFXOEBWIIEKFZLCLOAQJULJOYHSSMBBGWHZANVOIIPYRBRTDJQDJJOQKCXWDNBBTYVXLYTAPGVEATXSONPNYNQFUDBBHHVWEPYEYDOHNLXKZDNWRHDUWUJUMWWVIIWZXIVIUQDRHYMNCYEFUAPNHOTKHKGDNPSAKNUAGHJZSMJBMHVTREQEDGXHLZWIFUSKDQVELNMIMITHBHDBWVHDFYHJOQIHORTDJDBWXEMEAYXGYQXOHFDMYUXXNOJAZRSGHPLWMLRECWWUTLRTTVLBHYOORGLGOWUXNXHMHYFAACQEKTHSJW",
expectedOutput: "KRKRALLEXXFOLGENDESISTSOFORTBEKANNTZUGEBENXXICHHABEFOLGELNBEBEFEHLERHALTENXXJANSTERLEDESBISHERIGXNREICHSMARSCHALLSJGOERINGJSETZTDERFUEHRERSIEYHVRRGRZSSADMIRALYALSSEINENNACHFOLGEREINXSCHRIFTLSCHEVOLLMACHTUNTERWEGSXABSOFORTSOLLENSIESAEMTLICHEMASSNAHMENVERFUEGENYDIESICHAUSDERGEGENWAERTIGENLAGEERGEBENXGEZXREICHSLEITEIKKTULPEKKJBORMANNJXXOBXDXMMMDURNHFKSTXKOMXADMXUUUBOOIEXKP",
expectedOutput:
"KRKRALLEXXFOLGENDESISTSOFORTBEKANNTZUGEBENXXICHHABEFOLGELNBEBEFEHLERHALTENXXJANSTERLEDESBISHERIGXNREICHSMARSCHALLSJGOERINGJSETZTDERFUEHRERSIEYHVRRGRZSSADMIRALYALSSEINENNACHFOLGEREINXSCHRIFTLSCHEVOLLMACHTUNTERWEGSXABSOFORTSOLLENSIESAEMTLICHEMASSNAHMENVERFUEGENYDIESICHAUSDERGEGENWAERTIGENLAGEERGEBENXGEZXREICHSLEITEIKKTULPEKKJBORMANNJXXOBXDXMMMDURNHFKSTXKOMXADMXUUUBOOIEXKP",
recipeConfig: [
{
"op": "Enigma",
"args": [
"4-rotor",
"LEYJVCNIXWPBQMDRTAKZGFUHOS", "E", "C", // Beta
"VZBRGITYUPSDNHLXAWMJQOFECK<A", "P", "D", // V
"JPGVOUMFYQBENHZRDKASXLICTW<AN", "E", "S", // VI
"FKQHTLXOCBJSPDZRAMEWNIUYGV<AN", "L", "Z", // VIII
"LEYJVCNIXWPBQMDRTAKZGFUHOS",
"E",
"C", // Beta
"VZBRGITYUPSDNHLXAWMJQOFECK<A",
"P",
"D", // V
"JPGVOUMFYQBENHZRDKASXLICTW<AN",
"E",
"S", // VI
"FKQHTLXOCBJSPDZRAMEWNIUYGV<AN",
"L",
"Z", // VIII
"AR BD CO EJ FN GT HK IV LM PW QZ SX UY", // C thin
"AE BF CM DQ HU JN LX PR SZ VW"
]
@ -359,12 +496,21 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "A", // III
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"A", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"", true
"",
true
]
}
]
@ -379,12 +525,21 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "A", // III
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"A", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"", false
"",
false
]
}
]
@ -398,10 +553,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQ", "A", "A", // III
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQ",
"A",
"A", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
""
]
@ -417,10 +580,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQo", "A", "A", // III
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQo",
"A",
"A", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
""
]
@ -436,10 +607,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQA", "A", "A", // III
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQA",
"A",
"A", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
""
]
@ -455,10 +634,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<RR", "A", "A", // III
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<RR",
"A",
"A", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
""
]
@ -474,10 +661,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<a", "A", "A", // III
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<a",
"A",
"A", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
""
]
@ -495,10 +690,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "A", // III
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"A", // III
"AY BR CU DH EQ FS GL IP JX KN MO", // B
""
]
@ -514,10 +717,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "A", // III
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"A", // III
"AA BR CU DH EQ FS GL IP JX KN MO TZ VV WY", // B
""
]
@ -533,10 +744,18 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "A", // III
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"A", // III
"AY AR CU DH EQ FS GL IP JX KN MO TZ", // B
""
]
@ -552,14 +771,22 @@ TestRegister.addTests([
"op": "Enigma",
"args": [
"3-rotor",
"", "A", "A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", "A", "A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "A", "A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "A", "A", // III
"",
"A",
"A",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R",
"A",
"A", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
"A",
"A", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"A",
"A", // III
"AYBR CU DH EQ FS GL IP JX KN MO TZ", // B
""
]
}
]
},
}
]);

View file

@ -11,45 +11,49 @@ 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]
},
],
}
]
},
{
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]
},
],
}
]
},
{
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]
},
],
}
]
},
{
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]
},
],
},
}
]
}
]);

View file

@ -17,7 +17,7 @@ TestRegister.addTests([
op: "Fernet Decrypt",
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
}
],
]
},
{
name: "Fernet Decrypt: no secret",
@ -28,7 +28,7 @@ TestRegister.addTests([
op: "Fernet Decrypt",
args: [""]
}
],
]
},
{
name: "Fernet Decrypt: valid arguments",
@ -39,7 +39,7 @@ TestRegister.addTests([
op: "Fernet Decrypt",
args: ["VGhpc0lzVGhpcnR5VHdvQ2hhcmFjdGVyc0xvbmdLZXk="]
}
],
]
}
]);
@ -53,7 +53,7 @@ TestRegister.addTests([
op: "Fernet Encrypt",
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
}
],
]
},
{
name: "Fernet Encrypt: no secret",
@ -64,7 +64,7 @@ TestRegister.addTests([
op: "Fernet Encrypt",
args: [""]
}
],
]
},
{
name: "Fernet Encrypt: valid arguments",
@ -75,6 +75,6 @@ TestRegister.addTests([
op: "Fernet Encrypt",
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
}
],
]
}
]);

View file

@ -15,8 +15,8 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "File Tree",
"args": ["/", "Line feed"],
},
],
"args": ["/", "Line feed"]
}
]
}
]);

View file

@ -13,9 +13,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fletcher-16 Checksum",
args: [],
},
],
args: []
}
]
},
{
name: "Fletcher-16 Checksum: abcdef",
@ -24,9 +24,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fletcher-16 Checksum",
args: [],
},
],
args: []
}
]
},
{
name: "Fletcher-16 Checksum: abcdefgh",
@ -35,9 +35,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fletcher-16 Checksum",
args: [],
},
],
args: []
}
]
},
{
name: "Fletcher-32 Checksum: abcde",
@ -46,9 +46,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fletcher-32 Checksum",
args: [],
},
],
args: []
}
]
},
{
name: "Fletcher-32 Checksum: abcdef",
@ -57,9 +57,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fletcher-32 Checksum",
args: [],
},
],
args: []
}
]
},
{
name: "Fletcher-32 Checksum: abcdefgh",
@ -68,9 +68,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fletcher-32 Checksum",
args: [],
},
],
args: []
}
]
},
{
name: "Fletcher-64 Checksum: abcde",
@ -79,9 +79,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fletcher-64 Checksum",
args: [],
},
],
args: []
}
]
},
{
name: "Fletcher-64 Checksum: abcdef",
@ -90,9 +90,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fletcher-64 Checksum",
args: [],
},
],
args: []
}
]
},
{
name: "Fletcher-64 Checksum: abcdefgh",
@ -101,8 +101,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fletcher-64 Checksum",
args: [],
},
],
},
args: []
}
]
}
]);

View file

@ -16,9 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fork",
args: ["\n", "\n", false],
},
],
args: ["\n", "\n", false]
}
]
},
{
name: "Fork, Merge: nothing",
@ -27,44 +27,46 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fork",
args: ["\n", "\n", false],
args: ["\n", "\n", false]
},
{
op: "Merge",
args: [true],
},
],
args: [true]
}
]
},
{
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",
args: ["\n\n", "\n\n", false],
args: ["\n\n", "\n\n", false]
},
{
op: "Set Union",
args: ["\n\n", ","],
args: ["\n\n", ","]
},
{
op: "Merge",
args: [true],
},
],
args: [true]
}
]
},
{
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+/="] }
]
},
{
@ -72,10 +74,10 @@ TestRegister.addTests([
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] }
]
},
}
]);

View file

@ -16,8 +16,8 @@ TestRegister.addTests([
{
op: "From Decimal",
args: ["Space", false]
},
],
}
]
},
{
name: "From Decimal with negatives",
@ -27,7 +27,7 @@ TestRegister.addTests([
{
op: "From Decimal",
args: ["Comma", true]
},
],
},
}
]
}
]);

View file

@ -33,7 +33,7 @@ TestRegister.addTests([
"ZERO"
]
}
],
]
},
{
name: "GOST Encrypt: Kuznyechik",
@ -55,7 +55,7 @@ TestRegister.addTests([
"PKCS5"
]
}
],
]
},
{
name: "GOST Decrypt: Magma",
@ -77,7 +77,7 @@ TestRegister.addTests([
"ZERO"
]
}
],
]
},
{
name: "GOST Decrypt: Kuznyechik",
@ -99,7 +99,7 @@ TestRegister.addTests([
"PKCS5"
]
}
],
]
},
{
name: "GOST Sign",
@ -119,7 +119,7 @@ TestRegister.addTests([
48
]
}
],
]
},
{
name: "GOST Verify",
@ -138,7 +138,7 @@ TestRegister.addTests([
"E-TEST"
]
}
],
]
},
{
name: "GOST Key Wrap",
@ -158,7 +158,7 @@ TestRegister.addTests([
"CP"
]
}
],
]
},
{
name: "GOST Key Unwrap",
@ -178,6 +178,6 @@ TestRegister.addTests([
"CP"
]
}
],
},
]
}
]);

View file

@ -22,7 +22,8 @@ TestRegister.addTests([
{
name: "Generate De Bruijn Sequence: Long Sequence",
input: "",
expectedOutput: "0000010000200003000110001200013000210002200023000310003200033001010010200103001110011200113001210012200123001310013200133002010020200203002110021200213002210022200223002310023200233003010030200303003110031200313003210032200323003310033200333010110101201013010210102201023010310103201033011020110301111011120111301121011220112301131011320113301202012030121101212012130122101222012230123101232012330130201303013110131201313013210132201323013310133201333020210202202023020310203202033021030211102112021130212102122021230213102132021330220302211022120221302221022220222302231022320223302303023110231202313023210232202323023310233202333030310303203033031110311203113031210312203123031310313203133032110321203213032210322203223032310323203233033110331203313033210332203323033310333203333111112111131112211123111321113311212112131122211223112321123311312113131132211323113321133312122121231213212133122131222212223122321223312313123221232312332123331313213133132221322313232132331332213323133321333322222322233223232233323233233333",
expectedOutput:
"0000010000200003000110001200013000210002200023000310003200033001010010200103001110011200113001210012200123001310013200133002010020200203002110021200213002210022200223002310023200233003010030200303003110031200313003210032200323003310033200333010110101201013010210102201023010310103201033011020110301111011120111301121011220112301131011320113301202012030121101212012130122101222012230123101232012330130201303013110131201313013210132201323013310133201333020210202202023020310203202033021030211102112021130212102122021230213102132021330220302211022120221302221022220222302231022320223302303023110231202313023210232202323023310233202333030310303203033031110311203113031210312203123031310313203133032110321203213032210322203223032310323203233033110331203313033210332203323033310333203333111112111131112211123111321113311212112131122211223112321123311312113131132211323113321133312122121231213212133122131222212223122321223312313123221232312332123331313213133132221322313232132331332213323133321333322222322233223232233323233233333",
recipeConfig: [
{
"op": "Generate De Bruijn Sequence",

View file

@ -11,7 +11,8 @@ 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",

View file

@ -13,7 +13,8 @@ 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",
@ -32,7 +33,8 @@ TestRegister.addTests([
{
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",
@ -51,7 +53,8 @@ TestRegister.addTests([
{
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",
@ -70,7 +73,8 @@ TestRegister.addTests([
{
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",
@ -85,5 +89,5 @@ TestRegister.addTests([
args: ["None"]
}
]
},
}
]);

View file

@ -17,7 +17,7 @@ TestRegister.addTests([
"op": "HASSH Client Fingerprint",
"args": ["Hex", "Hash digest"]
}
],
]
},
{
name: "HASSH Server Fingerprint",
@ -28,6 +28,6 @@ TestRegister.addTests([
"op": "HASSH Server Fingerprint",
"args": ["Hex", "Hash digest"]
}
],
]
}
]);

View file

@ -13,36 +13,50 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "From Hex",
"args": ["None"],
"args": ["None"]
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c"},
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
"SHA256", "with salt", 42,
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c" },
{ "option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9" },
"SHA256",
"with salt",
42
]
}
]
},
{
"name": "HKDF: RFC5869 Test Case 2",
"input": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
"expectedOutput": "b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87",
"input":
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
"expectedOutput":
"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87",
"recipeConfig": [
{
"op": "From Hex",
"args": ["None"],
"args": ["None"]
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf"},
{"option": "Hex", "string": "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"},
"SHA256", "with salt", 82,
],
},
],
{
"option": "Hex",
"string":
"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf"
},
{
"option": "Hex",
"string":
"b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
},
"SHA256",
"with salt",
82
]
}
]
},
{
"name": "HKDF: RFC5869 Test Case 3",
@ -51,17 +65,19 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "From Hex",
"args": ["None"],
"args": ["None"]
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": ""},
{"option": "Hex", "string": ""},
"SHA256", "with salt", 42,
],
},
],
{ "option": "Hex", "string": "" },
{ "option": "Hex", "string": "" },
"SHA256",
"with salt",
42
]
}
]
},
{
"name": "HKDF: RFC5869 Test Case 4",
@ -70,36 +86,50 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "From Hex",
"args": ["None"],
"args": ["None"]
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c"},
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
"SHA1", "with salt", 42,
],
},
],
{ "option": "Hex", "string": "000102030405060708090a0b0c" },
{ "option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9" },
"SHA1",
"with salt",
42
]
}
]
},
{
"name": "HKDF: RFC5869 Test Case 5",
"input": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
"expectedOutput": "0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4",
"input":
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
"expectedOutput":
"0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4",
"recipeConfig": [
{
"op": "From Hex",
"args": ["None"],
"args": ["None"]
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf"},
{"option": "Hex", "string": "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"},
"SHA1", "with salt", 82,
],
},
],
{
"option": "Hex",
"string":
"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf"
},
{
"option": "Hex",
"string":
"b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
},
"SHA1",
"with salt",
82
]
}
]
},
{
"name": "HKDF: RFC5869 Test Case 6",
@ -108,17 +138,13 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "From Hex",
"args": ["None"],
"args": ["None"]
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": ""},
{"option": "Hex", "string": ""},
"SHA1", "with salt", 42,
],
},
],
"args": [{ "option": "Hex", "string": "" }, { "option": "Hex", "string": "" }, "SHA1", "with salt", 42]
}
]
},
{
"name": "HKDF: RFC5869 Test Case 7",
@ -127,17 +153,13 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "From Hex",
"args": ["None"],
"args": ["None"]
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": ""},
{"option": "Hex", "string": ""},
"SHA1", "no salt", 42,
],
},
],
"args": [{ "option": "Hex", "string": "" }, { "option": "Hex", "string": "" }, "SHA1", "no salt", 42]
}
]
},
{
"name": "HKDF: RFC5869 Test Case 1 with skip extract",
@ -146,17 +168,19 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "From Hex",
"args": ["None"],
"args": ["None"]
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": ""},
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
"SHA256", "skip", 42,
],
},
],
{ "option": "Hex", "string": "" },
{ "option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9" },
"SHA256",
"skip",
42
]
}
]
},
{
"name": "HKDF: too large L",
@ -165,16 +189,18 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "From Hex",
"args": ["None"],
"args": ["None"]
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c"},
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
"SHA256", "with salt", 8161,
],
},
],
},
{ "option": "Hex", "string": "000102030405060708090a0b0c" },
{ "option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9" },
"SHA256",
"with salt",
8161
]
}
]
}
]);

View file

@ -88,7 +88,8 @@ TestRegister.addTests([
{
name: "SHA2 384",
input: "Hello, World!",
expectedOutput: "5485cc9b3365b4305dfb4e8337e0a598a574f8242bf17289e0dd6c20a3cd44a089de16ab4ab308f63e44b1170eb5f515",
expectedOutput:
"5485cc9b3365b4305dfb4e8337e0a598a574f8242bf17289e0dd6c20a3cd44a089de16ab4ab308f63e44b1170eb5f515",
recipeConfig: [
{
"op": "SHA2",
@ -110,7 +111,8 @@ TestRegister.addTests([
{
name: "SHA2 512",
input: "Hello, World!",
expectedOutput: "374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc69291e0fa2fe0006a52570ef18c19def4e617c33ce52ef0a6e5fbe318cb0387",
expectedOutput:
"374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc69291e0fa2fe0006a52570ef18c19def4e617c33ce52ef0a6e5fbe318cb0387",
recipeConfig: [
{
"op": "SHA2",
@ -154,7 +156,8 @@ TestRegister.addTests([
{
name: "SHA3 384",
input: "Hello, World!",
expectedOutput: "aa9ad8a49f31d2ddcabbb7010a1566417cff803fef50eba239558826f872e468c5743e7f026b0a8e5b2d7a1cc465cdbe",
expectedOutput:
"aa9ad8a49f31d2ddcabbb7010a1566417cff803fef50eba239558826f872e468c5743e7f026b0a8e5b2d7a1cc465cdbe",
recipeConfig: [
{
"op": "SHA3",
@ -176,7 +179,8 @@ TestRegister.addTests([
{
name: "SHA3 512",
input: "Hello, World!",
expectedOutput: "38e05c33d7b067127f217d8c856e554fcff09c9320b8a5979ce2ff5d95dd27ba35d1fba50c562dfd1d6cc48bc9c5baa4390894418cc942d968f97bcb659419ed",
expectedOutput:
"38e05c33d7b067127f217d8c856e554fcff09c9320b8a5979ce2ff5d95dd27ba35d1fba50c562dfd1d6cc48bc9c5baa4390894418cc942d968f97bcb659419ed",
recipeConfig: [
{
"op": "SHA3",
@ -198,7 +202,8 @@ TestRegister.addTests([
{
name: "Keccak 384",
input: "Hello, World!",
expectedOutput: "4d60892fde7f967bcabdc47c73122ae6311fa1f9be90d721da32030f7467a2e3db3f9ccb3c746483f9d2b876e39def17",
expectedOutput:
"4d60892fde7f967bcabdc47c73122ae6311fa1f9be90d721da32030f7467a2e3db3f9ccb3c746483f9d2b876e39def17",
recipeConfig: [
{
"op": "Keccak",
@ -220,7 +225,8 @@ TestRegister.addTests([
{
name: "Keccak 512",
input: "Hello, World!",
expectedOutput: "eda765576c84c600ed7f5d97510e92703b61f5215def2a161037fd9dd1f5b6ed4f86ce46073c0e3f34b52de0289e9c618798fff9dd4b1bfe035bdb8645fc6e37",
expectedOutput:
"eda765576c84c600ed7f5d97510e92703b61f5215def2a161037fd9dd1f5b6ed4f86ce46073c0e3f34b52de0289e9c618798fff9dd4b1bfe035bdb8645fc6e37",
recipeConfig: [
{
"op": "Keccak",
@ -242,7 +248,8 @@ TestRegister.addTests([
{
name: "Shake 256",
input: "Hello, World!",
expectedOutput: "b3be97bfd978833a65588ceae8a34cf59e95585af62063e6b89d0789f372424e8b0d1be4f21b40ce5a83a438473271e0661854f02d431db74e6904d6c347d757",
expectedOutput:
"b3be97bfd978833a65588ceae8a34cf59e95585af62063e6b89d0789f372424e8b0d1be4f21b40ce5a83a438473271e0661854f02d431db74e6904d6c347d757",
recipeConfig: [
{
"op": "Shake",
@ -308,7 +315,8 @@ TestRegister.addTests([
{
name: "Whirlpool-0",
input: "Hello, World!",
expectedOutput: "1c327026f565a0105a827efbfb3d3635cdb042c0aabb8416e96deb128e6c5c8684b13541cf31c26c1488949df050311c6999a12eb0e7002ad716350f5c7700ca",
expectedOutput:
"1c327026f565a0105a827efbfb3d3635cdb042c0aabb8416e96deb128e6c5c8684b13541cf31c26c1488949df050311c6999a12eb0e7002ad716350f5c7700ca",
recipeConfig: [
{
"op": "Whirlpool",
@ -319,7 +327,8 @@ TestRegister.addTests([
{
name: "Whirlpool-T",
input: "Hello, World!",
expectedOutput: "16c581089b6a6f356ae56e16a63a4c613eecd82a2a894b293f5ee45c37a31d09d7a8b60bfa7e414bd4a7166662cea882b5cf8c96b7d583fc610ad202591bcdb1",
expectedOutput:
"16c581089b6a6f356ae56e16a63a4c613eecd82a2a894b293f5ee45c37a31d09d7a8b60bfa7e414bd4a7166662cea882b5cf8c96b7d583fc610ad202591bcdb1",
recipeConfig: [
{
"op": "Whirlpool",
@ -330,7 +339,8 @@ TestRegister.addTests([
{
name: "Whirlpool",
input: "Hello, World!",
expectedOutput: "3d837c9ef7bb291bd1dcfc05d3004af2eeb8c631dd6a6c4ba35159b8889de4b1ec44076ce7a8f7bfa497e4d9dcb7c29337173f78d06791f3c3d9e00cc6017f0b",
expectedOutput:
"3d837c9ef7bb291bd1dcfc05d3004af2eeb8c631dd6a6c4ba35159b8889de4b1ec44076ce7a8f7bfa497e4d9dcb7c29337173f78d06791f3c3d9e00cc6017f0b",
recipeConfig: [
{
"op": "Whirlpool",
@ -422,7 +432,7 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Latin1", "string": "test"}, "SHA256"]
"args": [{ "option": "Latin1", "string": "test" }, "SHA256"]
}
]
},
@ -433,7 +443,7 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"}, "SHA224"]
"args": [{ "option": "Hex", "string": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" }, "SHA224"]
}
]
},
@ -444,29 +454,31 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"}, "SHA256"]
"args": [{ "option": "Hex", "string": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" }, "SHA256"]
}
]
},
{
name: "HMAC: RFC4231 Test Case 1 SHA-384",
input: "Hi There",
expectedOutput: "afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6",
expectedOutput:
"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6",
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"}, "SHA384"]
"args": [{ "option": "Hex", "string": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" }, "SHA384"]
}
]
},
{
name: "HMAC: RFC4231 Test Case 1 SHA-512",
input: "Hi There",
expectedOutput: "87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854",
expectedOutput:
"87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854",
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"}, "SHA512"]
"args": [{ "option": "Hex", "string": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" }, "SHA512"]
}
]
},
@ -477,7 +489,7 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "4a656665"}, "SHA224"]
"args": [{ "option": "Hex", "string": "4a656665" }, "SHA224"]
}
]
},
@ -488,29 +500,31 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "4a656665"}, "SHA256"]
"args": [{ "option": "Hex", "string": "4a656665" }, "SHA256"]
}
]
},
{
name: "HMAC: RFC4231 Test Case 2 SHA-384",
input: "what do ya want for nothing?",
expectedOutput: "af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649",
expectedOutput:
"af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649",
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "4a656665"}, "SHA384"]
"args": [{ "option": "Hex", "string": "4a656665" }, "SHA384"]
}
]
},
{
name: "HMAC: RFC4231 Test Case 2 SHA-512",
input: "what do ya want for nothing?",
expectedOutput: "164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737",
expectedOutput:
"164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737",
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "4a656665"}, "SHA512"]
"args": [{ "option": "Hex", "string": "4a656665" }, "SHA512"]
}
]
},
@ -525,7 +539,7 @@ TestRegister.addTests([
},
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA224"]
"args": [{ "option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "SHA224"]
}
]
},
@ -540,14 +554,15 @@ TestRegister.addTests([
},
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA256"]
"args": [{ "option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "SHA256"]
}
]
},
{
name: "HMAC: RFC4231 Test Case 3 SHA-384",
input: "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
expectedOutput: "88062608d3e6ad8a0aa2ace014c8a86f0aa635d947ac9febe83ef4e55966144b2a5ab39dc13814b94e3ab6e101a34f27",
expectedOutput:
"88062608d3e6ad8a0aa2ace014c8a86f0aa635d947ac9febe83ef4e55966144b2a5ab39dc13814b94e3ab6e101a34f27",
recipeConfig: [
{
"op": "From Hex",
@ -555,14 +570,15 @@ TestRegister.addTests([
},
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA384"]
"args": [{ "option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "SHA384"]
}
]
},
{
name: "HMAC: RFC4231 Test Case 3 SHA-512",
input: "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
expectedOutput: "fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fb",
expectedOutput:
"fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fb",
recipeConfig: [
{
"op": "From Hex",
@ -570,7 +586,7 @@ TestRegister.addTests([
},
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA512"]
"args": [{ "option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "SHA512"]
}
]
},
@ -585,7 +601,7 @@ TestRegister.addTests([
},
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "0102030405060708090a0b0c0d0e0f10111213141516171819"}, "SHA224"]
"args": [{ "option": "Hex", "string": "0102030405060708090a0b0c0d0e0f10111213141516171819" }, "SHA224"]
}
]
},
@ -600,14 +616,15 @@ TestRegister.addTests([
},
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "0102030405060708090a0b0c0d0e0f10111213141516171819"}, "SHA256"]
"args": [{ "option": "Hex", "string": "0102030405060708090a0b0c0d0e0f10111213141516171819" }, "SHA256"]
}
]
},
{
name: "HMAC: RFC4231 Test Case 4 SHA-384",
input: "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd",
expectedOutput: "3e8a69b7783c25851933ab6290af6ca77a9981480850009cc5577c6e1f573b4e6801dd23c4a7d679ccf8a386c674cffb",
expectedOutput:
"3e8a69b7783c25851933ab6290af6ca77a9981480850009cc5577c6e1f573b4e6801dd23c4a7d679ccf8a386c674cffb",
recipeConfig: [
{
"op": "From Hex",
@ -615,14 +632,15 @@ TestRegister.addTests([
},
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "0102030405060708090a0b0c0d0e0f10111213141516171819"}, "SHA384"]
"args": [{ "option": "Hex", "string": "0102030405060708090a0b0c0d0e0f10111213141516171819" }, "SHA384"]
}
]
},
{
name: "HMAC: RFC4231 Test Case 4 SHA-512",
input: "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd",
expectedOutput: "b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd",
expectedOutput:
"b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd",
recipeConfig: [
{
"op": "From Hex",
@ -630,7 +648,7 @@ TestRegister.addTests([
},
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "0102030405060708090a0b0c0d0e0f10111213141516171819"}, "SHA512"]
"args": [{ "option": "Hex", "string": "0102030405060708090a0b0c0d0e0f10111213141516171819" }, "SHA512"]
}
]
},
@ -641,7 +659,14 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA224"]
"args": [
{
"option": "Hex",
"string":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"SHA224"
]
}
]
},
@ -652,29 +677,52 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA256"]
"args": [
{
"option": "Hex",
"string":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"SHA256"
]
}
]
},
{
name: "HMAC: RFC4231 Test Case 6 SHA-384",
input: "Test Using Larger Than Block-Size Key - Hash Key First",
expectedOutput: "4ece084485813e9088d2c63a041bc5b44f9ef1012a2b588f3cd11f05033ac4c60c2ef6ab4030fe8296248df163f44952",
expectedOutput:
"4ece084485813e9088d2c63a041bc5b44f9ef1012a2b588f3cd11f05033ac4c60c2ef6ab4030fe8296248df163f44952",
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA384"]
"args": [
{
"option": "Hex",
"string":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"SHA384"
]
}
]
},
{
name: "HMAC: RFC4231 Test Case 6 SHA-512",
input: "Test Using Larger Than Block-Size Key - Hash Key First",
expectedOutput: "80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598",
expectedOutput:
"80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598",
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA512"]
"args": [
{
"option": "Hex",
"string":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"SHA512"
]
}
]
},
@ -685,7 +733,14 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA224"]
"args": [
{
"option": "Hex",
"string":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"SHA224"
]
}
]
},
@ -696,29 +751,52 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA256"]
"args": [
{
"option": "Hex",
"string":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"SHA256"
]
}
]
},
{
name: "HMAC: RFC4231 Test Case 7 SHA-384",
input: "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
expectedOutput: "6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523e",
expectedOutput:
"6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523e",
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA384"]
"args": [
{
"option": "Hex",
"string":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"SHA384"
]
}
]
},
{
name: "HMAC: RFC4231 Test Case 7 SHA-512",
input: "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
expectedOutput: "e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58",
expectedOutput:
"e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58",
recipeConfig: [
{
"op": "HMAC",
"args": [{"option": "Hex", "string": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "SHA512"]
"args": [
{
"option": "Hex",
"string":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"SHA512"
]
}
]
},
@ -785,7 +863,8 @@ TestRegister.addTests([
{
name: "SHA2 384: Complex bytes",
input: "10dc10e32010de10d010dc10d810d910d010e12e",
expectedOutput: "2a6369ffec550ea0bfb810b3b8246b7d6b7f060edfae88441f0f242b98b91549aa4ff407de38c6d03b5f377434ad2f36",
expectedOutput:
"2a6369ffec550ea0bfb810b3b8246b7d6b7f060edfae88441f0f242b98b91549aa4ff407de38c6d03b5f377434ad2f36",
recipeConfig: [
{
"op": "From Hex",
@ -800,7 +879,8 @@ TestRegister.addTests([
{
name: "SHA2 512: Complex bytes",
input: "10dc10e32010de10d010dc10d810d910d010e12e",
expectedOutput: "544ae686522c05b70d12b460b5b39ea0a758eb4027333edbded7e2b3f467aa605804f71f54db61a7bbe50e6e7898510635efd6721fd418a9ea4d05b286d12806",
expectedOutput:
"544ae686522c05b70d12b460b5b39ea0a758eb4027333edbded7e2b3f467aa605804f71f54db61a7bbe50e6e7898510635efd6721fd418a9ea4d05b286d12806",
recipeConfig: [
{
"op": "From Hex",
@ -845,7 +925,8 @@ TestRegister.addTests([
{
name: "SHA3 384: Complex bytes",
input: "10dc10e32010de10d010dc10d810d910d010e12e",
expectedOutput: "39f8796dd697dc39e5a943817833793f2c29dc0d1adc7037854c0fb51e135c6bd26b113240c4fb1e3fcc16ff8690c91a",
expectedOutput:
"39f8796dd697dc39e5a943817833793f2c29dc0d1adc7037854c0fb51e135c6bd26b113240c4fb1e3fcc16ff8690c91a",
recipeConfig: [
{
"op": "From Hex",
@ -860,7 +941,8 @@ TestRegister.addTests([
{
name: "SHA3 512: Complex bytes",
input: "10dc10e32010de10d010dc10d810d910d010e12e",
expectedOutput: "ee9061bed83b1ad1e2fc4a4bac72a5a65a23a0fa55193b808af0a3e2013b718a5a3e40474765b4f93d1b2747401058a5b58099cc890a159db92b2ea816287add",
expectedOutput:
"ee9061bed83b1ad1e2fc4a4bac72a5a65a23a0fa55193b808af0a3e2013b718a5a3e40474765b4f93d1b2747401058a5b58099cc890a159db92b2ea816287add",
recipeConfig: [
{
"op": "From Hex",
@ -919,7 +1001,8 @@ TestRegister.addTests([
{
name: "SHA2 384: UTF-8",
input: "ნუ პანიკას",
expectedOutput: "140b929391a66c9a943bcd60e6964f0d19526d3bc9ba020fbb29aae51cddb8e63a78784d8770f1d36335bf4efff8c131",
expectedOutput:
"140b929391a66c9a943bcd60e6964f0d19526d3bc9ba020fbb29aae51cddb8e63a78784d8770f1d36335bf4efff8c131",
recipeConfig: [
{
"op": "SHA2",
@ -930,7 +1013,8 @@ TestRegister.addTests([
{
name: "SHA2 512: UTF-8",
input: "ნუ პანიკას",
expectedOutput: "04a7887c400bf647b7c67b9a0f1ada70d176348b5afdfebea184f7e62748849828669c7b5160be99455fdbf625589bd1689c003bc06ef60c39607d825a2f8838",
expectedOutput:
"04a7887c400bf647b7c67b9a0f1ada70d176348b5afdfebea184f7e62748849828669c7b5160be99455fdbf625589bd1689c003bc06ef60c39607d825a2f8838",
recipeConfig: [
{
"op": "SHA2",
@ -963,7 +1047,8 @@ TestRegister.addTests([
{
name: "SHA3 384: UTF-8",
input: "ნუ პანიკას",
expectedOutput: "93e87b9aa8c9c47eba146adac357c525b418b71677f6db01d1c760d87b058682e639c8d43a8bfe91529cecd9800700e3",
expectedOutput:
"93e87b9aa8c9c47eba146adac357c525b418b71677f6db01d1c760d87b058682e639c8d43a8bfe91529cecd9800700e3",
recipeConfig: [
{
"op": "SHA3",
@ -974,7 +1059,8 @@ TestRegister.addTests([
{
name: "SHA3 512: UTF-8",
input: "ნუ პანიკას",
expectedOutput: "1fbc484b5184982561795162757717474eebc846ca9f10029a75a54cdd897a7b48d1db42f2478fa1d5d213a0dd7de71c809cb19c60581ba57e7289d29408fb36",
expectedOutput:
"1fbc484b5184982561795162757717474eebc846ca9f10029a75a54cdd897a7b48d1db42f2478fa1d5d213a0dd7de71c809cb19c60581ba57e7289d29408fb36",
recipeConfig: [
{
"op": "SHA3",
@ -996,7 +1082,8 @@ TestRegister.addTests([
{
name: "Scrypt: RFC test vector 1",
input: "",
expectedOutput: "77d6576238657b203b19ca42c18a0497f16b4844e3074ae8dfdffa3fede21442fcd0069ded0948f8326a753a0fc81f17e8d3e0fb2e0d3628cf35e20c38d18906",
expectedOutput:
"77d6576238657b203b19ca42c18a0497f16b4844e3074ae8dfdffa3fede21442fcd0069ded0948f8326a753a0fc81f17e8d3e0fb2e0d3628cf35e20c38d18906",
recipeConfig: [
{
op: "Scrypt",
@ -1005,7 +1092,10 @@ TestRegister.addTests([
"option": "Latin1",
"string": ""
},
16, 1, 1, 64
16,
1,
1,
64
]
}
]
@ -1013,7 +1103,8 @@ TestRegister.addTests([
{
name: "Scrypt: RFC test vector 2",
input: "password",
expectedOutput: "fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b3731622eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640",
expectedOutput:
"fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b3731622eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640",
recipeConfig: [
{
op: "Scrypt",
@ -1022,7 +1113,10 @@ TestRegister.addTests([
"option": "Latin1",
"string": "NaCl"
},
1024, 8, 16, 64
1024,
8,
16,
64
]
}
]
@ -1030,7 +1124,8 @@ TestRegister.addTests([
{
name: "Scrypt: RFC test vector 3",
input: "pleaseletmein",
expectedOutput: "7023bdcb3afd7348461c06cd81fd38ebfda8fbba904f8e3ea9b543f6545da1f2d5432955613f0fcf62d49705242a9af9e61e85dc0d651e40dfcf017b45575887",
expectedOutput:
"7023bdcb3afd7348461c06cd81fd38ebfda8fbba904f8e3ea9b543f6545da1f2d5432955613f0fcf62d49705242a9af9e61e85dc0d651e40dfcf017b45575887",
recipeConfig: [
{
op: "Scrypt",
@ -1039,7 +1134,10 @@ TestRegister.addTests([
"option": "Latin1",
"string": "SodiumChloride"
},
16384, 8, 1, 64
16384,
8,
1,
64
]
}
]
@ -1069,7 +1167,8 @@ TestRegister.addTests([
{
name: "Streebog-512: Test Case 1",
input: "",
expectedOutput: "8e945da209aa869f0455928529bcae4679e9873ab707b55315f56ceb98bef0a7362f715528356ee83cda5f2aac4c6ad2ba3a715c1bcd81cb8e9f90bf4c1c1a8a",
expectedOutput:
"8e945da209aa869f0455928529bcae4679e9873ab707b55315f56ceb98bef0a7362f715528356ee83cda5f2aac4c6ad2ba3a715c1bcd81cb8e9f90bf4c1c1a8a",
recipeConfig: [
{
op: "Streebog",
@ -1080,7 +1179,8 @@ TestRegister.addTests([
{
name: "Streebog-512: Test Case 2",
input: "The quick brown fox jumps over the lazy dog",
expectedOutput: "d2b793a0bb6cb5904828b5b6dcfb443bb8f33efc06ad09368878ae4cdc8245b97e60802469bed1e7c21a64ff0b179a6a1e0bb74d92965450a0adab69162c00fe",
expectedOutput:
"d2b793a0bb6cb5904828b5b6dcfb443bb8f33efc06ad09368878ae4cdc8245b97e60802469bed1e7c21a64ff0b179a6a1e0bb74d92965450a0adab69162c00fe",
recipeConfig: [
{
op: "Streebog",
@ -1134,15 +1234,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Argon2",
args: [
{"option": "UTF8", "string": "somesalt"},
3,
4096,
1,
32,
"Argon2i",
"Encoded hash"
]
args: [{ "option": "UTF8", "string": "somesalt" }, 3, 4096, 1, 32, "Argon2i", "Encoded hash"]
}
]
},
@ -1153,9 +1245,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Argon2 compare",
args: [
"$argon2i$v=19$m=4096,t=3,p=1$c29tZXNhbHQ$s43my9eBljQADuF/LWCG8vGqwAJzOorKQ0Yog8jFvbw"
]
args: ["$argon2i$v=19$m=4096,t=3,p=1$c29tZXNhbHQ$s43my9eBljQADuF/LWCG8vGqwAJzOorKQ0Yog8jFvbw"]
}
]
}

View file

@ -17,7 +17,7 @@ TestRegister.addTests([
"op": "Haversine distance",
"args": []
}
],
]
},
{
name: "Haversine distance, zero distance",
@ -28,6 +28,6 @@ TestRegister.addTests([
"op": "Haversine distance",
"args": []
}
],
]
}
]);

View file

@ -8,11 +8,8 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "To Hex",
"args": [
"None",
0
]
},
"args": ["None", 0]
}
]
},
{
@ -22,10 +19,7 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "To Hex",
"args": [
"Colon",
0
]
"args": ["Colon", 0]
}
]
},
@ -36,10 +30,7 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "To Hex",
"args": [
"0x with comma",
0
]
"args": ["0x with comma", 0]
}
]
},
@ -50,10 +41,7 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "To Hex",
"args": [
"0x with comma",
4
]
"args": ["0x with comma", 4]
}
]
},
@ -64,12 +52,9 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "From Hex",
"args": [
"Auto"
]
"args": ["Auto"]
}
]
},
{
name: "Multiline 0x hex to ASCII",
@ -83,13 +68,12 @@ 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"
]
"args": ["Auto"]
}
]
},
@ -100,11 +84,8 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "From Hex",
"args": [
"0x with comma"
]
"args": ["0x with comma"]
}
]
},
}
]);

View file

@ -24,7 +24,7 @@ const ALL_BYTES = [
"\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",
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
].join("");
TestRegister.addTests([
@ -41,7 +41,7 @@ TestRegister.addTests([
op: "From Hexdump",
args: []
}
],
]
},
{
name: "Hexdump: Hello, World!",
@ -56,7 +56,7 @@ TestRegister.addTests([
op: "From Hexdump",
args: []
}
],
]
},
{
name: "Hexdump: UTF-8",
@ -71,7 +71,7 @@ TestRegister.addTests([
op: "From Hexdump",
args: []
}
],
]
},
{
name: "Hexdump: All bytes",
@ -86,7 +86,7 @@ TestRegister.addTests([
op: "From Hexdump",
args: []
}
],
]
},
{
name: "To Hexdump: UTF-8",
@ -98,7 +98,7 @@ TestRegister.addTests([
op: "To Hexdump",
args: [16, false, false]
}
],
]
},
{
name: "To Hexdump: All bytes",
@ -124,7 +124,7 @@ TestRegister.addTests([
op: "To Hexdump",
args: [16, false, false]
}
],
]
},
{
name: "From Hexdump: xxd",
@ -150,7 +150,7 @@ TestRegister.addTests([
op: "From Hexdump",
args: []
}
],
]
},
{
name: "From Hexdump: Wireshark",
@ -177,7 +177,7 @@ TestRegister.addTests([
op: "From Hexdump",
args: []
}
],
]
},
{
name: "From Hexdump: Wireshark alt",
@ -203,7 +203,7 @@ TestRegister.addTests([
op: "From Hexdump",
args: []
}
],
]
},
{
name: "From Hexdump: 010",
@ -229,7 +229,7 @@ TestRegister.addTests([
op: "From Hexdump",
args: []
}
],
]
},
{
name: "From Hexdump: Linux hexdump",
@ -256,6 +256,6 @@ TestRegister.addTests([
op: "From Hexdump",
args: []
}
],
},
]
}
]);

View file

@ -16,14 +16,13 @@ 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"] }
@ -32,18 +31,16 @@ TestRegister.addTests([
{
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",
@ -52,9 +49,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Extract EXIF",
args: [],
},
],
args: []
}
]
},
{
name: "Extract EXIF: hello world text (error)",
@ -63,9 +60,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Extract EXIF",
args: [],
},
],
args: []
}
]
},
{
name: "Extract EXIF: meerkat jpeg",
@ -100,7 +97,7 @@ TestRegister.addTests([
"SceneCaptureType: 0",
"Contrast: 0",
"Saturation: 0",
"Sharpness: 0",
"Sharpness: 0"
].join("\n"),
recipeConfig: [
{
@ -109,9 +106,9 @@ TestRegister.addTests([
},
{
op: "Extract EXIF",
args: [],
},
],
args: []
}
]
},
{
name: "Extract EXIF: avatar jpeg",
@ -124,9 +121,9 @@ TestRegister.addTests([
},
{
op: "Extract EXIF",
args: [],
},
],
args: []
}
]
},
{
name: "Remove EXIF: hello world text (error)",
@ -135,9 +132,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Remove EXIF",
args: [],
},
],
args: []
}
]
},
{
name: "Remove EXIF: meerkat jpeg (has EXIF)",
@ -150,13 +147,13 @@ TestRegister.addTests([
},
{
op: "Remove EXIF",
args: [],
args: []
},
{
op: "Extract EXIF",
args: [],
},
],
args: []
}
]
},
{
name: "Extract EXIF: avatar jpeg (has no EXIF)",
@ -169,18 +166,19 @@ TestRegister.addTests([
},
{
op: "Remove EXIF",
args: [],
args: []
},
{
op: "Extract EXIF",
args: [],
},
],
args: []
}
]
},
{
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",
@ -195,7 +193,8 @@ TestRegister.addTests([
{
name: "Extract LSB",
input: PNG_HEX,
expectedOutput: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000208000000000000000000008000000000000000000000000248000000200240000000208908000000200240000000200821000000200240000000061249000000240000000000209b69000001a49b00000000a204a1200001a49b00000009800414000001a49b0000000035db6c00000094924000000086dffc20000df6dec8000001e10014a0000df6dec800002564924b00000df6dec80000009a6db20000007edb4124804177fffba0002fffff69249044e0924bc4002fffff6924905fb2db6d04002fffff692490416d2490040001bfffcc92030dbffffdc00037fffffdb6d302c6db6d700037fffffdb6d327eb6db6148037fffffdb6d30db4000014800dffffeb6d9aefffffff640",
expectedOutput:
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000208000000000000000000008000000000000000000000000248000000200240000000208908000000200240000000200821000000200240000000061249000000240000000000209b69000001a49b00000000a204a1200001a49b00000009800414000001a49b0000000035db6c00000094924000000086dffc20000df6dec8000001e10014a0000df6dec800002564924b00000df6dec80000009a6db20000007edb4124804177fffba0002fffff69249044e0924bc4002fffff6924905fb2db6d04002fffff692490416d2490040001bfffcc92030dbffffdc00037fffffdb6d302c6db6d700037fffffdb6d327eb6db6148037fffffdb6d30db4000014800dffffeb6d9aefffffff640",
recipeConfig: [
{
op: "From Hex",
@ -214,7 +213,8 @@ TestRegister.addTests([
{
name: "View Bit Plane",
input: PNG_HEX,
expectedOutput: "89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af400000140494441547801c5c1416ea3400000c1ee11ffff726fe6808410186ce26c95fde0432a154f0cdea4b2aa505151519954ee1a5c50995454aea8ac54ae2c5ca8982a3ea132551c199c507942e58ec1898adf50f1cae084ca15952b2a152a47067f40a5e2c8e00f54a81c199ca8b85271a542a5e2c8e005159527542ace0c5ea8a8f844c54ae5ccc217555c197c41c55d83ff6cf0052a772ddca052b1a752b1a772d7c2432a4f2c3c50f1d4c20b2a1593ca918a4965afe2cac29b2a562a93ca56c55d0b2754b62a269555c554b15251a9b8637040e5884ac54a654ba5a2624be5cce040c5918a55c55ec5a4a232a9549c197c48655239523155bc3278a862af624be5ccc2072aaea854a8549c5978834a85ca5ec5918a57ec076f50a958a9546ca94c1557ec071754a68a2d958a270637544c2a2abf69e1a68a95ca54b152a978d73f2e08bd57b6f839a00000000049454e44ae426082",
expectedOutput:
"89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af400000140494441547801c5c1416ea3400000c1ee11ffff726fe6808410186ce26c95fde0432a154f0cdea4b2aa505151519954ee1a5c50995454aea8ac54ae2c5ca8982a3ea132551c199c507942e58ec1898adf50f1cae084ca15952b2a152a47067f40a5e2c8e00f54a81c199ca8b85271a542a5e2c8e005159527542ace0c5ea8a8f844c54ae5ccc217555c197c41c55d83ff6cf0052a772ddca052b1a752b1a772d7c2432a4f2c3c50f1d4c20b2a1593ca918a4965afe2cac29b2a562a93ca56c55d0b2754b62a269555c554b15251a9b8637040e5884ac54a654ba5a2624be5cce040c5918a55c55ec5a4a232a9549c197c48655239523155bc3278a862af624be5ccc2072aaea854a8549c5978834a85ca5ec5918a57ec076f50a958a9546ca94c1557ec071754a68a2d958a270637544c2a2abf69e1a68a95ca54b152a978d73f2e08bd57b6f839a00000000049454e44ae426082",
recipeConfig: [
{
op: "From Hex",
@ -233,7 +233,8 @@ TestRegister.addTests([
{
name: "Randomize Colour Palette",
"input": PNG_HEX,
expectedOutput: "89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af4000004f3494441547801c5c10b50cf0700c0f16fbfff8f0ae5f157ed9f1e446358ab28b3913f29b3f89f65deab9859c624cafbf557b6eb3662799c8a285c541479ed3c125d2d2cba52e45d4da8bc66b99d1ebbff6ddd75ddeff7efef75fb7c8c5cb5b10dbc869ccbd1ac4f0c67dfc55cba1f9ec32dd303bc0e854aadd1f20ace5f29e1c9346b4c3982aada03b3285b540f4b099f664ca5720321a34c582466b2f38f3e1842a1526bb4e811efe64a56403a465dc270a998cb517b47e62f7842870b6aaabc5b519627a253784e606a8e25470fbbe358a0c2fd692f9c9668b8bda084e77d5f2247448f790f42a9b9da915d415a6020508a3e49e207e8ec7961cb9594545657e5e26e0fdaf9df5014998a141119f16eae24b4db84f7d775bc8e3e3e9e24f12fabaccf282210292232ce6a5e12dab58e37656be7cf8893916498d72345404681d7365ae217b18b969495261019998f8569145204e47c3e99b7a58f8f278fa76e478a808c522f23de165b3b7f3aee9c8e14011956e9b6841c29419f5d8bfd6889ad9d3fc1c9c654be08428a808cfc9a0c02e7d711973a823751569ac0c79dd72347408fb9ee3d102f4c616d9c82579596dd8df1b5c58caf2d26625d2fe488b420b16c129e3d7825534ccbb01a3881f0803354adba49c5853ce488bc037ba66b48c93586e20298885e02ff338177c0a1ed600c256200973699b0f130cd9dafcd20c87a3bcd9d29d90b1462081103c4d444d1bee2139aab9b7c87ec50479adbd47f13a0c610227a94af8a6565ce118ce72dc1618d3b4ded6f678465840dd905bd519f3e455305e67eb4f1db8ed94fdeb444448f0dbb94740bcec029db9fa636fc99cbf176a708b9e44198af3573469b323cb992469694b031bd133b2a955cb2a8461f0119a3b6f810fcac81619ea1c42cbf43a3711393d8727b1ee37ad6a263b1388cc8a872264cc8a7d1c97116d407ede1ab9c44ac3de610e5f32372142ab5468b84d091d984d79a90147e8dfb8322e8bcf71cdf370ce07ae6158606ee479c164c8794ddf88f76664c5d3d96579ee171db85d9917524b996102e2e65d882753c4c28e690714f9e3ffa1b2902122a0e6571a3c8864657b304ee2e4d6579e1038e0879cc0c716765c67ec2ee1d63cbaa9154db0760ffcc8e0fd7f643d3ba9c31ce69fc3c68124507bae060eb8379dc45e4884850aa4730ca2e97e68a572ca178055c7ff411cb56c4002bf86ef6717c53f94f3c3a4ff72590d6fa09ef134ae0a983ec1efc2b720424fc55b8107dbea8fe81134ecee8687c4d68ae62de45bc636ad099782b126b8f39c81190b0f292127d5295cb98f2b415aa2a055dcb2fb035b081a686f48ee5f4d37ee80c9d91498855007204240cc9ea89efeabec871ec5443c381b1980c9a4f456d1233a38d68ce667c2ee7c2927019e1ce8bb84ce48848f832d10bb1f50dd6540d03d268d4677d39ed1d52514407d3b6d8830327dc49b0984574507b3a3b0573fb5806f762afa37379790e7783ab0849ee0f66fd91a350a9355a24d4bb754239ca02df597598d52dc5c2bb339503cde95213cff3a089240d7f48fd522f9c943eec1db088e53b0412631ea193dec188e4b3a7d9d6eb535a62e4aa8d6da005bfe4d9125de082dbcd6f69ca6ecc66c2166ca329eb198ee4bf5780a5ba3b861030c05cd732eea4acc3c42106671f0d52ac6738727064325b8ff5c752dd1d4329546a8d1603bc2c51f2bbf3356eae2c64b379374c964561b5f53c36d65e14fd3683c7f7179232d686bdf9777915ff00ec08ae8ecb66a3370000000049454e44ae426082",
expectedOutput:
"89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af4000004f3494441547801c5c10b50cf0700c0f16fbfff8f0ae5f157ed9f1e446358ab28b3913f29b3f89f65deab9859c624cafbf557b6eb3662799c8a285c541479ed3c125d2d2cba52e45d4da8bc66b99d1ebbff6ddd75ddeff7efef75fb7c8c5cb5b10dbc869ccbd1ac4f0c67dfc55cba1f9ec32dd303bc0e854aadd1f20ace5f29e1c9346b4c3982aada03b3285b540f4b099f664ca5720321a34c582466b2f38f3e1842a1526bb4e811efe64a56403a465dc270a998cb517b47e62f7842870b6aaabc5b519627a253784e606a8e25470fbbe358a0c2fd692f9c9668b8bda084e77d5f2247448f790f42a9b9da915d415a6020508a3e49e207e8ec7961cb9594545657e5e26e0fdaf9df5014998a141119f16eae24b4db84f7d775bc8e3e3e9e24f12fabaccf282210292232ce6a5e12dab58e37656be7cf8893916498d72345404681d7365ae217b18b969495261019998f8569145204e47c3e99b7a58f8f278fa76e478a808c522f23de165b3b7f3aee9c8e14011956e9b6841c29419f5d8bfd6889ad9d3fc1c9c654be08428a808cfc9a0c02e7d711973a823751569ac0c79dd72347408fb9ee3d102f4c616d9c82579596dd8df1b5c58caf2d26625d2fe488b420b16c129e3d7825534ccbb01a3881f0803354adba49c5853ce488bc037ba66b48c93586e20298885e02ff338177c0a1ed600c256200973699b0f130cd9dafcd20c87a3bcd9d29d90b1462081103c4d444d1bee2139aab9b7c87ec50479adbd47f13a0c610227a94af8a6565ce118ce72dc1618d3b4ded6f678465840dd905bd519f3e455305e67eb4f1db8ed94fdeb444448f0dbb94740bcec029db9fa636fc99cbf176a708b9e44198af3573469b323cb992469694b031bd133b2a955cb2a8461f0119a3b6f810fcac81619ea1c42cbf43a3711393d8727b1ee37ad6a263b1388cc8a872264cc8a7d1c97116d407ede1ab9c44ac3de610e5f32372142ab5468b84d091d984d79a90147e8dfb8322e8bcf71cdf370ce07ae6158606ee479c164c8794ddf88f76664c5d3d96579ee171db85d9917524b996102e2e65d882753c4c28e690714f9e3ffa1b2902122a0e6571a3c8864657b304ee2e4d6579e1038e0879cc0c716765c67ec2ee1d63cbaa9154db0760ffcc8e0fd7f643d3ba9c31ce69fc3c68124507bae060eb8379dc45e4884850aa4730ca2e97e68a572ca178055c7ff411cb56c4002bf86ef6717c53f94f3c3a4ff72590d6fa09ef134ae0a983ec1efc2b720424fc55b8107dbea8fe81134ecee8687c4d68ae62de45bc636ad099782b126b8f39c81190b0f292127d5295cb98f2b415aa2a055dcb2fb035b081a686f48ee5f4d37ee80c9d91498855007204240cc9ea89efeabec871ec5443c381b1980c9a4f456d1233a38d68ce667c2ee7c2927019e1ce8bb84ce48848f832d10bb1f50dd6540d03d268d4677d39ed1d52514407d3b6d8830327dc49b0984574507b3a3b0573fb5806f762afa37379790e7783ab0849ee0f66fd91a350a9355a24d4bb754239ca02df597598d52dc5c2bb339503cde95213cff3a089240d7f48fd522f9c943eec1db088e53b0412631ea193dec188e4b3a7d9d6eb535a62e4aa8d6da005bfe4d9125de082dbcd6f69ca6ecc66c2166ca329eb198ee4bf5780a5ba3b861030c05cd732eea4acc3c42106671f0d52ac6738727064325b8ff5c752dd1d4329546a8d1603bc2c51f2bbf3356eae2c64b379374c964561b5f53c36d65e14fd3683c7f7179232d686bdf9777915ff00ec08ae8ecb66a3370000000049454e44ae426082",
recipeConfig: [
{
op: "From Hex",
@ -248,7 +249,7 @@ TestRegister.addTests([
args: ["None"]
}
]
},
}
/* { This operation only works in a browser
name: "Optical Character Recognition",
input: "iVBORw0KGgoAAAANSUhEUgAAAUAAAAC0CAIAAABqhmJGAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAASuSURBVHhe7dftVdswAIbRzsVAzMM0XabDUCOUxLYsWW4Jp+/pvf9w9GH76CHw4x2IJWAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAI9p8G/PbyY8rL2686g8t+vnqHTyfgIYfvz/26veTXn/UKX8+f0EU9bHrtu/6KfAN/AwEXAj7lFf2TBFw4nae8on+SgIvJ01n/KLzpDK+L3bT/Ap4O+HC+V12mTH+M3gzcLbIY/EO6HfxYp13k09nb6r3UqcdnjoCL3ll72J26h+35Oxy2XvZ0wOLaXq9v2+F1UC+7RZtMZ/DnfX1lwDOPzwUCLo7O2trtDK8H3M/iqoc6bj1subT68XTA/F7bGJooyzKbhTvLPHY8eJLHlbNX1DqYUVfdXbqwJjsCLsans37aNNJM6w68OR0wv9f9ymKw3k67yn2ZZpHlg3a3zis60s6oV+ZvlzMCLoanc3Dsdt9TdWT/lM8OmNjr5KY72jmzq1zfrbvXtVtmRMDF8HTWcgaaqIrD1U4G/MFewxrW262s5jS/Fzpmdts6mnHy+Fwl4GJ0OjsNrG1P/y7CNo3+gEt7jW56MVprNed7A/5w+n6YJ+BieDpnj/jO6pweTz0acGWvmZveL9XOmd3x6wKuTt8PEwRczLRw4eje1XX7c/cDruw1uuneOu2c4aOvzI57mJhRh1xZlQ0BF+Oz9vcF96fuB1zYa7R2b5mD6/XSwdfg8snj4q21+W/L02dfzIxhQMDFyTm6Hd7m+JYP7rPKT5sRuzhOBywm91rUkYc3fV9ltchtr8VmzuGOdfDB9N1tFYefNfdXLmyGjNZkhoCLUQufVqd/7z7rUcLW/XieDvg0s9difNOdRV5ePibt5vTuazusWbF9rs2E5v4mH58LBFyMW7g5OID7s9cMuTygmt9rcNPb5MrAz0lHc3Z9Ht7XZsxqxO36ZtLR/c0+PpMEzLOc/4LhrwmYZ6lfywJ+JgHzJPr9DgLmi23/zdXvcwmYL7YKWL1PJ2AIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmCI9f7+G6yFxVg/GyYwAAAAAElFTkSuQmCC",

View file

@ -16,7 +16,7 @@ TestRegister.addTests([
{
"op": "Index of Coincidence",
"args": []
},
],
},
}
]
}
]);

View file

@ -17,7 +17,7 @@ TestRegister.addTests([
"op": "JA3 Fingerprint",
"args": ["Hex", "Hash digest"]
}
],
]
},
{
name: "JA3 Fingerprint: TLS 1.1",
@ -28,7 +28,7 @@ TestRegister.addTests([
"op": "JA3 Fingerprint",
"args": ["Hex", "Hash digest"]
}
],
]
},
{
name: "JA3 Fingerprint: TLS 1.2",
@ -39,7 +39,7 @@ TestRegister.addTests([
"op": "JA3 Fingerprint",
"args": ["Hex", "Hash digest"]
}
],
]
},
{
name: "JA3 Fingerprint: TLS 1.3",
@ -50,6 +50,6 @@ TestRegister.addTests([
"op": "JA3 Fingerprint",
"args": ["Hex", "Hash digest"]
}
],
},
]
}
]);

View file

@ -17,7 +17,7 @@ TestRegister.addTests([
"op": "JA3S Fingerprint",
"args": ["Hex", "Hash digest"]
}
],
]
},
{
name: "JA3S Fingerprint: TLS 1.1",
@ -28,7 +28,7 @@ TestRegister.addTests([
"op": "JA3S Fingerprint",
"args": ["Hex", "Hash digest"]
}
],
]
},
{
name: "JA3S Fingerprint: TLS 1.2",
@ -39,8 +39,8 @@ TestRegister.addTests([
"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.
// The published version of TLS1.3 does require a legacy Session ID field (even if it is empty).
// {

View file

@ -16,9 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Beautify",
args: [" ", false, false],
},
],
args: [" ", false, false]
}
]
},
{
name: "JSON Beautify: space, number",
@ -27,24 +27,24 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Beautify",
args: [" ", false, false],
},
],
args: [" ", false, false]
}
]
},
{
name: "JSON Beautify: space, string",
input: "\"string\"",
expectedOutput: "\"string\"",
input: '"string"',
expectedOutput: '"string"',
recipeConfig: [
{
op: "JSON Beautify",
args: [" ", false, false],
args: [" ", false, false]
},
{
op: "HTML To Text",
args: []
}
],
]
},
{
name: "JSON Beautify: space, boolean",
@ -53,9 +53,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Beautify",
args: [" ", false, false],
},
],
args: [" ", false, false]
}
]
},
{
name: "JSON Beautify: space, emptyList",
@ -64,9 +64,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Beautify",
args: [" ", false, false],
},
],
args: [" ", false, false]
}
]
},
{
name: "JSON Beautify: space, list",
@ -75,9 +75,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Beautify",
args: [" ", false, false],
},
],
args: [" ", false, false]
}
]
},
{
name: "JSON Beautify: tab, list",
@ -86,53 +86,55 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Beautify",
args: ["\t", false, false],
},
],
args: ["\t", false, false]
}
]
},
{
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",
args: [" ", false, false],
args: [" ", false, false]
},
{
op: "HTML To Text",
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",
args: ["\t", false, false],
args: ["\t", false, false]
},
{
op: "HTML To Text",
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",
args: ["\t", true, false],
args: ["\t", true, false]
},
{
op: "HTML To Text",
args: []
}
],
},
]
}
]);

View file

@ -16,9 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Minify",
args: [],
},
],
args: []
}
]
},
{
name: "JSON Minify: number",
@ -27,9 +27,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Minify",
args: [],
},
],
args: []
}
]
},
{
name: "JSON Minify: number",
@ -38,20 +38,20 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Minify",
args: [],
},
],
args: []
}
]
},
{
name: "JSON Minify: string",
input: "\"string\"",
expectedOutput: "\"string\"",
input: '"string"',
expectedOutput: '"string"',
recipeConfig: [
{
op: "JSON Minify",
args: [],
},
],
args: []
}
]
},
{
name: "JSON Minify: boolean",
@ -60,9 +60,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Minify",
args: [],
},
],
args: []
}
]
},
{
name: "JSON Minify: emptyList",
@ -71,9 +71,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Minify",
args: [],
},
],
args: []
}
]
},
{
name: "JSON Minify: list",
@ -82,30 +82,30 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON Minify",
args: [],
},
],
args: []
}
]
},
{
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",
args: [],
},
],
args: []
}
]
},
{
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",
args: [],
},
],
},
args: []
}
]
}
]);

View file

@ -15,69 +15,72 @@ 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"]
},
],
}
]
},
{
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"]
},
],
}
]
},
{
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"]
},
],
}
]
},
{
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"]
},
],
}
]
},
{
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"]
},
],
}
]
},
{
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"]
},
],
}
]
},
{
name: "JSON to CSV: empty JSON",
@ -87,8 +90,8 @@ TestRegister.addTests([
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
},
],
}
]
},
{
name: "JSON to CSV: empty JSON in array",
@ -98,73 +101,73 @@ TestRegister.addTests([
{
op: "JSON to CSV",
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"]
},
],
}
]
},
{
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"]
},
],
}
]
},
{
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"]
},
],
}
]
},
{
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"]
},
],
}
]
},
{
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"]
},
],
}
]
},
{
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"]
},
],
}
]
}
]);

View file

@ -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([
{
@ -22,9 +26,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Decode",
args: [],
args: []
}
],
]
},
{
name: "JWT Decode: RS",
@ -33,9 +37,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Decode",
args: [],
args: []
}
],
]
},
{
name: "JWT Decode: ES",
@ -44,8 +48,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Decode",
args: [],
args: []
}
],
]
}
]);

View file

@ -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,35 +44,38 @@ 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"],
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"],
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"],
args: [hsKey, "HS512"]
}
],
]
},
{
name: "JWT Sign: ES256",
@ -77,13 +84,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Sign",
args: [esKey, "ES256"],
args: [esKey, "ES256"]
},
{
op: "JWT Decode",
args: []
}
],
]
},
{
name: "JWT Sign: ES384",
@ -92,13 +99,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Sign",
args: [esKey, "ES384"],
args: [esKey, "ES384"]
},
{
op: "JWT Decode",
args: []
}
],
]
},
{
name: "JWT Sign: ES512",
@ -107,13 +114,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Sign",
args: [esKey, "ES512"],
args: [esKey, "ES512"]
},
{
op: "JWT Decode",
args: []
}
],
]
},
{
name: "JWT Sign: RS256",
@ -122,13 +129,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Sign",
args: [rsKey, "RS256"],
args: [rsKey, "RS256"]
},
{
op: "JWT Decode",
args: []
}
],
]
},
{
name: "JWT Sign: RS384",
@ -137,13 +144,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Sign",
args: [rsKey, "RS384"],
args: [rsKey, "RS384"]
},
{
op: "JWT Decode",
args: []
}
],
]
},
{
name: "JWT Sign: RS512",
@ -152,12 +159,12 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Sign",
args: [esKey, "RS512"],
args: [esKey, "RS512"]
},
{
op: "JWT Decode",
args: []
}
],
]
}
]);

View file

@ -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
@ -58,9 +62,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Verify",
args: [hsKey],
args: [hsKey]
}
],
]
},
{
name: "JWT Verify: RS",
@ -69,9 +73,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Verify",
args: [rsPub],
args: [rsPub]
}
],
]
},
{
name: "JWT Verify: ES",
@ -80,8 +84,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JWT Verify",
args: [esPub],
args: [esPub]
}
],
]
}
]);

View file

@ -11,44 +11,36 @@ 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",
args: ["", 10],
args: ["", 10]
},
{
op: "To Base64",
args: ["A-Za-z0-9+/="],
},
],
args: ["A-Za-z0-9+/="]
}
]
},
{
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",
args: ["skipReplace", 10],
args: ["skipReplace", 10]
},
{
op: "To Base64",
args: ["A-Za-z0-9+/="],
args: ["A-Za-z0-9+/="]
},
{
op: "Label",
args: ["skipReplace"]
},
],
}
]
}
]);

View file

@ -16,9 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "LS47 Encrypt",
args: ["helloworld", 0, "test"],
},
],
args: ["helloworld", 0, "test"]
}
]
},
{
name: "LS47 Decrypt",
@ -27,9 +27,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "LS47 Decrypt",
args: ["helloworld", 0],
},
],
args: ["helloworld", 0]
}
]
},
{
name: "LS47 Encrypt",
@ -38,8 +38,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "LS47 Encrypt",
args: ["Helloworld", 0, "test"],
},
],
args: ["Helloworld", 0, "test"]
}
]
}
]);

View file

@ -17,6 +17,6 @@ TestRegister.addTests([
op: "LZNT1 Decompress",
args: []
}
],
]
}
]);

View file

@ -17,7 +17,7 @@ TestRegister.addTests([
"op": "LZString Compress",
"args": ["Base64"]
}
],
]
},
{
name: "LZString Decompress From Base64",
@ -28,6 +28,6 @@ TestRegister.addTests([
"op": "LZString Decompress",
"args": ["Base64"]
}
],
]
}
]);

View file

@ -13,11 +13,9 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, 1,
],
},
],
"args": ["\\n", 1, 1, 1]
}
]
},
{
"name": "Levenshtein Distance: Wikipedia example 2",
@ -26,11 +24,9 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, 1,
],
},
],
"args": ["\\n", 1, 1, 1]
}
]
},
{
"name": "Levenshtein Distance: Wikipedia example 1 with substitution cost 2",
@ -39,11 +35,9 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, 2,
],
},
],
"args": ["\\n", 1, 1, 2]
}
]
},
{
"name": "Levenshtein Distance: varied costs 1",
@ -52,11 +46,9 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 10, 100, 1000,
],
},
],
"args": ["\\n", 10, 100, 1000]
}
]
},
{
"name": "Levenshtein Distance: varied costs 2",
@ -65,11 +57,9 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1000, 100, 10,
],
},
],
"args": ["\\n", 1000, 100, 10]
}
]
},
{
"name": "Levenshtein Distance: another delimiter",
@ -78,11 +68,9 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
" ", 1, 1, 1,
],
},
],
"args": [" ", 1, 1, 1]
}
]
},
{
"name": "Levenshtein Distance: too few samples",
@ -91,11 +79,9 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, 1,
],
},
],
"args": ["\\n", 1, 1, 1]
}
]
},
{
"name": "Levenshtein Distance: too many samples",
@ -104,11 +90,9 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, 1,
],
},
],
"args": ["\\n", 1, 1, 1]
}
]
},
{
"name": "Levenshtein Distance: negative insertion cost",
@ -117,11 +101,9 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
"\\n", -1, 1, 1,
],
},
],
"args": ["\\n", -1, 1, 1]
}
]
},
{
"name": "Levenshtein Distance: negative deletion cost",
@ -130,11 +112,9 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, -1, 1,
],
},
],
"args": ["\\n", 1, -1, 1]
}
]
},
{
"name": "Levenshtein Distance: negative substitution cost",
@ -143,11 +123,9 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, -1,
],
},
],
"args": ["\\n", 1, 1, -1]
}
]
},
{
"name": "Levenshtein Distance: cost zero",
@ -156,10 +134,8 @@ TestRegister.addTests([
"recipeConfig": [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 0, 0, 0,
],
},
],
},
"args": ["\\n", 0, 0, 0]
}
]
}
]);

File diff suppressed because one or more lines are too long

View file

@ -16,8 +16,8 @@ TestRegister.addTests([
{
op: "Luhn Checksum",
args: []
},
],
}
]
},
{
name: "Luhn Checksum on standard data 2",
@ -27,8 +27,8 @@ TestRegister.addTests([
{
op: "Luhn Checksum",
args: []
},
],
}
]
},
{
name: "Luhn Checksum on standard data 3",
@ -38,8 +38,8 @@ TestRegister.addTests([
{
op: "Luhn Checksum",
args: []
},
],
}
]
},
{
name: "Luhn Checksum on invalid data",
@ -49,8 +49,8 @@ TestRegister.addTests([
{
op: "Luhn Checksum",
args: []
},
],
}
]
},
{
name: "Luhn Checksum on empty data",
@ -60,7 +60,7 @@ TestRegister.addTests([
{
op: "Luhn Checksum",
args: []
},
],
}
]
}
]);

View file

@ -11,12 +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": []
},
],
},
}
]
}
]);

View file

@ -13,13 +13,14 @@ 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]
}
],
]
},
{
name: "Magic: hex, correct rank",
@ -30,7 +31,7 @@ TestRegister.addTests([
op: "Magic",
args: [3, false, false]
}
],
]
},
{
name: "Magic: jpeg render",
@ -41,7 +42,7 @@ TestRegister.addTests([
op: "Magic",
args: [3, false, false]
}
],
]
},
{
name: "Magic: mojibake",
@ -52,7 +53,7 @@ TestRegister.addTests([
op: "Magic",
args: [1, true, false]
}
],
]
},
{
name: "Magic: extensive language support, Yiddish",
@ -63,18 +64,19 @@ TestRegister.addTests([
op: "Magic",
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]
}
],
]
},
{
name: "Magic Chain: Hex -> Hexdump -> Base64",
@ -85,7 +87,7 @@ TestRegister.addTests([
op: "Magic",
args: [3, false, false]
}
],
]
},
{
name: "Magic Chain: Charcode -> Octal -> Base32",
@ -96,7 +98,7 @@ TestRegister.addTests([
op: "Magic",
args: [3, false, false]
}
],
]
},
{
name: "Magic Chain: Base64 output",
@ -107,7 +109,7 @@ TestRegister.addTests([
op: "Magic",
args: [3, false, false]
}
],
]
},
{
name: "Magic Chain: Decimal -> Base32 -> Base32",
@ -118,12 +120,13 @@ TestRegister.addTests([
op: "Magic",
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",

File diff suppressed because one or more lines are too long

View file

@ -16,9 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Morse Code",
args: ["-/.", "Space", "Line feed"],
},
],
args: ["-/.", "Space", "Line feed"]
}
]
},
{
name: "From Morse Code '... --- ...'",
@ -27,8 +27,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Morse Code",
args: ["Space", "Line feed"],
},
],
},
args: ["Space", "Line feed"]
}
]
}
]);

View file

@ -20,11 +20,13 @@ TestRegister.addTests([
"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
{

Some files were not shown because too many files have changed in this diff Show more