Crate binascii

Source
Expand description

This crate contains encoders & decoders for various formats (base16, base32 & base64)

Most functions of this crate work the same way.

§Quick Example

use binascii::b32decode;

let mut output_buffer = [0u8; 200];
let message = "MJUW4YLTMNUWSLLSOMQGS4ZAORUGKIDCMVZXIII=";

let result = b32decode(&message.as_bytes(), &mut output_buffer).ok().unwrap();

assert_eq!(result, "binascii-rs is the best!".as_bytes());

Enums§

ConvertError
Enum that identifies possible failure in encoding binary or decoding text

Functions§

b32decode
Base32 Decoder - Converts a base32 encoded string to it’s raw form
b32encode
Base32 Encoder - Convert arbitrary data to a base32 string
b64decode
Base64 Decoder - Converts a base64 encoded string to it’s binary form.
b64encode
Base64 Encoder - Converts data to a base64 encoded string.
bin2hex
Base16 Encoder - Converts binary to base16 (hex)
hex2bin
Base16 Decoder - Converts a hexadecimal string to it’s binary form.