Slashdot Mirror


Descrambling CSS w/ 7 Lines Of Perl A DMCA Violation?

An Anonymous Coward, who wears a Camel on his shirt, asks: "Dr. David Touretzky has done it again, posting a 7-line 526-byte Perl VOB descrambler on his ever-growing Gallery of CSS Descramblers. 'qrpff' was written by MIT Student Information Processing Board members Keith Winstein and Marc Horowitz for a 6-hour seminar on 'Decrypting DVD' taught at MIT in January-February. Did those guys violate the DMCA by teaching the class?" Click below for the script, which is among the most obscure pieces of code I've ever seen. For something so small, this is quite an accomplishment. It's also a bit of an embarassment for Hollywood when you consider that the basis of a multi-billion dollar revenue-stream can be foiled by such a small piece of code!

Here's the script:

$_='while(read+STDIN,$_,2048){$a=29;$c=142;if((@a=unx"C*",$_)[20]&48){$h=5;
$_=unxb24,join"",@b=map{xB8,unxb8,chr($_^$a[--$h+84])}@ARGV;s/...$/1$&/;$d=
unxV,xb25,$_;$b=73;$e=256|(ord$b[4])<<9|ord$b[3];$d=$d>>8^($f=($t=255)&($d
>>12^$d>>4^$d^$d/8))<<17,$e=$e>>8^($t&($g=($q=$e>>14&7^$e)^$q*8^$q<<6))<<9
,$_=(map{$_%16or$t^=$c^=($m=(11,10,116,100,11,122,20,100)[$_/16%8])&110;$t
^=(72,@z=(64,72,$a^=12*($_%16-2?0:$m&17)),$b^=$_%64?12:0,@z)[$_%8]}(16..271))
[$_]^(($h>>=8)+=$f+(~$g&$t))for@a[128..$#a]}print+x"C*",@a}';s/x/pack+/g;eval

A rewrite, using an extra five bytes (!) of perl code, caches a table, which apparently makes the program fast enough to decode a movie in realtime:

$_='while(read+STDIN,$_,2048){$a=29;$b=73;$c=142;$t=255;@t=map{$_%16or$t^=$c^=(
$m=(11,10,116,100,11,122,20,100)[$_/16%8])&110;$t^=(72,@z=(64,72,$a^=12*($_%16
-2?0:$m&17)),$b^=$_%64?12:0,@z)[$_%8]}(16..271);if((@a=unx"C*",$_)[20]&48){$h
=5;$_=unxb24,join"",@b=map{xB8,unxb8,chr($_^$a[--$h+84])}@ARGV;s/...$/1$&/;$
d=unxV,xb25,$_;$e=256|(ord$b[4])<<9|ord$b[3];$d=$d>>8^($f=$t&($d>>12^$d>>4^
$d^$d/8))<<17,$e=$e>>8^($t&($g=($q=$e>>14&7^$e)^$q*8^$q<<6))<<9,$_=$t[$_]^
(($h>>=8)+=$f+(~$g&$t))for@a[128..$#a]}print+x"C*",@a}';s/x/pack+/g;eval

As Touretzky writes on his Gallery page, typical usage is just: cat /mnt/dvd/VOB_FILE_NAME | qrpff 153 2 8 105 225 | extract_mpeg2 | mpeg2dec -

20 of 270 comments (clear)

  1. Re:CSS Encoder? by Anonymous Coward · · Score: 4


    Has anyone though of writting a virus that
    takes a persons files and encodes them with
    CSS? It would be extremely funny if some MPAA
    lawyer found himself sitting in front of his
    computer and a message pops up

    "Dear user: Your files have been encrypted with CSS. You may trivially decrypt these files with DeCSS unless you live in the United States in which case the use of DeCss could cost you five years in jail and $150,000 file. Have a nice day."

  2. Re:Is CSS encryption? by demon · · Score: 4

    CSS is a two-phase procedure - first being the player software (well, that's the DVD CCA's idea) authenticating to the drive (software passes player key to drive, verifies that player key is entitled to access the loaded disc's content), and then, the title keys are used to decrypt the individual streams on the disc.

    Is it a crappy arrangement? You bet. The title keys are 40 bits, and the player keys are (iirc) 80 bits. This is not high encryption here. Once you get past the auth-with-drive part, the title keys are handed over anyway. But simply, yes, it is encryption - from what I've heard from cryptological experts, far from a well-designed system. But it more-or-less does what the DVD CCA intended.
    _____

    --

    Sam: "That was needlessly cryptic."
    Max: "I'd be peeing my pants if I wore any!"
  3. Re:Now the RIAA will sue everyone... by Helmholtz · · Score: 4
    Actually if all they cared about was the dollar, we wouldn't be having this mess. There are certainly more long term profits to be made by taking these new digital formats and finding a new and innovative way to make money from them.

    This nonsense of trying to lock everything down and create laws that make viewing your product illegal is not good business. Sure it maintains profit margins for now, but long term will do nothing but cause damage.

    Not to sound exceedingly paranoid here, but this is not so much about money as it is about fear of losing power and face.

    Pride is causing this mess, not greed.

    --
    RFC2119
  4. Re:Owning is not a crime using it is by acb · · Score: 4


    What's more is that USING it to view any legally obtained DVD is not a crime. These things are what allow projects like xine and LiViD to exist with a relative lack of legal molestation.


    xine and LiViD, AFAIK, do not include CSS decryption tools, and can only view unprotected DVDs out of the box. There are CSS patches, but they are in countries without a WIPO law.


    The DMCA itself is strictly an AMERICAN law and has no jurisdiction * anywhere * else in the world.


    True; though it is an implementation of the WIPO copyright treaty (the one everybody was up in arms about a few years ago). The EU and Australia have already criminalised circumvention devices; other nations are in the process of doing so.

    Maybe someone can persuade Gaddafi to set up a data haven in those bombproof bunkers he has. Given the MPAA's panic, disseminating DeCSS may be a better way of attacking the Great Satan America than using it as a chemical weapons plant.

  5. Suggested email .sig by Odinson · · Score: 4

    I will be appending this with a brief description to my emails. Here is what I had in mind.

    The following code is a PERL script capable of decoding an encrypted DVD (necessary to watch a DVD on a Linux machine) in real time. This is illegal to have according to the Digital Millennium Copyright Act, a set of laws passed by anonymous vote in congress in 1998. The MPAA feels that they must stop you from using this code to watch DVD movies because then...

    ...they can't force you to watch the commercials,
    ...they can't charge you more money according to your wealth or region code.

    $_='while(read+STDIN,$_,2048){$a=29;$b=73;$c=142;$ t=255;@t=map{$_%16or$t^=$c^=($m=(11,10,116,100,11, 122,20,100)[$_/16%8])$t^=(72,@z=(64,72,$a^=12 *($_%16-2?0:$m&17)),$b^=$_%64?12:0,@z)[$_%8]}(16.. 271);if((@a=unx"C*",$_)[20]&48){$h=5;$_=unxb24,joi n"",@b=map{xB8,unxb8,chr($_^$a[--$h+84])}@ARGV;s/. ..$/1$&/;$d=unxV,xb25,$_;$e=256|(ord$b[4])>8^($f=$ t &($d>>12^$d>>4^$d^$d/8))>8^($t&($g=($q=$e>>14&7^$e )^$q*8^ $q>=8)+=$f+(~$g&$t))for@a[128..$#a]}print+x"C*",@a } ';s/x/pack+/g;eval

    If you are interested in learning more about how to create your own DVD decoder you can take the authors class on the subject at MIT http://www.mit.edu/iap/dvd

  6. Re: Sure. by mikeCRS · · Score: 4

    Well.. I tried to paste the unobfuscated version, but unfortunately it is caught by the lameness filter here :(

    Anyway, to unobfuscate it do this:

    First paste the code into your favourite editor and change eval to print
    Then save the file as decss.pl and execute this command in the shell:

    perl decss.pl | perl -MO=Deparse

    Now it's almost readable :-)

    --

    --
    - Trond Michelsen, mike@crusaders.no
  7. Re:Owning is not a crime using it is by kfg · · Score: 4

    Publishing it is a crime because a judge said it was. That's really all it takes. So, you got that one wrong.

    The other thing you got wrong is that *owning* it is NOT a crime! Noone, most particularly neither a judge nor the MPAA have ever suggested that possesion is a crime, and in fact the MPAA ONLY prosecuted those KNOWN to possess it for * distribution *, not possesion.

    What's more is that USING it to view any legally obtained DVD is not a crime. These things are what allow projects like xine and LiViD to exist with a relative lack of legal molestation.

    I've said this a thousand times already, and I'll keep saying it until people get it:

    The ONLY thing that has been ruled to be illegal about DeCSS is its *distribution.*

    *Possesion* of DeCSS is legal, it has been banned neither by a judge nor by the DMCA. If you have obtained a copy of DeCSS YOU are not in violation of the law, only your *source* is.

    USE of DeCSS for viewing legally obtained DVD's is not illegal.

    Any illegality of DeCSS, at the moment, applies strictly only to California and New York State. It is only in these states that courts that have ruled have any jurisdiction.

    The DMCA itself is strictly an AMERICAN law and has no jurisdiction * anywhere * else in the world.

    KFG

  8. Re:Is this piece of Perl covered by the DMCA? by cyber-vandal · · Score: 4

    I believe you can also be sued for debugging Perl code under the DMCA.

  9. Re:UUOC by Dr.+Awktagon · · Score: 4

    Useless use of cat!!

    Using cat to present on stdin isn't useless! What if, after running your command line, you discovered you had to run it through your special frob script:

    cat /mnt/dvd/VOB_FILE_NAME | frob | qrpff 153 2 8 105 225 | extract_mpeg2 | mpeg2_dec -
    Now if you use < you have to hit up arrow, and do some retyping, cutting and pasting..but with cat you can hit up arrow, move to the right place, and type frob and a pipe!

    cat is your friend..

  10. Maybe by Prophet+of+Doom · · Score: 4
    This probably should have been submitted to Ask a Lawyer rather than Slashdot but it is an interesting question.

    I'm not sure that it would matter to the courts whether the source code to descramble CSS was composed of 7 lines or 700, whether it was Perl or C or VB, compiled or binary. The judge probably wouldn't understand any of those details anyway. What really matters is that the MPAA scrambled the content on their DVDs and this code circumvents that. Just because you bought the disc, don't expect to use it in some way in which its owners don't approve. Unfotunately, if the judge could really understand the details of the case I think he would agree with the opinions expressed on Slashdot, so would just about any sensible person who doesn't have some vested intrest in the MPAA's revenue stream.

    The reality is that once the lawyers use the word 'hacker' to describe the people who write code like this, throw in 'circumvent' a few times, and tell everyone that this program will cause their DVD prices to skyrocket, people's heads turn. The facts of the case get lost.

    Anyway, this is a nice accomplishment. 7 lines of Perl that will descramble CSS. Sad that it constitutes a circumvention device, but maybe that will change.

  11. Re:CSS Encoder? by Anonymous Coward · · Score: 5

    On second thought, you should email professor Touretzky with this suggestion. He could encrypt one of his copyrighted works and place it on a page at the site and let people know that DeCSS is necessary for them to read his words. On the other hand, this emphasizes the functional aspect of DeCSS which is different from Touretzky's focus. It would allow him to sue (under the DMCA) anyone who trafficked in (or now I think it's even possesses) a circumvention device, such as the courts have determined DeCSS to be. He could sue himself! If he placed his words on a DVD and encrypted using CSS, could he sue the DVD makers for trafficking in a circumvention device -- a DVD player. He could license his DVD as not being allowed (under his authority as a copyright holder) to be used in any DVD player with built-in CSS decryption. Then the DVD makers would be violating the DMCA vis a vis Toretzky's authority as a copyright holder.

  12. For the love of coding! by Pedro+Picasso · · Score: 5
    Please, people. This sort of rampant display of the idiocy of the DMCA (pdf) is fun, but it's not going to help much. What we need is real action. 2600 has already shown that the MPAA has links posted to the code their fighting against (thought the Disney online search engine). This sort of rampant proliferation is cute, but it's not producing results.

    Things that actually help:

    1. OpenDVD - actually learn about the DMCA and the case against it.
    2. Electronic Frontier Foundation - donate to the actual court case
    3. US Congress - Hand write your representatives and inform them of your digust with this law
    Don't get me wrong. Sig files are fun and using this tiny piece of code in every post might help, but this situation isn't going to get better unless we put some real work into it.
    -the Pedro Picasso

    (sourceCode==freeSpeech)

    --

    1. Re:For the love of coding! by dillon_rinker · · Score: 5

      Dear Congress Critter (insert name here):

      Under current law, you are in illegal possession of a copyright protection circumvention device (see attachment). Under the Freedom of Information Act, I demand that you retain this information and make it available to me. However, under the DMCA, I demand that you initiate impeachment proceedings against yourself for your flagrant violation of the law in receiving the attached piece of paper.

      Yours truly,

      (insert name here)

  13. CSS Encoder? by grahamm · · Score: 5

    Has anyone ever published a CSS encoder? Then people could encode their documents/articles/emails etc with this and distribute DeCSS as the mechanism for accessing the information. This usage should not fall foul of DCMA as it is being distributed by the owner of of the copyright material (you) to enable access. MPAA did not patent CSS, so can they prevent anyone from using the algorithm to "protect" their own copyright material?

  14. and the useless use of 'cat' goes to.... by orabidoo · · Score: 5

    slashdot, for the command line at the end of the example.

  15. Is this one actually illegal? by dschuetz · · Score: 5
    It looks like this won't automagically decode "any" DVD, but requires you to know the key first. Therefore, without a specific key given to you by the content providers, you're not actually able to decode the content. Does that mean that this script actually is not in violation of DMCA or other such MPAA devices? It's not actually a "circumvention" device, it's the actual decryption device, that requires secret keys to operate.

    Once you write brute-force wrapper around it to bludgeon out keys, or something to derive a title key from a disk key, utilizing secrets stolen by illegally reverse-engineering other stuff, then are you violating MPAA plans?

  16. Anyone notice this little bit of the code? by HuvahCraftah · · Score: 5

    >8^(

    I think that's a portrait of the people at the MPAA.

  17. .sig!! Yay!! by Noryungi · · Score: 5

    Let's have fun, ladies and gentlement!!

    We should all add this snippet of code to our .sigs and use it everyday for every form of electronic communication: Slashdot postings, Usenet, email, you name it!!

    Then stand back and watch as lawyers for the DVD Association go crazy, trying to sue everyone! Even better than linking! =)

    The DeCSS case will be won, not in the court, but over the Internet -- so fire up that editor today... ROFL

    --
    The right to offend is far more important than the right not to be offended. (Rowan Atkinson)
  18. Terse by pallex · · Score: 5

    Perl has got to be the only language where its actually more readable when compiled and then disassembled!

  19. erm by fjordboy · · Score: 5

    if it was a violation, I am sure posting the script on /. is as well. :) This will make for a much better "Got DeCSS" shirt, because it will actually all fit on the shirt.