LibJAD Web Routines
#include "jadweb.h"
Overview
Libjad provides a set of routines for web encoding and decoding.
unsigned char* base64_decode(char* b64, size_t* lenout)
b64 | The string to decode. |
lenout | This is an output variable. It contains the length of the returned buffer. |
return | An array of bytes containing the decoded data. Of size lenout. |
Converts from base64 to binary. Ignores any character that is not part of the encoding, such as whitespace. Data to convert should be in b64 and null terminated. Returns a buffer filled with binary data and sets the value pointed at by length to the length of the returned data.
char* base64_encode(unsigned char* data, size_t length)
data | The data buffer to encode. |
length | The length of the buffer pointed to by data. |
return | A null terminated string representing the data in base64. |
Encode a buffer of binary data to a null terminated string containing the base64 representation. The returned buffer is does not contain line breaks or white space. It may need to be modified to confirm to PEM format or similar.
char* urlencode(char* data)
data | A null terminated string to encode. |
return | A null terminated list of tokens (null terminated strings). |
Encodes a null terminated string into url format. Returns a null terminated string containing the encoded version of data.
char* urldecode(char* data)
data | A null terminated string to decode. |
return | A null terminated string. |
Decodes a null terminated string in url format. Returns a null terminated string containing the decoded version of data.