#base64 #base32 #base16 #hex

no-std binascii

Useful no-std binascii operations including base64, base32 and base16 (hex)

3 releases

0.1.3 Nov 1, 2019
0.1.2 Sep 23, 2018
0.1.1 Aug 3, 2018
0.1.0 Aug 1, 2018

#131 in Encoding

Download history 958/week @ 2019-10-07 871/week @ 2019-10-14 749/week @ 2019-10-21 834/week @ 2019-10-28 824/week @ 2019-11-04 199/week @ 2019-11-11 228/week @ 2019-11-18 240/week @ 2019-11-25 316/week @ 2019-12-02 356/week @ 2019-12-09 635/week @ 2019-12-16 58/week @ 2019-12-23 106/week @ 2019-12-30 203/week @ 2020-01-06 125/week @ 2020-01-13

2,724 downloads per month
Used in 1 crate

MIT license

18KB
317 lines

binascii

Build Status

Rust implementation of useful binascii functions.

  • Encode & Decode support for:
    • Base16 (Hex)
    • Base32
    • Base64
  • no_std support
  • never panics

Getting Started

  • Add binascii to your package's Cargo.toml:
    [dependencies]
    binascii = "0.1"
    
  • The API is very simple, head over to https://docs.rs/binascii/.

Why binascii?

  • This library was written with security in mind, and includes unit tests to prevent vulnerabilities found in many other implementations (many can be found here).
  • There are no "unsafe" blocks, such blocks are forbidden.
  • no-std is supported for your bare-metal & embedded projects.

lib.rs:

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());

No runtime deps