Results 1 to 3 of 3
Thread: symmetric cipher help
- 11-19-2009, 07:03 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 1
- Rep Power
- 0
symmetric cipher help
i'm not sure where to go from here on my symmetric cipher program. i'm trying to use the "key" to encrypt "msg" with an XOR(^) to write an array like msg2. right now, the program writes this:
byte[] msg2 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,};
for example, xor the character codes for 'h' and 'd'; h^d == 12
public class symmetric {
public static void main(String args[]) {
String key = "helloworld";
String msg = "random text of awesomeness";
byte[] msg2 = {11,10,0,0,10,16,10,82,3,2,72,4,28,28,3,30,10,22,7 6,23,11,12,9,2,12,18,};
byte[] out = symmetric.crypt(key, msg.getBytes());
System.out.print("byte[] msg2 = {");
for (int i = 0; i < out.length; i++)
System.out.print(out[i]+",");
System.out.println("};");
out = symmetric.crypt(key, msg2);
String str = "";
for (int i = 0; i < out.length; i++)
str += (char)out[i];
System.out.println(str);
}
public static byte [] crypt(String key, byte[] msg) {
byte[] out = new byte[msg.length];
return out;
}
}
- 12-27-2011, 09:07 PM #2
Member
- Join Date
- Dec 2011
- Location
- Malta
- Posts
- 6
- Rep Power
- 0
Re: symmetric cipher help
I cant understand the program clearly can you please upload the symmetric class. Thank you.
-
Re: symmetric cipher help
Re-animated zombie thread: closing. Please let's not re-animate long dead threads.
Similar Threads
-
vigenere cipher
By swaart in forum New To JavaReplies: 7Last Post: 11-22-2011, 07:20 PM -
How to cipher a string without using Cipher class?
By arnab321 in forum New To JavaReplies: 1Last Post: 09-08-2009, 11:19 PM -
Need help with Ceasar Cipher question
By Gigi in forum New To JavaReplies: 3Last Post: 01-21-2009, 03:25 AM -
cipher.. Won't work
By jgonzalez14 in forum New To JavaReplies: 1Last Post: 11-18-2008, 01:22 PM


LinkBack URL
About LinkBacks

Bookmarks