mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-02 17:28:30 +00:00
Add base64 support
Lua Server Pages may now call the EncodeBase64() and DecodeBase64() functions should they wish to do things like emit embeded data URIs See #97
This commit is contained in:
parent
4d21cd315d
commit
dcbd2b8668
8 changed files with 333 additions and 5 deletions
|
@ -38,7 +38,9 @@ static const signed char kBase64i[256] = {
|
|||
};
|
||||
|
||||
/**
|
||||
* Converts base64 to 32-bit integer.
|
||||
* Converts base64 to 32-bit integer, the posix way.
|
||||
* @see l64a() for inverse
|
||||
* @see DecodeBase64()
|
||||
*/
|
||||
long a64l(const char *s) {
|
||||
uint32_t i, v, x;
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#include "libc/str/str.h"
|
||||
|
||||
/**
|
||||
* Converts 32-bit integer to base64.
|
||||
* Converts 32-bit integer to base64, the posix way.
|
||||
* @see a64l() for inverse
|
||||
* @see EncodeBase64()
|
||||
*/
|
||||
char *l64a(long x) {
|
||||
static char b[7];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue