• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 0.22.0
2
3- `DecodeSliceError::OutputSliceTooSmall` is now conservative rather than precise. That is, the error will only occur if the decoded output _cannot_ fit, meaning that `Engine::decode_slice` can now be used with exactly-sized output slices. As part of this, `Engine::internal_decode` now returns `DecodeSliceError` instead of `DecodeError`, but that is not expected to affect any external callers.
4- `DecodeError::InvalidLength` now refers specifically to the _number of valid symbols_ being invalid (i.e. `len % 4 == 1`), rather than just the number of input bytes. This avoids confusing scenarios when based on interpretation you could make a case for either `InvalidLength` or `InvalidByte` being appropriate.
5- Decoding is somewhat faster (5-10%)
6
7# 0.21.7
8
9- Support getting an alphabet's contents as a str via `Alphabet::as_str()`
10
11# 0.21.6
12
13- Improved introductory documentation and example
14
15# 0.21.5
16
17- Add `Debug` and `Clone` impls for the general purpose Engine
18
19# 0.21.4
20
21- Make `encoded_len` `const`, allowing the creation of arrays sized to encode compile-time-known data lengths
22
23# 0.21.3
24
25- Implement `source` instead of `cause` on Error types
26- Roll back MSRV to 1.48.0 so Debian can continue to live in a time warp
27- Slightly faster chunked encoding for short inputs
28- Decrease binary size
29
30# 0.21.2
31
32- Rollback MSRV to 1.57.0 -- only dev dependencies need 1.60, not the main code
33
34# 0.21.1
35
36- Remove the possibility of panicking during decoded length calculations
37- `DecoderReader` no longer sometimes erroneously ignores
38  padding  [#226](https://github.com/marshallpierce/rust-base64/issues/226)
39
40## Breaking changes
41
42- `Engine.internal_decode` return type changed
43- Update MSRV to 1.60.0
44
45# 0.21.0
46
47## Migration
48
49### Functions
50
51| < 0.20 function         | 0.21 equivalent                                                                     |
52|-------------------------|-------------------------------------------------------------------------------------|
53| `encode()`              | `engine::general_purpose::STANDARD.encode()` or `prelude::BASE64_STANDARD.encode()` |
54| `encode_config()`       | `engine.encode()`                                                                   |
55| `encode_config_buf()`   | `engine.encode_string()`                                                            |
56| `encode_config_slice()` | `engine.encode_slice()`                                                             |
57| `decode()`              | `engine::general_purpose::STANDARD.decode()` or `prelude::BASE64_STANDARD.decode()` |
58| `decode_config()`       | `engine.decode()`                                                                   |
59| `decode_config_buf()`   | `engine.decode_vec()`                                                               |
60| `decode_config_slice()` | `engine.decode_slice()`                                                             |
61
62The short-lived 0.20 functions were the 0.13 functions with `config` replaced with `engine`.
63
64### Padding
65
66If applicable, use the preset engines `engine::STANDARD`, `engine::STANDARD_NO_PAD`, `engine::URL_SAFE`,
67or `engine::URL_SAFE_NO_PAD`.
68The `NO_PAD` ones require that padding is absent when decoding, and the others require that
69canonical padding is present .
70
71If you need the < 0.20 behavior that did not care about padding, or want to recreate < 0.20.0's predefined `Config`s
72precisely, see the following table.
73
74| 0.13.1 Config   | 0.20.0+ alphabet | `encode_padding` | `decode_padding_mode` |
75|-----------------|------------------|------------------|-----------------------|
76| STANDARD        | STANDARD         | true             | Indifferent           |
77| STANDARD_NO_PAD | STANDARD         | false            | Indifferent           |
78| URL_SAFE        | URL_SAFE         | true             | Indifferent           |
79| URL_SAFE_NO_PAD | URL_SAFE         | false            | Indifferent           |
80
81# 0.21.0-rc.1
82
83- Restore the ability to decode into a slice of precisely the correct length with `Engine.decode_slice_unchecked`.
84- Add `Engine` as a `pub use` in `prelude`.
85
86# 0.21.0-beta.2
87
88## Breaking changes
89
90- Re-exports of preconfigured engines in `engine` are removed in favor of `base64::prelude::...` that are better suited
91  to those who wish to `use` the entire path to a name.
92
93# 0.21.0-beta.1
94
95## Breaking changes
96
97- `FastPortable` was only meant to be an interim name, and shouldn't have shipped in 0.20. It is now `GeneralPurpose` to
98  make its intended usage more clear.
99- `GeneralPurpose` and its config are now `pub use`'d in the `engine` module for convenience.
100- Change a few `from()` functions to be `new()`. `from()` causes confusing compiler errors because of confusion
101  with `From::from`, and is a little misleading because some of those invocations are not very cheap as one would
102  usually expect from a `from` call.
103- `encode*` and `decode*` top level functions are now methods on `Engine`.
104- `DEFAULT_ENGINE` was replaced by `engine::general_purpose::STANDARD`
105- Predefined engine consts `engine::general_purpose::{STANDARD, STANDARD_NO_PAD, URL_SAFE, URL_SAFE_NO_PAD}`
106    - These are `pub use`d into `engine` as well
107- The `*_slice` decode/encode functions now return an error instead of panicking when the output slice is too small
108    - As part of this, there isn't now a public way to decode into a slice _exactly_ the size needed for inputs that
109      aren't multiples of 4 tokens. If adding up to 2 bytes to always be a multiple of 3 bytes for the decode buffer is
110      a problem, file an issue.
111
112## Other changes
113
114- `decoded_len_estimate()` is provided to make it easy to size decode buffers correctly.
115
116# 0.20.0
117
118## Breaking changes
119
120- Update MSRV to 1.57.0
121- Decoding can now either ignore padding, require correct padding, or require no padding. The default is to require
122  correct padding.
123    - The `NO_PAD` config now requires that padding be absent when decoding.
124
125## 0.20.0-alpha.1
126
127### Breaking changes
128
129- Extended the `Config` concept into the `Engine` abstraction, allowing the user to pick different encoding / decoding
130  implementations.
131    - What was formerly the only algorithm is now the `FastPortable` engine, so named because it's portable (works on
132      any CPU) and relatively fast.
133    - This opens the door to a portable constant-time
134      implementation ([#153](https://github.com/marshallpierce/rust-base64/pull/153),
135      presumably `ConstantTimePortable`?) for security-sensitive applications that need side-channel resistance, and
136      CPU-specific SIMD implementations for more speed.
137    - Standard base64 per the RFC is available via `DEFAULT_ENGINE`. To use different alphabets or other settings (
138      padding, etc), create your own engine instance.
139- `CharacterSet` is now `Alphabet` (per the RFC), and allows creating custom alphabets. The corresponding tables that
140  were previously code-generated are now built dynamically.
141- Since there are already multiple breaking changes, various functions are renamed to be more consistent and
142  discoverable.
143- MSRV is now 1.47.0 to allow various things to use `const fn`.
144- `DecoderReader` now owns its inner reader, and can expose it via `into_inner()`. For symmetry, `EncoderWriter` can do
145  the same with its writer.
146- `encoded_len` is now public so you can size encode buffers precisely.
147
148# 0.13.1
149
150- More precise decode buffer sizing, avoiding unnecessary allocation in `decode_config`.
151
152# 0.13.0
153
154- Config methods are const
155- Added `EncoderStringWriter` to allow encoding directly to a String
156- `EncoderWriter` now owns its delegate writer rather than keeping a reference to it (though refs still work)
157    - As a consequence, it is now possible to extract the delegate writer from an `EncoderWriter` via `finish()`, which
158      returns `Result<W>` instead of `Result<()>`. If you were calling `finish()` explicitly, you will now need to
159      use `let _ = foo.finish()` instead of just `foo.finish()` to avoid a warning about the unused value.
160- When decoding input that has both an invalid length and an invalid symbol as the last byte, `InvalidByte` will be
161  emitted instead of `InvalidLength` to make the problem more obvious.
162
163# 0.12.2
164
165- Add `BinHex` alphabet
166
167# 0.12.1
168
169- Add `Bcrypt` alphabet
170
171# 0.12.0
172
173- A `Read` implementation (`DecoderReader`) to let users transparently decoded data from a b64 input source
174- IMAP's modified b64 alphabet
175- Relaxed type restrictions to just `AsRef<[ut8]>` for main `encode*`/`decode*` functions
176- A minor performance improvement in encoding
177
178# 0.11.0
179
180- Minimum rust version 1.34.0
181- `no_std` is now supported via the two new features `alloc` and `std`.
182
183# 0.10.1
184
185- Minimum rust version 1.27.2
186- Fix bug in streaming encoding ([#90](https://github.com/marshallpierce/rust-base64/pull/90)): if the underlying writer
187  didn't write all the bytes given to it, the remaining bytes would not be retried later. See the docs
188  on `EncoderWriter::write`.
189- Make it configurable whether or not to return an error when decoding detects excess trailing bits.
190
191# 0.10.0
192
193- Remove line wrapping. Line wrapping was never a great conceptual fit in this library, and other features (streaming
194  encoding, etc) either couldn't support it or could support only special cases of it with a great increase in
195  complexity. Line wrapping has been pulled out into a [line-wrap](https://crates.io/crates/line-wrap) crate, so it's
196  still available if you need it.
197    - `Base64Display` creation no longer uses a `Result` because it can't fail, which means its helper methods for
198      common
199      configs that `unwrap()` for you are no longer needed
200- Add a streaming encoder `Write` impl to transparently base64 as you write.
201- Remove the remaining `unsafe` code.
202- Remove whitespace stripping to simplify `no_std` support. No out of the box configs use it, and it's trivial to do
203  yourself if needed: `filter(|b| !b" \n\t\r\x0b\x0c".contains(b)`.
204- Detect invalid trailing symbols when decoding and return an error rather than silently ignoring them.
205
206# 0.9.3
207
208- Update safemem
209
210# 0.9.2
211
212- Derive `Clone` for `DecodeError`.
213
214# 0.9.1
215
216- Add support for `crypt(3)`'s base64 variant.
217
218# 0.9.0
219
220- `decode_config_slice` function for no-allocation decoding, analogous to `encode_config_slice`
221- Decode performance optimization
222
223# 0.8.0
224
225- `encode_config_slice` function for no-allocation encoding
226
227# 0.7.0
228
229- `STANDARD_NO_PAD` config
230- `Base64Display` heap-free wrapper for use in format strings, etc
231
232# 0.6.0
233
234- Decode performance improvements
235- Use `unsafe` in fewer places
236- Added fuzzers
237
238# 0.5.2
239
240- Avoid usize overflow when calculating length
241- Better line wrapping performance
242
243# 0.5.1
244
245- Temporarily disable line wrapping
246- Add Apache 2.0 license
247
248# 0.5.0
249
250- MIME support, including configurable line endings and line wrapping
251- Removed `decode_ws`
252- Renamed `Base64Error` to `DecodeError`
253
254# 0.4.1
255
256- Allow decoding a `AsRef<[u8]>` instead of just a `&str`
257
258# 0.4.0
259
260- Configurable padding
261- Encode performance improvements
262
263# 0.3.0
264
265- Added encode/decode functions that do not allocate their own storage
266- Decode performance improvements
267- Extraneous padding bytes are no longer ignored. Now, an error will be returned.
268