base64-lib

Crates.iobase64-lib
lib.rsbase64-lib
version0.2.2
sourcesrc
created_at2017-09-24 00:14:59.812836
updated_at2018-04-29 00:41:11.085447
descriptionA base64 encoder / decoder
homepagehttps://gitlab.com/jeremymreed/base64-lib.git
repositoryhttps://gitlab.com/jeremymreed/base64-lib.git
max_upload_size
id32817
size26,401
Jeremy Reed (jeremymreed)

documentation

https://docs.rs/base64-lib

README

A basic base64 encoder / decoder for Rust.

STATUS:

  • master: pipeline status
  • develop: pipeline status

==========================================

  1. Usage
  2. Notes
  3. License

Usage:

Import:

At the top of the file:

extern crate base64_lib;

Encode:

encode(&Vec) -> String

let input_vector: Vec<u8> = String::from("Hello World").into_bytes();
let result_string: String = base64_lib::encode(&input_vector);

Decode:

decode(&String) -> Vec

let input_string: String = String::from("SGVsbG8gV29ybGQ=");
let result_vector: Vec<u8> = base64_lib::decode(&input_string);

Encode with custom alphabet:

encode_with_alphabet(&Vec, &String) -> Vec

let input_vector: Vec<u8> = String::from("Hello World").into_bytes();
let alphabet: String = String::from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
let result_string: String = base64_lib::encode_with_alphabet(&input_vector, &alphabet);

Decode with custom alphabet:

decode_with_alphabet(&String, &String) -> Vec

let input_string: String = String::from("SGVsbG8gV29ybGQ=");
let alphabet: String = String::from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
let result_vector: Vec<u8> = base64_lib::decode_with_alphabet(&input_string, &alphabet);

Notes:

  • When using a custom alphabet, be sure there are 64 unique characters in the string.

License:

Licensed under the MIT License.

Commit count: 44

cargo fmt