Merge pull request #933 from cbeuw/blowfish-keyfix

This commit is contained in:
a3957273 2024-03-31 00:39:33 +00:00 committed by GitHub
commit 8647b50cca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 46 additions and 4 deletions

View file

@ -70,10 +70,14 @@ class BlowfishDecrypt extends Operation {
inputType = args[3],
outputType = args[4];
if (key.length !== 8) {
if (key.length < 4 || key.length > 56) {
throw new OperationError(`Invalid key length: ${key.length} bytes
Blowfish uses a key length of 8 bytes (64 bits).`);
Blowfish's key length needs to be between 4 and 56 bytes (32-448 bits).`);
}
if (iv.length !== 8) {
throw new OperationError(`Invalid IV length: ${iv.length} bytes. Expected 8 bytes`);
}
input = Utils.convertToByteString(input, inputType);