Hex string to decimal string conversion C++

16 hours ago 3
ARTICLE AD BOX

i have input string in hex values "0123...ABCDEF", maximum 512 bits long (64 times x"FF"), need to convert it to decimal string, how to do it the easiest way in C++?

I will also need conversion in the opposite direction

MrLeyt1125's user avatar

3

The entire idea is wrong. There is no conversion. The terms hex and decimal are not about numbers, they are only about string representing numbers. The request to do the conversion is usually the indication of the intent to work with strings representing objects instead of objects themselves. It can work but is totally wrong. Just don't do it. Beware of XY Problem and explain your ultimate goal, what you want to achieve.

2026-02-08 06:10:35 +00:00

Commented 49 mins ago

How are you going to fit 512 bits into 64 bit integers without a big-int library? If you found such a library it is an easy task to ask an LLM give me a constexpr friendly function for this (it is a well-known pattern)

2026-02-08 06:18:45 +00:00

Commented 41 mins ago

Read Entire Article