Main Page Modules Data Structures File List Data Fields Globals Related Pages

# beecrypt/base64.h File Reference

Base64 encoding/decoding, header. More...

`#include "beecrypt.h"`

Go to the source code of this file.

## Defines

#define | B64DECODE_WHITESPACE " \f\n\r\t\v"
#define | B64ENCODE_CHARS_PER_LINE 72
#define | B64ENCODE_EOLSTR "\n"

## Functions

char * | b64encode (const void *data, int ns)
| Encode chunks of 3 bytes of binary input into 4 bytes of base64 output. More...
char * | b64crc (const unsigned char *data, int ns)
| Encode crc of binary input data into 5 bytes of base64 output. More...
int | b64decode (const char *s, void **datap, int *lenp)
| Decode chunks of 4 bytes of base64 input into 3 bytes of binary output. More...
char * | b64enc (const memchunk *)
memchunk * | b64dec (const char *)

## Variables

const char * | b64decode_whitespace
| Decode white space character set (default). More...
int | b64encode_chars_per_line
| Encode 72 characters per line (default). More...
const char * | b64encode_eolstr
| Encode end-of-line string (default). More...

## Detailed Description

Base64 encoding/decoding, header.

Definition in file base64.h.

## Define Documentation

#define B64DECODE_WHITESPACE " \f\n\r\t\v"

| Definition at line 40 of file base64.h.

#define B64ENCODE_CHARS_PER_LINE 72

| Definition at line 49 of file base64.h.

#define B64ENCODE_EOLSTR "\n"

| Definition at line 58 of file base64.h.

## Function Documentation

char* b64crc | ( | const unsigned char * | data,
|  | int | ns
| ) |

Encode crc of binary input data into 5 bytes of base64 output.

Parameters:

  data | binary data
  ns | crc of data

Returns:
  (malloc'd) base64 string

Definition at line 338 of file base64.c.

Referenced by armorFormat.

memchunk* b64dec | ( | const char * |  | ) |

| Definition at line 106 of file base64.c.

int b64decode | ( | const char * | s,
|  | void ** | datap,
|  | int * | lenp
| ) |

Decode chunks of 4 bytes of base64 input into 3 bytes of binary output.

Parameters:

  s | base64 string

Return values:

  datap | address of (malloc'd) binary data
  lenp | address of no. bytes of binary data

Returns:
  0 on success, 1: s == NULL, 2: bad length, 3: bad char

Definition at line 370 of file base64.c.

Referenced by armorFormat, pgpReadPkts, rpmdbAdd, rpmdbRemove, and rpmtsFindPubkey.

char* b64enc | ( | const memchunk * |  | ) |

| Definition at line 42 of file base64.c.

char* b64encode | ( | const void * | data,
|  | int | ns
| ) |

Encode chunks of 3 bytes of binary input into 4 bytes of base64 output.

Parameters:

  data | binary data
  ns | no. bytes of data (0 uses strlen(data))

Returns:
  (malloc'd) base64 string

Definition at line 249 of file base64.c.

Referenced by armorFormat, b64crc, base64Format, and rpmcliImportPubkey.

## Variable Documentation

const char* b64decode_whitespace

| Decode white space character set (default). Definition at line 38 of file base64.h.

int b64encode_chars_per_line

| Encode 72 characters per line (default). Definition at line 47 of file base64.h.

const char* b64encode_eolstr

| Encode end-of-line string (default). Definition at line 56 of file base64.h.