#base64 #bech32 #constant-time #hex #security

no-std subtle-encoding

Encoders and decoders for common data encodings (base64, bech32, hex) which avoid data-dependent branching/table lookups and therefore provide “best effort” constant time. Useful for encoding/decoding secret values such as cryptographic keys.

15 unstable releases (3 breaking)

✓ Uses Rust 2018 edition

new 0.3.6 May 20, 2019
0.3.4 Mar 23, 2019
0.3.2 Dec 25, 2018
0.3.0 Nov 25, 2018

#83 in Encoding

Download history 15/week @ 2019-02-04 32/week @ 2019-02-11 34/week @ 2019-02-18 55/week @ 2019-02-25 69/week @ 2019-03-04 118/week @ 2019-03-11 40/week @ 2019-03-18 195/week @ 2019-03-25 162/week @ 2019-04-01 255/week @ 2019-04-08 364/week @ 2019-04-15 381/week @ 2019-04-22 298/week @ 2019-04-29 390/week @ 2019-05-06 306/week @ 2019-05-13

894 downloads per month
Used in 6 crates (5 directly)

Apache-2.0 OR MIT


subtle-encoding iqlusion

Crate Docs Apache 2.0/MIT Licensed Build Status unsafe: forbidden

Rust crate for encoding/decoding binary data to/from base64 and hex encodings while avoiding data-dependent branching/table lookups, and therefore providing "best effort" constant-time operation.

Useful for encoding/decoding secret values such as cryptographic keys.


Security Notice

While this crate takes care to avoid data-dependent branching, that does not actually make it "constant time", which is an architecture-dependent property.

This crate is a "best effort" attempt at providing a constant time encoding library, however it presently provides no guarantees, nor has it been independently audited for security vulnerabilities.

Use at your own risk.


subtle-encoding is distributed under the terms of either the MIT license or the Apache License (Version 2.0), at your option.

See LICENSE (Apache License, Version 2.0) file in the iqlusioninc/crates toplevel directory of this repository or LICENSE-MIT for details.


~19K SLoC