title: Converting String to String of Hex and vice-versa in Vb.Net
body: <p>I need to convert a String of totally random characters in something i can read back!
  My idea is:</p>
  
  <p>Example String: hi</p>
  
  <pre><code>h (Ascii) -&gt; 68 (hex) 
  i (Ascii) -&gt; 69 (hex)
  </code></pre>
  
  <p>So converting <code>hi</code> i must have <code>6869</code></p>
  
  <p>My value is now in <code>Base64</code> (i got it with a <code>Convert.ToBase64String()</code>), is this "ascii to hex" conversion correct? In base64 i have value like "4kIw0ueWC/+c=" but i need <strong>characters</strong> only, special characters can mess my system</p>
  
  <p>The vb.net  Convert can only translate to base64 string :(</p>
  
  <p>edit: This is my final solution:
  i got the base64 string inside my <code>enc</code> variable and converted it first in ASCII then in corrispondent Hex using:</p>
  
  <pre><code>Dim bytes As Byte() = System.Text.Encoding.ASCII.GetBytes(enc)
  Dim hex As String = BitConverter.ToString(bytes).Replace("-", String.Empty)
  </code></pre>
  
  <p>After that i reversed this with:</p>
  
  <pre><code>Dim b((input.Length \ 2) - 1) As Byte
  For i As Int32 = 0 To b.GetUpperBound(0)
       b(i) = Byte.Parse(input.Substring(i * 2, 2), Globalization.NumberStyles.HexNumber)
  Next i
  Dim enc As New System.Text.ASCIIEncoding()
  result = enc.GetString(b)
  </code></pre>
  
  <p>After all this i got back my base64string and converted one last time with <code>Convert.FromBase64String(result)</code></p>
  
  <p>Done! Thanks for the hint :)</p>