alphabet.rs |
Provides [Alphabet] and constants for alphabets commonly used in the wild. |
8985 |
chunked_encoder.rs |
|
5291 |
decode.rs |
|
12892 |
display.rs |
Enables base64'd output anywhere you might use a `Display` implementation, like a format string.
```
use base64::{display::Base64Display, engine::general_purpose::STANDARD};
let data = vec![0x0, 0x1, 0x2, 0x3];
let wrapper = Base64Display::new(&data, &STANDARD);
assert_eq!("base64: AAECAw==", format!("base64: {}", wrapper));
``` |
2731 |
encode.rs |
|
15841 |
engine |
|
|
lib.rs |
Correct, fast, and configurable [base64][] decoding and encoding. Base64
transports binary data efficiently in contexts where only plain text is
allowed.
[base64]: https://developer.mozilla.org/en-US/docs/Glossary/Base64
# Usage
Use an [`Engine`] to decode or encode base64, configured with the base64
alphabet and padding behavior best suited to your application.
## Engine setup
There is more than one way to encode a stream of bytes as “base64”.
Different applications use different encoding
[alphabets][alphabet::Alphabet] and
[padding behaviors][engine::general_purpose::GeneralPurposeConfig].
### Encoding alphabet
Almost all base64 [alphabets][alphabet::Alphabet] use `A-Z`, `a-z`, and
`0-9`, which gives nearly 64 characters (26 + 26 + 10 = 62), but they differ
in their choice of their final 2.
Most applications use the [standard][alphabet::STANDARD] alphabet specified
in [RFC 4648][rfc-alphabet]. If that’s all you need, you can get started
quickly by using the pre-configured
[`STANDARD`][engine::general_purpose::STANDARD] engine, which is also available
in the [`prelude`] module as shown here, if you prefer a minimal `use`
footprint.
|
10571 |
prelude.rs |
Preconfigured engines for common use cases.
These are re-exports of `const` engines in [crate::engine::general_purpose], renamed with a `BASE64_`
prefix for those who prefer to `use` the entire path to a name.
# Examples
|
844 |
read |
|
|
tests.rs |
|
3274 |
write |
|
|