package batteries

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

batteries-3.10.0.tar.gz
md5=b7f3b99f12f21b1da6b6aa13d993206d
sha512=8b7f2479eb0271bcfd9168887c1e4a9a815c512eab3ee61b150fc4dfa9ec803e4f73115155f20b3017e4a822148d0e6d1c1e8e5f96790fd691b419dd39a908a2

doc/batteries.unthreaded/BatBase64/index.html

Module BatBase64Source

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
Sourceexception Invalid_char

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

Sourceexception Invalid_table

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

Sourcetype encoding_table = char array

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

Sourcetype 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.

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

Encode a string into Base64.

Sourceval 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.

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

Generic base64 encoding over an output.

Generic base64 decoding over an input.

Sourceval make_decoding_table : encoding_table -> decoding_table

Create a valid decoding table from an encoding one.