Monday, June 1, 2009

Serving Up Samples Without Giving Away The Farm

If you are in the business of creating and selling multimedia productions online, you may have wondered how you can make samples of your content available for free but without giving it all away for free. For example, if you produce daily or weekly audio casts that people are willing to pay for, you probably don't want to post the mp3 files in a year/date/month.mp3 format on the web site. Otherwise, people can easily guess this scheme and download all of your recordings for free.

One two part approach to solve this problem is to obscure the file name such that it isn't easy to guess. For example, you could use the md5 sum of the file name. For example, the md5 sum for 20090529.mp3 might be d41d8cd98f00b204e9800998ecf8427e. You could re-name the file to be d41d8cd98f00b204e9800998ecf8427e.mp3.

This obfuscation method may be good for making it hard to guess other file names but it can make it a little more challenging to incorporate it into your web site. Therefore, the second part to this two part scheme is to provide an easy programmatic way to map the obfuscated file name to a more meaningful data point, like a date or title. For example, your web site may currently determine which audiocast sample to serve via the date. Here is a php sample snippet from one web site:
var mfile = 'audio/' + month + day + '.mp3'
The developer for this web site could through cgi (my favorite), php, or even asp lookup the mapping of md5 value through a reference file or a database. For example they could have a simple text file (hidden from web site view of course) like the following that maps the date of a recording to its corresponding md5 sum value.
2009/05/29 d41d8cd98f00b204e9800998ecf8427e
The web site would simply read the file looking for the specified date, and then parse out the md5 sum value for that date and use the md5 sum value for the mp3 file to serve up.

I hope this trivial idea helps you protect your digital assets.

Blessings to you and yours!

Brad