Convert Hex to Dec in bash

Viewed 368

I want to convert Hex to decimal. I'm using Zsh, but even bash command is ok

For now I try with

echo $((0x0000000000000000003218a50000000000000000000000000000000000000000))

but the result is truncated

zsh: number truncated after 34 digits: 0000000000000000003218a50000000000000000000000000000000000000000
3609816520756035584

I want the same result that I retrieve from this website

input

0x0000000000000000003218a50000000000000000000000000000000000000000

output

4798269179035823348880781507454323228379569035237392384

I'm using mac

1 Answers

You can use bc. Note letters should be in upper case. You can use this answer to convert.

 echo "obase=10; ibase=16; 0000000000000000003218A50000000000000000000000000000000000000000" |bc
Related