Rust
Rust
Base64 Encode/Decode a String
See more Encryption Examples
_LANGUAGE_ example to base-64 encode and decode a string.Chilkat Rust Downloads
let bd = chilkat::BinData::new();
let s = "A friend called me up the other day and talked about investing in a dot-com that sells lobsters. Internet lobsters. Where will this end? --Donald Trump".to_string();
let _ = bd.append_string(&s, "utf-8").is_ok();
let str_base64 = bd.get_encoded("base64").unwrap_or_default();
println!("{}", str_base64);
// To decode:
let bd2 = chilkat::BinData::new();
let _ = bd2.append_encoded(&str_base64, "base64");
let decoded = bd2.get_string("utf-8").unwrap_or_default();
println!("{}", decoded);