class type scheme = object
.. end
Generic interface of a padding scheme.
method pad : string -> int -> unit
pad str used
is called with a buffer string
str
containing valid input data at positions
0, ..., used-1
.
The
pad
method must write padding characters in positions
used
to
String.length str - 1
. It is guaranteed that
used < String.length str
, so that at least one character of
padding must be added. The padding scheme must be unambiguous
in the following sense: from
buf
after padding, it must be
possible to determine
used
unambiguously. (This is what
method
Cryptokit.Padding.scheme.strip
does.)
method strip : string -> int
This is the converse of the pad
operation: from a padded
string buf
as built by method pad
, strip buf
determines
and returns the starting position of the padding data,
or equivalently the length of valid, non-padded input data
in buf
. This method must raise Error Bad_padding
if
buf
does not have the format of a padded block as produced
by pad
.