I am trying to store the results of a xor operation into a string array. When I run my code as shown, it is able to print out the values.
int[] randnumbs = new int[0];
randnumbs = streamGen(plaintext.length());
String plaintextnumb;
String encryption;
int[] answer = new int[0];
int count = 0;
while(true) {
plaintextnumb = plaintext.substring(count, count + 2);
int numbfromfile = Integer.valueOf(plaintextnumb, 16);
int xored = numbfromfile ^ randnumbs[count];
encryption = Integer.toHexString(xored);
System.out.print(encryption + " ");
if(count == (plaintext.length() / 2) - 1) {
break;
}else {
count++;
}
}
results:
af a0 52 b1 fb 0 a6 75
When I change my variable "encryption" to a String array my code is able to run but seams to stop running when it gets to where "encryption[count] = Integer.toHexString(xored);" I have never encountered this problem before. No errors are showing up when I run my program, it is just showing an empty console. I also inserted printout statements before and after this line of code and was only able to see the printout before the line of code, not after. Any explanation of why this is happening would be greatly appreciated!
int[] randnumbs = new int[0];
randnumbs = streamGen(plaintext.length());
String plaintextnumb;
String[] encryption = new String[0];
int[] answer = new int[0];
int count = 0;
while(true) {
plaintextnumb = plaintext.substring(count, count + 2);
int numbfromfile = Integer.valueOf(plaintextnumb, 16);
int xored = numbfromfile ^ randnumbs[count];
encryption[count] = Integer.toHexString(xored);
System.out.print(encryption[count] + " ");
if(count == (plaintext.length() / 2) - 1) {
break;
}else {
count++;
}
}