routine or constant name search

8.24 Base 64 Encoding and Decoding

Base64 is used to encode binary data into an ASCII string; this allows binary data to be transmitted using media designed to transmit text data only. See en.wikipedia.org/wiki/Base64 and the RFC 2045 standard for more information.

8.24.1 Routines

8.24.1.1 encode

include std/base64.e
namespace base64
public function encode(sequence in, integer wrap_column = 0)

encodes to base64.

Parameters:
  1. in -- must be a simple sequence
  2. wrap_column -- column to wrap the base64 encoded message to; defaults to 0 which is do not wrap
Returns:

A sequence, a base64 encoded sequence representing in.

Example 1:
puts(1, encode( "Hello Euphoria!") )
--> SGVsbG8gRXVwaG9yaWEh

8.24.1.2 decode

include std/base64.e
namespace base64
public function decode(sequence in)

decodes from base64.

Parameters:
  1. in -- must be a simple sequence of length 4 to 76 .
Returns:

A sequence, base256 decode of passed sequence. the length of data to decode must be a multiple of 4 .

Comments:

The calling program is expected to strip newlines and so on before calling.