Comments (4)
@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.
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.
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.
@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)
- no-std support for macro crate
- Macros Won't Build in no_std HOT 4
- (std -> core)::fmt::Display for DecodeError and DecodeKind HOT 2
- feature `std` leaking when using macro in no_std env HOT 7
- Missing a new line and decode error HOT 2
- Rust 2021 edition is a major, not a "patch" change HOT 6
- Removing dependency on syn HOT 7
- Make `{encode,decode}_len` const fns? HOT 4
- Encode into an "impl std::fmt::Write" and/or "impl std::io::Write" HOT 5
- Breaking change wish list
- Use doc_auto_cfg once stable HOT 2
- Use as_chunks family of functions once stable
- Internal symbols array is publicly exposed and unsound HOT 4
- Deny warnings in rustdoc
- Partial encoding with padding HOT 3
- Question about Specification HOT 6
- Release 2.5.0
- SIMD optimization HOT 4
- `Encoding::encode_mut` is very code-size heavy HOT 15
- feature request - base58 d/encoding HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from data-encoding.