title: Integer decimal to hexadecimal conversion
body: <p>I've pretty decent challenge. One of our systems works on huge numbers like uint256. Unfortunately, we receive such numbers as a string. In further calculations it's required to convert the numbers to their hexadecimal representations, and that's the problem.</p>
  <p><strong>What is the most efficient way to convert string with decimal integer representation to string with hex/binary representation?</strong></p>
  <p>We know the simplest solution is to use an external library e.g. <em>boost</em> and convert (decimal) string -&gt; uin256 -&gt; (hex) string, but <strong>we can't use any external library</strong> in this particular case.</p>
  <p>To better understand the problem, we looking for a function toHex(...), such as:</p>
  <pre class="lang-cpp prettyprint-override"><code>void toHex(const char* decimal, char* result)
  {
      ...
  }
  
  int main()
  {
      const char* decimal = &quot;6322365123570985008687907853269984665640564039457584007913129639935&quot;;
      char* hexadecimal; 
      toHex(decimal, hexadecimal);
      printf(&quot;%s\n&quot;, hexadecimal);
      return 0;
  }
  </code></pre>
  <blockquote>
  <p>output <br>
  3C08D179C2394472E8C2036E13A5F862C7EEE1D4E7FFFFFFFFFFFFFF</p>
  </blockquote>
  <p>P.S. <br>
  The numbers are always positive, so we don't have to care about the sign.</p>