Giter VIP home page Giter VIP logo

Comments (4)

ia0 avatar ia0 commented on July 20, 2024 1

@kali The v2.0.0-rc.1 now makes the distinction between padded and non-padded bases. You can use BASE64.no_pad() to encode and decode non-padded base64.

The v2.0.0-rc.1 should move to v2.0.0 in about one month according to feedback.

from data-encoding.

ia0 avatar ia0 commented on July 20, 2024

Thanks for the issue! This is definitely a shortcoming of decode_mut. However, since fixing it would be a breaking change (the documentation specifies that the function should panic in this case), I'll delay this issue to the next major release, which will actually be focused on improving padding issues and allowing callers to decide if and how padding should be handled.

from data-encoding.

ia0 avatar ia0 commented on July 20, 2024

In the meantime, the following function finds out automatically the prefix of the input that is necessary to read to fill the output completely:

fn base64_decode_exact_mut(input: &[u8], output: &mut [u8])
       -> Result<(), data_encoding::decode::Error> {
    let ilen = data_encoding::base64::encode_nopad_len(output.len());
    data_encoding::base64::decode_nopad_mut(&input[0..ilen], output)
}

from data-encoding.

ia0 avatar ia0 commented on July 20, 2024

@kali I don't know if this is still of interest, but I released a v2.0.0-rc.2 and the non-padded encoding is now called BASE64_NOPAD.

I'm closing the issue since it's pretty old. Feel free to reopen or create a new issue if your needs are not fulfilled with v2 (should be out of candidate before the end of the year).

from data-encoding.

Related Issues (20)

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.