mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
Added 'XKCD Random Number' operation
This commit is contained in:
parent
f6b68f9880
commit
8518fa67f2
7 changed files with 152 additions and 87 deletions
|
@ -326,6 +326,7 @@ const Categories = [
|
|||
"Remove EXIF",
|
||||
"Extract EXIF",
|
||||
"Numberwang",
|
||||
"XKCD Random Number",
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -3966,6 +3966,13 @@ const OperationConfig = {
|
|||
value: StrUtils.HAMMING_INPUT_TYPE
|
||||
}
|
||||
]
|
||||
},
|
||||
"XKCD Random Number": {
|
||||
module: "Default",
|
||||
description: "RFC 1149.5 specifies 4 as the standard IEEE-vetted random number.<br><br><a href='https://xkcd.com/221/'>XKCD #221</a>",
|
||||
inputType: "string",
|
||||
outputType: "number",
|
||||
args: []
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ import StrUtils from "../../operations/StrUtils.js";
|
|||
import Tidy from "../../operations/Tidy.js";
|
||||
import Unicode from "../../operations/Unicode.js";
|
||||
import UUID from "../../operations/UUID.js";
|
||||
import XKCD from "../../operations/XKCD.js";
|
||||
|
||||
|
||||
/**
|
||||
* Default module.
|
||||
|
@ -161,6 +163,7 @@ OpModules.Default = {
|
|||
"Standard Deviation": Arithmetic.runStdDev,
|
||||
"Windows Filetime to UNIX Timestamp": Filetime.runFromFiletimeToUnix,
|
||||
"UNIX Timestamp to Windows Filetime": Filetime.runToFiletimeFromUnix,
|
||||
"XKCD Random Number": XKCD.runRandomNumber,
|
||||
|
||||
|
||||
/*
|
||||
|
|
26
src/core/operations/XKCD.js
Executable file
26
src/core/operations/XKCD.js
Executable file
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* XKCD operations.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*
|
||||
* @namespace
|
||||
*/
|
||||
const XKCD = {
|
||||
|
||||
/**
|
||||
* XKCD Random Number operation.
|
||||
*
|
||||
* @param {string} input
|
||||
* @param {Object[]} args
|
||||
* @returns {number}
|
||||
*/
|
||||
runRandomNumber: function(input, args) {
|
||||
return 4; // chosen by fair dice roll.
|
||||
// guaranteed to be random.
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
export default XKCD;
|
Loading…
Add table
Add a link
Reference in a new issue