Expand description
§fashex - fast hexadecimal encoding and decoding
Hexadecimal string encoding and decoding with best-effort SIMD acceleration.
§Highlights
- Best-effort SIMD acceleration.
- Small, focused public APIs.
- APIs that work in const contexts.
- Unlike crates
const-hex,faster-hex, etc., this crate accepts uninitialized output buffers.
§Performance
This crate offers performance comparable to const-hex or hex-simd on x86 / x86_64 architectures.
For benchmark results, please refer to BENCHMARK.md.
§Disclaimer
Although all tests are passing and hours of fuzzing show no failures, latent bugs may still exist in the code.
- The SIMD-accelerated code paths for
x86/x86_64architecture are well tested and fuzzed. - The SIMD-accelerated code paths for
aarch64architecture are tested and fuzzed. - The SIMD-accelerated code paths for
loongarch64architecture have not been tested or fuzzed on real hardware.
If you find any bugs, please report them.
§Acknowledgements
This crate is inspired by the following repositories:
const-hex, SPDX-License-Identifier: MIT OR Apache-2.0hex-simd, SPDX-License-Identifier: MITfaster-hex, SPDX-License-Identifier: MIT OR Apache-2.0
§License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in these crates by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Modules§
- buffer
docsrs - Traits and implementations for buffers used by this crate.
Macros§
- decode
- Helper macro for decoding hexadecimal strings to byte arrays in const contexts.
- encode
- Helper macro for encoding byte arrays as hexadecimal strings in const contexts.
Structs§
- Display
alloc - A wrapper for displaying a byte slice as a hexadecimal string.
- Invalid
Input - A generic error type indicating invalid input.
Constants§
- HEX_
CHARS_ LOWER - The lowercase hexadecimal chars:
"0123456789abcdef". - HEX_
CHARS_ UPPER - The uppercase hexadecimal chars:
"0123456789ABCDEF".
Traits§
- Hex
- A trait for encoding / decoding a hexadecimal string from / into the raw bytes.
Functions§
- decode
- Decodes
src(a hexadecimal string, case insensitive) into raw bytes, writes them intodst, and returns a reference to the written bytes. - decode_
generic decode(), but const-evaluable at the cost of performance.- encode
- Encodes
srcas a hexadecimal string intodstand returns a reference to the written string. - encode_
generic encode(), but const-evaluable at the cost of performance.