title: Convert string to SHA1 and to base64
body: <p>I am having problem with converting the string, lets say: "TestPassword" to SHA1 and to base64.</p>
  
  <p>Generally according to that site: 
  <a href="http://www.online-convert.com/result/1f76972748a7d186198171e9a11e9493" rel="noreferrer">http://www.online-convert.com/result/1f76972748a7d186198171e9a11e9493</a></p>
  
  <p>I should be given the results below for the above password:</p>
  
  <pre><code>hex: 6250625b226df62870ae23af8d3fac0760d71588
  HEX: 6250625B226DF62870AE23AF8D3FAC0760D71588
  h:e:x: 62:50:62:5b:22:6d:f6:28:70:ae:23:af:8d:3f:ac:07:60:d7:15:88
  base64: YlBiWyJt9ihwriOvjT+sB2DXFYg=  &lt;-- That is what I would like to achieve ...
  </code></pre>
  
  <p>There is no problem with converting string to SHA1 but i don't know how to convert it again to base64 as there is a need to treat every two characters as a hex byte and then pass it to base64 function.</p>
  
  <p>Could someone please throw light on it or paste code snippet how to do it?</p>
  
  <p>Thank You!</p>