package batteries

  1. Overview
  2. Docs
A community-maintained standard library extension

Install

Dune Dependency

Authors

Maintainers

Sources

v3.5.1.tar.gz
md5=d3d16ffc960e832a1c0e21b7123194e9
sha512=36c8561079aa9fefc864c2f03bd8ae20aa05987bb67e7a9beac3ab4f440dbf7d44f141c172b05fddb1a5b618fc55a27962bb45fc39bd7b3a15d56e0ed3ff3870

doc/batteries.unthreaded/BatBase64/index.html

Module BatBase64

Base64 codec.

8-bit characters are encoded into 6-bit ones using ASCII lookup tables. Default tables maps 0..63 values on characters A-Z, a-z, 0-9, '+' and '/' (in that order).

@documents Base64

  • author Nicolas Cannasse
exception Invalid_char

This exception is raised when reading an invalid character from a base64 input.

exception Invalid_table

This exception is raised if the encoding or decoding table size is not correct.

type encoding_table = char array

An encoding table maps integers 0..63 to the corresponding char.

type decoding_table = int array

A decoding table maps chars 0..255 to the corresponding 0..63 value or -1 if the char is not accepted.

val str_encode : ?tbl:encoding_table -> string -> string

Encode a string into Base64.

val str_decode : ?tbl:decoding_table -> string -> string

Decode a string encoded into Base64, raise Invalid_char if a character in the input string is not a valid one.

val encode : ?tbl:encoding_table -> 'a BatIO.output -> 'a BatIO.output

Generic base64 encoding over an output.

val decode : ?tbl:decoding_table -> BatIO.input -> BatIO.input

Generic base64 decoding over an input.

val make_decoding_table : encoding_table -> decoding_table

Create a valid decoding table from an encoding one.

OCaml

Innovation. Community. Security.