mirror of
https://github.com/gchq/CyberChef
synced 2024-12-24 11:33:11 +00:00
Added MD6 operation. Closes #53
This commit is contained in:
parent
f1fe0b944f
commit
a736be7ca8
5 changed files with 83 additions and 20 deletions
45
package-lock.json
generated
45
package-lock.json
generated
|
@ -4,6 +4,15 @@
|
|||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"HTML_CodeSniffer": {
|
||||
"version": "github:squizlabs/HTML_CodeSniffer#d209ce54876657858a8a01528ad812cd234f37f0",
|
||||
"dev": true
|
||||
},
|
||||
"JSONSelect": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz",
|
||||
"integrity": "sha1-oI7cxn6z/L6Z7WMIVTRKDPKCu40="
|
||||
},
|
||||
"abab": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/abab/-/abab-1.0.3.tgz",
|
||||
|
@ -22,12 +31,12 @@
|
|||
"integrity": "sha1-IJ4W63DAlaA79/yCnsrLfHeS9e4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"HTML_CodeSniffer": "github:squizlabs/HTML_CodeSniffer#d209ce54876657858a8a01528ad812cd234f37f0",
|
||||
"axios": "0.9.1",
|
||||
"bluebird": "3.5.0",
|
||||
"chalk": "1.1.3",
|
||||
"commander": "2.11.0",
|
||||
"glob": "7.1.2",
|
||||
"HTML_CodeSniffer": "github:squizlabs/HTML_CodeSniffer#d209ce54876657858a8a01528ad812cd234f37f0",
|
||||
"jsdom": "9.12.0",
|
||||
"mkdirp": "0.5.1",
|
||||
"phantomjs-prebuilt": "2.1.15",
|
||||
|
@ -3524,10 +3533,6 @@
|
|||
"integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==",
|
||||
"dev": true
|
||||
},
|
||||
"HTML_CodeSniffer": {
|
||||
"version": "github:squizlabs/HTML_CodeSniffer#d209ce54876657858a8a01528ad812cd234f37f0",
|
||||
"dev": true
|
||||
},
|
||||
"html-comment-regex": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.1.tgz",
|
||||
|
@ -4141,12 +4146,12 @@
|
|||
"resolved": "https://registry.npmjs.org/jison/-/jison-0.4.13.tgz",
|
||||
"integrity": "sha1-kEFwfWIkE2f1iDRTK58ZwsNvrHg=",
|
||||
"requires": {
|
||||
"JSONSelect": "0.4.0",
|
||||
"cjson": "0.2.1",
|
||||
"ebnf-parser": "0.1.10",
|
||||
"escodegen": "0.0.21",
|
||||
"esprima": "1.0.4",
|
||||
"jison-lex": "0.2.1",
|
||||
"JSONSelect": "0.4.0",
|
||||
"lex-parser": "0.1.4",
|
||||
"nomnom": "1.5.2"
|
||||
},
|
||||
|
@ -4398,11 +4403,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"JSONSelect": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz",
|
||||
"integrity": "sha1-oI7cxn6z/L6Z7WMIVTRKDPKCu40="
|
||||
},
|
||||
"jsprim": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
|
||||
|
@ -4924,6 +4924,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node-md6": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/node-md6/-/node-md6-0.1.0.tgz",
|
||||
"integrity": "sha1-9WH0WyszY1K4KXbFHMoRR9U5N/U="
|
||||
},
|
||||
"nomnom": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.5.2.tgz",
|
||||
|
@ -6990,15 +6995,6 @@
|
|||
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
|
||||
"dev": true
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
|
||||
|
@ -7026,6 +7022,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
}
|
||||
},
|
||||
"stringstream": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
"lodash": "^4.17.4",
|
||||
"moment": "^2.17.1",
|
||||
"moment-timezone": "^0.5.11",
|
||||
"node-md6": "^0.1.0",
|
||||
"otp": "^0.1.3",
|
||||
"sladex-blowfish": "^0.8.1",
|
||||
"sortablejs": "^1.5.1",
|
||||
|
|
|
@ -247,6 +247,7 @@ const Categories = [
|
|||
"MD2",
|
||||
"MD4",
|
||||
"MD5",
|
||||
"MD6",
|
||||
"SHA0",
|
||||
"SHA1",
|
||||
"SHA224",
|
||||
|
|
|
@ -2882,6 +2882,29 @@ const OperationConfig = {
|
|||
outputType: "string",
|
||||
args: []
|
||||
},
|
||||
"MD6": {
|
||||
description: "TODO",
|
||||
run: Hash.runMD6,
|
||||
inputType: "string",
|
||||
outputType: "string",
|
||||
args: [
|
||||
{
|
||||
name: "Size",
|
||||
type: "number",
|
||||
value: Hash.MD6_SIZE
|
||||
},
|
||||
{
|
||||
name: "Levels",
|
||||
type: "number",
|
||||
value: Hash.MD6_LEVELS
|
||||
},
|
||||
{
|
||||
name: "Key",
|
||||
type: "string",
|
||||
value: ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"SHA0": {
|
||||
description: "SHA-0 is a retronym applied to the original version of the 160-bit hash function published in 1993 under the name 'SHA'. It was withdrawn shortly after publication due to an undisclosed 'significant flaw' and replaced by the slightly revised version SHA-1.",
|
||||
run: Hash.runSHA0,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Utils from "../Utils.js";
|
||||
import CryptoJS from "crypto-js";
|
||||
import CryptoApi from "crypto-api";
|
||||
import MD6 from "node-md6";
|
||||
import Checksum from "./Checksum.js";
|
||||
|
||||
|
||||
|
@ -52,6 +53,38 @@ const Hash = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
MD6_SIZE: 256,
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
MD6_LEVELS: 64,
|
||||
|
||||
/**
|
||||
* MD6 operation.
|
||||
*
|
||||
* @param {string} input
|
||||
* @param {Object[]} args
|
||||
* @returns {string}
|
||||
*/
|
||||
runMD6: function (input, args) {
|
||||
const size = args[0],
|
||||
levels = args[1],
|
||||
key = args[2];
|
||||
|
||||
if (size < 0 || size > 512)
|
||||
return "Size must be between 0 and 512";
|
||||
if (levels < 0)
|
||||
return "Levels must be greater than 0";
|
||||
|
||||
return MD6.getHashOfText(input, size, key, levels);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* SHA0 operation.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue