Opened 10 years ago

Last modified 7 years ago

#7064 new Feature Requests

hex() with flag for lowercase output

Reported by: Olaf van der Spek <olafvdspek@…> Owned by: Marshall Clow
Milestone: To Be Determined Component: algorithm
Version: Boost 1.51.0 Severity: Problem
Keywords: Cc:

Description

Could you provide a paramter for hex() to indicate lowercase output is desired?

Change History (7)

comment:1 by Marshall Clow, 10 years ago

Is there a use case here? Some existing piece of software that does unhex that only accepts lower case hex digits?

comment:2 by Olaf van der Spek <olafvdspek@…>, 10 years ago

Yes. Existing software currently using lowercase output and not wanting to change the output just to take advantage of these Boost functions.

comment:3 by nigels.com@…, 7 years ago

Agreed, I prefer to match the output of commandline sha256sum, than have to do the upper to lower case fix.

comment:4 by Marshall Clow, 7 years ago

Olaf - I asked if there was "some piece of software that does unhex that only accepts lower case hex digits", and you said "Yes", but gave no examples.

Nigels - You prefer to match the output of sha256sum, but this isn't a checksuming routine. This encodes the bytes into a hex stream.

comment:5 by nigels.com@…, 7 years ago

Hi Marhsall - my specific task was to convert binary hash to a hex string matching the output of sha256sum. It made me sad to have to write that manually, rather than use boost::algorithm::hex() A hex_lower() alternative, perhaps? I'd point out that hex_char_to_int already supports lower case.

comment:6 by Olaf van der Spek <olafvdspek@…>, 7 years ago

Ah, I misread your question. I don't know if only lowercase is accepted, but I'd like to have full control over the output without having to pipe it through to_lower.

comment:7 by nigels.com@…, 7 years ago

I proposed a patch on github: https://github.com/boostorg/algorithm/pull/14

Note: See TracTickets for help on using tickets.