package cryptokit

  1. Overview
  2. Docs

Add Output Feedback Block (OFB) to the given block cipher. The integer argument n is the number of bytes processed at a time; it must lie between 1 and the block size of the underlying cipher, included. The returned block cipher has block size n. It is usable both for encryption and decryption.

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.

method blocksize : int

The size in bytes of the blocks manipulated by the cipher.

method transform : bytes -> int -> bytes -> int -> unit

The size in bytes of the blocks manipulated by the cipher.

transform src spos dst dpos encrypts or decrypts one block of data. The input data is read from byte array src at positions spos, ..., spos + blocksize - 1, and the output data is stored in byte array dst at positions dpos, ..., dpos + blocksize - 1.

method wipe : unit

transform src spos dst dpos encrypts or decrypts one block of data. The input data is read from byte array src at positions spos, ..., spos + blocksize - 1, and the output data is stored in byte array dst at positions dpos, ..., dpos + blocksize - 1.

Erase the internal state of the block cipher, such as all key-dependent material.

OCaml

Innovation. Community. Security.