Matasano Cryptopals Challenge 1: convert hex to base64
Base 16 -&gt; Base 2 -&gt; Base 64: Cut out the middleman
You are currently converting each hex digit to 4 binary digits, then converting 6 binary digits into one Base64 digit.  Instead of doing two conversions, how about if you took each three hex digits (= 12 binary digits) and converted that into two Base64 digits?  You can do this up until the end of your hex string, where you might have 1 or 2 leftover hex digits.  You can handle those leftover digits by padding with extra zero bits and outputting extra Base64 digits, including the special '=' digit.
Bug
Your code doesn't convert zeros correctly.  The problem is here:

if (index_b64 == 0)
  buf[0] = '=';
else
  buf[0] = dec_2_base64[index_b64];


As you can see, you output '=' for each Base64 zero digit.  However, the correct digit to output is 'A'.  The special '=' digit is only used to indicate zero bits for padding.  Therefore, if I try to convert the hex string &quot;0000&quot;, your program returns &quot;====&quot; when the correct answer is &quot;AAA=&quot;.