Revert "DES Encryption: Check Length of IV"
This reverts commit b785f4482a89a8c304fc03449d796ce036a5f85b.
This commit is contained in:
parent
7a7afebbd9
commit
9ddb207845
@ -90,7 +90,7 @@ export function fromHex(data, delim="Auto", byteLen=2) {
|
||||
const delimRegex = delim === "Auto" ? /[^a-f\d]/gi : Utils.regexRep(delim);
|
||||
data = data.replace(delimRegex, "");
|
||||
}
|
||||
|
||||
|
||||
const output = [];
|
||||
for (let i = 0; i < data.length; i += byteLen) {
|
||||
output.push(parseInt(data.substr(i, byteLen), 16));
|
||||
|
||||
@ -19,6 +19,7 @@ class DESEncrypt extends Operation {
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "DES Encrypt";
|
||||
this.module = "Ciphers";
|
||||
this.description = "DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.<br><br><b>Key:</b> DES uses a key length of 8 bytes (64 bits).<br>Triple DES uses a key length of 24 bytes (192 bits).<br><br>You can generate a password-based key using one of the KDF operations.<br><br><b>IV:</b> The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.<br><br><b>Padding:</b> In CBC and ECB mode, PKCS#7 padding will be used.";
|
||||
@ -72,13 +73,9 @@ class DESEncrypt extends Operation {
|
||||
DES uses a key length of 8 bytes (64 bits).
|
||||
Triple DES uses a key length of 24 bytes (192 bits).`);
|
||||
}
|
||||
else if(iv.length !== 8) {
|
||||
throw new OperationError(`Invalid IV length: ${iv.length} bytes
|
||||
|
||||
DES uses a iv length of 8 bytes (64 bits).`);
|
||||
|
||||
}
|
||||
input = Utils.convertToByteString(input, inputType);
|
||||
|
||||
const cipher = forge.cipher.createCipher("DES-" + mode, key);
|
||||
cipher.start({iv: iv});
|
||||
cipher.update(forge.util.createBuffer(input));
|
||||
|
||||
@ -415,7 +415,7 @@ color: white;
|
||||
},
|
||||
iv: {
|
||||
string: "threetwo",
|
||||
option: "utf8",
|
||||
option: "Hex",
|
||||
},
|
||||
mode: "ECB",
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user