Class Cryptokit.Block.ctr

class ctr : ?iv:string -> ?inc:int -> block_cipher -> block_cipher
Add Counter mode to the given block cipher. Viewing the IV as a blocksize-byte integer in big-endian representation, the blocks IV, IV+1, IV+2, ... are encrypted using the given block cipher, and the result is xor-ed with the input blocks to produce the output blocks. The additions IV+n are performed modulo 2 to the 8 * inc power. In other words, only the low inc bytes of the IV are subject to incrementation; the high blocksize - inc bytes are unaffected. inc defaults to blocksize. The returned block cipher has the same block size as the underlying block cipher, and is usable both for encryption and decryption.