Faster decryption for iPlayer downloads

I’ve managed to make a decent improvement to the code that performs the iPlayer XOR decryption. It’s not as fast as it could be in C, but it’s a lot better than it was.

For those who are interested, I’ve used pack/unpack to quickly convert a string into an array of byte values and back again, and I’ve unrolled the loop and used a simple guard to reduce the amount of branching when XORing the main part of the file. The diff explains it.

Here are the files; get them while they’re fresh!

Comments

  1. Jamie Thompson

    Wrote at 2008-06-12 08:27 UTC using Firefox 2.0.0.14 on Windows XP:

    You Sir, are a genius
  2. Mac Man

    Wrote at 2008-06-12 09:34 UTC using Firefox 2.0.0.14 on Mac OS X:

    I can’t work with code :-( Has the Mac OS X GUI version been fixed? I can’t find it.

    Thank you Paul and everyone working very hard on the iPlayer Downloader. :-D
  3. Irregular Shed

    Wrote at 2008-06-12 09:48 UTC using Firefox 2.0.0.14 on Windows XP:

    Nice work Paul. I’m still reeling over the use of XOR – last time I did anything with that was encrypting messages on a Spectrum!
  4. Strawp

    Wrote at 2008-06-12 10:45 UTC using Firefox 3.0 on Windows XP:

    I’ve direct linked to the files on http://beebhack.wikia.com/wiki/Programs#Windows if that’s OK.

    BTW, let me know if you want sysop on that wiki Paul. It seems to be picking up momentum!
  5. Graingert

    Wrote at 2008-06-12 10:48 UTC using Firefox 3.0 on Linux:

    Are there any instructions to make the linux gui work?

    I just get

    /usr/local/lib/site_ruby/1.8/iplayer/gui/app.rb:1:in `require’: no such file to load—wx (LoadError)
    from /usr/local/lib/site_ruby/1.8/iplayer/gui/app.rb:1
    from /usr/bin/iplayer-dl-gui:11:in `require’
    from /usr/bin/iplayer-dl-gui:11
  6. Paul Battley

    Wrote at 2008-06-12 13:35 UTC using Firefox 3.0 on Mac OS X:

    Comments are now closed: please visit the new project page for more information (including Linux instructions).