EMMA Coverage Report (generated Sun Mar 01 22:06:14 CET 2015)
[all classes][org.h2.security]

COVERAGE SUMMARY FOR SOURCE FILE [AES.java]

nameclass, %method, %block, %line, %
AES.java100% (1/1)100% (12/12)100% (4088/4088)100% (192/192)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AES100% (1/1)100% (12/12)100% (4088/4088)100% (192/192)
<static initializer> 100% (1/1)100% (285/285)100% (44/44)
AES (): void 100% (1/1)100% (11/11)100% (3/3)
decrypt (byte [], int, int): void 100% (1/1)100% (15/15)100% (3/3)
decryptBlock (byte [], byte [], int): void 100% (1/1)100% (1680/1680)100% (55/55)
encrypt (byte [], int, int): void 100% (1/1)100% (15/15)100% (3/3)
encryptBlock (byte [], byte [], int): void 100% (1/1)100% (1680/1680)100% (54/54)
getDec (int): int 100% (1/1)100% (38/38)100% (1/1)
getKeyLength (): int 100% (1/1)100% (2/2)100% (1/1)
mul (int [], int [], int, int): int 100% (1/1)100% (18/18)100% (1/1)
rot8 (int): int 100% (1/1)100% (8/8)100% (1/1)
setKey (byte []): void 100% (1/1)100% (322/322)100% (25/25)
xtime (int): int 100% (1/1)100% (14/14)100% (1/1)

1/*
2 * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (http://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6package org.h2.security;
7 
8/**
9 * An implementation of the AES block cipher algorithm,
10 * also known as Rijndael. Only AES-128 is supported by this class.
11 */
12public class AES implements BlockCipher {
13 
14    private static final int[] RCON = new int[10];
15    private static final int[] FS = new int[256];
16    private static final int[] FT0 = new int[256];
17    private static final int[] FT1 = new int[256];
18    private static final int[] FT2 = new int[256];
19    private static final int[] FT3 = new int[256];
20    private static final int[] RS = new int[256];
21    private static final int[] RT0 = new int[256];
22    private static final int[] RT1 = new int[256];
23    private static final int[] RT2 = new int[256];
24    private static final int[] RT3 = new int[256];
25    private final int[] encKey = new int[44];
26    private final int[] decKey = new int[44];
27 
28    private static int rot8(int x) {
29        return (x >>> 8) | (x << 24);
30    }
31 
32    private static int xtime(int x) {
33        return ((x << 1) ^ (((x & 0x80) != 0) ? 0x1b : 0)) & 255;
34    }
35 
36    private static int mul(int[] pow, int[] log, int x, int y) {
37        return (x != 0 && y != 0) ? pow[(log[x] + log[y]) % 255] : 0;
38    }
39 
40    static {
41        int[] pow = new int[256];
42        int[] log = new int[256];
43        for (int i = 0, x = 1; i < 256; i++, x ^= xtime(x)) {
44            pow[i] = x;
45            log[x] = i;
46        }
47        for (int i = 0, x = 1; i < 10; i++, x = xtime(x)) {
48            RCON[i] = x << 24;
49        }
50        FS[0x00] = 0x63;
51        RS[0x63] = 0x00;
52        for (int i = 1; i < 256; i++) {
53            int x = pow[255 - log[i]], y = x;
54            y = ((y << 1) | (y >> 7)) & 255;
55            x ^= y;
56            y = ((y << 1) | (y >> 7)) & 255;
57            x ^= y;
58            y = ((y << 1) | (y >> 7)) & 255;
59            x ^= y;
60            y = ((y << 1) | (y >> 7)) & 255;
61            x ^= y ^ 0x63;
62            FS[i] = x & 255;
63            RS[x] = i & 255;
64        }
65        for (int i = 0; i < 256; i++) {
66            int x = FS[i], y = xtime(x);
67            FT0[i] = (x ^ y) ^ (x << 8) ^ (x << 16) ^ (y << 24);
68            FT1[i] = rot8(FT0[i]);
69            FT2[i] = rot8(FT1[i]);
70            FT3[i] = rot8(FT2[i]);
71            y = RS[i];
72            RT0[i] = mul(pow, log, 0x0b, y) ^ (mul(pow, log, 0x0d, y) << 8)
73                ^ (mul(pow, log, 0x09, y) << 16) ^ (mul(pow, log, 0x0e, y) << 24);
74            RT1[i] = rot8(RT0[i]);
75            RT2[i] = rot8(RT1[i]);
76            RT3[i] = rot8(RT2[i]);
77        }
78    }
79 
80    private static int getDec(int t) {
81        return RT0[FS[(t >> 24) & 255]] ^ RT1[FS[(t >> 16) & 255]]
82                ^ RT2[FS[(t >> 8) & 255]] ^ RT3[FS[t & 255]];
83    }
84 
85    @Override
86    public void setKey(byte[] key) {
87        for (int i = 0, j = 0; i < 4; i++) {
88            encKey[i] = decKey[i] = ((key[j++] & 255) << 24)
89                    | ((key[j++] & 255) << 16) | ((key[j++] & 255) << 8)
90                    | (key[j++] & 255);
91        }
92        int e = 0;
93        for (int i = 0; i < 10; i++, e += 4) {
94            encKey[e + 4] = encKey[e] ^ RCON[i]
95                    ^ (FS[(encKey[e + 3] >> 16) & 255] << 24)
96                    ^ (FS[(encKey[e + 3] >> 8) & 255] << 16)
97                    ^ (FS[(encKey[e + 3]) & 255] << 8)
98                    ^ FS[(encKey[e + 3] >> 24) & 255];
99            encKey[e + 5] = encKey[e + 1] ^ encKey[e + 4];
100            encKey[e + 6] = encKey[e + 2] ^ encKey[e + 5];
101            encKey[e + 7] = encKey[e + 3] ^ encKey[e + 6];
102        }
103        int d = 0;
104        decKey[d++] = encKey[e++];
105        decKey[d++] = encKey[e++];
106        decKey[d++] = encKey[e++];
107        decKey[d++] = encKey[e++];
108        for (int i = 1; i < 10; i++) {
109            e -= 8;
110            decKey[d++] = getDec(encKey[e++]);
111            decKey[d++] = getDec(encKey[e++]);
112            decKey[d++] = getDec(encKey[e++]);
113            decKey[d++] = getDec(encKey[e++]);
114        }
115        e -= 8;
116        decKey[d++] = encKey[e++];
117        decKey[d++] = encKey[e++];
118        decKey[d++] = encKey[e++];
119        decKey[d] = encKey[e];
120    }
121 
122    @Override
123    public void encrypt(byte[] bytes, int off, int len) {
124        for (int i = off; i < off + len; i += 16) {
125            encryptBlock(bytes, bytes, i);
126        }
127    }
128 
129    @Override
130    public void decrypt(byte[] bytes, int off, int len) {
131        for (int i = off; i < off + len; i += 16) {
132            decryptBlock(bytes, bytes, i);
133        }
134    }
135 
136    private void encryptBlock(byte[] in, byte[] out, int off) {
137        int[] k = encKey;
138        int x0 = ((in[off] << 24) | ((in[off + 1] & 255) << 16)
139                | ((in[off + 2] & 255) << 8) | (in[off + 3] & 255)) ^ k[0];
140        int x1 = ((in[off + 4] << 24) | ((in[off + 5] & 255) << 16)
141                | ((in[off + 6] & 255) << 8) | (in[off + 7] & 255)) ^ k[1];
142        int x2 = ((in[off + 8] << 24) | ((in[off + 9] & 255) << 16)
143                | ((in[off + 10] & 255) << 8) | (in[off + 11] & 255)) ^ k[2];
144        int x3 = ((in[off + 12] << 24) | ((in[off + 13] & 255) << 16)
145                | ((in[off + 14] & 255) << 8) | (in[off + 15] & 255)) ^ k[3];
146        int y0 = FT0[(x0 >> 24) & 255] ^ FT1[(x1 >> 16) & 255]
147                ^ FT2[(x2 >> 8) & 255] ^ FT3[x3 & 255] ^ k[4];
148        int y1 = FT0[(x1 >> 24) & 255] ^ FT1[(x2 >> 16) & 255]
149                ^ FT2[(x3 >> 8) & 255] ^ FT3[x0 & 255] ^ k[5];
150        int y2 = FT0[(x2 >> 24) & 255] ^ FT1[(x3 >> 16) & 255]
151                ^ FT2[(x0 >> 8) & 255] ^ FT3[x1 & 255] ^ k[6];
152        int y3 = FT0[(x3 >> 24) & 255] ^ FT1[(x0 >> 16) & 255]
153                ^ FT2[(x1 >> 8) & 255] ^ FT3[x2 & 255] ^ k[7];
154        x0 = FT0[(y0 >> 24) & 255] ^ FT1[(y1 >> 16) & 255]
155                ^ FT2[(y2 >> 8) & 255] ^ FT3[y3 & 255] ^ k[8];
156        x1 = FT0[(y1 >> 24) & 255] ^ FT1[(y2 >> 16) & 255]
157                ^ FT2[(y3 >> 8) & 255] ^ FT3[y0 & 255] ^ k[9];
158        x2 = FT0[(y2 >> 24) & 255] ^ FT1[(y3 >> 16) & 255]
159                ^ FT2[(y0 >> 8) & 255] ^ FT3[y1 & 255] ^ k[10];
160        x3 = FT0[(y3 >> 24) & 255] ^ FT1[(y0 >> 16) & 255]
161                ^ FT2[(y1 >> 8) & 255] ^ FT3[y2 & 255] ^ k[11];
162        y0 = FT0[(x0 >> 24) & 255] ^ FT1[(x1 >> 16) & 255]
163                ^ FT2[(x2 >> 8) & 255] ^ FT3[x3 & 255] ^ k[12];
164        y1 = FT0[(x1 >> 24) & 255] ^ FT1[(x2 >> 16) & 255]
165                ^ FT2[(x3 >> 8) & 255] ^ FT3[x0 & 255] ^ k[13];
166        y2 = FT0[(x2 >> 24) & 255] ^ FT1[(x3 >> 16) & 255]
167                ^ FT2[(x0 >> 8) & 255] ^ FT3[x1 & 255] ^ k[14];
168        y3 = FT0[(x3 >> 24) & 255] ^ FT1[(x0 >> 16) & 255]
169                ^ FT2[(x1 >> 8) & 255] ^ FT3[x2 & 255] ^ k[15];
170        x0 = FT0[(y0 >> 24) & 255] ^ FT1[(y1 >> 16) & 255]
171                ^ FT2[(y2 >> 8) & 255] ^ FT3[y3 & 255] ^ k[16];
172        x1 = FT0[(y1 >> 24) & 255] ^ FT1[(y2 >> 16) & 255]
173                ^ FT2[(y3 >> 8) & 255] ^ FT3[y0 & 255] ^ k[17];
174        x2 = FT0[(y2 >> 24) & 255] ^ FT1[(y3 >> 16) & 255]
175                ^ FT2[(y0 >> 8) & 255] ^ FT3[y1 & 255] ^ k[18];
176        x3 = FT0[(y3 >> 24) & 255] ^ FT1[(y0 >> 16) & 255]
177                ^ FT2[(y1 >> 8) & 255] ^ FT3[y2 & 255] ^ k[19];
178        y0 = FT0[(x0 >> 24) & 255] ^ FT1[(x1 >> 16) & 255]
179                ^ FT2[(x2 >> 8) & 255] ^ FT3[x3 & 255] ^ k[20];
180        y1 = FT0[(x1 >> 24) & 255] ^ FT1[(x2 >> 16) & 255]
181                ^ FT2[(x3 >> 8) & 255] ^ FT3[x0 & 255] ^ k[21];
182        y2 = FT0[(x2 >> 24) & 255] ^ FT1[(x3 >> 16) & 255]
183                ^ FT2[(x0 >> 8) & 255] ^ FT3[x1 & 255] ^ k[22];
184        y3 = FT0[(x3 >> 24) & 255] ^ FT1[(x0 >> 16) & 255]
185                ^ FT2[(x1 >> 8) & 255] ^ FT3[x2 & 255] ^ k[23];
186        x0 = FT0[(y0 >> 24) & 255] ^ FT1[(y1 >> 16) & 255]
187                ^ FT2[(y2 >> 8) & 255] ^ FT3[y3 & 255] ^ k[24];
188        x1 = FT0[(y1 >> 24) & 255] ^ FT1[(y2 >> 16) & 255]
189                ^ FT2[(y3 >> 8) & 255] ^ FT3[y0 & 255] ^ k[25];
190        x2 = FT0[(y2 >> 24) & 255] ^ FT1[(y3 >> 16) & 255]
191                ^ FT2[(y0 >> 8) & 255] ^ FT3[y1 & 255] ^ k[26];
192        x3 = FT0[(y3 >> 24) & 255] ^ FT1[(y0 >> 16) & 255]
193                ^ FT2[(y1 >> 8) & 255] ^ FT3[y2 & 255] ^ k[27];
194        y0 = FT0[(x0 >> 24) & 255] ^ FT1[(x1 >> 16) & 255]
195                ^ FT2[(x2 >> 8) & 255] ^ FT3[x3 & 255] ^ k[28];
196        y1 = FT0[(x1 >> 24) & 255] ^ FT1[(x2 >> 16) & 255]
197                ^ FT2[(x3 >> 8) & 255] ^ FT3[x0 & 255] ^ k[29];
198        y2 = FT0[(x2 >> 24) & 255] ^ FT1[(x3 >> 16) & 255]
199                ^ FT2[(x0 >> 8) & 255] ^ FT3[x1 & 255] ^ k[30];
200        y3 = FT0[(x3 >> 24) & 255] ^ FT1[(x0 >> 16) & 255]
201                ^ FT2[(x1 >> 8) & 255] ^ FT3[x2 & 255] ^ k[31];
202        x0 = FT0[(y0 >> 24) & 255] ^ FT1[(y1 >> 16) & 255]
203                ^ FT2[(y2 >> 8) & 255] ^ FT3[y3 & 255] ^ k[32];
204        x1 = FT0[(y1 >> 24) & 255] ^ FT1[(y2 >> 16) & 255]
205                ^ FT2[(y3 >> 8) & 255] ^ FT3[y0 & 255] ^ k[33];
206        x2 = FT0[(y2 >> 24) & 255] ^ FT1[(y3 >> 16) & 255]
207                ^ FT2[(y0 >> 8) & 255] ^ FT3[y1 & 255] ^ k[34];
208        x3 = FT0[(y3 >> 24) & 255] ^ FT1[(y0 >> 16) & 255]
209                ^ FT2[(y1 >> 8) & 255] ^ FT3[y2 & 255] ^ k[35];
210        y0 = FT0[(x0 >> 24) & 255] ^ FT1[(x1 >> 16) & 255]
211                ^ FT2[(x2 >> 8) & 255] ^ FT3[x3 & 255] ^ k[36];
212        y1 = FT0[(x1 >> 24) & 255] ^ FT1[(x2 >> 16) & 255]
213                ^ FT2[(x3 >> 8) & 255] ^ FT3[x0 & 255] ^ k[37];
214        y2 = FT0[(x2 >> 24) & 255] ^ FT1[(x3 >> 16) & 255]
215                ^ FT2[(x0 >> 8) & 255] ^ FT3[x1 & 255] ^ k[38];
216        y3 = FT0[(x3 >> 24) & 255] ^ FT1[(x0 >> 16) & 255]
217                ^ FT2[(x1 >> 8) & 255] ^ FT3[x2 & 255] ^ k[39];
218        x0 = ((FS[(y0 >> 24) & 255] << 24) | (FS[(y1 >> 16) & 255] << 16)
219                | (FS[(y2 >> 8) & 255] << 8) | FS[y3 & 255]) ^ k[40];
220        x1 = ((FS[(y1 >> 24) & 255] << 24) | (FS[(y2 >> 16) & 255] << 16)
221                | (FS[(y3 >> 8) & 255] << 8) | FS[y0 & 255]) ^ k[41];
222        x2 = ((FS[(y2 >> 24) & 255] << 24) | (FS[(y3 >> 16) & 255] << 16)
223                | (FS[(y0 >> 8) & 255] << 8) | FS[y1 & 255]) ^ k[42];
224        x3 = ((FS[(y3 >> 24) & 255] << 24) | (FS[(y0 >> 16) & 255] << 16)
225                | (FS[(y1 >> 8) & 255] << 8) | FS[y2 & 255]) ^ k[43];
226        out[off] = (byte) (x0 >> 24); out[off+1] = (byte) (x0 >> 16);
227        out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0;
228        out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16);
229        out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1;
230        out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16);
231        out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2;
232        out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16);
233        out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3;
234    }
235 
236    private void decryptBlock(byte[] in, byte[] out, int off) {
237        int[] k = decKey;
238        int x0 = ((in[off] << 24) | ((in[off + 1] & 255) << 16)
239                | ((in[off + 2] & 255) << 8) | (in[off + 3] & 255)) ^ k[0];
240        int x1 = ((in[off + 4] << 24) | ((in[off + 5] & 255) << 16)
241                | ((in[off + 6] & 255) << 8) | (in[off + 7] & 255)) ^ k[1];
242        int x2 = ((in[off + 8] << 24) | ((in[off + 9] & 255) << 16)
243                | ((in[off + 10] & 255) << 8) | (in[off + 11] & 255)) ^ k[2];
244        int x3 = ((in[off + 12] << 24) | ((in[off + 13] & 255) << 16)
245                | ((in[off + 14] & 255) << 8) | (in[off + 15] & 255)) ^ k[3];
246        int y0 = RT0[(x0 >> 24) & 255] ^ RT1[(x3 >> 16) & 255]
247                ^ RT2[(x2 >> 8) & 255] ^ RT3[x1 & 255] ^ k[4];
248        int y1 = RT0[(x1 >> 24) & 255] ^ RT1[(x0 >> 16) & 255]
249                ^ RT2[(x3 >> 8) & 255] ^ RT3[x2 & 255] ^ k[5];
250        int y2 = RT0[(x2 >> 24) & 255] ^ RT1[(x1 >> 16) & 255]
251                ^ RT2[(x0 >> 8) & 255] ^ RT3[x3 & 255] ^ k[6];
252        int y3 = RT0[(x3 >> 24) & 255] ^ RT1[(x2 >> 16) & 255]
253                ^ RT2[(x1 >> 8) & 255] ^ RT3[x0 & 255] ^ k[7];
254        x0 = RT0[(y0 >> 24) & 255] ^ RT1[(y3 >> 16) & 255]
255                ^ RT2[(y2 >> 8) & 255] ^ RT3[y1 & 255] ^ k[8];
256        x1 = RT0[(y1 >> 24) & 255] ^ RT1[(y0 >> 16) & 255]
257                ^ RT2[(y3 >> 8) & 255] ^ RT3[y2 & 255] ^ k[9];
258        x2 = RT0[(y2 >> 24) & 255] ^ RT1[(y1 >> 16) & 255]
259                ^ RT2[(y0 >> 8) & 255] ^ RT3[y3 & 255] ^ k[10];
260        x3 = RT0[(y3 >> 24) & 255] ^ RT1[(y2 >> 16) & 255]
261                ^ RT2[(y1 >> 8) & 255] ^ RT3[y0 & 255] ^ k[11];
262        y0 = RT0[(x0 >> 24) & 255] ^ RT1[(x3 >> 16) & 255]
263                ^ RT2[(x2 >> 8) & 255] ^ RT3[x1 & 255] ^ k[12];
264        y1 = RT0[(x1 >> 24) & 255] ^ RT1[(x0 >> 16) & 255]
265                ^ RT2[(x3 >> 8) & 255] ^ RT3[x2 & 255] ^ k[13];
266        y2 = RT0[(x2 >> 24) & 255] ^ RT1[(x1 >> 16) & 255]
267                ^ RT2[(x0 >> 8) & 255] ^ RT3[x3 & 255] ^ k[14];
268        y3 = RT0[(x3 >> 24) & 255] ^ RT1[(x2 >> 16) & 255]
269                ^ RT2[(x1 >> 8) & 255] ^ RT3[x0 & 255] ^ k[15];
270        x0 = RT0[(y0 >> 24) & 255] ^ RT1[(y3 >> 16) & 255]
271                ^ RT2[(y2 >> 8) & 255] ^ RT3[y1 & 255] ^ k[16];
272        x1 = RT0[(y1 >> 24) & 255] ^ RT1[(y0 >> 16) & 255]
273                ^ RT2[(y3 >> 8) & 255] ^ RT3[y2 & 255] ^ k[17];
274        x2 = RT0[(y2 >> 24) & 255] ^ RT1[(y1 >> 16) & 255]
275                ^ RT2[(y0 >> 8) & 255] ^ RT3[y3 & 255] ^ k[18];
276        x3 = RT0[(y3 >> 24) & 255] ^ RT1[(y2 >> 16) & 255]
277                ^ RT2[(y1 >> 8) & 255] ^ RT3[y0 & 255] ^ k[19];
278        y0 = RT0[(x0 >> 24) & 255] ^ RT1[(x3 >> 16) & 255]
279                ^ RT2[(x2 >> 8) & 255] ^ RT3[x1 & 255] ^ k[20];
280        y1 = RT0[(x1 >> 24) & 255] ^ RT1[(x0 >> 16) & 255]
281                ^ RT2[(x3 >> 8) & 255] ^ RT3[x2 & 255] ^ k[21];
282        y2 = RT0[(x2 >> 24) & 255] ^ RT1[(x1 >> 16) & 255]
283                ^ RT2[(x0 >> 8) & 255] ^ RT3[x3 & 255] ^ k[22];
284        y3 = RT0[(x3 >> 24) & 255] ^ RT1[(x2 >> 16) & 255]
285                ^ RT2[(x1 >> 8) & 255] ^ RT3[x0 & 255] ^ k[23];
286        x0 = RT0[(y0 >> 24) & 255] ^ RT1[(y3 >> 16) & 255]
287                ^ RT2[(y2 >> 8) & 255] ^ RT3[y1 & 255] ^ k[24];
288        x1 = RT0[(y1 >> 24) & 255] ^ RT1[(y0 >> 16) & 255]
289                ^ RT2[(y3 >> 8) & 255] ^ RT3[y2 & 255] ^ k[25];
290        x2 = RT0[(y2 >> 24) & 255] ^ RT1[(y1 >> 16) & 255]
291                ^ RT2[(y0 >> 8) & 255] ^ RT3[y3 & 255] ^ k[26];
292        x3 = RT0[(y3 >> 24) & 255] ^ RT1[(y2 >> 16) & 255]
293                ^ RT2[(y1 >> 8) & 255] ^ RT3[y0 & 255] ^ k[27];
294        y0 = RT0[(x0 >> 24) & 255] ^ RT1[(x3 >> 16) & 255]
295                ^ RT2[(x2 >> 8) & 255] ^ RT3[x1 & 255] ^ k[28];
296        y1 = RT0[(x1 >> 24) & 255] ^ RT1[(x0 >> 16) & 255]
297                ^ RT2[(x3 >> 8) & 255] ^ RT3[x2 & 255] ^ k[29];
298        y2 = RT0[(x2 >> 24) & 255] ^ RT1[(x1 >> 16) & 255]
299                ^ RT2[(x0 >> 8) & 255] ^ RT3[x3 & 255] ^ k[30];
300        y3 = RT0[(x3 >> 24) & 255] ^ RT1[(x2 >> 16) & 255]
301                ^ RT2[(x1 >> 8) & 255] ^ RT3[x0 & 255] ^ k[31];
302        x0 = RT0[(y0 >> 24) & 255] ^ RT1[(y3 >> 16) & 255]
303                ^ RT2[(y2 >> 8) & 255] ^ RT3[y1 & 255] ^ k[32];
304        x1 = RT0[(y1 >> 24) & 255] ^ RT1[(y0 >> 16) & 255]
305                ^ RT2[(y3 >> 8) & 255] ^ RT3[y2 & 255] ^ k[33];
306        x2 = RT0[(y2 >> 24) & 255] ^ RT1[(y1 >> 16) & 255]
307                ^ RT2[(y0 >> 8) & 255] ^ RT3[y3 & 255] ^ k[34];
308        x3 = RT0[(y3 >> 24) & 255] ^ RT1[(y2 >> 16) & 255]
309                ^ RT2[(y1 >> 8) & 255] ^ RT3[y0 & 255] ^ k[35];
310        y0 = RT0[(x0 >> 24) & 255] ^ RT1[(x3 >> 16) & 255]
311                ^ RT2[(x2 >> 8) & 255] ^ RT3[x1 & 255] ^ k[36];
312        y1 = RT0[(x1 >> 24) & 255] ^ RT1[(x0 >> 16) & 255]
313                ^ RT2[(x3 >> 8) & 255] ^ RT3[x2 & 255] ^ k[37];
314        y2 = RT0[(x2 >> 24) & 255] ^ RT1[(x1 >> 16) & 255]
315                ^ RT2[(x0 >> 8) & 255] ^ RT3[x3 & 255] ^ k[38];
316        y3 = RT0[(x3 >> 24) & 255] ^ RT1[(x2 >> 16) & 255]
317                ^ RT2[(x1 >> 8) & 255] ^ RT3[x0 & 255] ^ k[39];
318        x0 = ((RS[(y0 >> 24) & 255] << 24) | (RS[(y3 >> 16) & 255] << 16)
319                | (RS[(y2 >> 8) & 255] << 8) | RS[y1 & 255]) ^ k[40];
320        x1 = ((RS[(y1 >> 24) & 255] << 24) | (RS[(y0 >> 16) & 255] << 16)
321                | (RS[(y3 >> 8) & 255] << 8) | RS[y2 & 255]) ^ k[41];
322        x2 = ((RS[(y2 >> 24) & 255] << 24) | (RS[(y1 >> 16) & 255] << 16)
323                | (RS[(y0 >> 8) & 255] << 8) | RS[y3 & 255]) ^ k[42];
324        x3 = ((RS[(y3 >> 24) & 255] << 24) | (RS[(y2 >> 16) & 255] << 16)
325                | (RS[(y1 >> 8) & 255] << 8) | RS[y0 & 255]) ^ k[43];
326        out[off] = (byte) (x0 >> 24);
327        out[off + 1] = (byte) (x0 >> 16);
328        out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0;
329        out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16);
330        out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1;
331        out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16);
332        out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2;
333        out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16);
334        out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3;
335    }
336 
337    @Override
338    public int getKeyLength() {
339        return 16;
340    }
341 
342}

[all classes][org.h2.security]
EMMA 2.0.5312 (C) Vladimir Roubtsov