package data-encoding

  1. Overview
  2. Docs

Create encodings that produce data of a fixed length when binary encoded. See the preamble for an explanation.

val string : int -> string encoding
  • raises Invalid_argument

    if the argument is less or equal to zero.

val bytes : int -> Stdlib.Bytes.t encoding
  • raises Invalid_argument

    if the argument is less or equal to zero.

val add_padding : 'a encoding -> int -> 'a encoding

add_padding e n is a padded version of the encoding e. In Binary, there are n null bytes (\000) added after the value encoded by e. In JSON, padding is ignored.

  • raises Invalid_argument

    if n <= 0.

OCaml

Innovation. Community. Security.