KokaKiwi / rust-hex

A basic crate to encode values to hexadecimal representation. Originally extracted from rustc-serialize.
https://crates.io/crates/hex
Apache License 2.0
203 stars 57 forks source link

feature request: support space seperated strings #23

Closed mendelmunkis closed 5 years ago

KokaKiwi commented 5 years ago

As discussed on #4 and #6, i don't think it'd be implemented Also as I would like to keep hex code relatively simple and not handle every corner cases (which are generally easy to detect and fix).

mendelmunkis commented 5 years ago

I'm sorry I somehow missed those while looking through the issues.

ildar commented 3 years ago

Also as I would like to keep hex code relatively simple and not handle every corner cases (which are generally easy to detect and fix).

I understand that. Still the current API is very restrictive: no spaces, no "0x" at start and fixed input width (exactly input.len() == output.len() * 2). A (new) function to parse a "dirty" input looks appropriate here.

A user of this crate would be happy to clean up his code and avoid reinventing a wheel using such a (new) fn.

mversic commented 2 years ago

there is more of use that would say spaces are useful in hex encoded strings. Implementation could check for ASCII byte 32. hex-literal supports whitespace characters so I was affected with this when copying example which worked with hex-literal::hex to hex::decode which returned error