hi
I should write a code to break AES encryption. I have the key in file
but its not complete so i have to guess the missing right most 16-
bits
out of 128-bits. I don't know how to treat the key at the level of
bit
where i get it as SecretKey. This is my code:
ObjectInputStream in = new ObjectInputStream(new
FileInputStream("SecretKey.ser"));
SecretKey key = (SecretKey)in.readObject();
byte[] raw = key.getEncoded();
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
how can i make a for loop to move over all possible key values.
please help
Roedy Green - 02 Apr 2008 21:39 GMT
On Wed, 2 Apr 2008 11:31:01 -0700 (PDT), polaris
<smarto59@hotmail.com> wrote, quoted or indirectly quoted someone who
said :
>how can i make a for loop to move over all possible key values.
see http://mindprod.com/jgloss/combination.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Arne Vajhøj - 09 Apr 2008 02:43 GMT
> I should write a code to break AES encryption. I have the key in file
> but its not complete so i have to guess the missing right most 16-
[quoted text clipped - 10 lines]
>
> how can i make a for loop to move over all possible key values.
Try:
for(int i = 0; i < 256; i++) {
raw[14] = (byte)i;
for(int j = 0; j < 256; j++) {
raw[15] = (byte)j;
// test raw
}
}
assuming you really have the first 112 bits and only miss the
last 16 bit of raw.
Arne