title: how to convert a string of hex values into a base64 string
body: <p>I'm working on creating a websockets server, and I don't really know how to convert the hex values (which I got from <strong>sha1</strong> hashing) into a base64 string. I mean, the base64 string of: </p>
  
  <pre><code>"b37a4f2cc0624f1690f64606cf385945b2bec4ea" 
  </code></pre>
  
  <p>is not:</p>
  
  <pre><code>"YjM3YTRmMmNjMDYyNGYxNjkwZjY0NjA2Y2YzODU5NDViMmJlYzRlYQ=="
  </code></pre>
  
  <p>it is: </p>
  
  <pre><code>"s3pPLMBiTxaQ9kYGzzhZRbK+xOo="
  </code></pre>
  
  <p>But the library I use gives me the second one back when I give it the sha1 string above. Is that because the string above isn't considered as hex values?
  These are the libraries I use:</p>
  
  <blockquote>
    <p>base64:
    <a href="http://renenyffenegger.ch/notes/development/Base64/Encoding-and-decoding-base-64-with-cpp" rel="nofollow noreferrer">http://renenyffenegger.ch/notes/development/Base64/Encoding-and-decoding-base-64-with-cpp</a>
    sha1: <a href="http://www.zedwood.com/article/cpp-sha1-function" rel="nofollow noreferrer">http://www.zedwood.com/article/cpp-sha1-function</a></p>
  </blockquote>
  
  <p>and it seems to me I've choosen the wrong ones. What can I use to get it working? I need to send some headers back to the client to establish connection, but I need to do these steps first. </p>