Google
 

4.26.2006

HexToBin and BinToHex

While dealing with storing parts of an X509 certificate, I’ve found the need for a couple of utility methods that allow converting the string representations of the Public Key to a byte array (or vice versa). That’s what the HexToBin() method does. Included also is BinToHex() for going the other direction.


If you found this article helpful:

3 comments:

j. montgomery said...

Oh yea - a null check on the passed in string argument would be wise in the HexToBin(s) method.

Eric Watkins said...

Are you converting to VB?

j. montgomery said...

Hah - naw, I code in whatever the client dictates. :D VB.NET, C#, RPG.NET. It's all the same. :) My preferences is still C#.