I have a key for a cipher in the form "XY XY+1 XY+2 XY+3 XY+4 XY+5 FF FF" where XY is an unknown byte, for example, XY could be 00000000 so XY+1 is 00000001. Also, FF is a constant so always 11111111.
l have an addBinary()
method which simply adds 1 to any binary string I give it, however, I'm finding it hard to generate all binary strings composing of "xxxx... 11111111 11111111".
I also found this printB()
method on StackOverflow which generates the strings but just not sure how to hard code the FF's into it.
static void printB()
{
for(int i = 0; i < Math.pow(2,8); i++)
{
String format="%0"+8+"d";
System.out.printf(format,Integer.valueOf(Integer.toBinaryString(i)));
System.out.println();
}
}
Any help on how to generate this strings would be appreciated