This was code I wrote for the crypto job interview.  I thought it would be clever to implement a state machine for the parsing requirement.  Sadly they did not like my code.  I'm not sure why. I thought it was very flexible.