Encode binary data using printable characters.
More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
|
#define | SDB_INLINE static |
|
#define | SDB_EXPORT __declspec(dllimport) |
|
#define | SDB_EXTERN_C_START |
|
#define | SDB_EXTERN_C_END |
|
|
SDB_EXPORT int | base64Encode (const char *s, int in_size, char *out, int out_size) |
| String convert base64.
|
|
SDB_EXPORT int | base64Decode (const char *s, char *out, int out_size) |
| Base64 convert string.
|
|
SDB_EXPORT int | getEnBase64Size (int size) |
| Get string convert base64 need size.
|
|
SDB_EXPORT int | getDeBase64Size (const char *s) |
| Get base64 convert string need size.
|
|
Encode binary data using printable characters.
int base64Decode |
( |
const char * |
s, |
|
|
char * |
out, |
|
|
int |
out_size |
|
) |
| |
Base64 convert string.
- Parameters
-
[in] | s | Input string |
[in] | out_size | The size of the buffer that 'out' pointing to , make sure it's large enough |
[out] | out | Output string |
- Returns
- If successful return the length of string,else return 0
char *str = "aGVsbG8gd29ybGQ=" ;
char *out = (char *)malloc( len ) ;
memset( out, 0, len ) ;
printf( "out is: %s\n", out ) ;
free( out ) ;
SDB_EXTERN_C_STARTint base64Encode |
( |
const char * |
s, |
|
|
int |
in_size, |
|
|
char * |
out, |
|
|
int |
out_size |
|
) |
| |
String convert base64.
- Parameters
-
[in] | s | Input buffer |
[in] | in_size | Input buffer size |
[in] | out_size | The size of the buffer that 'out' pointing to , make sure it's large enough |
[out] | out | Output string |
- Returns
- If successful return the length of base64,else return 0
char *str = "hello world" ;
int strLen = strlen( str ) ;
char *out = (char *)malloc( len ) ;
memset( out, 0, len ) ;
printf( "out is: %s\n", out ) ;
free( out ) ;
int getDeBase64Size |
( |
const char * |
s | ) |
|
Get base64 convert string need size.
- Parameters
-
- Returns
- String length + 1
int getEnBase64Size |
( |
int |
size | ) |
|
Get string convert base64 need size.
- Parameters
-
[in] | size | original data size |
- Returns
- Base64 length + 1