}
else
{
+ // ECB Blowfish encodes in blocks of 12 chars, so anything else is malformed input
+ if ((temp.length() % 12) != 0)
+ return cipherText;
+
temp = b64ToByte(temp);
while ((temp.length() % 8) != 0) temp.append('\0');
}
if (!cipher.ok())
return cipherText;
- if (direction)
+ if (direction) {
+ // Sanity check
+ if ((temp2.length() % 8) != 0)
+ return cipherText;
+
temp2 = byteToB64(temp2);
+ }
return temp2;
}
right += v;
for (int i = 0; i < 6; i++) {
- encoded.append(base64.at(right & 0x3F).toAscii());
+ encoded.append(base64.at(right & 0x3F).toLatin1());
right = right >> 6;
}
- //TODO make sure the .toascii doesn't break anything
+ //TODO make sure the .toLatin1 doesn't break anything
for (int i = 0; i < 6; i++) {
- encoded.append(base64.at(left & 0x3F).toAscii());
+ encoded.append(base64.at(left & 0x3F).toLatin1());
left = left >> 6;
}
}