How would I encrypt a string using the XTEA scheme in Java.
Thanks
public class run {
public static void main(String[] args) throws Exception{
XTEA2 x= new XTEA2("keykey");
String s = "hi there";
byte[] theBytes = s.getBytes();
System.out.println("Plaintext: " + new String(theBytes));
x.encrypt(theBytes); //theBytes now contains the encrypted data
System.out.println("Crypo Text: " + new String(theBytes));
x.decrypt(theBytes); //theBytes now contains the decrypted data
System.out.println("Decrypted: " + new String(theBytes));
String str = new String(theBytes); //decrypted String
}
}
|
Works if it is padded properly. Thanks guys