Skip to content

skullchap/b64

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

b64.h

base64 single header encode/decode

Works with C89

#include <stdio.h>
#include "b64.h"

int main(int argc, char **argv)
{
// External buffer
    char b64enc[1024];
    char b64dec[1024];
    
    b64Encode(b64enc, argv[1], strlen(argv[1]));
    printf("%s\n", b64enc);
    
    b64Decode(b64dec, b64enc, strlen(b64enc));
    printf("%s\n", b64dec);

// Heap allocation done by passing NULL to dst, don't forget to free()
    char* b64encoded = b64Encode(NULL, argv[1], strlen(argv[1]));
    printf("%s\n", b64enc);
    
    char* b64decoded = b64Decode(NULL, b64enc, strlen(b64enc));
    printf("%s\n", b64dec);
}
$ ./a.out sus
c3Vz
sus

About

base64 single header encode/decode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages