diff --git a/package-lock.json b/package-lock.json index 28647150..1918738a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { + "@alexaltea/capstone-js": "^3.0.5", "@astronautlabs/amf": "^0.0.6", "@blu3r4y/lzma": "^2.3.3", "@wavesenterprise/crypto-gost-js": "^2.1.0-RC1", @@ -37,7 +38,7 @@ "d3": "7.9.0", "d3-hexbin": "^0.2.2", "diff": "^5.2.2", - "dompurify": "^3.3.1", + "dompurify": "^3.3.3", "es6-promisify": "^7.0.0", "escodegen": "^2.1.0", "esprima": "^4.0.1", @@ -59,7 +60,7 @@ "json5": "^2.2.3", "jsonata": "^2.1.0", "jsonpath-plus": "^10.4.0", - "jsonwebtoken": "9.0.0", + "jsonwebtoken": "9.0.3", "jsqr": "^1.4.0", "jsrsasign": "^11.1.1", "kbpgp": "^2.1.17", @@ -92,7 +93,7 @@ "snackbarjs": "^1.1.0", "sortablejs": "^1.15.7", "split.js": "^1.6.5", - "sql-formatter": "^15.6.5", + "sql-formatter": "^15.6.12", "ssdeep.js": "0.0.3", "stream-browserify": "^3.0.0", "tesseract.js": "^6.0.1", @@ -113,11 +114,11 @@ "@babel/preset-env": "^7.29.0", "@babel/runtime": "^7.28.6", "@codemirror/commands": "^6.10.2", - "@codemirror/language": "^6.12.1", + "@codemirror/language": "^6.12.2", "@codemirror/search": "^6.6.0", "@codemirror/state": "^6.5.4", - "@codemirror/view": "^6.39.15", - "autoprefixer": "^10.4.24", + "@codemirror/view": "^6.39.17", + "autoprefixer": "^10.4.27", "babel-loader": "^10.0.0", "base64-loader": "^1.0.0", "chromedriver": "^130.0.4", @@ -128,7 +129,7 @@ "core-js": "^3.48.0", "cspell": "^8.19.4", "css-loader": "7.1.4", - "eslint": "^9.39.3", + "eslint": "^9.39.4", "eslint-plugin-jsdoc": "^50.8.0", "globals": "^15.15.0", "grunt": "^1.6.1", @@ -144,17 +145,17 @@ "grunt-zip": "^1.0.0", "html-webpack-plugin": "^5.6.6", "imports-loader": "^5.0.0", - "mini-css-extract-plugin": "2.10.0", + "mini-css-extract-plugin": "2.10.1", "modify-source-webpack-plugin": "^4.1.0", "nightwatch": "^3.15.0", - "postcss": "^8.5.6", + "postcss": "^8.5.8", "postcss-css-variables": "^0.19.0", "postcss-import": "^16.1.1", "postcss-loader": "^8.2.1", "prompt": "^1.3.0", - "sitemap": "^8.0.2", + "sitemap": "^8.0.3", "terser": "^5.46.0", - "webpack": "^5.105.2", + "webpack": "^5.105.4", "webpack-bundle-analyzer": "^4.10.2", "webpack-dev-server": "5.0.4", "webpack-node-externals": "^3.0.0" @@ -163,6 +164,26 @@ "node": ">=24 <25" } }, + "node_modules/@alexaltea/capstone-js": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@alexaltea/capstone-js/-/capstone-js-3.0.5.tgz", + "integrity": "sha512-HWa4d5vblYc3OEJ9MpcXFo0gV/oDLTI5iH7ng80Gs3/Wo3lcYvB14gDDwSr9So1F+fuwIET8meo6TxTezEyqTg==" + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@asamuzakjp/css-color": { "version": "2.8.3", "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-2.8.3.tgz", @@ -238,23 +259,23 @@ } }, "node_modules/@babel/core": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", - "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.0.tgz", + "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-compilation-targets": "^7.28.6", - "@babel/helper-module-transforms": "^7.28.6", - "@babel/helpers": "^7.28.6", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/traverse": "^7.29.0", - "@babel/types": "^7.29.0", - "@jridgewell/remapping": "^2.3.5", + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.0", + "@babel/generator": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.0", + "@babel/parser": "^7.26.0", + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.26.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -376,9 +397,9 @@ } }, "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.6.tgz", - "integrity": "sha512-mOAsxeeKkUKayvZR3HeTYD/fICpCPLJrU5ZjelT/PA6WHtNDBOE436YiaEUvHN454bRM3CebhDsIpieCc4texA==", + "version": "0.6.7", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.7.tgz", + "integrity": "sha512-6Fqi8MtQ/PweQ9xvux65emkLQ83uB+qAVtfHkC9UodyHMIZdxNI01HjLCLUtybElp2KY2XNE0nOgyP1E1vXw9w==", "dev": true, "license": "MIT", "dependencies": { @@ -1706,13 +1727,13 @@ } }, "node_modules/@babel/preset-env/node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.14.0.tgz", - "integrity": "sha512-AvDcMxJ34W4Wgy4KBIIePQTAOP1Ie2WFwkQp3dB7FQ/f0lI5+nM96zUnYEOE1P9sEg0es5VCP0HxiWu5fUHZAQ==", + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.14.1.tgz", + "integrity": "sha512-ENp89vM9Pw4kv/koBb5N2f9bDZsR0hpf3BdPMOg/pkS3pwO4dzNnQZVXtBbeyAadgm865DmQG2jMMLqmZXvuCw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.6", + "@babel/helper-define-polyfill-provider": "^0.6.7", "core-js-compat": "^3.48.0" }, "peerDependencies": { @@ -1834,9 +1855,9 @@ } }, "node_modules/@codemirror/language": { - "version": "6.12.1", - "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.12.1.tgz", - "integrity": "sha512-Fa6xkSiuGKc8XC8Cn96T+TQHYj4ZZ7RdFmXA3i9xe/3hLHfwPZdM+dqfX0Cp0zQklBKhVD8Yzc8LS45rkqcwpQ==", + "version": "6.12.2", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.12.2.tgz", + "integrity": "sha512-jEPmz2nGGDxhRTg3lTpzmIyGKxz3Gp3SJES4b0nAuE5SWQoKdT5GoQ69cwMmFd+wvFUhYirtDTr0/DRHpQAyWg==", "dev": true, "license": "MIT", "dependencies": { @@ -1871,9 +1892,9 @@ } }, "node_modules/@codemirror/view": { - "version": "6.39.15", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.39.15.tgz", - "integrity": "sha512-aCWjgweIIXLBHh7bY6cACvXuyrZ0xGafjQ2VInjp4RM4gMfscK5uESiNdrH0pE+e1lZr2B4ONGsjchl2KsKZzg==", + "version": "6.39.17", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.39.17.tgz", + "integrity": "sha512-Aim4lFqhbijnchl83RLfABWueSGs1oUCSv0mru91QdhpXQeNKprIdRO9LWA4cYkJvuYTKGJN7++9MXx8XW43ag==", "dev": true, "license": "MIT", "dependencies": { @@ -2079,9 +2100,9 @@ "license": "MIT" }, "node_modules/@cspell/dict-css": { - "version": "4.0.19", - "resolved": "https://registry.npmjs.org/@cspell/dict-css/-/dict-css-4.0.19.tgz", - "integrity": "sha512-VYHtPnZt/Zd/ATbW3rtexWpBnHUohUrQOHff/2JBhsVgxOrksAxJnLAO43Q1ayLJBJUUwNVo+RU0sx0aaysZfg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@cspell/dict-css/-/dict-css-4.1.0.tgz", + "integrity": "sha512-bfuvlTeGoK5QgXzzjn+PvqXU5J6mwraIdESNDSvPyplr/EbGFSuvgW3TOuoVNqW4WdDI7eM4tmoP5Dn1ZVgLag==", "dev": true, "license": "MIT" }, @@ -2128,9 +2149,9 @@ "license": "MIT" }, "node_modules/@cspell/dict-en_us": { - "version": "4.4.29", - "resolved": "https://registry.npmjs.org/@cspell/dict-en_us/-/dict-en_us-4.4.29.tgz", - "integrity": "sha512-G3B27++9ziRdgbrY/G/QZdFAnMzzx17u8nCb2Xyd4q6luLpzViRM/CW3jA+Mb/cGT5zR/9N+Yz9SrGu1s0bq7g==", + "version": "4.4.30", + "resolved": "https://registry.npmjs.org/@cspell/dict-en_us/-/dict-en_us-4.4.30.tgz", + "integrity": "sha512-+eVO/VNw8IzQpDIL/SCj+ytd5WbzbHZdU+GAM8eUY2ZU1KTxRw6BoDO+hEFB4cGkD9x+BXm0OKVGSWHNCSGdVw==", "dev": true, "license": "MIT" }, @@ -2149,9 +2170,9 @@ "license": "MIT" }, "node_modules/@cspell/dict-filetypes": { - "version": "3.0.15", - "resolved": "https://registry.npmjs.org/@cspell/dict-filetypes/-/dict-filetypes-3.0.15.tgz", - "integrity": "sha512-uDMeqYlLlK476w/muEFQGBy9BdQWS0mQ7BJiy/iQv5XUWZxE2O54ZQd9nW8GyQMzAgoyg5SG4hf9l039Qt66oA==", + "version": "3.0.16", + "resolved": "https://registry.npmjs.org/@cspell/dict-filetypes/-/dict-filetypes-3.0.16.tgz", + "integrity": "sha512-SyrtuK2/sx+cr94jOp2/uOAb43ngZEVISUTRj4SR6SfoGULVV1iJS7Drqn7Ul9HJ731QDttwWlOUgcQ+yMRblg==", "dev": true, "license": "MIT" }, @@ -2289,13 +2310,13 @@ "license": "MIT" }, "node_modules/@cspell/dict-markdown": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/@cspell/dict-markdown/-/dict-markdown-2.0.14.tgz", - "integrity": "sha512-uLKPNJsUcumMQTsZZgAK9RgDLyQhUz/uvbQTEkvF/Q4XfC1i/BnA8XrOrd0+Vp6+tPOKyA+omI5LRWfMu5K/Lw==", + "version": "2.0.15", + "resolved": "https://registry.npmjs.org/@cspell/dict-markdown/-/dict-markdown-2.0.15.tgz", + "integrity": "sha512-xz3LJfFCIJaxHu5Msu9UUSev1R1urVkERb5h1Yc5lJyNOkk/SQTSlNyME0Oma1sXlp6dLnIekL8GyeXJYszQ2w==", "dev": true, "license": "MIT", "peerDependencies": { - "@cspell/dict-css": "^4.0.19", + "@cspell/dict-css": "^4.1.0", "@cspell/dict-html": "^4.0.14", "@cspell/dict-html-symbol-entities": "^4.0.5", "@cspell/dict-typescript": "^3.2.3" @@ -2316,9 +2337,9 @@ "license": "MIT" }, "node_modules/@cspell/dict-npm": { - "version": "5.2.34", - "resolved": "https://registry.npmjs.org/@cspell/dict-npm/-/dict-npm-5.2.34.tgz", - "integrity": "sha512-M2MtfmYeHIPBuC8esMU4JQXHKma7Xt7VyBWUk67B62KDu61sxebQ2HeizdqmN2sLEJsTkq3bZT5PGzHpZ0LEWQ==", + "version": "5.2.36", + "resolved": "https://registry.npmjs.org/@cspell/dict-npm/-/dict-npm-5.2.36.tgz", + "integrity": "sha512-QeoanpVt8QrSxDQVseXn+qk4sy79TAkbgB0G7q3klsZAByr61gXd1yDQ/0wp8xXsyPx+M/BIj5Qd6B8GnozFLA==", "dev": true, "license": "MIT" }, @@ -2337,9 +2358,9 @@ "license": "MIT" }, "node_modules/@cspell/dict-public-licenses": { - "version": "2.0.15", - "resolved": "https://registry.npmjs.org/@cspell/dict-public-licenses/-/dict-public-licenses-2.0.15.tgz", - "integrity": "sha512-cJEOs901H13Pfy0fl4dCD1U+xpWIMaEPq8MeYU83FfDZvellAuSo4GqWCripfIqlhns/L6+UZEIJSOZnjgy7Wg==", + "version": "2.0.16", + "resolved": "https://registry.npmjs.org/@cspell/dict-public-licenses/-/dict-public-licenses-2.0.16.tgz", + "integrity": "sha512-EQRrPvEOmwhwWezV+W7LjXbIBjiy6y/shrET6Qcpnk3XANTzfvWflf9PnJ5kId/oKWvihFy0za0AV1JHd03pSQ==", "dev": true, "license": "MIT" }, @@ -2389,9 +2410,9 @@ "license": "MIT" }, "node_modules/@cspell/dict-software-terms": { - "version": "5.1.21", - "resolved": "https://registry.npmjs.org/@cspell/dict-software-terms/-/dict-software-terms-5.1.21.tgz", - "integrity": "sha512-3lAB4OXsf6rs5zbwe4/nKmwyAJAvjs5KTRrPckzHx7q9dYpviW+UxDyhevCCsRfmcu24OhYP7BVQWXxLvYk4xA==", + "version": "5.1.24", + "resolved": "https://registry.npmjs.org/@cspell/dict-software-terms/-/dict-software-terms-5.1.24.tgz", + "integrity": "sha512-Y+5b5mw8lnovcoyuiVJJX5PpNPMbdpNyILR4wJDsUMWPK2ZVcl0yyG2UYJmevY7jq/+LY48Ai9RSp0ARAlDzEQ==", "dev": true, "license": "MIT" }, @@ -2656,9 +2677,9 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.12.2", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", - "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", "dev": true, "license": "MIT", "engines": { @@ -2666,20 +2687,33 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", - "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", + "version": "0.21.2", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.2.tgz", + "integrity": "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==", "dev": true, "license": "Apache-2.0", "dependencies": { "@eslint/object-schema": "^2.1.7", "debug": "^4.3.1", - "minimatch": "^3.1.2" + "minimatch": "^3.1.5" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@eslint/config-helpers": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", @@ -2707,9 +2741,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.4.tgz", - "integrity": "sha512-4h4MVF8pmBsncB60r0wSJiIeUKTSD4m7FmTFThG8RHlsg9ajqckLm9OraguFGZE4vVdpiI1Q4+hFnisopmG6gQ==", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.5.tgz", + "integrity": "sha512-4IlJx0X0qftVsN5E+/vGujTRIFtwuLbNsVUe7TO6zYPDR1O6nFwvwhIKEKSrl6dZchmYBITazxKoUYOjdtjlRg==", "dev": true, "license": "MIT", "dependencies": { @@ -2720,7 +2754,7 @@ "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.1", - "minimatch": "^3.1.3", + "minimatch": "^3.1.5", "strip-json-comments": "^3.1.1" }, "engines": { @@ -2744,9 +2778,9 @@ } }, "node_modules/@eslint/eslintrc/node_modules/minimatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.3.tgz", - "integrity": "sha512-M2GCs7Vk83NxkUyQV1bkABc4yxgz9kILhHImZiBPAZ9ybuvCb0/H7lEl5XvIg3g+9d4eNotkZA5IWwYl0tibaA==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", "dev": true, "license": "ISC", "dependencies": { @@ -2757,9 +2791,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.39.3", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.3.tgz", - "integrity": "sha512-1B1VkCq6FuUNlQvlBYb+1jDu/gV297TIs/OeiaSR9l1H27SVW55ONE1e1Vp16NqP683+xEGzxYtv4XCiDPaQiw==", + "version": "9.39.4", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.4.tgz", + "integrity": "sha512-nE7DEIchvtiFTwBw4Lfbu59PG+kCofhjsKaCWzxTpt4lfRjRMqG6uMBzKXuEcyXhOHoUp9riAm7/aWYGhXZ9cw==", "dev": true, "license": "MIT", "engines": { @@ -3397,18 +3431,6 @@ "@jridgewell/trace-mapping": "^0.3.24" } }, - "node_modules/@jridgewell/remapping": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", - "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", @@ -5432,9 +5454,9 @@ "license": "MIT" }, "node_modules/autoprefixer": { - "version": "10.4.24", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.24.tgz", - "integrity": "sha512-uHZg7N9ULTVbutaIsDRoUkoS8/h3bdsmVJYZ5l3wv8Cp/6UIIoRDm90hZ+BwxUj/hGBEzLxdHNSKuFpn8WOyZw==", + "version": "10.4.27", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.27.tgz", + "integrity": "sha512-NP9APE+tO+LuJGn7/9+cohklunJsXWiaWEfV3si4Gi/XHDwVNgkwr1J3RQYFIvPy76GmJ9/bW8vyoU1LcxwKHA==", "dev": true, "funding": [ { @@ -5453,7 +5475,7 @@ "license": "MIT", "dependencies": { "browserslist": "^4.28.1", - "caniuse-lite": "^1.0.30001766", + "caniuse-lite": "^1.0.30001774", "fraction.js": "^5.3.4", "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" @@ -5512,9 +5534,9 @@ } }, "node_modules/axios": { - "version": "1.13.5", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.5.tgz", - "integrity": "sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==", + "version": "1.13.6", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.6.tgz", + "integrity": "sha512-ChTCHMouEe2kn713WHbQGcuYrr6fXTBiu460OTwWrWob16g1bXn4vtz07Ope7ewMozJAnEquLk5lWQWtBig9DQ==", "dev": true, "license": "MIT", "dependencies": { @@ -5524,9 +5546,9 @@ } }, "node_modules/babel-loader": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-10.0.0.tgz", - "integrity": "sha512-z8jt+EdS61AMw22nSfoNJAZ0vrtmhPRVi6ghL3rCeRZI8cdNYFiV5xeV3HbE7rlZZNmGH8BVccwWt8/ED0QOHA==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-10.1.0.tgz", + "integrity": "sha512-5HTUZa013O4SWEYlJDHexrqSIYkWatfA9w/ZZQa7V2nMc0dRWkfu/0pmioC7XMYm8M7Z/3+q42NWj6e+fAT0MQ==", "dev": true, "license": "MIT", "dependencies": { @@ -5536,19 +5558,28 @@ "node": "^18.20.0 || ^20.10.0 || >=22.0.0" }, "peerDependencies": { - "@babel/core": "^7.12.0", + "@babel/core": "^7.12.0 || ^8.0.0-beta.1", + "@rspack/core": "^1.0.0 || ^2.0.0-0", "webpack": ">=5.61.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "webpack": { + "optional": true + } } }, "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.4.15", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.15.tgz", - "integrity": "sha512-hR3GwrRwHUfYwGfrisXPIDP3JcYfBrW7wKE7+Au6wDYl7fm/ka1NEII6kORzxNU556JjfidZeBsO10kYvtV1aw==", + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.16.tgz", + "integrity": "sha512-xaVwwSfebXf0ooE11BJovZYKhFjIvQo7TsyVpETuIeH2JHv0k/T6Y5j22pPTvqYqmpkxdlPAJlyJ0tfOJAoMxw==", "dev": true, "license": "MIT", "dependencies": { "@babel/compat-data": "^7.28.6", - "@babel/helper-define-polyfill-provider": "^0.6.6", + "@babel/helper-define-polyfill-provider": "^0.6.7", "semver": "^6.3.1" }, "peerDependencies": { @@ -5570,13 +5601,13 @@ } }, "node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.6.tgz", - "integrity": "sha512-hYm+XLYRMvupxiQzrvXUj7YyvFFVfv5gI0R71AJzudg1g2AI2vyCPPIFEBjk162/wFzti3inBHo7isWFuEVS/A==", + "version": "0.6.7", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.7.tgz", + "integrity": "sha512-OTYbUlSwXhNgr4g6efMZgsO8//jA61P7ZbRX3iTT53VON8l+WQS8IAUEVo4a4cWknrg2W8Cj4gQhRYNCJ8GkAA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.6" + "@babel/helper-define-polyfill-provider": "^0.6.7" }, "peerDependencies": { "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" @@ -6421,9 +6452,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001769", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001769.tgz", - "integrity": "sha512-BCfFL1sHijQlBGWBMuJyhZUhzo7wer5sVj9hqekB/7xn0Ypy+pER/edCYQm4exbXj4WiySGp40P8UuTh6w1srg==", + "version": "1.0.30001777", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001777.tgz", + "integrity": "sha512-tmN+fJxroPndC74efCdp12j+0rk0RHwV5Jwa1zWaFVyw2ZxAuPeG8ZgWC3Wz7uSjT3qMRQ5XHZ4COgQmsCMJAQ==", "dev": true, "funding": [ { @@ -6857,14 +6888,13 @@ } }, "node_modules/comment-json": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/comment-json/-/comment-json-4.5.1.tgz", - "integrity": "sha512-taEtr3ozUmOB7it68Jll7s0Pwm+aoiHyXKrEC8SEodL4rNpdfDLqa7PfBlrgFoCNNdR8ImL+muti5IGvktJAAg==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/comment-json/-/comment-json-4.6.2.tgz", + "integrity": "sha512-R2rze/hDX30uul4NZoIZ76ImSJLFxn/1/ZxtKC1L77y2X1k+yYu1joKbAtMA2Fg3hZrTOiw0I5mwVMo0cf250w==", "dev": true, "license": "MIT", "dependencies": { "array-timsort": "^1.0.3", - "core-util-is": "^1.0.3", "esprima": "^4.0.1" }, "engines": { @@ -8530,7 +8560,8 @@ "node_modules/discontinuous-range": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz", - "integrity": "sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==" + "integrity": "sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==", + "license": "MIT" }, "node_modules/dns-packet": { "version": "5.6.1", @@ -8610,9 +8641,9 @@ } }, "node_modules/dompurify": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.3.1.tgz", - "integrity": "sha512-qkdCKzLNtrgPFP1Vo+98FRzJnBRGe4ffyCea9IwHB1fyxPOeNTHpLKYGd4Uk9xvNoH0ZoOjwZxNptyMwqrId1Q==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.3.3.tgz", + "integrity": "sha512-Oj6pzI2+RqBfFG+qOaOLbFXLQ90ARpcGG6UePL82bJLtdsa6CYJD7nmiU8MW9nQNOtCHV3lZ/Bzq1X0QYbBZCA==", "license": "(MPL-2.0 OR Apache-2.0)", "optionalDependencies": { "@types/trusted-types": "^2.0.7" @@ -8731,9 +8762,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.302", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.302.tgz", - "integrity": "sha512-sM6HAN2LyK82IyPBpznDRqlTQAtuSaO+ShzFiWTvoMJLHyZ+Y39r8VMfHzwbU8MVBzQ4Wdn85+wlZl2TLGIlwg==", + "version": "1.5.307", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.307.tgz", + "integrity": "sha512-5z3uFKBWjiNR44nFcYdkcXjKMbg5KXNdciu7mhTPo9tB7NbqSNP2sSnGR+fqknZSCwKkBN+oxiiajWs4dT6ORg==", "dev": true, "license": "ISC" }, @@ -8796,9 +8827,9 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.19.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.19.0.tgz", - "integrity": "sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==", + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.20.0.tgz", + "integrity": "sha512-/ce7+jQ1PQ6rVXwe+jKEg5hW5ciicHwIQUagZkp6IufBoY3YDgdTTY1azVs0qoRgVmvsNB+rbjLJxDAeHHtwsQ==", "dev": true, "license": "MIT", "dependencies": { @@ -8909,6 +8940,13 @@ "dev": true, "license": "MIT" }, + "node_modules/es-module-lexer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz", + "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==", + "dev": true, + "license": "MIT" + }, "node_modules/es-object-atoms": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", @@ -9018,25 +9056,25 @@ } }, "node_modules/eslint": { - "version": "9.39.3", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.3.tgz", - "integrity": "sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg==", + "version": "9.39.4", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.4.tgz", + "integrity": "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.21.1", + "@eslint/config-array": "^0.21.2", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", - "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.39.3", + "@eslint/eslintrc": "^3.3.5", + "@eslint/js": "9.39.4", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", - "ajv": "^6.12.4", + "ajv": "^6.14.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", @@ -9055,7 +9093,7 @@ "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", + "minimatch": "^3.1.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, @@ -9238,6 +9276,19 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/eslint/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -9296,9 +9347,9 @@ } }, "node_modules/esquery": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", - "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -11173,9 +11224,9 @@ } }, "node_modules/html-entities": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.6.0.tgz", - "integrity": "sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz", + "integrity": "sha512-K//PSRMQk4FZ78Kyau+mZurHn3FH0Vwr+H36eE0rPbeYkRRi9YxceYPhuN60UwWorxyKHhqoAJl2OFKa4BVtaA==", "dev": true, "funding": [ { @@ -12340,15 +12391,16 @@ } }, "node_modules/jake": { - "version": "10.9.4", - "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.4.tgz", - "integrity": "sha512-wpHYzhxiVQL+IV05BLE2Xn34zW1S223hvjtqk0+gsPrwd/8JNLXJgZZM/iPFsYc1xyphF+6M6EvdE5E9MBGkDA==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz", + "integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "async": "^3.2.6", + "async": "^3.2.3", + "chalk": "^4.0.2", "filelist": "^1.0.4", - "picocolors": "^1.1.1" + "minimatch": "^3.1.2" }, "bin": { "jake": "bin/cli.js" @@ -12357,6 +12409,52 @@ "node": ">=10" } }, + "node_modules/jake/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jake/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jake/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/jest-worker": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", @@ -12627,15 +12725,21 @@ } }, "node_modules/jsonwebtoken": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", - "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", + "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==", "license": "MIT", "dependencies": { - "jws": "^3.2.2", - "lodash": "^4.17.21", + "jws": "^4.0.1", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", "ms": "^2.1.1", - "semver": "^7.3.8" + "semver": "^7.5.4" }, "engines": { "node": ">=12", @@ -12683,9 +12787,9 @@ } }, "node_modules/jwa": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.2.tgz", - "integrity": "sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", "license": "MIT", "dependencies": { "buffer-equal-constant-time": "^1.0.1", @@ -12694,12 +12798,12 @@ } }, "node_modules/jws": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.3.tgz", - "integrity": "sha512-byiJ0FLRdLdSVSReO/U4E7RoEyOCKnEnEPMjq3HxWtvzLsV08/i5RQKsFVNkCldrCaPr2vDNAOMsfs8T/Hze7g==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", "license": "MIT", "dependencies": { - "jwa": "^1.4.2", + "jwa": "^2.0.1", "safe-buffer": "^5.0.1" } }, @@ -12962,6 +13066,18 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "license": "MIT" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "license": "MIT" + }, "node_modules/lodash.isfinite": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz", @@ -12969,11 +13085,28 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "license": "MIT" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "license": "MIT" + }, "node_modules/lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", - "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", "license": "MIT" }, "node_modules/lodash.merge": { @@ -12983,6 +13116,12 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "license": "MIT" + }, "node_modules/lodash.union": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", @@ -13341,9 +13480,9 @@ } }, "node_modules/mini-css-extract-plugin": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.10.0.tgz", - "integrity": "sha512-540P2c5dYnJlyJxTaSloliZexv8rji6rY8FhQN+WF/82iHQfA23j/xtJx97L+mXOML27EqksSek/g4eK7jaL3g==", + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.10.1.tgz", + "integrity": "sha512-k7G3Y5QOegl380tXmZ68foBRRjE9Ljavx835ObdvmZjQ639izvZD8CS7BkWw1qKPPzHsGL/JDhl0uyU1zc2rJw==", "dev": true, "license": "MIT", "dependencies": { @@ -13550,9 +13689,10 @@ } }, "node_modules/moo": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz", - "integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==" + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.3.tgz", + "integrity": "sha512-m2fmM2dDm7GZQsY7KK2cme8agi+AAljILjQnof7p1ZMDe6dQ4bdnSMx0cPppudoeNv5hEFQirN6u+O4fDE0IWA==", + "license": "BSD-3-Clause" }, "node_modules/more-entropy": { "version": "0.0.7", @@ -13663,6 +13803,7 @@ "version": "2.20.1", "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz", "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==", + "license": "MIT", "dependencies": { "commander": "^2.19.0", "moo": "^0.5.0", @@ -13683,7 +13824,8 @@ "node_modules/nearley/node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" }, "node_modules/negotiator": { "version": "0.6.3", @@ -14018,9 +14160,9 @@ "license": "CC0-1.0" }, "node_modules/node-releases": { - "version": "2.0.27", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", - "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", + "version": "2.0.36", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.36.tgz", + "integrity": "sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==", "dev": true, "license": "MIT" }, @@ -15021,9 +15163,9 @@ } }, "node_modules/postcss": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", - "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "version": "8.5.8", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", + "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", "dev": true, "funding": [ { @@ -15502,12 +15644,14 @@ "node_modules/railroad-diagrams": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", - "integrity": "sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A==" + "integrity": "sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A==", + "license": "CC0-1.0" }, "node_modules/randexp": { "version": "0.4.6", "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", + "license": "MIT", "dependencies": { "discontinuous-range": "1.0.0", "ret": "~0.1.10" @@ -15944,6 +16088,7 @@ "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "license": "MIT", "engines": { "node": ">=0.12" } @@ -16616,9 +16761,9 @@ } }, "node_modules/sitemap": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/sitemap/-/sitemap-8.0.2.tgz", - "integrity": "sha512-LwktpJcyZDoa0IL6KT++lQ53pbSrx2c9ge41/SeLTyqy2XUNA6uR4+P9u5IVo5lPeL2arAcOKn1aZAxoYbCKlQ==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/sitemap/-/sitemap-8.0.3.tgz", + "integrity": "sha512-9Ew1tR2WYw8RGE2XLy7GjkusvYXy8Rg6y8TYuBuQMfIEdGcWoJpY2Wr5DzsEiL/TKCw56+YKTCCUHglorEYK+A==", "dev": true, "license": "MIT", "dependencies": { @@ -16855,9 +17000,10 @@ "license": "BSD-3-Clause" }, "node_modules/sql-formatter": { - "version": "15.6.5", - "resolved": "https://registry.npmjs.org/sql-formatter/-/sql-formatter-15.6.5.tgz", - "integrity": "sha512-fr4TyM1udCSrOHOmouotwUi8dxIDhSLpYNmPePGFVzxq8/i8jd828IapE49QXG7Gzkswxo5WwdAGnYX4YpKoTg==", + "version": "15.7.2", + "resolved": "https://registry.npmjs.org/sql-formatter/-/sql-formatter-15.7.2.tgz", + "integrity": "sha512-b0BGoM81KFRVSpZFwPpIPU5gng4YD8DI/taLD96NXCFRf5af3FzSE4aSwjKmxcyTmf/MfPu91j75883nRrWDBw==", + "license": "MIT", "dependencies": { "argparse": "^2.0.1", "nearley": "^2.20.1" @@ -17283,16 +17429,15 @@ } }, "node_modules/terser-webpack-plugin": { - "version": "5.3.16", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.16.tgz", - "integrity": "sha512-h9oBFCWrq78NyWWVcSwZarJkZ01c2AyGrzs1crmHZO3QUg9D61Wu4NPjBy69n7JqylFF5y+CsUZYmYEIZ3mR+Q==", + "version": "5.3.17", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.17.tgz", + "integrity": "sha512-YR7PtUp6GMU91BgSJmlaX/rS2lGDbAF7D+Wtq7hRO+MiljNmodYvqslzCFiYVAgW+Qoaaia/QUIP4lGXufjdZw==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "jest-worker": "^27.4.5", "schema-utils": "^4.3.0", - "serialize-javascript": "^6.0.2", "terser": "^5.31.1" }, "engines": { @@ -17343,9 +17488,9 @@ } }, "node_modules/tesseract.js-core": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/tesseract.js-core/-/tesseract.js-core-6.0.0.tgz", - "integrity": "sha512-1Qncm/9oKM7xgrQXZXNB+NRh19qiXGhxlrR8EwFbK5SaUbPZnS5OMtP/ghtqfd23hsr1ZvZbZjeuAGcMxd/ooA==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/tesseract.js-core/-/tesseract.js-core-6.1.2.tgz", + "integrity": "sha512-pv4GjmramjdObhDyR1q85Td8X60Puu/lGQn7Kw2id05LLgHhAcWgnz6xSdMCSxBMWjQDmMyDXPTC2aqADdpiow==", "license": "Apache-2.0" }, "node_modules/thingies": { @@ -18097,9 +18242,9 @@ } }, "node_modules/webpack": { - "version": "5.105.3", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.105.3.tgz", - "integrity": "sha512-LLBBA4oLmT7sZdHiYE/PeVuifOxYyE2uL/V+9VQP7YSYdJU7bSf7H8bZRRxW8kEPMkmVjnrXmoR3oejIdX0xbg==", + "version": "5.105.4", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.105.4.tgz", + "integrity": "sha512-jTywjboN9aHxFlToqb0K0Zs9SbBoW4zRUlGzI2tYNxVYcEi/IPpn+Xi4ye5jTLvX2YeLuic/IvxNot+Q1jMoOw==", "dev": true, "license": "MIT", "dependencies": { @@ -18113,7 +18258,7 @@ "acorn-import-phases": "^1.0.3", "browserslist": "^4.28.1", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.19.0", + "enhanced-resolve": "^5.20.0", "es-module-lexer": "^2.0.0", "eslint-scope": "5.1.1", "events": "^3.2.0", @@ -18125,7 +18270,7 @@ "neo-async": "^2.6.2", "schema-utils": "^4.3.3", "tapable": "^2.3.0", - "terser-webpack-plugin": "^5.3.16", + "terser-webpack-plugin": "^5.3.17", "watchpack": "^2.5.1", "webpack-sources": "^3.3.4" }, @@ -18469,13 +18614,6 @@ "node": ">=10.13.0" } }, - "node_modules/webpack/node_modules/es-module-lexer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz", - "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==", - "dev": true, - "license": "MIT" - }, "node_modules/websocket-driver": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", diff --git a/package.json b/package.json index c7ee8909..4fba587a 100644 --- a/package.json +++ b/package.json @@ -45,11 +45,11 @@ "@babel/preset-env": "^7.29.0", "@babel/runtime": "^7.28.6", "@codemirror/commands": "^6.10.2", - "@codemirror/language": "^6.12.1", + "@codemirror/language": "^6.12.2", "@codemirror/search": "^6.6.0", "@codemirror/state": "^6.5.4", - "@codemirror/view": "^6.39.15", - "autoprefixer": "^10.4.24", + "@codemirror/view": "^6.39.17", + "autoprefixer": "^10.4.27", "babel-loader": "^10.0.0", "base64-loader": "^1.0.0", "chromedriver": "^130.0.4", @@ -60,7 +60,7 @@ "core-js": "^3.48.0", "cspell": "^8.19.4", "css-loader": "7.1.4", - "eslint": "^9.39.3", + "eslint": "^9.39.4", "eslint-plugin-jsdoc": "^50.8.0", "globals": "^15.15.0", "grunt": "^1.6.1", @@ -76,22 +76,23 @@ "grunt-zip": "^1.0.0", "html-webpack-plugin": "^5.6.6", "imports-loader": "^5.0.0", - "mini-css-extract-plugin": "2.10.0", + "mini-css-extract-plugin": "2.10.1", "modify-source-webpack-plugin": "^4.1.0", "nightwatch": "^3.15.0", - "postcss": "^8.5.6", + "postcss": "^8.5.8", "postcss-css-variables": "^0.19.0", "postcss-import": "^16.1.1", "postcss-loader": "^8.2.1", "prompt": "^1.3.0", - "sitemap": "^8.0.2", + "sitemap": "^8.0.3", "terser": "^5.46.0", - "webpack": "^5.105.2", + "webpack": "^5.105.4", "webpack-bundle-analyzer": "^4.10.2", "webpack-dev-server": "5.0.4", "webpack-node-externals": "^3.0.0" }, "dependencies": { + "@alexaltea/capstone-js": "^3.0.5", "@astronautlabs/amf": "^0.0.6", "@blu3r4y/lzma": "^2.3.3", "@wavesenterprise/crypto-gost-js": "^2.1.0-RC1", @@ -119,7 +120,7 @@ "d3": "7.9.0", "d3-hexbin": "^0.2.2", "diff": "^5.2.2", - "dompurify": "^3.3.1", + "dompurify": "^3.3.3", "es6-promisify": "^7.0.0", "escodegen": "^2.1.0", "esprima": "^4.0.1", @@ -141,7 +142,7 @@ "json5": "^2.2.3", "jsonata": "^2.1.0", "jsonpath-plus": "^10.4.0", - "jsonwebtoken": "9.0.0", + "jsonwebtoken": "9.0.3", "jsqr": "^1.4.0", "jsrsasign": "^11.1.1", "kbpgp": "^2.1.17", @@ -174,7 +175,7 @@ "snackbarjs": "^1.1.0", "sortablejs": "^1.15.7", "split.js": "^1.6.5", - "sql-formatter": "^15.6.5", + "sql-formatter": "^15.6.12", "ssdeep.js": "0.0.3", "stream-browserify": "^3.0.0", "tesseract.js": "^6.0.1", diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index cee966b0..8b62046e 100644 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -41,6 +41,7 @@ "From Base", "To BCD", "From BCD", + "Text-Integer Conversion", "To HTML Entity", "From HTML Entity", "URL Encode", @@ -109,6 +110,8 @@ "Rabbit", "SM4 Encrypt", "SM4 Decrypt", + "RC6 Encrypt", + "RC6 Decrypt", "GOST Encrypt", "GOST Decrypt", "GOST Sign", @@ -556,6 +559,7 @@ "Chi Square", "P-list Viewer", "Disassemble x86", + "Disassemble ARM", "Pseudo-Random Number Generator", "Pseudo-Random Integer Generator", "Generate De Bruijn Sequence", diff --git a/src/core/lib/RC6.mjs b/src/core/lib/RC6.mjs new file mode 100644 index 00000000..eaa6087c --- /dev/null +++ b/src/core/lib/RC6.mjs @@ -0,0 +1,625 @@ +/** + * Complete implementation of RC6 block cipher encryption/decryption with + * configurable word size (w), rounds (r), and key length (b). + * + * RC6 was an AES finalist designed by Ron Rivest, Matt Robshaw, Ray Sidney, and Yiqun Lisa Yin. + * Reference: https://en.wikipedia.org/wiki/RC6 + * Test Vectors: https://datatracker.ietf.org/doc/html/draft-krovetz-rc6-rc5-vectors-00 + * + * The P and Q constants are derived from mathematical constants e (Euler's number) and + * φ (golden ratio) as specified in the IETF draft. Master 256-bit values are scaled to + * any word size. + * + * @author Medjedtxm + * @copyright Crown Copyright 2026 + * @license Apache-2.0 + */ + +import OperationError from "../errors/OperationError.mjs"; + +/** + * Master P constant (256-bit) from IETF draft-krovetz-rc6-rc5-vectors-00 + * Derived from Odd((e-2) * 2^256) where e = 2.71828... + */ +const P_256 = 0xb7e151628aed2a6abf7158809cf4f3c762e7160f38b4da56a784d9045190cfefn; + +/** + * Master Q constant (256-bit) from IETF draft-krovetz-rc6-rc5-vectors-00 + * Derived from Odd((φ-1) * 2^256) where φ = 1.61803... (golden ratio) + */ +const Q_256 = 0x9e3779b97f4a7c15f39cc0605cedc8341082276bf3a27251f86c6a11d0c18e95n; + +/** + * Get P constant for given word size by scaling the 256-bit master constant + * @param {number} w - Word size in bits + * @returns {bigint} - P constant for word size w + */ +function getP(w) { + return (P_256 >> BigInt(256 - w)) | 1n; // Ensure odd +} + +/** + * Get Q constant for given word size by scaling the 256-bit master constant + * @param {number} w - Word size in bits + * @returns {bigint} - Q constant for word size w + */ +function getQ(w) { + return (Q_256 >> BigInt(256 - w)) | 1n; // Ensure odd +} + +/** + * Get block size in bytes for given word size + * Block size = 4 words = 4 * (w/8) bytes + * @param {number} w - Word size in bits + * @returns {number} - Block size in bytes + */ +export function getBlockSize(w) { + return 4 * (w / 8); +} + +/** + * Get recommended number of rounds for given word size + * @param {number} w - Word size in bits + * @returns {number} - Recommended rounds + */ +export function getDefaultRounds(w) { + if (w <= 16) return 16; + if (w <= 32) return 20; + if (w <= 64) return 24; + return 28; +} + +/** + * Create mask for w-bit word + * @param {number} w - Word size in bits + * @returns {bigint} - Mask with w bits set + */ +function wordMask(w) { + return (1n << BigInt(w)) - 1n; +} + +/** + * Rotate left for arbitrary word size using BigInt + * Uses lower lg(w) bits of n for rotation amount (RC6 spec) + * @param {bigint} x - Value to rotate + * @param {bigint} n - Rotation amount + * @param {number} w - Word size in bits + * @param {bigint} lgMask - Mask for lower lg(w) bits + * @returns {bigint} - Rotated value + */ +function ROL(x, n, w, lgMask) { + const mask = wordMask(w); + // Mask to lg(w) bits, then mod w for non-power-of-2 word sizes + // For power-of-2, (n & lgMask) < w always, so mod w is no-op + const shift = (n & lgMask) % BigInt(w); + return ((x << shift) | (x >> (BigInt(w) - shift))) & mask; +} + +/** + * Rotate right for arbitrary word size using BigInt + * Uses lower lg(w) bits of n for rotation amount (RC6 spec) + * @param {bigint} x - Value to rotate + * @param {bigint} n - Rotation amount + * @param {number} w - Word size in bits + * @param {bigint} lgMask - Mask for lower lg(w) bits + * @returns {bigint} - Rotated value + */ +function ROR(x, n, w, lgMask) { + const mask = wordMask(w); + // Mask to lg(w) bits, then mod w for non-power-of-2 word sizes + // For power-of-2, (n & lgMask) < w always, so mod w is no-op + const shift = (n & lgMask) % BigInt(w); + return ((x >> shift) | (x << (BigInt(w) - shift))) & mask; +} + +/** + * Convert byte array to word array (little-endian) using BigInt + * @param {number[]} bytes - Input byte array + * @param {number} w - Word size in bits + * @returns {bigint[]} - Array of w-bit words as BigInt + */ +function bytesToWords(bytes, w) { + const bytesPerWord = w / 8; + const words = []; + for (let i = 0; i < bytes.length; i += bytesPerWord) { + let word = 0n; + for (let j = 0; j < bytesPerWord && (i + j) < bytes.length; j++) { + word |= BigInt(bytes[i + j] || 0) << BigInt(j * 8); + } + words.push(word); + } + return words; +} + +/** + * Convert word array to byte array (little-endian) using BigInt + * @param {bigint[]} words - Array of words + * @param {number} w - Word size in bits + * @returns {number[]} - Output byte array + */ +function wordsToBytes(words, w) { + const bytesPerWord = w / 8; + const bytes = []; + for (const word of words) { + for (let j = 0; j < bytesPerWord; j++) { + bytes.push(Number((word >> BigInt(j * 8)) & 0xFFn)); + } + } + return bytes; +} + +/** + * Generate round subkeys from user key + * + * @param {number[]} key - User key as byte array + * @param {number} rounds - Number of rounds + * @param {number} w - Word size in bits + * @returns {bigint[]} - Array of 2r+4 subkeys as BigInt + */ +function generateSubkeys(key, rounds, w) { + const bytesPerWord = w / 8; + const b = key.length; + const c = Math.max(Math.ceil(b / bytesPerWord), 1); + + // Convert key bytes to words, pad with zeros if needed + const paddedKey = [...key]; + while (paddedKey.length < c * bytesPerWord) { + paddedKey.push(0); + } + const L = bytesToWords(paddedKey, w); + + // Number of subkeys: 2*r + 4 + const t = 2 * rounds + 4; + + // Get P and Q for this word size + const P = getP(w); + const Q = getQ(w); + const mask = wordMask(w); + + // lg(w) mask for rotation amounts (floor of log2(w), per RC6 spec) + const lgw = Math.floor(Math.log2(w)); + const lgMask = (1n << BigInt(lgw)) - 1n; + + // Initialise S array with magic constants + const S = new Array(t); + S[0] = P; + for (let i = 1; i < t; i++) { + S[i] = (S[i - 1] + Q) & mask; + } + + // Mix key into S + let A = 0n, B = 0n; + let i = 0, j = 0; + const v = 3 * Math.max(c, t); + + for (let s = 0; s < v; s++) { + A = S[i] = ROL((S[i] + A + B) & mask, 3n, w, lgMask); + B = L[j] = ROL((L[j] + A + B) & mask, A + B, w, lgMask); + i = (i + 1) % t; + j = (j + 1) % c; + } + + return S; +} + +/** + * Encrypt a single block using RC6 + * + * @param {number[]} block - Plaintext block (4*w/8 bytes) + * @param {bigint[]} S - Subkeys array + * @param {number} rounds - Number of rounds + * @param {number} w - Word size in bits + * @returns {number[]} - Ciphertext block + */ +function encryptBlock(block, S, rounds, w) { + const mask = wordMask(w); + const lgw = BigInt(Math.floor(Math.log2(w))); + const lgMask = (1n << lgw) - 1n; + + // Convert block to 4 words (A, B, C, D) + let [A, B, C, D] = bytesToWords(block, w); + + // Pre-whitening + B = (B + S[0]) & mask; + D = (D + S[1]) & mask; + + // Main rounds + for (let i = 1; i <= rounds; i++) { + // t = ROL(B * (2B + 1), lg(w)) + const t = ROL((B * ((2n * B + 1n) & mask)) & mask, lgw, w, lgMask); + + // u = ROL(D * (2D + 1), lg(w)) + const u = ROL((D * ((2n * D + 1n) & mask)) & mask, lgw, w, lgMask); + + // A = ROL(A ^ t, u) + S[2i] + A = (ROL(A ^ t, u, w, lgMask) + S[2 * i]) & mask; + + // C = ROL(C ^ u, t) + S[2i + 1] + C = (ROL(C ^ u, t, w, lgMask) + S[2 * i + 1]) & mask; + + // Rotate registers: (A, B, C, D) = (B, C, D, A) + const temp = A; + A = B; + B = C; + C = D; + D = temp; + } + + // Post-whitening + A = (A + S[2 * rounds + 2]) & mask; + C = (C + S[2 * rounds + 3]) & mask; + + // Convert words back to bytes + return wordsToBytes([A, B, C, D], w); +} + +/** + * Decrypt a single block using RC6 + * + * @param {number[]} block - Ciphertext block (4*w/8 bytes) + * @param {bigint[]} S - Subkeys array + * @param {number} rounds - Number of rounds + * @param {number} w - Word size in bits + * @returns {number[]} - Plaintext block + */ +function decryptBlock(block, S, rounds, w) { + const mask = wordMask(w); + const lgw = BigInt(Math.floor(Math.log2(w))); + const lgMask = (1n << lgw) - 1n; + + // Convert block to 4 words (A, B, C, D) + let [A, B, C, D] = bytesToWords(block, w); + + // Reverse post-whitening + C = (C - S[2 * rounds + 3] + (1n << BigInt(w))) & mask; + A = (A - S[2 * rounds + 2] + (1n << BigInt(w))) & mask; + + // Main rounds in reverse + for (let i = rounds; i >= 1; i--) { + // Reverse rotate registers: (A, B, C, D) = (D, A, B, C) + const temp = D; + D = C; + C = B; + B = A; + A = temp; + + // u = ROL(D * (2D + 1), lg(w)) + const u = ROL((D * ((2n * D + 1n) & mask)) & mask, lgw, w, lgMask); + + // t = ROL(B * (2B + 1), lg(w)) + const t = ROL((B * ((2n * B + 1n) & mask)) & mask, lgw, w, lgMask); + + // C = ROR(C - S[2i + 1], t) ^ u + C = ROR((C - S[2 * i + 1] + (1n << BigInt(w))) & mask, t, w, lgMask) ^ u; + + // A = ROR(A - S[2i], u) ^ t + A = ROR((A - S[2 * i] + (1n << BigInt(w))) & mask, u, w, lgMask) ^ t; + } + + // Reverse pre-whitening + D = (D - S[1] + (1n << BigInt(w))) & mask; + B = (B - S[0] + (1n << BigInt(w))) & mask; + + // Convert words back to bytes + return wordsToBytes([A, B, C, D], w); +} + +/** + * XOR two blocks + * @param {number[]} a - First block + * @param {number[]} b - Second block + * @returns {number[]} - XOR result + */ +function xorBlocks(a, b) { + const result = new Array(a.length); + for (let i = 0; i < a.length; i++) { + result[i] = a[i] ^ b[i]; + } + return result; +} + +/** + * Increment counter (little-endian) + * @param {number[]} counter - Counter block + * @returns {number[]} - Incremented counter + */ +function incrementCounter(counter) { + const result = [...counter]; + for (let i = 0; i < result.length; i++) { + result[i]++; + if (result[i] <= 255) break; + result[i] = 0; + } + return result; +} + +/** + * Apply padding to message + * @param {number[]} message - Original message + * @param {string} padding - Padding type ("NO", "PKCS5", "ZERO", "RANDOM", "BIT") + * @param {number} blockSize - Block size in bytes + * @returns {number[]} - Padded message + */ +function applyPadding(message, padding, blockSize) { + const remainder = message.length % blockSize; + let nPadding = remainder === 0 ? 0 : blockSize - remainder; + + // For PKCS5, always add at least one byte (full block if already aligned) + if (padding === "PKCS5" && remainder === 0) { + nPadding = blockSize; + } + + if (nPadding === 0) return [...message]; + + const paddedMessage = [...message]; + + switch (padding) { + case "NO": + throw new OperationError(`No padding requested but input is not a ${blockSize}-byte multiple.`); + + case "PKCS5": + for (let i = 0; i < nPadding; i++) { + paddedMessage.push(nPadding); + } + break; + + case "ZERO": + for (let i = 0; i < nPadding; i++) { + paddedMessage.push(0); + } + break; + + case "RANDOM": + for (let i = 0; i < nPadding; i++) { + paddedMessage.push(Math.floor(Math.random() * 256)); + } + break; + + case "BIT": + paddedMessage.push(0x80); + for (let i = 1; i < nPadding; i++) { + paddedMessage.push(0); + } + break; + + default: + throw new OperationError(`Unknown padding type: ${padding}`); + } + + return paddedMessage; +} + +/** + * Remove padding from message + * @param {number[]} message - Padded message + * @param {string} padding - Padding type ("NO", "PKCS5", "ZERO", "RANDOM", "BIT") + * @param {number} blockSize - Block size in bytes + * @returns {number[]} - Unpadded message + */ +function removePadding(message, padding, blockSize) { + if (message.length === 0) return message; + + switch (padding) { + case "NO": + case "ZERO": + case "RANDOM": + // These padding types cannot be reliably removed + return message; + + case "PKCS5": { + const padByte = message[message.length - 1]; + if (padByte > 0 && padByte <= blockSize) { + // Verify padding + for (let i = 0; i < padByte; i++) { + if (message[message.length - 1 - i] !== padByte) { + throw new OperationError("Invalid PKCS#5 padding."); + } + } + return message.slice(0, message.length - padByte); + } + throw new OperationError("Invalid PKCS#5 padding."); + } + + case "BIT": { + // Find 0x80 byte working backwards, skipping zeros + for (let i = message.length - 1; i >= 0; i--) { + if (message[i] === 0x80) { + return message.slice(0, i); + } else if (message[i] !== 0) { + throw new OperationError("Invalid BIT padding."); + } + } + throw new OperationError("Invalid BIT padding."); + } + + default: + throw new OperationError(`Unknown padding type: ${padding}`); + } +} + +/** + * Encrypt using RC6 cipher with specified block mode + * + * @param {number[]} message - Plaintext as byte array + * @param {number[]} key - Key as byte array + * @param {number[]} iv - IV (block size bytes, not used for ECB) + * @param {string} mode - Block cipher mode ("ECB", "CBC", "CFB", "OFB", "CTR") + * @param {string} padding - Padding type ("NO", "PKCS5", "ZERO", "RANDOM", "BIT") + * @param {number} rounds - Number of rounds (default: 20) + * @param {number} w - Word size in bits (default: 32) + * @returns {number[]} - Ciphertext as byte array + */ +export function encryptRC6(message, key, iv, mode = "ECB", padding = "PKCS5", rounds = 20, w = 32) { + const blockSize = getBlockSize(w); + const messageLength = message.length; + if (messageLength === 0) return []; + + const S = generateSubkeys(key, rounds, w); + + // Apply padding for ECB/CBC modes + let paddedMessage; + if (mode === "ECB" || mode === "CBC") { + paddedMessage = applyPadding(message, padding, blockSize); + } else { + // Stream modes (CFB, OFB, CTR) don't need padding + paddedMessage = [...message]; + } + + const cipherText = []; + + switch (mode) { + case "ECB": + for (let i = 0; i < paddedMessage.length; i += blockSize) { + const block = paddedMessage.slice(i, i + blockSize); + cipherText.push(...encryptBlock(block, S, rounds, w)); + } + break; + + case "CBC": { + let ivBlock = [...iv]; + for (let i = 0; i < paddedMessage.length; i += blockSize) { + const block = paddedMessage.slice(i, i + blockSize); + const xored = xorBlocks(block, ivBlock); + ivBlock = encryptBlock(xored, S, rounds, w); + cipherText.push(...ivBlock); + } + break; + } + + case "CFB": { + let ivBlock = [...iv]; + for (let i = 0; i < paddedMessage.length; i += blockSize) { + const encrypted = encryptBlock(ivBlock, S, rounds, w); + const block = paddedMessage.slice(i, i + blockSize); + // Pad block if shorter than blockSize + while (block.length < blockSize) block.push(0); + ivBlock = xorBlocks(encrypted, block); + cipherText.push(...ivBlock); + } + return cipherText.slice(0, messageLength); + } + + case "OFB": { + let ivBlock = [...iv]; + for (let i = 0; i < paddedMessage.length; i += blockSize) { + ivBlock = encryptBlock(ivBlock, S, rounds, w); + const block = paddedMessage.slice(i, i + blockSize); + // Pad block if shorter than blockSize + while (block.length < blockSize) block.push(0); + cipherText.push(...xorBlocks(ivBlock, block)); + } + return cipherText.slice(0, messageLength); + } + + case "CTR": { + let counter = [...iv]; + for (let i = 0; i < paddedMessage.length; i += blockSize) { + const encrypted = encryptBlock(counter, S, rounds, w); + const block = paddedMessage.slice(i, i + blockSize); + // Pad block if shorter than blockSize + while (block.length < blockSize) block.push(0); + cipherText.push(...xorBlocks(encrypted, block)); + counter = incrementCounter(counter); + } + return cipherText.slice(0, messageLength); + } + + default: + throw new OperationError(`Invalid block cipher mode: ${mode}`); + } + + return cipherText; +} + +/** + * Decrypt using RC6 cipher with specified block mode + * + * @param {number[]} cipherText - Ciphertext as byte array + * @param {number[]} key - Key as byte array + * @param {number[]} iv - IV (block size bytes, not used for ECB) + * @param {string} mode - Block cipher mode ("ECB", "CBC", "CFB", "OFB", "CTR") + * @param {string} padding - Padding type ("NO", "PKCS5", "ZERO", "RANDOM", "BIT") + * @param {number} rounds - Number of rounds (default: 20) + * @param {number} w - Word size in bits (default: 32) + * @returns {number[]} - Plaintext as byte array + */ +export function decryptRC6(cipherText, key, iv, mode = "ECB", padding = "PKCS5", rounds = 20, w = 32) { + const blockSize = getBlockSize(w); + const originalLength = cipherText.length; + if (originalLength === 0) return []; + + const S = generateSubkeys(key, rounds, w); + + if (mode === "ECB" || mode === "CBC") { + if ((originalLength % blockSize) !== 0) + throw new OperationError(`Invalid ciphertext length: ${originalLength} bytes. Must be a multiple of ${blockSize}.`); + } else { + // Pad for stream modes + while ((cipherText.length % blockSize) !== 0) + cipherText.push(0); + } + + const plainText = []; + + switch (mode) { + case "ECB": + for (let i = 0; i < cipherText.length; i += blockSize) { + const block = cipherText.slice(i, i + blockSize); + plainText.push(...decryptBlock(block, S, rounds, w)); + } + break; + + case "CBC": { + let ivBlock = [...iv]; + for (let i = 0; i < cipherText.length; i += blockSize) { + const block = cipherText.slice(i, i + blockSize); + const decrypted = decryptBlock(block, S, rounds, w); + plainText.push(...xorBlocks(decrypted, ivBlock)); + ivBlock = block; + } + break; + } + + case "CFB": { + let ivBlock = [...iv]; + for (let i = 0; i < cipherText.length; i += blockSize) { + const encrypted = encryptBlock(ivBlock, S, rounds, w); + const block = cipherText.slice(i, i + blockSize); + plainText.push(...xorBlocks(encrypted, block)); + ivBlock = block; + } + return plainText.slice(0, originalLength); + } + + case "OFB": { + let ivBlock = [...iv]; + for (let i = 0; i < cipherText.length; i += blockSize) { + ivBlock = encryptBlock(ivBlock, S, rounds, w); + const block = cipherText.slice(i, i + blockSize); + plainText.push(...xorBlocks(ivBlock, block)); + } + return plainText.slice(0, originalLength); + } + + case "CTR": { + let counter = [...iv]; + for (let i = 0; i < cipherText.length; i += blockSize) { + const encrypted = encryptBlock(counter, S, rounds, w); + const block = cipherText.slice(i, i + blockSize); + plainText.push(...xorBlocks(encrypted, block)); + counter = incrementCounter(counter); + } + return plainText.slice(0, originalLength); + } + + default: + throw new OperationError(`Invalid block cipher mode: ${mode}`); + } + + // Remove padding for ECB/CBC modes + if (mode === "ECB" || mode === "CBC") { + return removePadding(plainText, padding, blockSize); + } + + return plainText.slice(0, originalLength); +} diff --git a/src/core/operations/DisassembleARM.mjs b/src/core/operations/DisassembleARM.mjs new file mode 100644 index 00000000..d8cb56da --- /dev/null +++ b/src/core/operations/DisassembleARM.mjs @@ -0,0 +1,193 @@ +/** + * @author MedjedThomasXM + * @copyright Crown Copyright 2024 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import { isWorkerEnvironment } from "../Utils.mjs"; +import cs from "@alexaltea/capstone-js/dist/capstone.min.js"; + +/** + * Disassemble ARM operation + */ +class DisassembleARM extends Operation { + + /** + * DisassembleARM constructor + */ + constructor() { + super(); + + this.name = "Disassemble ARM"; + this.module = "Shellcode"; + this.description = "Disassembles ARM machine code into assembly language.

Supports ARM (32-bit), Thumb, and ARM64 (AArch64) architectures using the Capstone disassembly framework.

Input should be in hexadecimal."; + this.infoURL = "https://wikipedia.org/wiki/ARM_architecture_family"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + "name": "Architecture", + "type": "option", + "value": ["ARM (32-bit)", "ARM64 (AArch64)"] + }, + { + "name": "Mode", + "type": "option", + "value": ["ARM", "Thumb", "Thumb + Cortex-M", "ARMv8"] + }, + { + "name": "Endianness", + "type": "option", + "value": ["Little Endian", "Big Endian"] + }, + { + "name": "Starting address (hex)", + "type": "number", + "value": 0 + }, + { + "name": "Show instruction hex", + "type": "boolean", + "value": true + }, + { + "name": "Show instruction position", + "type": "boolean", + "value": true + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + async run(input, args) { + const [ + architecture, + mode, + endianness, + startAddress, + showHex, + showPosition + ] = args; + + // Remove whitespace from input + const hexInput = input.replace(/\s/g, ""); + + // Validate hex input + if (!/^[0-9a-fA-F]*$/.test(hexInput)) { + throw new OperationError("Invalid hexadecimal input. Please provide valid hex characters only."); + } + + if (hexInput.length === 0) { + return ""; + } + + if (hexInput.length % 2 !== 0) { + throw new OperationError("Invalid hexadecimal input. Length must be even."); + } + + // Convert hex string to byte array + const bytes = []; + for (let i = 0; i < hexInput.length; i += 2) { + bytes.push(parseInt(hexInput.substr(i, 2), 16)); + } + + // Determine architecture constant + let arch; + if (architecture === "ARM64 (AArch64)") { + arch = cs.ARCH_ARM64; + } else { + arch = cs.ARCH_ARM; + } + + // Determine mode constant + let modeValue = cs.MODE_LITTLE_ENDIAN; + + if (architecture === "ARM (32-bit)") { + switch (mode) { + case "ARM": + modeValue = cs.MODE_ARM; + break; + case "Thumb": + modeValue = cs.MODE_THUMB; + break; + case "Thumb + Cortex-M": + modeValue = cs.MODE_THUMB | cs.MODE_MCLASS; + break; + case "ARMv8": + modeValue = cs.MODE_ARM | cs.MODE_V8; + break; + default: + modeValue = cs.MODE_ARM; + } + } else { + // ARM64 only has one mode (ARM mode is default for ARM64) + modeValue = cs.MODE_ARM; + } + + // Add endianness + if (endianness === "Big Endian") { + modeValue |= cs.MODE_BIG_ENDIAN; + } + + if (isWorkerEnvironment()) { + self.sendStatusMessage("Disassembling..."); + } + + let disassembler; + try { + disassembler = new cs.Capstone(arch, modeValue); + } catch (e) { + throw new OperationError(`Failed to initialise Capstone disassembler: ${e}`); + } + + let instructions; + try { + instructions = disassembler.disasm(bytes, startAddress); + } catch (e) { + disassembler.close(); + // Check if it's a "no valid instructions" error (code 0 means OK but nothing decoded) + if (e && e.includes && e.includes("code 0:")) { + throw new OperationError(`No valid ${architecture} instructions found in input. The bytes may be for a different architecture or mode.`); + } + throw new OperationError(`Disassembly failed: ${e}`); + } + + // Format output + const output = []; + for (const insn of instructions) { + let line = ""; + + if (showPosition) { + // Format address as hex with 0x prefix + const addrHex = "0x" + insn.address.toString(16).padStart(8, "0"); + line += addrHex + " "; + } + + if (showHex) { + // Format instruction bytes as hex + const bytesHex = insn.bytes.map(b => b.toString(16).padStart(2, "0")).join(""); + line += bytesHex.padEnd(16, " ") + " "; + } + + line += insn.mnemonic; + if (insn.op_str) { + line += " " + insn.op_str; + } + + output.push(line); + } + + disassembler.close(); + + return output.join("\n"); + } + +} + +export default DisassembleARM; diff --git a/src/core/operations/RC6Decrypt.mjs b/src/core/operations/RC6Decrypt.mjs new file mode 100644 index 00000000..3185b632 --- /dev/null +++ b/src/core/operations/RC6Decrypt.mjs @@ -0,0 +1,119 @@ +/** + * @author Medjedtxm + * @copyright Crown Copyright 2026 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import Utils from "../Utils.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import { toHex } from "../lib/Hex.mjs"; +import { decryptRC6, getBlockSize, getDefaultRounds } from "../lib/RC6.mjs"; + +/** + * RC6 Decrypt operation + */ +class RC6Decrypt extends Operation { + + /** + * RC6Decrypt constructor + */ + constructor() { + super(); + + this.name = "RC6 Decrypt"; + this.module = "Ciphers"; + this.description = "RC6 is a symmetric key block cipher derived from RC5. It was designed by Ron Rivest, Matt Robshaw, Ray Sidney, and Yiqun Lisa Yin to meet the requirements of the AES competition, and was one of the five finalists.

RC6 is parameterised as RC6-w/r/b where w is word size in bits (any multiple of 8 from 8-256), r is the number of rounds (1-255), and b is the key length in bytes. The standard AES submission uses w=32, r=20. Common word sizes: 8, 16, 32 (standard), 64, 128.

IV: The Initialisation Vector should be 4*w/8 bytes (e.g. 16 bytes for w=32). If not entered, it will default to null bytes.

Padding: In CBC and ECB mode, the PKCS#7 padding scheme is used."; + this.infoURL = "https://wikipedia.org/wiki/RC6"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + "name": "Key", + "type": "toggleString", + "value": "", + "toggleValues": ["Hex", "UTF8", "Latin1", "Base64"] + }, + { + "name": "IV", + "type": "toggleString", + "value": "", + "toggleValues": ["Hex", "UTF8", "Latin1", "Base64"] + }, + { + "name": "Mode", + "type": "option", + "value": ["CBC", "CFB", "OFB", "CTR", "ECB"] + }, + { + "name": "Input", + "type": "option", + "value": ["Hex", "Raw"] + }, + { + "name": "Output", + "type": "option", + "value": ["Raw", "Hex"] + }, + { + "name": "Padding", + "type": "option", + "value": ["PKCS5", "NO", "ZERO", "RANDOM", "BIT"] + }, + { + "name": "Word Size", + "type": "number", + "value": 32, + "min": 8, + "max": 256, + "step": 8 + }, + { + "name": "Rounds", + "type": "number", + "value": 20, + "min": 1, + "max": 255 + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + const key = Utils.convertToByteArray(args[0].string, args[0].option), + iv = Utils.convertToByteArray(args[1].string, args[1].option), + [,, mode, inputType, outputType, padding, wordSize, rounds] = args; + + // Validate word size + if (!Number.isInteger(wordSize) || wordSize < 8 || wordSize > 256 || wordSize % 8 !== 0) + throw new OperationError(`Invalid word size: ${wordSize}. Must be a multiple of 8 between 8 and 256.`); + + const blockSize = getBlockSize(wordSize); + const defaultRounds = getDefaultRounds(wordSize); + + if (iv.length !== blockSize && iv.length !== 0 && mode !== "ECB") + throw new OperationError(`Invalid IV length: ${iv.length} bytes + +RC6-${wordSize} uses an IV length of ${blockSize} bytes (${blockSize * 8} bits). +Make sure you have specified the type correctly (e.g. Hex vs UTF8).`); + + if (!Number.isInteger(rounds) || rounds < 1 || rounds > 255) + throw new OperationError(`Invalid number of rounds: ${rounds} + +Rounds must be an integer between 1 and 255. Standard for w=${wordSize} is ${defaultRounds}.`); + + // Default IV to null bytes if empty (like AES) + const actualIv = iv.length === 0 ? new Array(blockSize).fill(0) : iv; + + input = Utils.convertToByteArray(input, inputType); + const output = decryptRC6(input, key, actualIv, mode, padding, rounds, wordSize); + return outputType === "Hex" ? toHex(output, "") : Utils.byteArrayToUtf8(output); + } + +} + +export default RC6Decrypt; diff --git a/src/core/operations/RC6Encrypt.mjs b/src/core/operations/RC6Encrypt.mjs new file mode 100644 index 00000000..d5ad6d7f --- /dev/null +++ b/src/core/operations/RC6Encrypt.mjs @@ -0,0 +1,119 @@ +/** + * @author Medjedtxm + * @copyright Crown Copyright 2026 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import Utils from "../Utils.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import { toHex } from "../lib/Hex.mjs"; +import { encryptRC6, getBlockSize, getDefaultRounds } from "../lib/RC6.mjs"; + +/** + * RC6 Encrypt operation + */ +class RC6Encrypt extends Operation { + + /** + * RC6Encrypt constructor + */ + constructor() { + super(); + + this.name = "RC6 Encrypt"; + this.module = "Ciphers"; + this.description = "RC6 is a symmetric key block cipher derived from RC5. It was designed by Ron Rivest, Matt Robshaw, Ray Sidney, and Yiqun Lisa Yin to meet the requirements of the AES competition, and was one of the five finalists.

RC6 is parameterised as RC6-w/r/b where w is word size in bits (any multiple of 8 from 8-256), r is the number of rounds (1-255), and b is the key length in bytes. The standard AES submission uses w=32, r=20. Common word sizes: 8, 16, 32 (standard), 64, 128.

IV: The Initialisation Vector should be 4*w/8 bytes (e.g. 16 bytes for w=32). If not entered, it will default to null bytes.

Padding: In CBC and ECB mode, the PKCS#7 padding scheme is used."; + this.infoURL = "https://wikipedia.org/wiki/RC6"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + "name": "Key", + "type": "toggleString", + "value": "", + "toggleValues": ["Hex", "UTF8", "Latin1", "Base64"] + }, + { + "name": "IV", + "type": "toggleString", + "value": "", + "toggleValues": ["Hex", "UTF8", "Latin1", "Base64"] + }, + { + "name": "Mode", + "type": "option", + "value": ["CBC", "CFB", "OFB", "CTR", "ECB"] + }, + { + "name": "Input", + "type": "option", + "value": ["Raw", "Hex"] + }, + { + "name": "Output", + "type": "option", + "value": ["Hex", "Raw"] + }, + { + "name": "Padding", + "type": "option", + "value": ["PKCS5", "NO", "ZERO", "RANDOM", "BIT"] + }, + { + "name": "Word Size", + "type": "number", + "value": 32, + "min": 8, + "max": 256, + "step": 8 + }, + { + "name": "Rounds", + "type": "number", + "value": 20, + "min": 1, + "max": 255 + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + const key = Utils.convertToByteArray(args[0].string, args[0].option), + iv = Utils.convertToByteArray(args[1].string, args[1].option), + [,, mode, inputType, outputType, padding, wordSize, rounds] = args; + + // Validate word size + if (!Number.isInteger(wordSize) || wordSize < 8 || wordSize > 256 || wordSize % 8 !== 0) + throw new OperationError(`Invalid word size: ${wordSize}. Must be a multiple of 8 between 8 and 256.`); + + const blockSize = getBlockSize(wordSize); + const defaultRounds = getDefaultRounds(wordSize); + + if (iv.length !== blockSize && iv.length !== 0 && mode !== "ECB") + throw new OperationError(`Invalid IV length: ${iv.length} bytes + +RC6-${wordSize} uses an IV length of ${blockSize} bytes (${blockSize * 8} bits). +Make sure you have specified the type correctly (e.g. Hex vs UTF8).`); + + if (!Number.isInteger(rounds) || rounds < 1 || rounds > 255) + throw new OperationError(`Invalid number of rounds: ${rounds} + +Rounds must be an integer between 1 and 255. Standard for w=${wordSize} is ${defaultRounds}.`); + + // Default IV to null bytes if empty (like AES) + const actualIv = iv.length === 0 ? new Array(blockSize).fill(0) : iv; + + input = Utils.convertToByteArray(input, inputType); + const output = encryptRC6(input, key, actualIv, mode, padding, rounds, wordSize); + return outputType === "Hex" ? toHex(output, "") : Utils.byteArrayToUtf8(output); + } + +} + +export default RC6Encrypt; diff --git a/src/core/operations/TextIntegerConverter.mjs b/src/core/operations/TextIntegerConverter.mjs new file mode 100644 index 00000000..4e740100 --- /dev/null +++ b/src/core/operations/TextIntegerConverter.mjs @@ -0,0 +1,123 @@ +/** + * @author p-leriche [philip.leriche@cantab.net] + * @copyright Crown Copyright 2025 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; + +/* ---------- helper functions ---------- */ + +/** + * Convert text to BigInt (big-endian byte interpretation) + */ +function textToBigInt(text) { + if (text.length === 0) return 0n; + + let result = 0n; + for (let i = 0; i < text.length; i++) { + const charCode = BigInt(text.charCodeAt(i)); + if (charCode > 255n) { + throw new OperationError( + `Character at position ${i} exceeds Latin-1 range (0-255).\n` + + "Only ASCII and Latin-1 characters are supported."); + } + result = (result << 8n) | charCode; + } + return result; +} + +/** + * Convert BigInt to text (big-endian byte interpretation) + */ +function bigIntToText(value) { + if (value === 0n) return ""; + + const bytes = []; + let num = value; + + while (num > 0n) { + bytes.unshift(Number(num & 0xFFn)); + num >>= 8n; + } + + return String.fromCharCode(...bytes); +} + +/* ---------- operation class ---------- */ + +/** + * Text/Integer Converter operation + */ +class TextIntegerConverter extends Operation { + /** + * TextIntegerConverter constructor + */ + constructor() { + super(); + + this.description = + "Converts between text strings and large integers (decimal or hexadecimal).

" + + "Text is interpreted as a big-endian sequence of character codes. For example:
" + + "ABC is 0x414243 (hex) is 4276803 (decimal)
" + + "Input format detection:
" + + "Decimal: digits 0-9 only
" + + "Hexadecimal: 0x... prefix
" + + "Quoted or unquoted text: treated as string

" + + "Character limitations:
" + + "Text input may only contain ASCII and Latin-1 characters (code point < 256).
" + + "Multi-byte Unicode characters will generate an error.

." ; + this.infoURL = "https://wikipedia.org/wiki/Endianness"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + name: "Output format", + type: "option", + value: ["String", "Decimal", "Hexadecimal"] + } + ]; + this.name = "Text-Integer Conversion"; + this.module = "Default"; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + const outputFormat = args[0]; + const trimmed = input.trim(); + + let bigIntValue; + + if (!trimmed) { + // Null input - treat as zero + bigIntValue = 0; + } else if (/^0x[0-9a-f]+$/i.test(trimmed) || + /^[+-]?[0-9]+$/.test(trimmed)) { + // Hex or decimal integer + bigIntValue = BigInt(trimmed); + } else if (/^["'].*["']$/.test(trimmed)) { + // Quoted string: Remove quotes and convert text to BigInt + const text = trimmed.slice(1, -1); + bigIntValue = textToBigInt(text); + } else { + // Assume it's unquoted text + bigIntValue = textToBigInt(trimmed); + } + + // Convert to output format + if (outputFormat === "String") { + return bigIntToText(bigIntValue); + } else if (outputFormat === "Decimal") { + return bigIntValue.toString(); + } else { // Hexadecimal + return "0x" + bigIntValue.toString(16); + } + } +} + +export default TextIntegerConverter; diff --git a/tests/node/tests/lib/BigIntUtils.mjs b/tests/node/tests/lib/BigIntUtils.mjs index d75a4893..f745f91b 100644 --- a/tests/node/tests/lib/BigIntUtils.mjs +++ b/tests/node/tests/lib/BigIntUtils.mjs @@ -9,46 +9,46 @@ TestRegister.addApiTests([ const value = parseBigInt("1", "test value"); assert.deepStrictEqual(value, BigInt("1")); }), - + it("BigIntUtils: parseBigInt - large decimal", () => { const value = parseBigInt("123456789012345678901234567890", "test value"); assert.deepStrictEqual(value, BigInt("123456789012345678901234567890")); }), - + it("BigIntUtils: parseBigInt - hexadecimal lowercase", () => { const value = parseBigInt("0xff", "test value"); assert.deepStrictEqual(value, BigInt("255")); }), - + it("BigIntUtils: parseBigInt - hexadecimal uppercase", () => { const value = parseBigInt("0xFF", "test value"); assert.deepStrictEqual(value, BigInt("255")); }), - + it("BigIntUtils: parseBigInt - large hexadecimal", () => { const value = parseBigInt("0x123456789ABCDEF", "test value"); assert.deepStrictEqual(value, BigInt("0x123456789ABCDEF")); }), - + it("BigIntUtils: parseBigInt - whitespace trimming", () => { const value = parseBigInt(" 42 ", "test value"); assert.deepStrictEqual(value, BigInt("42")); }), - + it("BigIntUtils: parseBigInt - invalid input (text)", () => { assert.throws(() => parseBigInt("test", "test value"), { name: "Error", message: "test value must be decimal or hex (0x...)" }); }), - + it("BigIntUtils: parseBigInt - invalid input (hex without prefix)", () => { assert.throws(() => parseBigInt("FF", "test value"), { name: "Error", message: "test value must be decimal or hex (0x...)" }); }), - + it("BigIntUtils: parseBigInt - invalid input (mixed)", () => { assert.throws(() => parseBigInt("12abc", "test value"), { name: "Error", @@ -65,40 +65,40 @@ TestRegister.addApiTests([ const bezout2 = BigInt("1"); assert.deepStrictEqual(egcd(a, b), [gcd, bezout1, bezout2]); }), - + it("BigIntUtils: egcd - coprime numbers", () => { const [g, x, y] = egcd(BigInt("3"), BigInt("11")); assert.strictEqual(g, BigInt("1")); - // Verify Bézout identity: a*x + b*y = gcd + // Verify Bézout identity: a*x + b*y = gcd assert.strictEqual(BigInt("3") * x + BigInt("11") * y, g); }), - + it("BigIntUtils: egcd - non-coprime numbers", () => { const [g, x, y] = egcd(BigInt("240"), BigInt("46")); assert.strictEqual(g, BigInt("2")); - // Verify Bézout identity + // Verify Bézout identity assert.strictEqual(BigInt("240") * x + BigInt("46") * y, g); }), - + it("BigIntUtils: egcd - with zero", () => { const [g, x, y] = egcd(BigInt("17"), BigInt("0")); assert.strictEqual(g, BigInt("17")); assert.strictEqual(x, BigInt("1")); assert.strictEqual(y, BigInt("0")); }), - + it("BigIntUtils: egcd - identical numbers", () => { const [g, x, y] = egcd(BigInt("42"), BigInt("42")); assert.strictEqual(g, BigInt("42")); - // Verify Bézout identity + // Verify Bézout identity assert.strictEqual(BigInt("42") * x + BigInt("42") * y, g); }), - + it("BigIntUtils: egcd - large numbers", () => { const a = BigInt("123456789012345678901234567890"); const b = BigInt("987654321098765432109876543210"); const [g, x, y] = egcd(a, b); - // Verify Bézout identity + // Verify Bézout identity assert.strictEqual(a * x + b * y, g); }), @@ -108,7 +108,7 @@ TestRegister.addApiTests([ const result = modPow(BigInt("2"), BigInt("10"), BigInt("1000")); assert.strictEqual(result, BigInt("24")); }), - + it("BigIntUtils: modPow - RSA-like example", () => { // Common RSA public exponent const base = BigInt("123456789"); @@ -119,26 +119,26 @@ TestRegister.addApiTests([ assert(result < mod); assert(result >= BigInt("0")); }), - + it("BigIntUtils: modPow - exponent zero", () => { // Any number^0 = 1 const result = modPow(BigInt("999"), BigInt("0"), BigInt("100")); assert.strictEqual(result, BigInt("1")); }), - + it("BigIntUtils: modPow - base zero", () => { // 0^n = 0 const result = modPow(BigInt("0"), BigInt("5"), BigInt("100")); assert.strictEqual(result, BigInt("0")); }), - + it("BigIntUtils: modPow - large exponent", () => { // Test with very large exponent (efficient algorithm should handle this) const result = modPow(BigInt("3"), BigInt("1000000"), BigInt("1000000007")); assert(result >= BigInt("0")); assert(result < BigInt("1000000007")); }), - + it("BigIntUtils: modPow - modular inverse verification", () => { // If a*x . 1 (mod m), then modPow(a, 1, m) * x . 1 (mod m) const a = BigInt("3"); diff --git a/tests/operations/index.mjs b/tests/operations/index.mjs index 9d803bcc..fb03a5f7 100644 --- a/tests/operations/index.mjs +++ b/tests/operations/index.mjs @@ -61,6 +61,7 @@ import "./tests/Crypt.mjs"; import "./tests/CSV.mjs"; import "./tests/DateTime.mjs"; import "./tests/DefangIP.mjs"; +import "./tests/DisassembleARM.mjs"; import "./tests/DropNthBytes.mjs"; import "./tests/ECDSA.mjs"; import "./tests/ELFInfo.mjs"; @@ -152,6 +153,7 @@ import "./tests/Shuffle.mjs"; import "./tests/SIGABA.mjs"; import "./tests/SM2.mjs"; import "./tests/SM4.mjs"; +import "./tests/RC6.mjs"; // import "./tests/SplitColourChannels.mjs"; // Cannot test operations that use the File type yet import "./tests/SQLBeautify.mjs"; import "./tests/StrUtils.mjs"; @@ -164,6 +166,7 @@ import "./tests/SymmetricDifference.mjs"; import "./tests/TakeNthBytes.mjs"; import "./tests/Template.mjs"; import "./tests/TextEncodingBruteForce.mjs"; +import "./tests/TextIntegerConverter.mjs"; import "./tests/ToFromInsensitiveRegex.mjs"; import "./tests/TranslateDateTimeFormat.mjs"; import "./tests/Typex.mjs"; diff --git a/tests/operations/tests/DisassembleARM.mjs b/tests/operations/tests/DisassembleARM.mjs new file mode 100644 index 00000000..5306e9ce --- /dev/null +++ b/tests/operations/tests/DisassembleARM.mjs @@ -0,0 +1,377 @@ +/** + * Disassemble ARM tests. + * + * @author MedjedThomasXM + * + * @copyright Crown Copyright 2024 + * @license Apache-2.0 + */ +import TestRegister from "../../lib/TestRegister.mjs"; + +TestRegister.addTests([ + // ==================== ARM32 TESTS ==================== + { + name: "Disassemble ARM: ARM32 NOP (mov r0, r0)", + input: "00 00 a0 e1", + expectedMatch: /mov\s+r0,\s*r0/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM32 bx lr", + input: "1e ff 2f e1", + expectedMatch: /bx\s+lr/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM32 push {fp, lr}", + input: "00 48 2d e9", + expectedMatch: /push\s+\{fp,\s*lr\}/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM32 add fp, sp, #4", + input: "04 b0 8d e2", + expectedMatch: /add\s+fp,\s*sp/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM32 ldr r0, [r1]", + input: "00 00 91 e5", + expectedMatch: /ldr\s+r0,\s*\[r1\]/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM32 str r0, [r1]", + input: "00 00 81 e5", + expectedMatch: /str\s+r0,\s*\[r1\]/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM32 bl (branch link)", + input: "00 00 00 eb", + expectedMatch: /bl\s+/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM32 mul r0, r1, r2", + input: "91 02 00 e0", + expectedMatch: /mul\s+r0,\s*r1,\s*r2/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + + // ==================== ARM32 THUMB TESTS ==================== + { + name: "Disassemble ARM: Thumb mov r0, r0", + input: "00 46", + expectedMatch: /mov\s+r0,\s*r0/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "Thumb", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: Thumb bx lr", + input: "70 47", + expectedMatch: /bx\s+lr/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "Thumb", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: Thumb push {r4, lr}", + input: "10 b5", + expectedMatch: /push\s+\{r4,\s*lr\}/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "Thumb", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: Thumb pop {r4, pc}", + input: "10 bd", + expectedMatch: /pop\s+\{r4,\s*pc\}/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "Thumb", "Little Endian", 0, true, true], + }, + ], + }, + + // ==================== ARM64 TESTS ==================== + { + name: "Disassemble ARM: ARM64 ret", + input: "c0 03 5f d6", + expectedMatch: /ret/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 mov x0, #0", + input: "00 00 80 d2", + expectedMatch: /mov[z]?\s+x0,\s*#0/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 stp x29, x30, [sp, #-16]!", + input: "fd 7b bf a9", + expectedMatch: /stp\s+x29,\s*x30,\s*\[sp/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 ldp x29, x30, [sp], #16", + input: "fd 7b c1 a8", + expectedMatch: /ldp\s+x29,\s*x30,\s*\[sp\]/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 add x0, x1, x2", + input: "20 00 02 8b", + expectedMatch: /add\s+x0,\s*x1,\s*x2/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 sub x0, x1, x2", + input: "20 00 02 cb", + expectedMatch: /sub\s+x0,\s*x1,\s*x2/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 mul x0, x1, x2", + input: "20 7c 02 9b", + expectedMatch: /mul\s+x0,\s*x1,\s*x2/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 ldr x0, [x1]", + input: "20 00 40 f9", + expectedMatch: /ldr\s+x0,\s*\[x1\]/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 str x0, [x1]", + input: "20 00 00 f9", + expectedMatch: /str\s+x0,\s*\[x1\]/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 bl (branch link)", + input: "00 00 00 94", + expectedMatch: /bl\s+/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 cbz x0", + input: "00 00 00 b4", + expectedMatch: /cbz\s+x0/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 cbnz x0", + input: "00 00 00 b5", + expectedMatch: /cbnz\s+x0/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 sub sp, sp, #0x20", + input: "ff 83 00 d1", + expectedMatch: /sub\s+sp,\s*sp/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 add sp, sp, #0x20", + input: "ff 83 00 91", + expectedMatch: /add\s+sp,\s*sp/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + + // ==================== MULTI-INSTRUCTION TESTS ==================== + { + name: "Disassemble ARM: ARM32 multiple instructions", + input: "00 48 2d e9 04 b0 8d e2 00 00 a0 e1 00 88 bd e8", + expectedMatch: /push.*\n.*add.*\n.*mov.*\n.*pop/s, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM64 function prologue/epilogue", + input: "fd 7b bf a9 fd 03 00 91 00 00 80 52 fd 7b c1 a8 c0 03 5f d6", + expectedMatch: /stp.*\n.*mov.*\n.*mov.*\n.*ldp.*\n.*ret/s, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, + + // ==================== ADDRESS TESTS ==================== + { + name: "Disassemble ARM: ARM64 with start address 0x1000", + input: "c0 03 5f d6", + expectedMatch: /0x00001000/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 4096, true, true], + }, + ], + }, + { + name: "Disassemble ARM: ARM32 with start address 0x8000", + input: "00 00 a0 e1", + expectedMatch: /0x00008000/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "ARM", "Little Endian", 32768, true, true], + }, + ], + }, + + // ==================== ENDIANNESS TESTS ==================== + { + name: "Disassemble ARM: ARM32 Big Endian", + input: "e1 a0 00 00", + expectedMatch: /mov\s+r0,\s*r0/, + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM (32-bit)", "ARM", "Big Endian", 0, true, true], + }, + ], + }, + + // ==================== EDGE CASES ==================== + { + name: "Disassemble ARM: Empty input", + input: "", + expectedOutput: "", + recipeConfig: [ + { + op: "Disassemble ARM", + args: ["ARM64 (AArch64)", "ARM", "Little Endian", 0, true, true], + }, + ], + }, +]); diff --git a/tests/operations/tests/RC6.mjs b/tests/operations/tests/RC6.mjs new file mode 100644 index 00000000..b9159ce3 --- /dev/null +++ b/tests/operations/tests/RC6.mjs @@ -0,0 +1,487 @@ +/** + * RC6 cipher tests. + * + * Test vectors from the IETF draft: + * "Test Vectors for RC6 and RC5" + * https://datatracker.ietf.org/doc/html/draft-krovetz-rc6-rc5-vectors-00 + * + * @author Medjedtxm + * @copyright Crown Copyright 2026 + * @license Apache-2.0 + */ + +import TestRegister from "../../lib/TestRegister.mjs"; + +TestRegister.addTests([ + // ============================================================ + // IETF TEST VECTORS - RC6-8/12/4 + // ============================================================ + { + name: "RC6-8/12/4: IETF vector encrypt", + input: "00010203", + expectedOutput: "aefc4612", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "00010203", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 8, 12 + ] + } + ] + }, + { + name: "RC6-8/12/4: IETF vector decrypt", + input: "aefc4612", + expectedOutput: "00010203", + recipeConfig: [ + { + op: "RC6 Decrypt", + args: [ + { string: "00010203", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 8, 12 + ] + } + ] + }, + + // ============================================================ + // IETF TEST VECTORS - RC6-16/16/8 + // ============================================================ + { + name: "RC6-16/16/8: IETF vector encrypt", + input: "0001020304050607", + expectedOutput: "2ff0b68eaeffad5b", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "0001020304050607", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 16, 16 + ] + } + ] + }, + { + name: "RC6-16/16/8: IETF vector decrypt", + input: "2ff0b68eaeffad5b", + expectedOutput: "0001020304050607", + recipeConfig: [ + { + op: "RC6 Decrypt", + args: [ + { string: "0001020304050607", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 16, 16 + ] + } + ] + }, + + // ============================================================ + // IETF TEST VECTORS - RC6-32/20/16 (AES standard) + // ============================================================ + { + name: "RC6-32/20/16: IETF vector encrypt (AES standard)", + input: "000102030405060708090a0b0c0d0e0f", + expectedOutput: "3a96f9c7f6755cfe46f00e3dcd5d2a3c", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 32, 20 + ] + } + ] + }, + { + name: "RC6-32/20/16: IETF vector decrypt (AES standard)", + input: "3a96f9c7f6755cfe46f00e3dcd5d2a3c", + expectedOutput: "000102030405060708090a0b0c0d0e0f", + recipeConfig: [ + { + op: "RC6 Decrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 32, 20 + ] + } + ] + }, + + // ============================================================ + // IETF TEST VECTORS - RC6-64/24/24 + // ============================================================ + { + name: "RC6-64/24/24: IETF vector encrypt", + input: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", + expectedOutput: "c002de050bd55e5d36864ab9853338e6dc4a1326c6bdaaeb1bc9e4fd67886617", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f1011121314151617", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 64, 24 + ] + } + ] + }, + { + name: "RC6-64/24/24: IETF vector decrypt", + input: "c002de050bd55e5d36864ab9853338e6dc4a1326c6bdaaeb1bc9e4fd67886617", + expectedOutput: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", + recipeConfig: [ + { + op: "RC6 Decrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f1011121314151617", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 64, 24 + ] + } + ] + }, + + // ============================================================ + // IETF TEST VECTORS - RC6-128/28/32 + // ============================================================ + { + name: "RC6-128/28/32: IETF vector encrypt", + input: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f", + expectedOutput: "4ed87c64baffecd4303ee6a79aafaef575b351c024272be70a70b4a392cfc157dba52d529a79e83845bf43d67545383aed3dbf4f0d23640e44cbf6cdaa034dcb", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 128, 28 + ] + } + ] + }, + { + name: "RC6-128/28/32: IETF vector decrypt", + input: "4ed87c64baffecd4303ee6a79aafaef575b351c024272be70a70b4a392cfc157dba52d529a79e83845bf43d67545383aed3dbf4f0d23640e44cbf6cdaa034dcb", + expectedOutput: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f", + recipeConfig: [ + { + op: "RC6 Decrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 128, 28 + ] + } + ] + }, + + // ============================================================ + // IETF TEST VECTORS - RC6-24/4/0 (non-power-of-2) + // ============================================================ + { + name: "RC6-24/4/0: IETF non-standard vector encrypt (w=24, empty key)", + input: "000102030405060708090a0b", + expectedOutput: "0177982579be2ee3303269b9", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 24, 4 + ] + } + ] + }, + { + name: "RC6-24/4/0: IETF non-standard vector decrypt (w=24, empty key)", + input: "0177982579be2ee3303269b9", + expectedOutput: "000102030405060708090a0b", + recipeConfig: [ + { + op: "RC6 Decrypt", + args: [ + { string: "", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 24, 4 + ] + } + ] + }, + + // ============================================================ + // IETF TEST VECTORS - RC6-80/4/12 (non-power-of-2) + // ============================================================ + { + name: "RC6-80/4/12: IETF non-standard vector encrypt (w=80)", + input: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324252627", + expectedOutput: "26d9d6128601d06dec3817d401f1c0ff715473543875da417c2116d1e87c919a49311b00b4e17962", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "000102030405060708090a0b", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 80, 4 + ] + } + ] + }, + { + name: "RC6-80/4/12: IETF non-standard vector decrypt (w=80)", + input: "26d9d6128601d06dec3817d401f1c0ff715473543875da417c2116d1e87c919a49311b00b4e17962", + expectedOutput: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324252627", + recipeConfig: [ + { + op: "RC6 Decrypt", + args: [ + { string: "000102030405060708090a0b", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 80, 4 + ] + } + ] + }, + + // ============================================================ + // ADDITIONAL KEY SIZE TESTS - RC6-32 (192-bit and 256-bit keys) + // ============================================================ + { + name: "RC6-32/20/24: 192-bit key encrypt", + input: "000102030405060708090a0b0c0d0e0f", + expectedOutput: "a68a14ff1342262a2bbd21f7966615eb", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f1011121314151617", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 32, 20 + ] + } + ] + }, + { + name: "RC6-32/20/32: 256-bit key encrypt", + input: "000102030405060708090a0b0c0d0e0f", + expectedOutput: "921c3ecd43d9426a90089334d67aea2e", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Hex", "NO", 32, 20 + ] + } + ] + }, + + // ============================================================ + // ROUND-TRIP TESTS - One per word size to verify encrypt/decrypt + // ============================================================ + { + name: "RC6-8 Round-trip: CBC mode", + input: "Hello World!", + expectedOutput: "Hello World!", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "mysecret", option: "UTF8" }, + { string: "abcd", option: "UTF8" }, + "CBC", "Raw", "Hex", "PKCS5", 8, 12 + ] + }, + { + op: "RC6 Decrypt", + args: [ + { string: "mysecret", option: "UTF8" }, + { string: "abcd", option: "UTF8" }, + "CBC", "Hex", "Raw", "PKCS5", 8, 12 + ] + } + ] + }, + { + name: "RC6-16 Round-trip: CBC mode", + input: "The quick brown fox", + expectedOutput: "The quick brown fox", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "secretkey1234567", option: "UTF8" }, + { string: "initvec!", option: "UTF8" }, + "CBC", "Raw", "Hex", "PKCS5", 16, 16 + ] + }, + { + op: "RC6 Decrypt", + args: [ + { string: "secretkey1234567", option: "UTF8" }, + { string: "initvec!", option: "UTF8" }, + "CBC", "Hex", "Raw", "PKCS5", 16, 16 + ] + } + ] + }, + { + name: "RC6-32 Round-trip: CBC mode", + input: "The quick brown fox jumps over the lazy dog", + expectedOutput: "The quick brown fox jumps over the lazy dog", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "aabbccddeeff00112233445566778899", option: "Hex" }, + { string: "00112233445566778899aabbccddeeff", option: "Hex" }, + "CBC", "Raw", "Hex", "PKCS5", 32, 20 + ] + }, + { + op: "RC6 Decrypt", + args: [ + { string: "aabbccddeeff00112233445566778899", option: "Hex" }, + { string: "00112233445566778899aabbccddeeff", option: "Hex" }, + "CBC", "Hex", "Raw", "PKCS5", 32, 20 + ] + } + ] + }, + { + name: "RC6-64 Round-trip: CBC mode", + input: "RC6 with 64-bit words is powerful!", + expectedOutput: "RC6 with 64-bit words is powerful!", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" }, + { string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" }, + "CBC", "Raw", "Hex", "PKCS5", 64, 24 + ] + }, + { + op: "RC6 Decrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" }, + { string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" }, + "CBC", "Hex", "Raw", "PKCS5", 64, 24 + ] + } + ] + }, + { + name: "RC6-128 Round-trip: ECB mode", + input: "RC6 with 128-bit words provides massive block size for testing purposes!", + expectedOutput: "RC6 with 128-bit words provides massive block size for testing purposes!", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Raw", "Hex", "PKCS5", 128, 28 + ] + }, + { + op: "RC6 Decrypt", + args: [ + { string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Raw", "PKCS5", 128, 28 + ] + } + ] + }, + + // ============================================================ + // STREAM MODES TEST - Verify CFB/OFB/CTR work correctly + // ============================================================ + { + name: "RC6-32 Round-trip: CTR mode", + input: "CTR mode test message", + expectedOutput: "CTR mode test message", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "00112233445566778899aabbccddeeff", option: "Hex" }, + { string: "00000000000000000000000000000001", option: "Hex" }, + "CTR", "Raw", "Hex", "PKCS5", 32, 20 + ] + }, + { + op: "RC6 Decrypt", + args: [ + { string: "00112233445566778899aabbccddeeff", option: "Hex" }, + { string: "00000000000000000000000000000001", option: "Hex" }, + "CTR", "Hex", "Raw", "PKCS5", 32, 20 + ] + } + ] + }, + + // ============================================================ + // CUSTOM ROUNDS TEST - Verify non-standard round count works + // ============================================================ + { + name: "RC6-32 Round-trip: Custom 8 rounds", + input: "Testing custom rounds", + expectedOutput: "Testing custom rounds", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "00112233445566778899aabbccddeeff", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Raw", "Hex", "PKCS5", 32, 8 + ] + }, + { + op: "RC6 Decrypt", + args: [ + { string: "00112233445566778899aabbccddeeff", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Raw", "PKCS5", 32, 8 + ] + } + ] + }, + + // ============================================================ + // EDGE CASE TEST - Padding boundary + // ============================================================ + { + name: "RC6-32 Round-trip: Exact block size input", + input: "1234567890123456", + expectedOutput: "1234567890123456", + recipeConfig: [ + { + op: "RC6 Encrypt", + args: [ + { string: "00112233445566778899aabbccddeeff", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Raw", "Hex", "PKCS5", 32, 20 + ] + }, + { + op: "RC6 Decrypt", + args: [ + { string: "00112233445566778899aabbccddeeff", option: "Hex" }, + { string: "", option: "Hex" }, + "ECB", "Hex", "Raw", "PKCS5", 32, 20 + ] + } + ] + } +]); diff --git a/tests/operations/tests/TextIntegerConverter.mjs b/tests/operations/tests/TextIntegerConverter.mjs new file mode 100644 index 00000000..fed8f6c3 --- /dev/null +++ b/tests/operations/tests/TextIntegerConverter.mjs @@ -0,0 +1,199 @@ +/** + * Text-Integer Conversion tests. + * + * @author p-leriche [philip.leriche@cantab.net] + * + * @copyright Crown Copyright 2025 + * @license Apache-2.0 + */ +import TestRegister from "../../lib/TestRegister.mjs"; + +TestRegister.addTests([ + { + name: "Text-Integer Conversion quoted string to decimal", + input: "\"ABC\"", + expectedOutput: "4276803", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["Decimal"], + }, + ], + }, + { + name: "Text-Integer Conversion quoted string to hexadecimal", + input: "\"ABC\"", + expectedOutput: "0x414243", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["Hexadecimal"], + }, + ], + }, + { + name: "Text-Integer Conversion single quoted string to decimal", + input: "'Hello'", + expectedOutput: "310939249775", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["Decimal"], + }, + ], + }, + { + name: "Text-Integer Conversion decimal to string", + input: "4276803", + expectedOutput: "ABC", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["String"], + }, + ], + }, + { + name: "Text-Integer Conversion hexadecimal to string", + input: "0x48656C6C6F", + expectedOutput: "Hello", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["String"], + }, + ], + }, + { + name: "Text-Integer Conversion round-trip string.decimal.string", + input: "\"Test\"", + expectedOutput: "Test", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["Decimal"], + }, + { + op: "Text-Integer Conversion", + args: ["String"], + }, + ], + }, + { + name: "Text-Integer Conversion round-trip string.hex.string", + input: "\"CyberChef\"", + expectedOutput: "CyberChef", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["Hexadecimal"], + }, + { + op: "Text-Integer Conversion", + args: ["String"], + }, + ], + }, + { + name: "Text-Integer Conversion implicit round trip string-string Latin-1", + input: "U+00FF", + expectedOutput: "U+00FF", // U+00FF (Latin small letter y with diaeresis) + recipeConfig: [ + { + op: "Unescape Unicode Characters", + args: ["U+"], + }, + { + op: "Text-Integer Conversion", + args: ["String"], + }, + { + op: "Escape Unicode Characters", + args: ["U+", false, 4, true], + }, + ], + }, + { + name: "Text-Integer Conversion unquoted text to decimal", + input: "Hi", + expectedOutput: "18537", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["Decimal"], + }, + ], + }, + { + name: "Text-Integer Conversion single character", + input: "\"A\"", + expectedOutput: "65", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["Decimal"], + }, + ], + }, + { + name: "Text-Integer Conversion hex to decimal conversion", + input: "0xFF", + expectedOutput: "255", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["Decimal"], + }, + ], + }, + { + name: "Text-Integer Conversion decimal to hex conversion", + input: "255", + expectedOutput: "0xff", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["Hexadecimal"], + }, + ], + }, + { + name: "Text-Integer Conversion large number to string", + input: "113091951015816448506195587157728348242683688608116", + expectedOutput: "Mary had a little cat", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["String"], + }, + ], + }, + { + name: "Text-Integer Conversion whitespace handling (quoted)", + input: "\" test \"", + expectedOutput: "2314978187545944096", + recipeConfig: [ + { + op: "Text-Integer Conversion", + args: ["Decimal"], + }, + ], + }, + { + name: "Text-Integer Conversion non-Latin1 character in input", + input: "61 ce 93 61", + expectedOutput: +`Character at position 1 exceeds Latin-1 range (0-255). +Only ASCII and Latin-1 characters are supported.`, + recipeConfig: [ + { + "op": "From Hex", + "args": ["Auto"] + }, + { + op: "Text-Integer Conversion", + args: ["Decimal"], + }, + ], + }, +]);