flibs/strings(n) 1.1 "flibs"

Name

flibs/strings - Encode/decode base64 strings

Table Of Contents

Synopsis

Description

The base64 module contains two routines, one to encode a sequence of bytes (stored as a character string) to a string of characters according to the base64 scheme and one to convert a base64 string back to the original bytes (again stored as a character string).

ROUTINES

use base64

To import the definitions, use this module.

call encode( string, encoded_string )

Convert the input string string and return the base64 result in the second argument.

character(len=*), intent(in) string

The string to be converted

character(len=:), allocatable, intent(out) encoded_string

The string holding the encoding. Note that the string is automatically allocated to the right size. If necessary, padding ("=" characters) is added.

call decode( encoded_string, output, error )

Convert the base64 input string encoded_string and return the decoded result in the second argument.

character(len=*), intent(in) encoded_string

The base64 string to be converted back to the original.

character(len=:), allocatable, intent(out) output

The string holding the original sequence of bytes. Note that the string is automatically allocated to the right size. Padding ("=" characters) is optional. Spaces in or surrounding the base64 string are ignored.

logical, intent(out) error

If the base64 string contains invalid characters, then this argument is set to true, otherwise it is to set to false and the output argument will contain the decoded sequence of bytes.