Skip to content

base64 in rust

Cargo.toml

toml
[dependencies]
base64 = "0.20.0"

main.rs

rust
extern crate base64;

fn b64encode(plaintext: &[u8]) -> String {
    base64::encode(plaintext)
}

fn b64decode(encoded_text: &str) -> Vec<u8>{
    base64::decode(encoded_text).unwrap()
}

Released under the MIT License.