3 * Galois counter mode, specified by NIST,
4 * http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf
8 /* Generation of fixed multiplication tables. */
10 /* nettle, low-level cryptographics library
12 * Copyright (C) 2011 Niels Möller
14 * The nettle library is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License as published by
16 * the Free Software Foundation; either version 2.1 of the License, or (at your
17 * option) any later version.
19 * The nettle library is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
22 * License for more details.
24 * You should have received a copy of the GNU Lesser General Public License
25 * along with the nettle library; see the file COPYING.LIB. If not, write to
26 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
33 #define GHASH_POLYNOMIAL 0xE1
36 /* When x is shifted out over the block edge, add multiples of the
37 defining polynomial to eliminate each bit. */
41 unsigned p
= GHASH_POLYNOMIAL
<< 1;
43 for (; x
; x
>>= 1, p
<<= 1)
50 main(int argc
, char **argv
)
53 printf("4-bit table:\n");
55 for (i
= 0; i
<16; i
++)
62 printf("W(%02x,%02x),", x
>> 8, x
& 0xff);
65 printf("8-bit table:\n");
66 for (i
= 0; i
<256; i
++)
73 printf("W(%02x,%02x),", x
>> 8, x
& 0xff);