3 ms·
Addendum: If anyone's curious about Galois Theory, this looks like a good place to start: https://www.gfuzz.de/AES_1.html https://www.gfuzz.de/AES_1.html
by some_furry 6y ago
Addendum:
If anyone's curious about Galois Theory, this looks like a good place to start: https://www.gfuzz.de/AES_1.html https://www.gfuzz.de/AES_1.html
- dragontamer 6y agoI dunno if its just "how I learned it", but experiments over the GF(5) prime field, followed by the GF(2) then GF(2^x) extension fields has always made the most sense in my brain. GF(5) is a prime field and is much easier to think about. You have 0, 1, 2, 3, 4 as your numbers (and they're "true numbers", not yet polynomials). The most natural generator is 2. * 2^0 == 1 mod 5 * 2^1 == 2 mod 5 * 2^2 == 4 mod 5 * 2^3 == 8 mod 5 == 3 * 2^4 == 2^3 * 2 == 3 * 2 == 6 mod 5 == 1 == 2^0 Because 2^4 == 2^0 == 1, you have your loop. All non-zero elements are created by this sequence (because 2 is an appropriate generator). Define multiplication to be consistent with these numbers (and it happens to line up with normal multiplication). For example: * 2^4 * 2^3 == 1 * 3 == 2^7 == 2^4 * 2^3 == 2^0 * 2^3 == 3. ------- Extend the cycle over the negative numbers, and you remain consistent: * 2^0 == 1 mod 5 * 2^-1 == 3 mod 5 * 2^-2 == 4 mod 5 * 2^-3 == 2 mod 5 * 2^-4 == 1 mod 5 == 2^0 By extending into the negative exponents, we've invented division that's 100% consistent with all other math. Notice that 2^-1 == 3, which is 2's inverse. 2^2 == 2^-2, which is its own inverse. Notice that 4 * 4 == 2^2 * 2^2 == 2^4 == 1. Any number times 4 twice equals itself. Remember, GF(5) is just simple mod-5 arithmetic. We've redefined multiplication to the above attributes, but it works out how you'd expect. Lets take some random examples of multiplicative inverses / division in GF(5), but "extended" over normal integers outside of the modular space to show you this really is amazing and it works. * 3 * 2 == 6 mod 5 == 1. * 4 * 2 * 3 == 24 mod 5 == 4 (notice: 2 * 3 is 1, so when 4 * 1 == 4) * 4 * 4 == 16 mod 5 == 1 * 2 * 4 * 4 == 32 mod 5 == 2 (notice: 4 is equal to 1/4. So 2 * 4/4 == 2 * 4 * 4 == 2) ----- A similar exercise can be done over addition. Then a similar exercise can be done over distributive property and even polynomials / quadratic equation / cubics and more! Logarithms, Square Roots. Everything. All the math you ever learned: shrunk down into the exact space of {0, 1, 2, 3, 4} numbers. -------- GF(5) is awkward for computers however. To make this "reasonable" for computers, we need to convert it into bits and bytes. Shrink the space down to GF(2) (0 and 1), then extend the space into GF(2^8). Extension fields (taking a "power" of the prime) are... complicated. Very complicated. An extension field is the GF-version of "complex numbers". You invent a polynomial over "x" (or some indeterminate variable). Complex numbers call it "i", electrical engineers call it "j". In the Complex world, i^4 == 1 (the 4th root of 1 is i). But in GF-version, the variable depends on the size of your field. A GF(2^8) will have x^255 == 1... so you have a much larger "loop" so to speak, but otherwise functions very similar to the Complex i. But hopefully the experiments in GF(5) show why cryptographers love to use GF() fields in general. Its very useful to have all numbers "loop" back into themselves.