mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46: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
|
@ -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