Giter Site home page Giter Site logo

base64's People

Contributors

odurc avatar rodrigo-dc avatar zhicheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

base64's Issues

hi, encode error, ex. "0"

online base64 encode 0 -> MA==
but yours 0 -> MAA=
if "MAA=" decode online.... then
图片
not good i feel.

macro BASE64_DECODE_OUT_SIZE(s) maybe needs plus 1

#define BASE64_DECODE_OUT_SIZE(s) ((unsigned int)(((s) / 4) * 3))

dec = malloc(BASE64_DECODE_OUT_SIZE(32));
base_decode(enc, enc_len, dec);

according to base64.c line 160;
out[j] = '\0'; // if not plus 1, out[j] is out of bound

maybe define the macro as follow:
#define BASE64_DECODE_OUT_SIZE(s) ((unsigned int)(((s) / 4) * 3 + 1))

Fix GCC compiler array subscript warning

My GCC complains compiling base64.c because we're using a signed char as a subscript:

base64.c: In function 'base64_decode':
base64.c:138:15: error: array subscript has type 'char' [-Werror=char-subscripts]
   c = base64de[in[i]];
               ^
cc1: all warnings being treated as errors

This change fixes it for me... casting is unpleasant but it's the simplest alternative.

--- a/base64.c  2019-01-11 16:51:12.495365424 -0500
+++ b/base64.c  2019-01-11 17:21:46.674386800 -0500
@@ -135,7 +135,7 @@
                        return 0;
                }

-               c = base64de[in[i]];
+               c = base64de[(unsigned char)in[i]];
                if (c == 255) {
                        return 0;
                }

utf-8 support?

Hi, i have tried this with utf8 string in russian "АБГДЕ", but got error

Expression: memcmp(encode_out, decode, decodelen) == 0
This application has requested the Runtime to terminate it in an unusual way.

Should it work with it, or any workaround/ideas? Thanks.

Impossible to set decoded size correctly

If the encoded data ends with = or == it is impossible to tell the size from output of base64_decode() alone. It would be more convenient if base64_decode() returned j (size of the decoded array) instead of the constant BASE64_OK.

data structure about base64

Hello! If i want to encrypt some data about Hex. May I use Hex format encrypt with base64? And could I get decrypted data in Hex format. Thank you!

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.