DeCSS as an Illegal Number (TIL)

When the law defines something as illegal, and you can represent that thing as a number, is that number or processing that number illegal?

The concept of illegal numbers raises interesting questions, and provides a interesting way to evade law or at least preserve (knowledge of) infringing data.

Numbers can be arbitrarily large. As such, a large number can represent data, binary data, and even program data or source code.

DeCSS - Decoding DVD video

Initially, there was no free and open way to play video DVDs. Your only option was to use proprietary products. Free and open operating systems like Linux were not able to play them.

DeCSS was the first to implement decrypting of commercially produced video DVDs without a license from the DVD Copy Control Association.

When legal threats against sites hosting DeCSS began in 1999, efforts began to mirror the program in various forms.

Creative mirroring was one form of protest against the legislation that prohibits publication of copy protection circumvention code.

Creating another program called DeCSS to bait unjustified takedowns was another form of successful protest, with a school taking down a script that removes CSS from HTML/a website (fitting functionality for something called DeCSS).

Hiding DeCSS in a number

How do you hide a program in a number?

  • Source code is useful, readable, and compatible than binary program data
  • Prime numbers exist as a distinct mathematics feature, and distinct and significant numbers, weakening any arguments against choosing just any number
  • Data compression reduces the size the number has to be
  • Varying the source code can influence the compression ratio and result

The goal was to encoding the DeCSS C source code in a prime number, or at least a number based on and calculated from a prime number (prime + x).

Because the source code uses only ASCII characters, using a 7-bit encoding can further reduce the space requirements.

DeCSS C-code -> gzip compression -> number

The following 1401 digit decimal number encodes the gzip-compressed program:

485650789657397829309841894694286137707442087351357924019652073668698513401047237446968797439926117510973777701027447528049058831384037549709987909653955227011712157025974666993240226834596619606034851742497735846851885567457025712547499964821941846557100841190862597169479707991520048667099759235960613207259737979936188606316914473588300245336972781813914797955513399949394882899846917836100182597890103160196183503434489568705384520853804584241565482488933380474758711283395989685223254460840897111977127694120795862440547161321005006459820176961771809478113622002723448272249323259547234688002927776497906148129840428345720146348968547169082354737835661972186224969431622716663939055430241564732924855248991225739466548627140482117138124388217717602984125524464744505583462814488335631902725319590439283873764073916891257924055015620889787163375999107887084908159097548019285768451988596305323823490558092032999603234471140776019847163531161713078576084862236370283570104961259568184678596533310077017991614674472549272833486916000647585917462781212690073518309241530106302893295665843662000800476778967984382090797619859493646309380586336721469695975027968771205724996666980561453382074120315933770309949152746918356593762102220068126798273445760938020304479122774980917955938387121000588766689258448700470772552497060444652127130404321182610103591186476662963858495087448497373476861420880529443

For decoding, you can use any programming language or interpretation that supports working with such a large decimal integer.

I used dotnet-script to write a short C# program/script to decode it into a BigInteger, transform it into a byte representation, and then decompress the source code.

using System.IO.Compression;
using System.Numerics;

void Convert(string dec, string outFilename)
{
  var i = BigInteger.Parse(dec);
  var bytes = i.ToByteArray(isUnsigned: false, isBigEndian: true);

  using var ms = new MemoryStream(bytes);
  using var zipStream = new GZipStream(ms, CompressionMode.Decompress);

  using FileStream outputFileStream = File.Create(outFilename);
  zipStream.CopyTo(outputFileStream);
}

var dec = "485650789657397829309841894694286137707442087351357924019652073668698513401047237446968797439926117510973777701027447528049058831384037549709987909653955227011712157025974666993240226834596619606034851742497735846851885567457025712547499964821941846557100841190862597169479707991520048667099759235960613207259737979936188606316914473588300245336972781813914797955513399949394882899846917836100182597890103160196183503434489568705384520853804584241565482488933380474758711283395989685223254460840897111977127694120795862440547161321005006459820176961771809478113622002723448272249323259547234688002927776497906148129840428345720146348968547169082354737835661972186224969431622716663939055430241564732924855248991225739466548627140482117138124388217717602984125524464744505583462814488335631902725319590439283873764073916891257924055015620889787163375999107887084908159097548019285768451988596305323823490558092032999603234471140776019847163531161713078576084862236370283570104961259568184678596533310077017991614674472549272833486916000647585917462781212690073518309241530106302893295665843662000800476778967984382090797619859493646309380586336721469695975027968771205724996666980561453382074120315933770309949152746918356593762102220068126798273445760938020304479122774980917955938387121000588766689258448700470772552497060444652127130404321182610103591186476662963858495087448497373476861420880529443";
Convert(dec, "DeCSS.c");

And indeed it can decode the decimal number into a c source file.

Historic Significance

History has shown how important decompilation and emulation efforts are. Often claimed to be illegal or detrimental by corporations, they are essential to cultural and technological preservation and access.

External References