mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-12 01:01:32 -04:00
Added 'Key Padding' to Triple DES
This commit is contained in:
parent
82da498c24
commit
8d7b4a6b7d
3 changed files with 98 additions and 18 deletions
|
@ -53,6 +53,11 @@ class TripleDESDecrypt extends Operation {
|
|||
"name": "Output",
|
||||
"type": "option",
|
||||
"value": ["Raw", "Hex"]
|
||||
},
|
||||
{
|
||||
"name": "Key Padding",
|
||||
"type": "option",
|
||||
"value": ["None", "Null", "Repeat"]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
@ -63,11 +68,16 @@ class TripleDESDecrypt extends Operation {
|
|||
* @returns {string}
|
||||
*/
|
||||
run(input, args) {
|
||||
const key = Utils.convertToByteString(args[0].string, args[0].option),
|
||||
iv = Utils.convertToByteArray(args[1].string, args[1].option),
|
||||
var key = Utils.convertToByteString(args[0].string, args[0].option);
|
||||
const iv = Utils.convertToByteArray(args[1].string, args[1].option),
|
||||
mode = args[2],
|
||||
inputType = args[3],
|
||||
outputType = args[4];
|
||||
outputType = args[4],
|
||||
keyPadding = args[5];
|
||||
|
||||
if (keyPadding !== "None" && key.length < 24) {
|
||||
key = key.padEnd(24, keyPadding === "Null" ? "\0" : key);
|
||||
}
|
||||
|
||||
if (key.length !== 24) {
|
||||
throw new OperationError(`Invalid key length: ${key.length} bytes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue