gwenhywfar 5.12.0
base64.c File Reference
#include "base64.h"
#include <gwenhywfar/misc.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/text.h>
#include <string.h>
Include dependency graph for base64.c:

Go to the source code of this file.

Macros

#define DISABLE_DEBUGLOG

Functions

int GWEN_Base64_Decode (const unsigned char *src, unsigned int size, GWEN_BUFFER *dst)
int GWEN_Base64_Encode (const unsigned char *src, unsigned int size, GWEN_BUFFER *dst, unsigned int maxLineLength)

Variables

static const char GWEN_Base64_Alphabet []

Macro Definition Documentation

◆ DISABLE_DEBUGLOG

#define DISABLE_DEBUGLOG

Definition at line 30 of file base64.c.

Function Documentation

◆ GWEN_Base64_Decode()

int GWEN_Base64_Decode ( const unsigned char * src,
unsigned int size,
GWEN_BUFFER * dst )

Decodes base64 encoded data and stores the result in a GWEN_BUFFER.

Returns
0 if ok, !=0 on error
Parameters
srcsrc buffer
sizenumber of bytes to store in the GWEN_BUFFER (this is NOT the number of bytes stored in the source buffer, that buffer must hold more bytes because base64 encoding inflates the data to 4/3).
dstdestination buffer

Definition at line 133 of file base64.c.

References DBG_ERROR, GWEN_Base64_Alphabet, GWEN_Buffer_AppendByte(), and GWEN_LOGDOMAIN.

Referenced by check1(), and GWEN_Crypt_Token_Context_ReadXml().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Base64_Encode()

int GWEN_Base64_Encode ( const unsigned char * src,
unsigned int size,
GWEN_BUFFER * dst,
unsigned int maxLineLength )

Encodes the given bytes and stores the result in a GWEN_BUFFER.

Returns
0 if ok, !=0 on error
Parameters
srcsrc buffer
sizenumber of bytes in the source buffer
dstdestination buffer
maxLineLengthafter this number of bytes a line break is inserted (if 0 then no line break is inserted)

Definition at line 44 of file base64.c.

References DBG_ERROR, GWEN_Base64_Alphabet, GWEN_Buffer_AppendByte(), GWEN_Buffer_AppendString(), and GWEN_LOGDOMAIN.

Referenced by check1(), and GWEN_Crypt_Token_Context_WriteXml().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ GWEN_Base64_Alphabet

const char GWEN_Base64_Alphabet[]
static
Initial value:
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="

Definition at line 40 of file base64.c.

Referenced by GWEN_Base64_Decode(), and GWEN_Base64_Encode().