1# hex 2 3[](https://crates.io/crates/hex) 4[](https://docs.rs/hex) 5[](https://github.com/KokaKiwi/rust-hex/actions) 6 7Encoding and decoding data into/from hexadecimal representation. 8 9## Examples 10 11Encoding a `String` 12 13```rust 14let hex_string = hex::encode("Hello world!"); 15 16println!("{}", hex_string); // Prints "48656c6c6f20776f726c6421" 17``` 18 19Decoding a `String` 20 21```rust 22let decoded_string = hex::decode("48656c6c6f20776f726c6421"); 23 24println!("{}", decoded_string); // Prints "Hello world!" 25``` 26 27You can find the [documentation](https://docs.rs/hex) here. 28 29## Installation 30 31In order to use this crate, you have to add it under `[dependencies]` to your `Cargo.toml` 32 33```toml 34[dependencies] 35hex = "0.4" 36``` 37 38By default this will import `std`, if you are working in a 39[`no_std`](https://rust-embedded.github.io/book/intro/no-std.html) 40environment you can turn this off by adding the following 41 42```toml 43[dependencies] 44hex = { version = "0.4", default-features = false } 45``` 46 47## Features 48 49- `std`: 50 Enabled by default. Add support for Rust's libstd types. 51- `serde`: 52 Disabled by default. Add support for `serde` de/serializing library. 53 See the `serde` module documentation for usage. 54 55## License 56 57Licensed under either of 58 59- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) 60- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) 61 62at your option. 63 64### Contribution 65 66Unless you explicitly state otherwise, any contribution intentionally 67submitted for inclusion in the work by you, as defined in the Apache-2.0 68license, shall be dual licensed as above, without any additional terms or 69conditions. 70