Git Product home page Git Product logo

arduino_base64's Introduction

dojyorin

I'm curiosity driven development and self taught.

SNS/BLOG

Interested

  • JavaScript/TypeScript
    • Deno
    • V8
    • TC39 Proposal
    • Vue.js
    • WebAPI (WebCrypto, WebSocket, WebGPU, WebUSB, ...etc)
  • C++ (Embedded)
    • Cortex-M
    • Arduino
    • STM32
  • ShellScript
  • Docker
  • VSCode

arduino_base64's People

Contributors

dojyorin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ekapujiw2002

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;
}

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.