Browse Source

Updated many dependencies including Webpack (v4) and crypto-api (v0.8)

n1474335 7 years ago
parent
commit
574207c626
6 changed files with 491 additions and 225 deletions
  1. 8 18
      Gruntfile.js
  2. 433 165
      package-lock.json
  3. 24 24
      package.json
  4. 1 1
      src/core/config/OperationConfig.js
  5. 21 17
      src/core/operations/Hash.js
  6. 4 0
      webpack.config.js

+ 8 - 18
Gruntfile.js

@@ -185,6 +185,7 @@ module.exports = function (grunt) {
         webpack: {
             options: webpackConfig,
             metaConf: {
+                mode: "production",
                 target: "node",
                 entry: [
                     "babel-polyfill",
@@ -200,6 +201,7 @@ module.exports = function (grunt) {
                 externals: [NodeExternals()],
             },
             metaConfDev: {
+                mode: "development",
                 target: "node",
                 entry: [
                     "babel-polyfill",
@@ -216,6 +218,7 @@ module.exports = function (grunt) {
                 watch: true
             },
             web: {
+                mode: "production",
                 target: "web",
                 entry: Object.assign({
                     main: "./src/web/index.js",
@@ -231,15 +234,6 @@ module.exports = function (grunt) {
                 },
                 plugins: [
                     new webpack.DefinePlugin(BUILD_CONSTANTS),
-                    new webpack.optimize.UglifyJsPlugin({
-                        compress: {
-                            "screw_ie8": true,
-                            "dead_code": true,
-                            "unused": true,
-                            "warnings": false
-                        },
-                        comments: false,
-                    }),
                     new HtmlWebpackPlugin({
                         filename: "index.html",
                         template: "./src/web/html/index.html",
@@ -256,6 +250,7 @@ module.exports = function (grunt) {
                 ]
             },
             webInline: {
+                mode: "production",
                 target: "web",
                 entry: "./src/web/index.js",
                 output: {
@@ -264,15 +259,6 @@ module.exports = function (grunt) {
                 },
                 plugins: [
                     new webpack.DefinePlugin(BUILD_CONSTANTS),
-                    new webpack.optimize.UglifyJsPlugin({
-                        compress: {
-                            "screw_ie8": true,
-                            "dead_code": true,
-                            "unused": true,
-                            "warnings": false
-                        },
-                        comments: false,
-                    }),
                     new HtmlWebpackPlugin({
                         filename: "cyberchef.htm",
                         template: "./src/web/html/index.html",
@@ -289,6 +275,7 @@ module.exports = function (grunt) {
                 ]
             },
             tests: {
+                mode: "development",
                 target: "node",
                 entry: "./test/index.js",
                 externals: [NodeExternals()],
@@ -301,6 +288,7 @@ module.exports = function (grunt) {
                 ]
             },
             node: {
+                mode: "production",
                 target: "node",
                 entry: "./src/node/index.js",
                 externals: [NodeExternals()],
@@ -327,11 +315,13 @@ module.exports = function (grunt) {
                     children: false,
                     chunks: false,
                     modules: false,
+                    entrypoints: false,
                     warningsFilter: /source-map/,
                 }
             },
             start: {
                 webpack: {
+                    mode: "development",
                     target: "web",
                     entry: Object.assign({
                         main: "./src/web/index.js"

File diff suppressed because it is too large
+ 433 - 165
package-lock.json


+ 24 - 24
package.json

@@ -31,15 +31,15 @@
   "bugs": "https://github.com/gchq/CyberChef/issues",
   "devDependencies": {
     "babel-core": "^6.26.0",
-    "babel-loader": "^7.1.2",
+    "babel-loader": "^7.1.3",
     "babel-preset-env": "^1.6.1",
-    "css-loader": "^0.28.9",
-    "eslint": "^4.17.0",
-    "exports-loader": "^0.6.4",
-    "extract-text-webpack-plugin": "^3.0.2",
-    "file-loader": "^1.1.6",
-    "grunt": ">=1.0.1",
-    "grunt-accessibility": "~5.0.0",
+    "css-loader": "^0.28.10",
+    "eslint": "^4.18.1",
+    "exports-loader": "^0.7.0",
+    "extract-text-webpack-plugin": "^4.0.0-alpha0",
+    "file-loader": "^1.1.10",
+    "grunt": ">=1.0.2",
+    "grunt-accessibility": "~6.0.0",
     "grunt-chmod": "~1.1.1",
     "grunt-concurrent": "^2.3.1",
     "grunt-contrib-clean": "~1.1.0",
@@ -49,24 +49,24 @@
     "grunt-execute": "^0.2.2",
     "grunt-jsdoc": "^2.2.1",
     "grunt-webpack": "^3.0.2",
-    "html-webpack-plugin": "^2.30.1",
-    "imports-loader": "^0.7.1",
+    "html-webpack-plugin": "^3.0.4",
+    "imports-loader": "^0.8.0",
     "ink-docstrap": "^1.3.2",
     "jsdoc-babel": "^0.3.0",
-    "less": "^2.7.3",
-    "less-loader": "^4.0.5",
+    "less": "^3.0.1",
+    "less-loader": "^4.0.6",
     "postcss-css-variables": "^0.8.0",
-    "postcss-import": "^11.0.0",
-    "postcss-loader": "^2.0.10",
+    "postcss-import": "^11.1.0",
+    "postcss-loader": "^2.1.1",
     "sitemap": "^1.13.0",
-    "style-loader": "^0.19.1",
+    "style-loader": "^0.20.2",
     "url-loader": "^0.6.2",
     "val-loader": "^1.1.0",
     "web-resource-inliner": "^4.2.1",
-    "webpack": "^3.10.0",
-    "webpack-dev-server": "^2.11.1",
+    "webpack": "^4.0.1",
+    "webpack-dev-server": "^3.1.0",
     "webpack-node-externals": "^1.6.0",
-    "worker-loader": "^1.1.0"
+    "worker-loader": "^1.1.1"
   },
   "dependencies": {
     "babel-polyfill": "^6.26.0",
@@ -74,10 +74,10 @@
     "bootstrap": "^3.3.7",
     "bootstrap-colorpicker": "^2.5.2",
     "bootstrap-switch": "^3.3.4",
-    "crypto-api": "^0.7.5",
+    "crypto-api": "^0.8.0",
     "crypto-js": "^3.1.9-1",
     "diff": "^3.4.0",
-    "escodegen": "^1.9.0",
+    "escodegen": "^1.9.1",
     "esmangle": "^1.0.1",
     "esprima": "^4.0.0",
     "exif-parser": "^0.1.12",
@@ -88,13 +88,13 @@
     "js-sha3": "^0.7.0",
     "jsbn": "^1.1.0",
     "jsonpath": "^1.0.0",
-    "jsrsasign": "8.0.4",
-    "lodash": "^4.17.4",
+    "jsrsasign": "8.0.6",
+    "lodash": "^4.17.5",
     "loglevel": "^1.6.1",
     "loglevel-message-prefix": "^3.0.0",
     "moment": "^2.20.1",
     "moment-timezone": "^0.5.14",
-    "node-forge": "^0.7.1",
+    "node-forge": "^0.7.2",
     "node-md6": "^0.1.0",
     "nwmatcher": "^1.4.3",
     "otp": "^0.1.3",
@@ -106,7 +106,7 @@
     "vkbeautify": "^0.99.3",
     "xmldom": "^0.1.27",
     "xpath": "0.0.27",
-    "xregexp": "^4.0.0",
+    "xregexp": "^4.1.1",
     "zlibjs": "^0.3.1"
   },
   "scripts": {

+ 1 - 1
src/core/config/OperationConfig.js

@@ -3181,7 +3181,7 @@ const OperationConfig = {
         outputType: "string",
         args: [
             {
-                name: "Password",
+                name: "Key",
                 type: "binaryString",
                 value: ""
             },

+ 21 - 17
src/core/operations/Hash.js

@@ -1,5 +1,5 @@
 import Utils from "../Utils.js";
-import CryptoApi from "crypto-api";
+import CryptoApi from "babel-loader!crypto-api";
 import MD6 from "node-md6";
 import * as SHA3 from "js-sha3";
 import Checksum from "./Checksum.js";
@@ -21,14 +21,11 @@ const Hash = {
      *
      * @param {string} name
      * @param {string} input
+     * @para, {Object} [options={}]
      * @returns {string}
      */
-    runHash: function(name, input) {
-        const hasher = CryptoApi.hasher(name);
-        hasher.state.message = input;
-        hasher.state.length += input.length;
-        hasher.process();
-        return hasher.finalize().stringify("hex");
+    runHash: function(name, input, options={}) {
+        return CryptoApi.hash(name, input, options);
     },
 
 
@@ -329,9 +326,10 @@ const Hash = {
      * @returns {string}
      */
     runSnefru: function (input, args) {
-        const rounds = args[0],
-            size = args[1];
-        return Hash.runHash(`snefru-${rounds}-${size}`, input);
+        return Hash.runHash("snefru", input, {
+            rounds: args[0],
+            length: args[1]
+        });
     },
 
 
@@ -358,7 +356,8 @@ const Hash = {
         "HAS160",
         "Whirlpool",
         "Whirlpool-0",
-        "Whirlpool-T"
+        "Whirlpool-T",
+        "Snefru"
     ],
 
     /**
@@ -369,12 +368,17 @@ const Hash = {
      * @returns {string}
      */
     runHMAC: function (input, args) {
-        const password = args[0],
-            hashFunc = args[1].toLowerCase(),
-            hmac = CryptoApi.mac("hmac", password, hashFunc, {});
-
-        hmac.update(input);
-        return hmac.finalize().stringify("hex");
+        const key = args[0],
+            hashFunc = args[1].toLowerCase();
+        let hasher = CryptoApi.getHasher(hashFunc);
+
+        // Horrible shim to fix constructor bug. Reported in nf404/crypto-api#8
+        hasher.reset = () => {
+            hasher.state = {};
+            const tmp = new hasher.constructor();
+            hasher.state = tmp.state;
+        };
+        return CryptoApi.hmac(key, input, hasher);
     },
 
 

+ 4 - 0
webpack.config.js

@@ -109,9 +109,13 @@ module.exports = {
         children: false,
         chunks: false,
         modules: false,
+        entrypoints: false,
         warningsFilter: /source-map/,
     },
     node: {
         fs: "empty"
+    },
+    performance: {
+        hints: false
     }
 };

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