1 5 package org.h2.security; 6 7 import org.h2.engine.Constants; 8 import org.h2.message.Message; 9 10 15 public class AES implements BlockCipher { 16 17 private static final int[] RCON = new int[10]; 18 private static final int[] FS = new int[256]; 19 private static final int[] FT0 = new int[256]; 20 private static final int[] FT1 = new int[256]; 21 private static final int[] FT2 = new int[256]; 22 private static final int[] FT3 = new int[256]; 23 private static final int[] RS = new int[256]; 24 private static final int[] RT0 = new int[256]; 25 private static final int[] RT1 = new int[256]; 26 private static final int[] RT2 = new int[256]; 27 private static final int[] RT3 = new int[256]; 28 private int[] encKey = new int[44]; 29 private int[] decKey = new int[44]; 30 31 private static int rot8(int x) { 32 return (x >>> 8) | (x << 24); 33 } 34 35 private static int xtime(int x) { 36 return ((x << 1) ^ (((x & 0x80) != 0) ? 0x1b : 0)) & 255; 37 } 38 39 private static int mul(int[] pow, int[] log, int x, int y) { 40 return ((x != 0 && y != 0) ? pow[(log[x] + log[y]) % 255] : 0); 41 } 42 43 static { 44 int[] pow = new int[256]; 45 int[] log = new int[256]; 46 for (int i = 0, x = 1; i < 256; i++, x ^= xtime(x)) { 47 pow[i] = x; 48 log[x] = i; 49 } 50 for (int i = 0, x = 1; i < 10; i++, x = xtime(x)) { 51 RCON[i] = x << 24; 52 } 53 FS[0x00] = 0x63; 54 RS[0x63] = 0x00; 55 for (int i = 1; i < 256; i++) { 56 int x = pow[255 - log[i]], y = x; 57 y = ((y << 1) | (y >> 7)) & 255; 58 x ^= y; 59 y = ((y << 1) | (y >> 7)) & 255; 60 x ^= y; 61 y = ((y << 1) | (y >> 7)) & 255; 62 x ^= y; 63 y = ((y << 1) | (y >> 7)) & 255; 64 x ^= y ^ 0x63; 65 FS[i] = x & 255; 66 RS[x] = i & 255; 67 } 68 for (int i = 0; i < 256; i++) { 69 int x = FS[i], y = xtime(x); 70 FT0[i] = (x ^ y) ^ (x << 8) ^ (x << 16) ^ (y << 24); 71 FT1[i] = rot8(FT0[i]); 72 FT2[i] = rot8(FT1[i]); 73 FT3[i] = rot8(FT2[i]); 74 y = RS[i]; 75 RT0[i] = mul(pow, log, 0x0b, y) ^ (mul(pow, log, 0x0d, y) << 8) 76 ^ (mul(pow, log, 0x09, y) << 16) ^ (mul(pow, log, 0x0e, y) << 24); 77 RT1[i] = rot8(RT0[i]); 78 RT2[i] = rot8(RT1[i]); 79 RT3[i] = rot8(RT2[i]); 80 } 81 } 82 83 private int getDec(int t) { 84 return RT0[FS[(t >> 24) & 255]] ^ RT1[FS[(t >> 16) & 255]] ^ RT2[FS[(t >> 8) & 255]] ^ RT3[FS[t & 255]]; 85 } 86 87 public void setKey(byte[] key) { 88 for (int i = 0, j = 0; i < 4; i++) { 89 encKey[i] = decKey[i] = ((key[j++] & 255) << 24) | ((key[j++] & 255) << 16) | ((key[j++] & 255) << 8) | (key[j++] & 255); 90 } 91 int e = 0; 92 for (int i = 0; i < 10; i++, e += 4) { 93 encKey[e + 4] = encKey[e] ^ RCON[i] ^ (FS[(encKey[e + 3] >> 16) & 255] << 24) 94 ^ (FS[(encKey[e + 3] >> 8) & 255] << 16) ^ (FS[(encKey[e + 3]) & 255] << 8) ^ FS[(encKey[e + 3] >> 24) & 255]; 95 encKey[e + 5] = encKey[e + 1] ^ encKey[e + 4]; 96 encKey[e + 6] = encKey[e + 2] ^ encKey[e + 5]; 97 encKey[e + 7] = encKey[e + 3] ^ encKey[e + 6]; 98 } 99 int d = 0; 100 decKey[d++] = encKey[e++]; 101 decKey[d++] = encKey[e++]; 102 decKey[d++] = encKey[e++]; 103 decKey[d++] = encKey[e++]; 104 for (int i = 1; i < 10; i++) { 105 e -= 8; 106 decKey[d++] = getDec(encKey[e++]); 107 decKey[d++] = getDec(encKey[e++]); 108 decKey[d++] = getDec(encKey[e++]); 109 decKey[d++] = getDec(encKey[e++]); 110 } 111 e -= 8; 112 decKey[d++] = encKey[e++]; 113 decKey[d++] = encKey[e++]; 114 decKey[d++] = encKey[e++]; 115 decKey[d++] = encKey[e++]; 116 } 117 118 public void encrypt(byte[] buff, int off, int len) { 119 if(Constants.CHECK && (len % ALIGN != 0)) { 120 throw Message.getInternalError("unaligned len "+len); 121 } 122 for(int i=off; i<off+len; i+=16) { 123 encryptBlock(buff, buff, i); 124 } 125 } 126 127 public void decrypt(byte[] bytes, int off, int len) { 128 if(Constants.CHECK && (len % ALIGN != 0)) { 129 throw Message.getInternalError("unaligned len "+len); 130 } 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) | ((in[off+2] & 255) << 8) | (in[off+3] & 255)) ^ k[0]; 139 int x1 = ((in[off+4] << 24) | ((in[off+5] & 255) << 16) | ((in[off+6] & 255) << 8) | (in[off+7] & 255)) ^ k[1]; 140 int x2 = ((in[off+8] << 24) | ((in[off+9] & 255) << 16) | ((in[off+10] & 255) << 8) | (in[off+11] & 255)) ^ k[2]; 141 int x3 = ((in[off+12] << 24) | ((in[off+13] & 255) << 16) | ((in[off+14] & 255) << 8) | (in[off+15] & 255)) ^ k[3]; 142 int y0 = FT0[(x0 >> 24) & 255] ^ FT1[(x1 >> 16) & 255] ^ FT2[(x2 >> 8) & 255] ^ FT3[x3 & 255] ^ k[4]; 143 int y1 = FT0[(x1 >> 24) & 255] ^ FT1[(x2 >> 16) & 255] ^ FT2[(x3 >> 8) & 255] ^ FT3[x0 & 255] ^ k[5]; 144 int y2 = FT0[(x2 >> 24) & 255] ^ FT1[(x3 >> 16) & 255] ^ FT2[(x0 >> 8) & 255] ^ FT3[x1 & 255] ^ k[6]; 145 int y3 = FT0[(x3 >> 24) & 255] ^ FT1[(x0 >> 16) & 255] ^ FT2[(x1 >> 8) & 255] ^ FT3[x2 & 255] ^ k[7]; 146 x0 = FT0[(y0 >> 24) & 255] ^ FT1[(y1 >> 16) & 255] ^ FT2[(y2 >> 8) & 255] ^ FT3[y3 & 255] ^ k[8]; 147 x1 = FT0[(y1 >> 24) & 255] ^ FT1[(y2 >> 16) & 255] ^ FT2[(y3 >> 8) & 255] ^ FT3[y0 & 255] ^ k[9]; 148 x2 = FT0[(y2 >> 24) & 255] ^ FT1[(y3 >> 16) & 255] ^ FT2[(y0 >> 8) & 255] ^ FT3[y1 & 255] ^ k[10]; 149 x3 = FT0[(y3 >> 24) & 255] ^ FT1[(y0 >> 16) & 255] ^ FT2[(y1 >> 8) & 255] ^ FT3[y2 & 255] ^ k[11]; 150 y0 = FT0[(x0 >> 24) & 255] ^ FT1[(x1 >> 16) & 255] ^ FT2[(x2 >> 8) & 255] ^ FT3[x3 & 255] ^ k[12]; 151 y1 = FT0[(x1 >> 24) & 255] ^ FT1[(x2 >> 16) & 255] ^ FT2[(x3 >> 8) & 255] ^ FT3[x0 & 255] ^ k[13]; 152 y2 = FT0[(x2 >> 24) & 255] ^ FT1[(x3 >> 16) & 255] ^ FT2[(x0 >> 8) & 255] ^ FT3[x1 & 255] ^ k[14]; 153 y3 = FT0[(x3 >> 24) & 255] ^ FT1[(x0 >> 16) & 255] ^ FT2[(x1 >> 8) & 255] ^ FT3[x2 & 255] ^ k[15]; 154 x0 = FT0[(y0 >> 24) & 255] ^ FT1[(y1 >> 16) & 255] ^ FT2[(y2 >> 8) & 255] ^ FT3[y3 & 255] ^ k[16]; 155 x1 = FT0[(y1 >> 24) & 255] ^ FT1[(y2 >> 16) & 255] ^ FT2[(y3 >> 8) & 255] ^ FT3[y0 & 255] ^ k[17]; 156 x2 = FT0[(y2 >> 24) & 255] ^ FT1[(y3 >> 16) & 255] ^ FT2[(y0 >> 8) & 255] ^ FT3[y1 & 255] ^ k[18]; 157 x3 = FT0[(y3 >> 24) & 255] ^ FT1[(y0 >> 16) & 255] ^ FT2[(y1 >> 8) & 255] ^ FT3[y2 & 255] ^ k[19]; 158 y0 = FT0[(x0 >> 24) & 255] ^ FT1[(x1 >> 16) & 255] ^ FT2[(x2 >> 8) & 255] ^ FT3[x3 & 255] ^ k[20]; 159 y1 = FT0[(x1 >> 24) & 255] ^ FT1[(x2 >> 16) & 255] ^ FT2[(x3 >> 8) & 255] ^ FT3[x0 & 255] ^ k[21]; 160 y2 = FT0[(x2 >> 24) & 255] ^ FT1[(x3 >> 16) & 255] ^ FT2[(x0 >> 8) & 255] ^ FT3[x1 & 255] ^ k[22]; 161 y3 = FT0[(x3 >> 24) & 255] ^ FT1[(x0 >> 16) & 255] ^ FT2[(x1 >> 8) & 255] ^ FT3[x2 & 255] ^ k[23]; 162 x0 = FT0[(y0 >> 24) & 255] ^ FT1[(y1 >> 16) & 255] ^ FT2[(y2 >> 8) & 255] ^ FT3[y3 & 255] ^ k[24]; 163 x1 = FT0[(y1 >> 24) & 255] ^ FT1[(y2 >> 16) & 255] ^ FT2[(y3 >> 8) & 255] ^ FT3[y0 & 255] ^ k[25]; 164 x2 = FT0[(y2 >> 24) & 255] ^ FT1[(y3 >> 16) & 255] ^ FT2[(y0 >> 8) & 255] ^ FT3[y1 & 255] ^ k[26]; 165 x3 = FT0[(y3 >> 24) & 255] ^ FT1[(y0 >> 16) & 255] ^ FT2[(y1 >> 8) & 255] ^ FT3[y2 & 255] ^ k[27]; 166 y0 = FT0[(x0 >> 24) & 255] ^ FT1[(x1 >> 16) & 255] ^ FT2[(x2 >> 8) & 255] ^ FT3[x3 & 255] ^ k[28]; 167 y1 = FT0[(x1 >> 24) & 255] ^ FT1[(x2 >> 16) & 255] ^ FT2[(x3 >> 8) & 255] ^ FT3[x0 & 255] ^ k[29]; 168 y2 = FT0[(x2 >> 24) & 255] ^ FT1[(x3 >> 16) & 255] ^ FT2[(x0 >> 8) & 255] ^ FT3[x1 & 255] ^ k[30]; 169 y3 = FT0[(x3 >> 24) & 255] ^ FT1[(x0 >> 16) & 255] ^ FT2[(x1 >> 8) & 255] ^ FT3[x2 & 255] ^ k[31]; 170 x0 = FT0[(y0 >> 24) & 255] ^ FT1[(y1 >> 16) & 255] ^ FT2[(y2 >> 8) & 255] ^ FT3[y3 & 255] ^ k[32]; 171 x1 = FT0[(y1 >> 24) & 255] ^ FT1[(y2 >> 16) & 255] ^ FT2[(y3 >> 8) & 255] ^ FT3[y0 & 255] ^ k[33]; 172 x2 = FT0[(y2 >> 24) & 255] ^ FT1[(y3 >> 16) & 255] ^ FT2[(y0 >> 8) & 255] ^ FT3[y1 & 255] ^ k[34]; 173 x3 = FT0[(y3 >> 24) & 255] ^ FT1[(y0 >> 16) & 255] ^ FT2[(y1 >> 8) & 255] ^ FT3[y2 & 255] ^ k[35]; 174 y0 = FT0[(x0 >> 24) & 255] ^ FT1[(x1 >> 16) & 255] ^ FT2[(x2 >> 8) & 255] ^ FT3[x3 & 255] ^ k[36]; 175 y1 = FT0[(x1 >> 24) & 255] ^ FT1[(x2 >> 16) & 255] ^ FT2[(x3 >> 8) & 255] ^ FT3[x0 & 255] ^ k[37]; 176 y2 = FT0[(x2 >> 24) & 255] ^ FT1[(x3 >> 16) & 255] ^ FT2[(x0 >> 8) & 255] ^ FT3[x1 & 255] ^ k[38]; 177 y3 = FT0[(x3 >> 24) & 255] ^ FT1[(x0 >> 16) & 255] ^ FT2[(x1 >> 8) & 255] ^ FT3[x2 & 255] ^ k[39]; 178 x0 = ((FS[(y0 >> 24) & 255] << 24) | (FS[(y1 >> 16) & 255] << 16) | (FS[(y2 >> 8) & 255] << 8) | FS[y3 & 255]) ^ k[40]; 179 x1 = ((FS[(y1 >> 24) & 255] << 24) | (FS[(y2 >> 16) & 255] << 16) | (FS[(y3 >> 8) & 255] << 8) | FS[y0 & 255]) ^ k[41]; 180 x2 = ((FS[(y2 >> 24) & 255] << 24) | (FS[(y3 >> 16) & 255] << 16) | (FS[(y0 >> 8) & 255] << 8) | FS[y1 & 255]) ^ k[42]; 181 x3 = ((FS[(y3 >> 24) & 255] << 24) | (FS[(y0 >> 16) & 255] << 16) | (FS[(y1 >> 8) & 255] << 8) | FS[y2 & 255]) ^ k[43]; 182 out[off] = (byte) (x0 >> 24); out[off+1] = (byte) (x0 >> 16); out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0; 183 out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16); out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1; 184 out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16); out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2; 185 out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16); out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3; 186 } 187 188 private void decryptBlock(byte[] in, byte[] out, int off) { 189 int[] k = decKey; 190 int x0 = ((in[off] << 24) | ((in[off+1] & 255) << 16) | ((in[off+2] & 255) << 8) | (in[off+3] & 255)) ^ k[0]; 191 int x1 = ((in[off+4] << 24) | ((in[off+5] & 255) << 16) | ((in[off+6] & 255) << 8) | (in[off+7] & 255)) ^ k[1]; 192 int x2 = ((in[off+8] << 24) | ((in[off+9] & 255) << 16) | ((in[off+10] & 255) << 8) | (in[off+11] & 255)) ^ k[2]; 193 int x3 = ((in[off+12] << 24) | ((in[off+13] & 255) << 16) | ((in[off+14] & 255) << 8) | (in[off+15] & 255)) ^ k[3]; 194 int y0 = RT0[(x0 >> 24) & 255] ^ RT1[(x3 >> 16) & 255] ^ RT2[(x2 >> 8) & 255] ^ RT3[x1 & 255] ^ k[4]; 195 int y1 = RT0[(x1 >> 24) & 255] ^ RT1[(x0 >> 16) & 255] ^ RT2[(x3 >> 8) & 255] ^ RT3[x2 & 255] ^ k[5]; 196 int y2 = RT0[(x2 >> 24) & 255] ^ RT1[(x1 >> 16) & 255] ^ RT2[(x0 >> 8) & 255] ^ RT3[x3 & 255] ^ k[6]; 197 int y3 = RT0[(x3 >> 24) & 255] ^ RT1[(x2 >> 16) & 255] ^ RT2[(x1 >> 8) & 255] ^ RT3[x0 & 255] ^ k[7]; 198 x0 = RT0[(y0 >> 24) & 255] ^ RT1[(y3 >> 16) & 255] ^ RT2[(y2 >> 8) & 255] ^ RT3[y1 & 255] ^ k[8]; 199 x1 = RT0[(y1 >> 24) & 255] ^ RT1[(y0 >> 16) & 255] ^ RT2[(y3 >> 8) & 255] ^ RT3[y2 & 255] ^ k[9]; 200 x2 = RT0[(y2 >> 24) & 255] ^ RT1[(y1 >> 16) & 255] ^ RT2[(y0 >> 8) & 255] ^ RT3[y3 & 255] ^ k[10]; 201 x3 = RT0[(y3 >> 24) & 255] ^ RT1[(y2 >> 16) & 255] ^ RT2[(y1 >> 8) & 255] ^ RT3[y0 & 255] ^ k[11]; 202 y0 = RT0[(x0 >> 24) & 255] ^ RT1[(x3 >> 16) & 255] ^ RT2[(x2 >> 8) & 255] ^ RT3[x1 & 255] ^ k[12]; 203 y1 = RT0[(x1 >> 24) & 255] ^ RT1[(x0 >> 16) & 255] ^ RT2[(x3 >> 8) & 255] ^ RT3[x2 & 255] ^ k[13]; 204 y2 = RT0[(x2 >> 24) & 255] ^ RT1[(x1 >> 16) & 255] ^ RT2[(x0 >> 8) & 255] ^ RT3[x3 & 255] ^ k[14]; 205 y3 = RT0[(x3 >> 24) & 255] ^ RT1[(x2 >> 16) & 255] ^ RT2[(x1 >> 8) & 255] ^ RT3[x0 & 255] ^ k[15]; 206 x0 = RT0[(y0 >> 24) & 255] ^ RT1[(y3 >> 16) & 255] ^ RT2[(y2 >> 8) & 255] ^ RT3[y1 & 255] ^ k[16]; 207 x1 = RT0[(y1 >> 24) & 255] ^ RT1[(y0 >> 16) & 255] ^ RT2[(y3 >> 8) & 255] ^ RT3[y2 & 255] ^ k[17]; 208 x2 = RT0[(y2 >> 24) & 255] ^ RT1[(y1 >> 16) & 255] ^ RT2[(y0 >> 8) & 255] ^ RT3[y3 & 255] ^ k[18]; 209 x3 = RT0[(y3 >> 24) & 255] ^ RT1[(y2 >> 16) & 255] ^ RT2[(y1 >> 8) & 255] ^ RT3[y0 & 255] ^ k[19]; 210 y0 = RT0[(x0 >> 24) & 255] ^ RT1[(x3 >> 16) & 255] ^ RT2[(x2 >> 8) & 255] ^ RT3[x1 & 255] ^ k[20]; 211 y1 = RT0[(x1 >> 24) & 255] ^ RT1[(x0 >> 16) & 255] ^ RT2[(x3 >> 8) & 255] ^ RT3[x2 & 255] ^ k[21]; 212 y2 = RT0[(x2 >> 24) & 255] ^ RT1[(x1 >> 16) & 255] ^ RT2[(x0 >> 8) & 255] ^ RT3[x3 & 255] ^ k[22]; 213 y3 = RT0[(x3 >> 24) & 255] ^ RT1[(x2 >> 16) & 255] ^ RT2[(x1 >> 8) & 255] ^ RT3[x0 & 255] ^ k[23]; 214 x0 = RT0[(y0 >> 24) & 255] ^ RT1[(y3 >> 16) & 255] ^ RT2[(y2 >> 8) & 255] ^ RT3[y1 & 255] ^ k[24]; 215 x1 = RT0[(y1 >> 24) & 255] ^ RT1[(y0 >> 16) & 255] ^ RT2[(y3 >> 8) & 255] ^ RT3[y2 & 255] ^ k[25]; 216 x2 = RT0[(y2 >> 24) & 255] ^ RT1[(y1 >> 16) & 255] ^ RT2[(y0 >> 8) & 255] ^ RT3[y3 & 255] ^ k[26]; 217 x3 = RT0[(y3 >> 24) & 255] ^ RT1[(y2 >> 16) & 255] ^ RT2[(y1 >> 8) & 255] ^ RT3[y0 & 255] ^ k[27]; 218 y0 = RT0[(x0 >> 24) & 255] ^ RT1[(x3 >> 16) & 255] ^ RT2[(x2 >> 8) & 255] ^ RT3[x1 & 255] ^ k[28]; 219 y1 = RT0[(x1 >> 24) & 255] ^ RT1[(x0 >> 16) & 255] ^ RT2[(x3 >> 8) & 255] ^ RT3[x2 & 255] ^ k[29]; 220 y2 = RT0[(x2 >> 24) & 255] ^ RT1[(x1 >> 16) & 255] ^ RT2[(x0 >> 8) & 255] ^ RT3[x3 & 255] ^ k[30]; 221 y3 = RT0[(x3 >> 24) & 255] ^ RT1[(x2 >> 16) & 255] ^ RT2[(x1 >> 8) & 255] ^ RT3[x0 & 255] ^ k[31]; 222 x0 = RT0[(y0 >> 24) & 255] ^ RT1[(y3 >> 16) & 255] ^ RT2[(y2 >> 8) & 255] ^ RT3[y1 & 255] ^ k[32]; 223 x1 = RT0[(y1 >> 24) & 255] ^ RT1[(y0 >> 16) & 255] ^ RT2[(y3 >> 8) & 255] ^ RT3[y2 & 255] ^ k[33]; 224 x2 = RT0[(y2 >> 24) & 255] ^ RT1[(y1 >> 16) & 255] ^ RT2[(y0 >> 8) & 255] ^ RT3[y3 & 255] ^ k[34]; 225 x3 = RT0[(y3 >> 24) & 255] ^ RT1[(y2 >> 16) & 255] ^ RT2[(y1 >> 8) & 255] ^ RT3[y0 & 255] ^ k[35]; 226 y0 = RT0[(x0 >> 24) & 255] ^ RT1[(x3 >> 16) & 255] ^ RT2[(x2 >> 8) & 255] ^ RT3[x1 & 255] ^ k[36]; 227 y1 = RT0[(x1 >> 24) & 255] ^ RT1[(x0 >> 16) & 255] ^ RT2[(x3 >> 8) & 255] ^ RT3[x2 & 255] ^ k[37]; 228 y2 = RT0[(x2 >> 24) & 255] ^ RT1[(x1 >> 16) & 255] ^ RT2[(x0 >> 8) & 255] ^ RT3[x3 & 255] ^ k[38]; 229 y3 = RT0[(x3 >> 24) & 255] ^ RT1[(x2 >> 16) & 255] ^ RT2[(x1 >> 8) & 255] ^ RT3[x0 & 255] ^ k[39]; 230 x0 = ((RS[(y0 >> 24) & 255] << 24) | (RS[(y3 >> 16) & 255] << 16) | (RS[(y2 >> 8) & 255] << 8) | RS[y1 & 255]) ^ k[40]; 231 x1 = ((RS[(y1 >> 24) & 255] << 24) | (RS[(y0 >> 16) & 255] << 16) | (RS[(y3 >> 8) & 255] << 8) | RS[y2 & 255]) ^ k[41]; 232 x2 = ((RS[(y2 >> 24) & 255] << 24) | (RS[(y1 >> 16) & 255] << 16) | (RS[(y0 >> 8) & 255] << 8) | RS[y3 & 255]) ^ k[42]; 233 x3 = ((RS[(y3 >> 24) & 255] << 24) | (RS[(y2 >> 16) & 255] << 16) | (RS[(y1 >> 8) & 255] << 8) | RS[y0 & 255]) ^ k[43]; 234 out[off] = (byte) (x0 >> 24); out[off+1] = (byte) (x0 >> 16); out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0; 235 out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16); out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1; 236 out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16); out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2; 237 out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16); out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3; 238 } 239 240 public int getKeyLength() { 241 return 4 * 4; 242 } 243 244 } 245 | Popular Tags |