I tried to change a couple of things, but the zeros remained. Any idea how I can get rid of them? Would it have to do with main
or maybe with encrypt
and decrypt
methods?
public static void main(String args[]) {
Tea t = new Tea(k, p);
p[0] = 0x01234567;
p[1] = 0x89abcdef;
k[0] = 0xa56babcd;
k[1] = 0xffffffff;
k[2] = 0xffffffff;
k[3] = 0xabcdef01;
System.out.println("Plaintext: " + Integer.toHexString(p[0]) + Integer.toHexString(p[1]));
System.out.println("Key: " + Integer.toHexString(k[0]) + Integer.toHexString(k[1])
+ Integer.toHexString(k[2]) + Integer.toHexString(k[3]));
System.out.print("Ciphertext: ");
int cipher = t.encrypt(p, k);
System.out.println(Integer.toHexString(cipher));
System.out.print("Decrypted Plaintext: ");
int decryptplain = t.decrypt(p, k);
System.out.println(Integer.toHexString(decryptplain));
}
Output:
Plaintext: 123456789abcdef
Key: a56babcdffffffffffffffffabcdef01
Ciphertext: fe18f8f3fcb8dcd3
0
Decrypted Plaintext: 123456789abcdef
0
User contributions licensed under CC BY-SA 3.0