Giter Site home page Giter Site logo

skyformat99 / base64-2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rafagafe/base64

0.0 2.0 0.0 19 KB

Base64 is a C library to convert from plain to base64 and vice versa suitable for embedded systems.

License: MIT License

C 97.07% Makefile 2.93%

base64-2's Introduction

Base64

Build Status

Base64 is a C library to convert from plain to base64 and vice versa suitable for embedded systems.

API

To convert from plain to base64 the following function is used:

char* bintob64( char* dest, void const* src, size_t size );
  • The parameter 'src' is the source memory block to be converted.
  • The parameter 'size' is the size in bytes of the source memory block.
  • The parameter 'dest' is the destination buffer where the translation to base64 is stored. Also a null character is added at the end to become a null-terminated string.
  • The return value is a pointer to the null character.

To convert from base64 to plain the following function is used:

void* b64tobin( void* dest, char const* src );
  • The parameter 'src' is the source base64 string. It must be terminated in a non base64-digit. A null-terminated string is OK.
  • The parameter 'dest' is the destination memory block where the result of convertion is stroed.
  • The return value is a null pointer if the base64 string has bad format. If the convertion is successfully the return value is a pointer to the end of the convertion. With this pointer you can get the length of the result.

Convert from base64 to plain in the same memory block is possible using the previous function by setting the same pointer for the destination and source. Or just use the following wrapper function:

static inline void* b64decode( void* p ) {
    return b64tobin( p, (char*)p );
}

base64-2's People

Contributors

rafagafe avatar

Watchers

 avatar  avatar

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.