I need to encrypt a string of 20-32 characters in my Android application, but the string generated have to be as small as possible, preferably 10-20 characters (max 32 characters anyhow). It's a necessary requirement for my app (doesn't matter the type of encryption).
I have no knowledge about cryptography technics, it's my first time using Android Crypto APIs.
I used this example as a start, it works but the generated string is too big.
Can you tell me please what i have to change to that code to achieve this? Or can you provide me some tutorial about this?
Note: I will mark as correct answer the answer with full code or link to a tutorial. Thanks!
UPDATE:
1) The algorithms I was thinking to use are AES CBC or CFB-8. With this encryption the length of the generated string is 64. I wasn't been able reduce the length to 32. Can you suggest a way to do this?
2) The thing is this string gets encrypted on a java web app, written on a rfid tag and decrypted on the Android app. How can I manage the encryption keys?
3) I didn't find any implementation/tutorial of the FPE (Format-Preserving Encryption) algorithm. Can you provide me one?
UPDATE 2:
I've decided that I need a more simple algorithm because it's enough that an average user not being able to read the information on the rfid tag. But the requirement of max 32 characters generated remains. Suggestions?
P.S. No matter what algorithm i tried in the above example and even if the input string had one letter, the size of the ciphertext was 64. (AES/ or DES/ CTR, CBC, ECB, CFB)