The Base64 structure provides support for Base-64 encoding/decoding
as specified by RFC 4648.
Synopsis
signature BASE64
structure Base64 : BASE64
Interface
val isBase64 : char -> bool
val encode : Word8Vector.vector -> string
val encodeSlice : Word8VectorSlice.slice -> string
exception Incomplete
exception Invalid of (int * char)
val decode : string -> Word8Vector.vector
val decodeSlice : substring -> Word8Vector.vector
val decodeStrict : string -> Word8Vector.vector
val decodeSliceStrict : substring -> Word8Vector.vector
Description
val isBase64 : char -> bool-
isBase64 creturns true if the charactercis in the Base-64 alphabet (i.e., a letter, digit, or a slash or plus character). Note that the padding character (the equals sign) is not considered to be in the alphabet. val encode : Word8Vector.vector -> string-
encode bvreturns a string that is the Base-64 encoding of the byte vectorbv. val encodeSlice : Word8VectorSlice.slice -> string-
encode bvsreturns a string that is the Base-64 encoding of the byte-vector slicebvs.
exception Incomplete-
This exception is raised by the decoding functions if a Base-64 string does not end in a complete encoding quantum (i.e., four characters including padding characters).
exception Invalid of (int * char)-
This exception is raised by the decoding functions if an invalid Base-64 character is encountered. The int is the position of the character and the char is the invalid character.
val decode : string -> Word8Vector.vector-
decode sreturns the result of decoding the Base-64 strings. This function ignores whitespace (e.g., line breaks), but will raise theIncompleteexception if the last quantum is incomplete. val decodeSlice : substring -> Word8Vector.vector-
decode ssreturns the result of decoding the Base-64 substringss. This function ignores whitespace (e.g., line breaks), but will raise theIncompleteexception if the last quantum is incomplete. val decodeStrict : string -> Word8Vector.vector-
decodeStrict sreturns the result of decoding the Base-64 strings. The stringsmaust only contain valid Base-64 characters, otherwise theInvalidexception is raised. This function will also raise theIncompleteexception if the last quantum is incomplete. val decodeSliceStrict : substring -> Word8Vector.vector-
decode ssreturns the result of decoding the Base-64 substringss. The stringsmaust only contain valid Base-64 characters, otherwise theInvalidexception is raised. This function will also raise theIncompleteexception if the last quantum is incomplete.