The encryptiong/decryption is simulated using XOR with a key, and the block
mode is CBC with PCKS5 padding. The decryption function acts as a padding oracle by throwing
an exception if the padding is invalid.
A description of CBC encryption/decryption is available here:
Automated Padding Oracle Attacks with PadBuster
The padding oracle decryption algorithm may not be the most optimal, but it seems to work most of the time.
A C# implementation is available here: http://github.com/eoftedal/PoetAndDidntKnowIt