Search this blog ...

Thursday, July 22, 2010

How to query and obtain MD5 checksum for a file hosted on

How many times have you downloaded file(s) from only to extract them / join them / etc and discover that the file appears to be corrupted? You then wonder was it a download issue, or was the actual file itself hosted on rapidshare the problem.

My ADSL2+ internet connection here in Australia is slow by today’s internet speed standards (realworld tests, I get 500 KB/s download and 100 KB/s upload); To add insult to injury, internet quota in Australia is capped!  Thus, I don’t want to have to download a large file again, unless absolutely required.

The solution to this problem, is to make a basic HTTP request to rapidshare and request MD5 checksum information for the specific file(s) concerned, and then compare this with the MD5 checksums of the downloaded files on your local machine.

To perform MD5 checksum on your local files, first get yourself a suitable md5 hash tool for your specific OS platform concerned:

You can then use my html script below to query rapidshare for checksum info.  Put in the textarea the rapidshare links to query, for example

The MD5 checksum is returned as 32-character, hexadecimal-formatted hash. Using the test.iso link above for example, the MD5 checksum component returned by rapidshare appears in bold below:


    <!-- Code by M.Shannon -->

    <script type="text/javascript">

      var debugMode=false; // set to true to enable window alerts

      function findURLs(refFiles, refFileNames)
        var exp=/http:\/\/(www\.)?rapidshare\.com\/files\/\d+\/[\w_\-\.]+/igm;
        var matches = document.getElementById("urls").value.match(exp);

        if (matches != null)
          for (var i = 0; i < matches.length; i++)
            var url = matches[i];
            if (debugMode) { alert(url); }
            var index1 = url.lastIndexOf("/files/");
            var index2 = url.lastIndexOf("/");

            refFiles.push(url.substring(index1 + 7, index2));
            refFileNames.push(url.substring(index2 + 1));

      function validate(form)
        var files = new Array();
        var fileNames = new Array();

        findURLs(files, fileNames);

        if (files.length > 0)
          if (debugMode) { alert(files); alert(fileNames); }
          form.files.value = files.toString();
          form.filenames.value = fileNames.toString();
          return true;
        return false;


  <form><textarea id="urls" cols="80" rows="4">paste your rapidshare hyperlinks in to this textarea</textarea></form>

  <form method="post" action="" onsubmit="return validate(this);">
    <input name="sub" type="hidden" value="checkfiles_v1">
    <input name="incmd5" type="hidden" value="1">
    <input name="files" type="hidden" value="">
    <input name="filenames" type="hidden" value="">
    <input type="submit">

  <script type="text/javascript">


1 comment:

  1. the above code no longer works. rapidshare changed the subroutine name

    ERROR: Invalid routine called. (5b97895d)