mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-16 08:58:30 +01:00
63 lines
1.3 KiB
JavaScript
63 lines
1.3 KiB
JavaScript
/**
|
|
* @author n1073645 [n1073645@gmail.com]
|
|
* @copyright Crown Copyright 2020
|
|
* @license Apache-2.0
|
|
*/
|
|
|
|
import Operation from "../Operation.mjs";
|
|
import * as LS47 from "../lib/LS47.mjs";
|
|
|
|
/**
|
|
* LS47 Encrypt operation
|
|
*/
|
|
class LS47Encrypt extends Operation {
|
|
|
|
/**
|
|
* LS47Encrypt constructor
|
|
*/
|
|
constructor() {
|
|
super();
|
|
|
|
this.name = "LS47 Encrypt";
|
|
this.module = "Crypto";
|
|
this.description = "";
|
|
this.infoURL = "";
|
|
this.inputType = "string";
|
|
this.outputType = "string";
|
|
this.args = [
|
|
{
|
|
name: "Password",
|
|
type: "string",
|
|
value: ""
|
|
},
|
|
{
|
|
name: "Padding",
|
|
type: "number",
|
|
value: 10
|
|
},
|
|
{
|
|
name: "Signature",
|
|
type: "string",
|
|
value: ""
|
|
}
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @param {string} input
|
|
* @param {Object[]} args
|
|
* @returns {string}
|
|
*/
|
|
run(input, args) {
|
|
|
|
this.paddingSize = parseInt(args[1], 10);
|
|
|
|
LS47.initTiles();
|
|
|
|
const key = LS47.deriveKey(args[0]);
|
|
return LS47.encryptPad(key, input, args[2], this.paddingSize);
|
|
}
|
|
|
|
}
|
|
|
|
export default LS47Encrypt;
|