<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: PHP string to hex and hex to string functions</title>
	<atom:link href="http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/</link>
	<description>Practical guide to WordPress development, blogging and programming</description>
	<lastBuildDate>Sun, 11 Dec 2011 21:19:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Krrish</title>
		<link>http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/comment-page-1/#comment-183073</link>
		<dc:creator>Krrish</dc:creator>
		<pubDate>Mon, 12 Sep 2011 10:24:10 +0000</pubDate>
		<guid isPermaLink="false">http://ditio.net/?p=148#comment-183073</guid>
		<description>Never thought this way... escaping string is much easier.
Bookmarked it for future reference...</description>
		<content:encoded><![CDATA[<p>Never thought this way&#8230; escaping string is much easier.<br />
Bookmarked it for future reference&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shawn</title>
		<link>http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/comment-page-1/#comment-158995</link>
		<dc:creator>Shawn</dc:creator>
		<pubDate>Fri, 22 Jul 2011 20:20:07 +0000</pubDate>
		<guid isPermaLink="false">http://ditio.net/?p=148#comment-158995</guid>
		<description>Hey, I am attempting to carve raw dumps of data for input with a PHP script. I am doing this for fun. Perhaps you could assist me? My problem is outlined here,

http://stackoverflow.com/questions/6740268/test-php-carve-for-jpg-files

I used your strhex functions and they work great!

Just need to figure out why my script is ignoring those zeros :(

Thanks so much! Send me an e-mail please! e.x.c.a.b.u.s.@.g.m.a.i.l DAWT CAWM</description>
		<content:encoded><![CDATA[<p>Hey, I am attempting to carve raw dumps of data for input with a PHP script. I am doing this for fun. Perhaps you could assist me? My problem is outlined here,</p>
<p><a href="http://stackoverflow.com/questions/6740268/test-php-carve-for-jpg-files" rel="nofollow">http://stackoverflow.com/questions/6740268/test-php-carve-for-jpg-files</a></p>
<p>I used your strhex functions and they work great!</p>
<p>Just need to figure out why my script is ignoring those zeros <img src='http://ditio.net/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Thanks so much! Send me an e-mail please! e.x.c.a.b.u.s.@.g.m.a.i.l DAWT CAWM</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Komb</title>
		<link>http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/comment-page-1/#comment-147757</link>
		<dc:creator>Komb</dc:creator>
		<pubDate>Thu, 07 Jul 2011 08:10:01 +0000</pubDate>
		<guid isPermaLink="false">http://ditio.net/?p=148#comment-147757</guid>
		<description>If you need to convert string to hex, just use built-in function:

bin2hex($string)

For reverse conversion native hex2bin() is in manual, but not yet implemented :(

I use sun0x0001 method - nice and short. Tested on urls.</description>
		<content:encoded><![CDATA[<p>If you need to convert string to hex, just use built-in function:</p>
<p>bin2hex($string)</p>
<p>For reverse conversion native hex2bin() is in manual, but not yet implemented <img src='http://ditio.net/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>I use sun0x0001 method &#8211; nice and short. Tested on urls.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yippy</title>
		<link>http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/comment-page-1/#comment-103249</link>
		<dc:creator>yippy</dc:creator>
		<pubDate>Sat, 19 Mar 2011 13:41:42 +0000</pubDate>
		<guid isPermaLink="false">http://ditio.net/?p=148#comment-103249</guid>
		<description>base64 anyone? :D</description>
		<content:encoded><![CDATA[<p>base64 anyone? <img src='http://ditio.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: arundhuti</title>
		<link>http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/comment-page-1/#comment-98356</link>
		<dc:creator>arundhuti</dc:creator>
		<pubDate>Thu, 03 Mar 2011 09:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://ditio.net/?p=148#comment-98356</guid>
		<description>Thanks for sharing.it really helps for the beginers.Can you let me how  can i generate hex code for chinesse language and shown in front-end?</description>
		<content:encoded><![CDATA[<p>Thanks for sharing.it really helps for the beginers.Can you let me how  can i generate hex code for chinesse language and shown in front-end?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ThA-B</title>
		<link>http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/comment-page-1/#comment-60281</link>
		<dc:creator>ThA-B</dc:creator>
		<pubDate>Thu, 09 Sep 2010 08:22:50 +0000</pubDate>
		<guid isPermaLink="false">http://ditio.net/?p=148#comment-60281</guid>
		<description>Hi, unfortunately (or fortunately) i must agree to Paul Gregg. Looping large strings (for example files to be handled in sql inserts) 5Mb file convertion on my server is at ~5 seconds. If you add check for 0x0 =&gt; 0x00 then it becomes ~ 8seconds when using unpack(&#039;H*&#039;) takes 1.5seconds. 

On the other hand using looping gives additional control over process so thanks for this too.</description>
		<content:encoded><![CDATA[<p>Hi, unfortunately (or fortunately) i must agree to Paul Gregg. Looping large strings (for example files to be handled in sql inserts) 5Mb file convertion on my server is at ~5 seconds. If you add check for 0&#215;0 =&gt; 0&#215;00 then it becomes ~ 8seconds when using unpack(&#8216;H*&#8217;) takes 1.5seconds. </p>
<p>On the other hand using looping gives additional control over process so thanks for this too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cvk</title>
		<link>http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/comment-page-1/#comment-46113</link>
		<dc:creator>cvk</dc:creator>
		<pubDate>Fri, 11 Jun 2010 12:25:31 +0000</pubDate>
		<guid isPermaLink="false">http://ditio.net/?p=148#comment-46113</guid>
		<description>strToHex doesn&#039;t work as expected. Try this instead:

function strToHex($string)
{
    $hex=&#039;&#039;;
    for ($i=0; $i &lt; strlen($string); $i++)
    {
        $hex .= sprintf(&quot;%02x&quot;,ord($string[$i]));
    }
    return $hex;
}</description>
		<content:encoded><![CDATA[<p>strToHex doesn&#8217;t work as expected. Try this instead:</p>
<p>function strToHex($string)<br />
{<br />
    $hex=&#8221;;<br />
    for ($i=0; $i &lt; strlen($string); $i++)<br />
    {<br />
        $hex .= sprintf(&quot;%02x&quot;,ord($string[$i]));<br />
    }<br />
    return $hex;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sun0x0001</title>
		<link>http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/comment-page-1/#comment-32433</link>
		<dc:creator>sun0x0001</dc:creator>
		<pubDate>Thu, 11 Feb 2010 16:57:45 +0000</pubDate>
		<guid isPermaLink="false">http://ditio.net/?p=148#comment-32433</guid>
		<description>Yo! Thanks for hexToStr() func! 
Suppose alternative might be usefull for smb:

$s = preg_replace(&#039;#(\w)(\w)#e&#039;, &quot;chr(hexdec(&#039;$1$2&#039;))&quot;, $hex);</description>
		<content:encoded><![CDATA[<p>Yo! Thanks for hexToStr() func!<br />
Suppose alternative might be usefull for smb:</p>
<p>$s = preg_replace(&#8216;#(\w)(\w)#e&#8217;, &#8220;chr(hexdec(&#8216;$1$2&#8242;))&#8221;, $hex);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phpnewbie</title>
		<link>http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/comment-page-1/#comment-31093</link>
		<dc:creator>phpnewbie</dc:creator>
		<pubDate>Tue, 12 Jan 2010 10:37:42 +0000</pubDate>
		<guid isPermaLink="false">http://ditio.net/?p=148#comment-31093</guid>
		<description>62E 635 645 20 35 30 30 2E 30 30 30 20 4B 57 44 20 645 646 20 62D 633 627 628 20 32 35 38 38 627 644 645 62A 628 642 64A 20 31 2C 34 32 31 2E 36 31 32 20 4B 57 44 20 627 644 645 62A 648 641 631 20 31 2C 34 32 31 2E 36 31 32 20 4B 57 44

this function does nt work with this..!!</description>
		<content:encoded><![CDATA[<p>62E 635 645 20 35 30 30 2E 30 30 30 20 4B 57 44 20 645 646 20 62D 633 627 628 20 32 35 38 38 627 644 645 62A 628 642 64A 20 31 2C 34 32 31 2E 36 31 32 20 4B 57 44 20 627 644 645 62A 648 641 631 20 31 2C 34 32 31 2E 36 31 32 20 4B 57 44</p>
<p>this function does nt work with this..!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joan</title>
		<link>http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/comment-page-1/#comment-29969</link>
		<dc:creator>joan</dc:creator>
		<pubDate>Fri, 18 Dec 2009 07:39:42 +0000</pubDate>
		<guid isPermaLink="false">http://ditio.net/?p=148#comment-29969</guid>
		<description>hi,
how can i get the string value for this hex value:  0x0C?

the expected output is: \f

this returns empty:
chr(hexdec(&#039;0x0C&#039;));

any idea how to get more than one char value from hex?</description>
		<content:encoded><![CDATA[<p>hi,<br />
how can i get the string value for this hex value:  0x0C?</p>
<p>the expected output is: \f</p>
<p>this returns empty:<br />
chr(hexdec(&#8217;0x0C&#8217;));</p>
<p>any idea how to get more than one char value from hex?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

