Answer the question
In order to leave comments, you need to log in
Why does Rijndael have a comparison with 0x80?
The code of the method of the encryption part is given below:
private static byte gfmultby02(byte b)
{
if (b < 0x80)
return (byte)(int)(b « 1);
else
return (byte)((int)(b « 1) ^ (int)(0x1b));
}
Answer the question
In order to leave comments, you need to log in
Because gfmultby02 is a function to multiply by two in a 2^8 Galois field . If you read the article and think about it, then a byte that is greater than or equal to 0x80 will be represented as "x ^ 7 + ..." - only x ^ 7 is important here, and a byte less than 0x80 will be represented by a polynomial of maximum sixth degree, t .e. x^6 + ...
Further, 2 (what we multiply by) is x^1 + x^0 = x.
Next, just multiply the polynomial by x. It can be seen that if the byte was less than 0x80, then the maximum polynomial will be x ^ 7 + ..., it is included in the used field. Implements this shift to the left.
The second code branch implements the behavior when the result is not included in our field. XOR 0x1b, apparently, is somehow connected with a specific generating polynomial 100011011, I did not understand it here. Maybe Mrrl can advise .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question