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 c
returns true if the characterc
is 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 bv
returns a string that is the Base-64 encoding of the byte vectorbv
. val encodeSlice : Word8VectorSlice.slice -> string
-
encode bvs
returns 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 s
returns the result of decoding the Base-64 strings
. This function ignores whitespace (e.g., line breaks), but will raise theIncomplete
exception if the last quantum is incomplete. val decodeSlice : substring -> Word8Vector.vector
-
decode ss
returns the result of decoding the Base-64 substringss
. This function ignores whitespace (e.g., line breaks), but will raise theIncomplete
exception if the last quantum is incomplete. val decodeStrict : string -> Word8Vector.vector
-
decodeStrict s
returns the result of decoding the Base-64 strings
. The strings
maust only contain valid Base-64 characters, otherwise theInvalid
exception is raised. This function will also raise theIncomplete
exception if the last quantum is incomplete. val decodeSliceStrict : substring -> Word8Vector.vector
-
decode ss
returns the result of decoding the Base-64 substringss
. The strings
maust only contain valid Base-64 characters, otherwise theInvalid
exception is raised. This function will also raise theIncomplete
exception if the last quantum is incomplete.