<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Solomon &#187; Hexadecimal string to Bytes array</title>
	<atom:link href="http://www.ms.oyangudi.com/blog/tag/hexadecimal-string-to-bytes-array/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ms.oyangudi.com/blog</link>
	<description>from Oyangudi...</description>
	<lastBuildDate>Tue, 18 Oct 2011 02:38:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Hexadecimal string to Bytes array</title>
		<link>http://www.ms.oyangudi.com/blog/csharp/hexadecimal-string-to-bytes-array/</link>
		<comments>http://www.ms.oyangudi.com/blog/csharp/hexadecimal-string-to-bytes-array/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 03:51:01 +0000</pubDate>
		<dc:creator>Solomon</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Hexadecimal string to Bytes array]]></category>

		<guid isPermaLink="false">http://www.ms.oyangudi.com/blog/?p=31</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<div class="simplesocialbuttons">
<div class="simplesocialbutton ssb-button-googleplus"><!-- Google Plus One--><g:plusone size="medium" count="true" href="http://www.ms.oyangudi.com/blog/csharp/hexadecimal-string-to-bytes-array/"></g:plusone></div>
<div class="simplesocialbutton ssb-button-fblike"><!-- Facebook like--><div id="fb-root"></div><fb:like href="http://www.ms.oyangudi.com/blog/csharp/hexadecimal-string-to-bytes-array/" send="false" layout="button_count" width="100" show_faces="false" action="like" font=""></fb:like></div>
<div class="simplesocialbutton ssb-buttom-twitter"><!-- Twitter--><a name="twitter_share" data-count="horizontal" href="http://twitter.com/share" data-text="Hexadecimal string to Bytes array" data-url="http://www.ms.oyangudi.com/blog/csharp/hexadecimal-string-to-bytes-array/" class="twitter-share-button" rel="nofollow"></a></div>
</div>
<pre class="brush: csharp; title: ; notranslate">

        /// &lt;summary&gt;
        /// Hexa decimal to Byte array
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;HexString&quot;&gt;Hexa decimal string&lt;/param&gt;
        /// &lt;returns&gt;byte array&lt;/returns&gt;
        public static byte[] HexToBytes(String hexString)
        {
            byte[] byteArray = null;
            int byteCount = 0;

            if (hexString != null &amp;&amp; hexString.Length &gt; 0)
            {
                // make sure we have an even number of characters
                if (hexString.Length % 2 != 0)
                    hexString = &quot;0&quot; + hexString;

                byteCount = hexString.Length / 2;
                byteArray = new byte[byteCount];
                string sTemp;

                for (int i = 0; i &lt; byteCount; i++)
                {
                    sTemp = hexString.Substring(i * 2, 2);
                    byteArray[i] = Convert.ToByte(sTemp, 16);
                }
            }

            return byteArray;
        }
</pre>
<div class="simplesocialbuttons">
<div class="simplesocialbutton ssb-button-googleplus"><!-- Google Plus One--><g:plusone size="medium" count="true" href="http://www.ms.oyangudi.com/blog/csharp/hexadecimal-string-to-bytes-array/"></g:plusone></div>
<div class="simplesocialbutton ssb-button-fblike"><!-- Facebook like--><div id="fb-root"></div><fb:like href="http://www.ms.oyangudi.com/blog/csharp/hexadecimal-string-to-bytes-array/" send="false" layout="button_count" width="100" show_faces="false" action="like" font=""></fb:like></div>
<div class="simplesocialbutton ssb-buttom-twitter"><!-- Twitter--><a name="twitter_share" data-count="horizontal" href="http://twitter.com/share" data-text="Hexadecimal string to Bytes array" data-url="http://www.ms.oyangudi.com/blog/csharp/hexadecimal-string-to-bytes-array/" class="twitter-share-button" rel="nofollow"></a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ms.oyangudi.com/blog/csharp/hexadecimal-string-to-bytes-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

