LibDap
This library contains the basic modules that are used in the products of the family DAP
Macros | Typedefs | Functions | Variables
dap_enc_base64.c File Reference
#include <math.h>
#include <stdio.h>
#include <stdint.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "dap_enc_base64.h"

Macros

#define b64_malloc(ptr)   malloc(ptr)
 
#define b64_realloc(ptr, size)   realloc(ptr, size)
 

Typedefs

typedef unsigned char byte
 

Functions

int B64_GetSize (int sz, int isEncode)
 
void B64_Encode (const byte *srcBytes, int srcLen, char *outChars)
 
void B64_Decode (const char *srcChars, int srcLen, byte *outBytes)
 
char B64_EncodeByte (byte b)
 
byte B64_DecodeByte (byte b)
 
char * b64_encode (const unsigned char *, size_t)
 
unsigned char * b64_decode (const char *, size_t)
 
unsigned char * b64_decode_ex (const char *, size_t, size_t *)
 
static const char * b64_table_by_standard (dap_enc_b64_standard_t standard)
 b64_table_by_standard The function returns the corresponding table of indices More...
 
size_t dap_enc_base64_decode (const char *in, size_t in_size, void *out, dap_enc_b64_standard_t standard)
 dap_enc_base64_decode Function of reverse transformation of base64 algorithm More...
 
size_t dap_enc_base64_encode (const void *a_in, size_t a_in_size, char *a_out, dap_enc_b64_standard_t standard)
 dap_enc_base64_encode The function encodes the array according to the base64 algorithm More...
 

Variables

static const char b64_standart_table []
 
static const char b64_table_url_safe []
 

Macro Definition Documentation

#define b64_malloc (   ptr)    malloc(ptr)
#define b64_realloc (   ptr,
  size 
)    realloc(ptr, size)

Typedef Documentation

typedef unsigned char byte

Function Documentation

void B64_Decode ( const char *  srcChars,
int  srcLen,
byte outBytes 
)
unsigned char* b64_decode ( const char *  ,
size_t   
)

Dencode `char *' source with `size_t' size. Returns a `unsigned char *' base64 decoded string.

unsigned char* b64_decode_ex ( const char *  ,
size_t  ,
size_t *   
)

Dencode `char *' source with `size_t' size. Returns a `unsigned char *' base64 decoded string + size of decoded string.

byte B64_DecodeByte ( byte  b)
void B64_Encode ( const byte srcBytes,
int  srcLen,
char *  outChars 
)
char* b64_encode ( const unsigned char *  ,
size_t   
)

Encode `unsigned char *' source with `size_t' size. Returns a `char *' base64 encoded string.

char B64_EncodeByte ( byte  b)
int B64_GetSize ( int  sz,
int  isEncode 
)
static const char* b64_table_by_standard ( dap_enc_b64_standard_t  standard)
static

b64_table_by_standard The function returns the corresponding table of indices

Parameters
[in]standardBase64 or Base64 URLSAFE encoding
Returns
index table
size_t dap_enc_base64_decode ( const char *  in,
size_t  in_size,
void *  out,
dap_enc_b64_standard_t  standard 
)

dap_enc_base64_decode Function of reverse transformation of base64 algorithm

Parameters
[in]inPointer to an array with incoming data
[in]in_sizeSize of the array with outgoing data
[out]outPointer to an array with outgoing data
Returns
Size of the array with outgoing data
size_t dap_enc_base64_encode ( const void *  a_in,
size_t  a_in_size,
char *  a_out,
dap_enc_b64_standard_t  standard 
)

dap_enc_base64_encode The function encodes the array according to the base64 algorithm

Parameters
[in]a_inArray with incoming data
[in]a_in_sizeThe size of the deviance array in the a_in parameter
[out]a_outA pointer to an array in which the data will be after encoding
Returns
Size of the array with outgoing data

Variable Documentation

const char b64_standart_table[]
static
Initial value:
= {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '+', '/'
}

Base64 index table.

const char b64_table_url_safe[]
static
Initial value:
= {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '-', '_'
}

Base64 url safe index table.