[FFmpeg-devel] Using decryption keys in a decoder

Maxim max_pole
Tue Apr 7 19:21:24 CEST 2009


Uoti Urpala schrieb:
> On Tue, 2009-04-07 at 18:25 +0200, Reimar D?ffinger wrote:
>   
>> 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++;
>>> }
>>>       
>
> So k1 is only used as to calculate k2? Or should it appear in the later
> formula?
>   

No, I splitted it out for simplicity...

> I assume that should be "*dataPtr ^=".
>   

Uhhuu, thanks! ;-)

>>> 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.
>>     
>
> For that kind of algorithm you could do much better than brute force. If
> there's some known plaintext you can solve the k values directly without
> much computation.
>
>   

I'll look at the bitstream syntax of the band header - maybe I'll find
something usefull. Thank you very much!

Regards
Maxim



More information about the ffmpeg-devel mailing list