Cleaned up abysmal decryption code.
Test script uses more realistic test data and web client will actually
parse it.