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!