GF128.multiply

Multiplies x by y using schoolbook multiplication. Result stored in x.

struct GF128
static
void
multiply
nothrow @nogc
(
T[] x
,
in T[] y
)
in { assert (x.length * T.sizeof * 8 == BLOCKLEN, "x: invalid length."); }

Examples

test multiplication by one

1 t {
2 		immutable block x0 = cast(immutable block) x"66e94bd4ef8a2c3b884cfa59ca342b2e";
3 		block x1 = x0;
4 
5 		block one;
6 		one[0] = ONE;
7 		
8 		multiply(x1, one);
9 		
10 		assert(x1 == x0, "GCM multiplication by ONE failed!")

test multiplication

1 t {
2 
3 		immutable block H = cast(immutable block)x"66e94bd4ef8a2c3b884cfa59ca342b2e";
4 
5 		block x1 = cast(immutable block) x"0388dace60b6a392f328c2b971b2fe78";
6 
7 		multiply(x1, H);
8 		
9 		assert(x1 == x"5e2ec746917062882c85b0685353deb7", "GCM multiplication failed!")

Meta