I\'m trying to encrypt some integers in java using java.security and javax.crypto.
The problem seems to be that the Cipher class only encrypts byte arrays. I can\'t d
My Simple Solution is that Encrypt Integer to the String by shifting ASCII Value of the Integer by the secret key you Provide.
Here is the Solution:
public String encodeDiscussionId(int Id) {
String tempEn = Id + "";
String encryptNum ="";
for(int i=0;i
Steps to Encode:
String temp = givenInt + ""
Integer
into Character and concatenate to the String encryptNum
and finally return it.Steps to Decode:
decodeText
. As previous encode output is always String '???'
and vary according to number of digits of input Id
.