Go over why multiplying a region by an number is such an important operation.
In case you need it, the program is m8.cpp
#include <iostream> using namespace std; int main() { int a, b, p, i; string s1, s2; cin >> s1 >> s2; if (sscanf(s1.c_str(), "0x%x", &a) == 0) sscanf(s1.c_str(), "%d", &a); if (sscanf(s2.c_str(), "0x%x", &b) == 0) sscanf(s2.c_str(), "%d", &b); p = 0; for (i = 0; i < 8; i++) { // Carry free multiplication if (a & (1 << i)) p ^= (b << i); } for (i = 14; i >= 8; i--) { // Reduction if (p & (1 << i)) p ^= (0x11d << (i-8)); } printf("%d 0x%x\n", p, p); return 0; } |
The picture from the TR (and the odp above) is in: Shift.jpg.
Start with multiplying 10000xxx + 1234yyy in decimal. What do you know about the first four digits of the product? Show some ezamples (they will be 1234zzz or 1235zzz).
Now show how this works in GF(2^64):
UNIX> sh CFM.shI have the whole thing below:
The irreducible polynomial for GF(2^64) is the following: 100000000000000c5 Now, suppose that I multiply two numbers in GF(2^64) and end up with the following before reduction: 55225eb7fc0f37b1bdea1a6a8d61cdac If I multiply the first 64 bits (55225eb7fc0f37b1) by the IP, I get: 10000000000000000 * 55225eb7fc0f37b1 = 55225eb7fc0f37b10000000000000000 c5 * 55225eb7fc0f37b1 = 000000000000003ed813d2690865ddb5 ----------------------------------------------------------------------- 100000000000000c5 * 55225eb7fc0f37b1 = 55225eb7fc0f378fd813d2690865ddb5 These bits: ^^^^^^^^^^^^^ are the same as the product's! When we xor this ith the product: 55225eb7fc0f37b1bdea1a6a8d61cdac ----------------------------------------------------- ------------------ We have zero'd 14*4=56 bits! 000000000000003e65f9c80385041019 Therefore, we can do the entire reduction with two CFM's and two XOR's! |
You should still have your table leftover from the beginning, so use it to create the log table.
Again, go over 10 * 13 = 11
Two tables.
Big zero.
UNIX> echo 0xe6 0xf8 | a.out 117 0x75 UNIX> echo 0xe0 0xf8 | a.out 95 0x5f UNIX> echo 0x06 0xf8 | a.out 42 0x2a UNIX>Do the bit arithmetic: 0x5f ^ 0x2a = 0x75 = 117.
Discuss implications on tables -- now you can do GF(2^8) with two 16-element tables.
Also talk about ramifications with GF(2^32) and (2^64). Show Split.jpg