[FFmpeg-devel] Using decryption keys in a decoder

Reimar Döffinger Reimar.Doeffinger
Tue Apr 7 18:25:37 CEST 2009


On Tue, Apr 07, 2009 at 05:01:11PM +0200, Maxim wrote:
> simple XOR...
> The encryption key is derived from the password named "AccessWord"
> entered by the user as follows:
> 
> uint32_t   k1 = (AccessWord >> 1) + 16384;
> uint32_t   k2 = (k1 / 200) * 200 + 21;
> uint32_t   k3 = (~AccessWord) >> 16;

Does the lowest bit of AccessWord have any meaning?

> for (i = 0; i < size; i++) {
>    k3 = (k3 * k2 + 1) & 0xFFFF;
>    dataPtr ^= k3;
>    dataPtr++;
> }

Why uint32_t above? Seems like everything is uint16_t.

> I don't know if it may be any kind of known encryption algorithm but
> it's how it works...

Depends on how you define "known", it is "xor by pseudo-random number
generator", should be brute-forceable easy enough (about 24 bit key
strength I think), though probably not easy enough to do it in realtime.
Of course an obvious question would be if the demuxer could decrypt it
or if that would be too ugly.



More information about the ffmpeg-devel mailing list