<?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>Intrepid Blog &#187; mailto</title>
	<atom:link href="http://blog.affien.com/archives/tag/mailto/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.affien.com</link>
	<description>A few thoughts</description>
	<lastBuildDate>Mon, 01 Mar 2010 00:58:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Update on the anti-email-harvester mailto links</title>
		<link>http://blog.affien.com/archives/2004/12/22/update-on-the-anti-email-harvester-mailto-links/</link>
		<comments>http://blog.affien.com/archives/2004/12/22/update-on-the-anti-email-harvester-mailto-links/#comments</comments>
		<pubDate>Wed, 22 Dec 2004 21:50:13 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[mailto]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2004/12/22/update-on-the-anti-email-harvester-mailto-links/</guid>
		<description><![CDATA[In the previous post I described a simple though effective method to get rid of the constantly cleverer spam email harvester bots.
I&#8217;ve made a little update on the algorithm, it now uses only 1 number for each character and uses a cascading incremental xor transform.
Python code for the algorithm itself:
def alphaicx(s):
    ret [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://blog.w-nz.com/archives/2004/12/21/protecting-your-email-address-against-spam-bots/">previous post</a> I described a simple though effective method to get rid of the constantly cleverer spam email harvester bots.</p>
<p>I&#8217;ve made a little update on the algorithm, it now uses only 1 number for each character and uses a cascading incremental xor transform.</p>
<p>Python code for the algorithm itself:</p>
<blockquote><pre>def alphaicx(s):
    ret = ""
    cascvalue = 0
    for i in range(0, len(s)):
        ret = ret + chr(ord(s[i]) ^ cascvalue)
        cascvalue = (ord(ret[i]) + 1) % 255
    return ret
def betaicx(s):
    ret = ""
    cascvalue = 0
    for i in range(0, len(s)):
        ret = ret + chr(ord(s[i]) ^ cascvalue)
        cascvalue = ((ord(ret[i]) ^ cascvalue) + 1) % 255
    return ret</pre>
</blockquote>
<p>I designed the algorithm in Python. <a href="http://blog.w-nz.com/archives/2004/12/20/rgb-to-hex-and-why-the-python-interactive-mode-is-so-damned-handy/">Python is great for that kind of stuff</a>.</p>
<p>As you can see there are 2 functions, when you encode something with <code>alphaicx</code> you can decode it with <code>betaicx</code>, and visa versa. <code>betaicx</code> creates tougher code though. <strong>This <em>encryption</em> is pretty lousy, but hard enough to stop spam bots</strong>.</p>
<p>I&#8217;ve ported <code>betaicx</code> to PHP, and <code>alphaicx</code> to Javascript. The <a href="http://w-nz.com/tools/secureemail.php?">running example (very usefull though)</a> has been updated.</p>
<p>The PHP/Javascript code for the function:</p>
<blockquote><pre>function JSBotProtect($text){
	$cxred = "0";
	$cascval = 0;
	for($i = 0; $i &lt; strlen($text); $i++){
		$value = (ord($text[$i]) ^ $cascval);
		$cxred .= "," . $value;
		$cascval = (($value ^ $cascval) + 1) % 255;
	}
	return &lt;&lt;&lt;EOF
&lt;script type="text/javascript"&gt;var cxred=String.fromCharCode({$cxred});
var uncxred=""; var cascval=0;for(i=1;i&lt;cxred .length; i++)
{uncxred+=String.fromCharCode(cxred.charCodeAt(i)^cascval);
cascval=((uncxred.charCodeAt(i-1))+1)%255;}document.write(uncxred);&lt;/script&gt;
EOF;
}</pre>
</blockquote>
<p>I&#8217;ll more compact <code>uncxred</code> storage. Probable just normal hex, or when I can get it working BASE64.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2004/12/22/update-on-the-anti-email-harvester-mailto-links/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
