mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 23:36:16 -04:00
Added MD6 operation. Closes #53
This commit is contained in:
parent
f1fe0b944f
commit
a736be7ca8
5 changed files with 83 additions and 20 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue