Module Counter

Fast counter functions for CTR cipher modes.

CTR is a chaining mode for symmetric block encryption or decryption.
Messages are divideded into blocks, and the cipher operation takes
place on each block using the secret key and a unique counter block.

The most straightforward way to fulfil the uniqueness property is
to start with an initial, random counter block value, and increment it as
the next block is processed.

The block ciphers from Crypto.Cipher (when configured in MODE_CTR mode)
invoke a callable object (the counter parameter) to get the next counter block.
Unfortunately, the Python calling protocol leads to major performance degradations.

The counter functions instantiated by this module will be invoked directly
by the ciphers in Crypto.Cipher. The fact that the Python layer is bypassed
lead to more efficient (and faster) execution of CTR cipher modes.