Skip to content

Modified base64 encode a bit. #4961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

superxkooda
Copy link
Contributor

@superxkooda superxkooda commented May 29, 2025

@raysan5 Implemented encode pulling inspiration from the gnu implementation. Stopping here for now to gauge interest.

Simple hello world example

#include <stdio.h>
#include <string.h>
#include "raylib.h"

int main() {

    char * original = "Hello, World!";
    char * encoded = NULL;
    unsigned int length = strlen(original);
    bool ok = Base64Encode(original, length, &encoded);
    printf("%s\n", encoded);
    if (!ok) {
        return 1;
    }
    int outSize =0 ;
    char * decoded = DecodeDataBase64(encoded, &outSize);
    printf("%s\n", decoded);
    return 0;
}

Compiled with gcc main.c -o test -I. -L. -lraylib -lm
Output

$ ./test 
SGVsbG8sIFdvcmxkIQ==
Hello, World!

@raysan5
Copy link
Owner

raysan5 commented May 29, 2025

@superxkooda Thanks for the code reference but I'm not adding an additional function, I like the function to be self-contained and neither calling other functions.

@raysan5 raysan5 closed this May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants