I have written my own AES-128bit implementation in Java, till yesterday I thought it would be alright. (I was working on the encryption) Now I’m trying to decrypt my encrypted cleartext, but this fails..
So, I hope I can ask such questions on here..
My Cleartext is: abcdefghijklmnop
This will be converted to the State Matrix (4x4, hexadezimal):
61 65 69 6d
62 66 6a 6e
63 67 6b 6f
64 68 6c 70
After that, it is going through the 10 rounds (The Key is generated randomly at the beginning, after that computed for every next round, will change that to a hash function later):
Round 1:
2c d3 db c6
3c 31 83 91
21 a9 f5 0d
48 9c 69 0a
Round 2:
9f 81 b2 c8
6e 4a 61 94
0a b8 cb a3
a4 4c 6c 57
Round 3:
01 3e a4 af
f0 69 fe 64
1f de 19 e1
cf a6 78 9e
Round 4:
d0 c9 40 e5
bd 81 de dc
8c 5a fd e2
61 84 37 65
Round 5:
19 51 92 00
63 f4 e9 33
15 48 8e ba
13 ae 7e 7a
Round 6:
1e 75 41 3d
34 ed fe 24
f6 02 64 39
ea 94 50 b1
Round 7:
a9 6a 6e 8a
7d 84 59 dd
b3 11 f3 d2
4d d8 e2 9c
Round 8:
e4 c3 89 0a
60 0a 29 e9
91 68 2c e4
13 23 e0 d8
Round 9:
24 c2 1c db
87 8c 22 bc
0b a8 3d e9
35 c2 3f 21
Round 10:
a9 58 3c 76
c0 db 39 20
58 db 80 3d
b6 63 b4 4e
And the KeyBlock from the beginning is:
d2 66 1b 52
08 fb 35 20
76 e9 11 1c
d3 7d 36 e0
And now, if i do the encryption backwards (with reversed tables and so on), i got this:
Round 1:
bf 5b d2 27
df 15 d0 d8
a6 70 69 07
b8 4c 4c 47
Round 2:
89 16 66 bc
1c 22 0e 56
bc db f0 77
7f b1 9e d4
Round 3:
bf ac 65 b8
70 70 8c a4
ef 6b 38 cc
63 13 ef 3e
Round 4:
28 ba 4b bd
44 63 d2 8c
33 aa ab 76
ba 71 02 00
Round 5:
ef 45 ee b9
fd e3 ce 09
1a 91 de 70
b2 95 22 2b
Round 6:
6c 95 6a c3
91 12 ec 27
62 df b7 49
ad ac 11 56
Round 7:
8a f5 d9 c7
68 0d be 3e
b0 58 45 bc
68 a1 ad b9
Round 8:
45 11 77 dd
84 cd f0 87
20 06 e8 3e
fe 32 4b e3
Round 9:
97 77 6c 8f
8c 36 c5 a7
56 ef f9 22
2d 4f 7d 03
So as you can see, there is something going on wrong.. I used this paper as main source of information (It’s in German), and I also used many other sites and Wikipedia (English Version) about Rijndael.
If someone can tell me anything with this information, that would be very very very cool, besides that I can also provide the source via email.
>>>
operator). You can always inline them later on using refactoring support of one of the major IDE's. I did not have that much of a problem implementing threefish anyway. That said, I've been doing bit operations for a very long time. $\endgroup$