[FFmpeg-devel] [PATCH] support encrypted asf

Michael Niedermayer michaelni
Sat Oct 13 14:24:25 CEST 2007


Hi

On Sat, Oct 13, 2007 at 12:53:34PM +0200, Reimar D?ffinger wrote:
[...]
> > +static uint32_t f_func(uint32_t r, uint64_t k) {
> > +    int i;
> > +    uint32_t out = 0;
> > +    // expand 32 bit data to 8 * 6 bit blocks
> > +    uint64_t tmp = shuffle(r, E_shuffle, sizeof(E_shuffle));
> > +    tmp ^= k;
> > +    // apply S-boxes, those compress the data again from 8 * 6 to 8 * 4 bits
> > +    for (i = 0; i < 8; i++) {
> > +        uint32_t v = S_boxes[i][(tmp >> 43) & 0x1f];
> > +        if (tmp & ((uint64_t)1 << 42)) v >>= 4;
> > +        else v &= 0x0f;
> > +        tmp <<= 6;
> > +        out = (out << 4) | v;
> > +    }
> > +    out = shuffle(out, P_shuffle, sizeof(P_shuffle));
> 
> The inner part of the for loop can be simplified to
> > out |= expanded_S_boxes[i][(tmp >> 43) & 0x1f];
> > tmp <<= 6;
> and the final shuffle can be removed by expanding the S boxes to include the
> other operations.
> This would increase the table size from 256 to 2048 bytes though (would
> using CONFIG_SMALL and having both implementations be good?).

yes

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I count him braver who overcomes his desires than him who conquers his
enemies for the hardest victory is over self. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071013/57c87bbf/attachment.pgp>



More information about the ffmpeg-devel mailing list