Image-Steganography-Library-Android
Image-Steganography-Library-Android copied to clipboard
Secret key of length >16 doesn't work
Describe the bug If the user passes secret key of length >16 to ImageSteganography constructor the convertKeyTo128bit method won't convert it properly. Instead of: result = result.substring(0, 16); it has: result = result.substring(0, 15);
And the encryption step fails then.
Possible solution without the pull request It is easy to fix in the library, but if it won't be fixed here is an easy workaround:
- Create class ImageSteganographyV2 which extends ImageSteganography
- Copy the whole code(since ImageSteganography doesn't open access to fields)
- Fix the bug by changing 15 to 16 in "result = result.substring(0, 15);"
- Create ImageSteganography instances using new class. For example:
ImageSteganography imageSteganography = new ImageSteganographyV2(message, secretKey, originalImage);
Everything else can stay the same