Defining full 8-bit byte data like the key and IV as ASCII strings, hoping they get magically converted by the compiler, will lead to unexpected results. Secondly, the buffer, when decrypted, certainly won't have a 0 byte at the end, so printing it as is, even if it is printable, will get another unexpected result.

The reason I'm writing this contrary to simply patching is people with homework will find this page and learn nothing from it otherwise.

after getting the cipher, which is encrypted byte[]. am converting it into
cipherString = new String(cipher, "UTF-8");
and again am sending it as
decrypt(cipherString.getBytes("UTF-8"), encryptionKey);
but its giving javax.crypto.IllegalBlockSizeException: Input length not multiple of 16 bytes
exception please give a solution.

Note: In any cost i want cipher in String format first, then i need to pass it as getBytes();
please suggest.

Hi, I am interested in that sample because i need for my thesis. But i can't dowload the correct lib. I need the mcrypt.c and mcrypt.h right? and i don't know. The files that i downloaded do not match...