Git Product home page Git Product logo

arduino_base64's Issues

Maybe need to add terminator in decoder

Hi, I think you need to add the string terminator:

*output = 0;

void BASE64::decode(const char* input, uint8_t* output){
    size_t inputLength = strlen(input);
    uint8_t i = 0;
    uint8_t a3[3];
    uint8_t a4[4];

    while(inputLength--){
        if(*input == '='){
            break;
        }

        a4[i++] = *input++;

        if(i == 4){
            for(i = 0; i < 4; i++){
                a4[i] = charTable[a4[i]];
            }

            a4to3(a4, a3);

            for(i = 0; i < 3; i++){
                *output++ = a3[i];
            }

            i = 0;
        }
    }

    if(i){
        for(uint8_t j = i; j < 4; j++){
            a4[j] = '\0';
        }

        for(uint8_t j = 0; j < 4; j++){
            a4[j] = charTable[a4[j]];
        }

        a4to3(a4, a3);

        for(uint8_t j = 0; j < i - 1; j++){
            *output++ = a3[j];
        }
    }

    *output = 0;
}

[Sharing/Not issue] I have used this library in my project

Here, I just want to say thanks and show case one of my Arduino project that implemented this base64 encoding library.

Cheers guys :)

Here the link to my project:
https://github.com/adriancs2/arduino.aes.asp.net

You can find the details of how the base64 encoding library being implemented at this article:
https://adriancs.com/c-sharp/1081/aes-encrypted-http-request-between-arduino-esp32-and-c-asp-net/

Here's a simplified version:
https://adriancs.com/arduino/1096/arduino-aes-encryption-128-bits-cbc/

Thank you very much for your contribution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.