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

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

Functions

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