libubox
C utility functions for OpenWrt.
test-b64.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "utils.h"

Go to the source code of this file.

Macros

#define BUF_LEN   255
 

Functions

static void test_b64_encode (const char *src)
 
static void test_b64_decode (const char *src)
 
int main ()
 

Macro Definition Documentation

◆ BUF_LEN

#define BUF_LEN   255

Definition at line 7 of file test-b64.c.

Function Documentation

◆ main()

int main ( )

Definition at line 25 of file test-b64.c.

26 {
27  test_b64_encode("");
28  test_b64_encode("f");
29  test_b64_encode("fo");
30  test_b64_encode("foo");
31  test_b64_encode("foob");
32  test_b64_encode("fooba");
33  test_b64_encode("foobar");
34 
35  test_b64_decode("");
36  test_b64_decode("Zg==");
37  test_b64_decode("Zm8=");
38  test_b64_decode("Zm9v");
39  test_b64_decode("Zm9vYg==");
40  test_b64_decode("Zm9vYmE=");
41  test_b64_decode("Zm9vYmFy");
42 
43  return 0;
44 }
static void test_b64_decode(const char *src)
Definition: test-b64.c:17
static void test_b64_encode(const char *src)
Definition: test-b64.c:9
Here is the call graph for this function:

◆ test_b64_decode()

static void test_b64_decode ( const char *  src)
static

Definition at line 17 of file test-b64.c.

18 {
19  char *dst = malloc(BUF_LEN+1);
20  int r = b64_decode(src, dst, BUF_LEN);
21  fprintf(stdout, "%d %s\n", r, dst);
22  free(dst);
23 }
int b64_decode(const void *_src, void *dest, size_t targsize)
Definition: base64.c:203
#define BUF_LEN
Definition: test-b64.c:7
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_b64_encode()

static void test_b64_encode ( const char *  src)
static

Definition at line 9 of file test-b64.c.

10 {
11  char *dst = malloc(BUF_LEN+1);
12  int r = b64_encode(src, strlen(src), dst, BUF_LEN);
13  fprintf(stdout, "%d %s\n", r, dst);
14  free(dst);
15 }
int b64_encode(const void *_src, size_t srclength, void *dest, size_t targsize)
Definition: base64.c:139
Here is the call graph for this function:
Here is the caller graph for this function: