Encryption Documentation for www.Videodetective.net/player.aspx Application
This document describes how to create an MD5 hash and expiration of URLs to video
The hash code (h in the url) is an MD5 hash appended to the end of the request to
the player. This hash code is created by encrypting your secret key and url to the
video. For example:
The logic to create a hash is as follows:
dim Md5Hash as string ' the hash code to append to the url
dim Url as string ' the url containing publishedId, customerId, e, etc...
dim RequestUrl as string ' the url and the hash (a valid url)
dim SharedSecretKey as string ' the constant shared key videodetective and you.
Md5Hash = MD5(lcase(SharedSecretKey & Url)) ' calls a MD5 function to create a hashcode
RequestUrl = URL + "&h=" + Hash + "&Stuff not included in the hash if you want."
There are a number of ways to create and md5 hash. Below are some examples.
ASP.NET: Use the builtin function FormsAuthentication.HashPasswordForStoringInConfigFile(StringToEncrypt,
ActionScript 2.0: There are various scripts available. We have tested
Important: although Md5 is available in Actionscript 2.0
we recommend not including your secret key inside a swf as swfs can be easily decompiled
allowing other sites to utilize your videodetective account.
In order to prevent a valid URL from being "hot linked" for an extended period of
time an expiration is required.
The expiration for the videodetective.net/player.aspx is measured in the number
of seconds from 1/1/1970. Below is a vbscript example of creating a TTL for 3 minutes.
* Please note that the server date is based on GMT time.
Public Function makettl()
TimeoutDate = DateAdd("n", 3, Now)
makettl = DateDiff("s", "01/01/1970 00:00:00", TimeoutDate) ' convert to unix time
The GMTOffset is the difference between your server's time and GMT Time.
One way to get GmtOffset is to use jScript:
GMTOffset = 0 - new Date().getTimezoneOffset()
// GMT offset in minutes of the server (sign inversed to bring into line with reality)