[FFmpeg-devel] Help: AES GF Multiply
pross at xvid.org
Wed Aug 1 14:37:44 CEST 2012
On Mon, Jul 30, 2012 at 10:03:27PM +0200, Reimar Döffinger wrote:
> On Mon, Jul 30, 2012 at 11:49:51PM +1000, Peter Ross wrote:
> > libavutil/aes.c is performing GF multiplication, but its not obvious to
> > me how to access this functionality. The math is especially foreign.
> Assuming that someone might be interesting, and because I always get
> confused myself for a short time, I made a try at explaining it,
> maybe it helps someone...
> It isn't really that foreign, GF2 really just means/can be thought as polynomial
> multiplication with the coefficients being a single bit, and
> a special rule, in AES e.g. x^8 + x^4 + x^3 + x^1 + 1 = 0
> (that is the 0x11B in line 204 in aes.c).
> It only gets really confusing when you store those polynomials
> in a normal int and then mix it with some other ints that really
> do represent normal numbers...
> j ^= j + j;
> if (j > 255)
> j ^= 0x11B;
> btw. is the multiplication of the polynomial stored in j by
> the polynomial (x + 1) which we have chosen to be basis for
> our log/exp functions.
> If you take "p" to be the polynomial j represents, then
> j ^ (j << 1)
> really means
> p + p*x = p * (x + 1)
> j ^ 0x11B;
> really is
> p + x^8 + x^4 + x^3 + x^1 + 1
Michael & Reimar. Thanks for taking the time witht this, it has
helped me immensely. Regards,
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel