Ensure counter is digested high order byte first.
Minor refactor.
Simplify encode_digest.
Merge pull request #1 from Ryman/master

Ensure big endian parsing