<?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: How to Obfuscate Integer IDs</title>
	<atom:link href="http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/feed/" rel="self" type="application/rss+xml" />
	<link>http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/</link>
	<description>Web Development, Travel, Photography, and more</description>
	<lastBuildDate>Sun, 11 Sep 2011 02:42:34 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: cson</title>
		<link>http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/comment-page-1/#comment-93</link>
		<dc:creator>cson</dc:creator>
		<pubDate>Sun, 11 Sep 2011 02:42:34 +0000</pubDate>
		<guid isPermaLink="false">http://raymorgan.net/?p=6#comment-93</guid>
		<description>@admin - If tamper resistance is necessary why not do something like:

(1) Create a server only known stored &quot;salt&quot;
(2) Concatenate &quot;salt&quot; + ID (e.g. first 8 bytes are salt, next 4 bytes are id)
(3) Encrypt these 12 bytes using AES (possibly with &quot;salt&quot; as the &quot;password&quot;... not sure if this compromises anything)
(4) Send this to browser
(5) Receive data from browser
(6) Unencrypt data using &quot;password&quot;
(7) Verify &quot;salt&quot;
(8) Trust ID

Now, I&#039;m not sure how much the &quot;password&quot;&#039;s integrity is compromised by a significant portion of the encrypted data being unchanged for each ID. My guess is very very little (because otherwise AES would be fundamentally flawed.. e.g. the password determined for a file just by knowing that it starts with a known header).

Of course you have to keep the &quot;salt&quot; and &quot;password&quot; secret. But this is required in your scheme as well.

This should allow the int to be both trusted, unknown, and unable to be tampered with.</description>
		<content:encoded><![CDATA[<p>@admin &#8211; If tamper resistance is necessary why not do something like:</p>
<p>(1) Create a server only known stored &#8220;salt&#8221;<br />
(2) Concatenate &#8220;salt&#8221; + ID (e.g. first 8 bytes are salt, next 4 bytes are id)<br />
(3) Encrypt these 12 bytes using AES (possibly with &#8220;salt&#8221; as the &#8220;password&#8221;&#8230; not sure if this compromises anything)<br />
(4) Send this to browser<br />
(5) Receive data from browser<br />
(6) Unencrypt data using &#8220;password&#8221;<br />
(7) Verify &#8220;salt&#8221;<br />
(8) Trust ID</p>
<p>Now, I&#8217;m not sure how much the &#8220;password&#8221;&#8216;s integrity is compromised by a significant portion of the encrypted data being unchanged for each ID. My guess is very very little (because otherwise AES would be fundamentally flawed.. e.g. the password determined for a file just by knowing that it starts with a known header).</p>
<p>Of course you have to keep the &#8220;salt&#8221; and &#8220;password&#8221; secret. But this is required in your scheme as well.</p>
<p>This should allow the int to be both trusted, unknown, and unable to be tampered with.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/comment-page-1/#comment-92</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 04 Sep 2011 01:42:38 +0000</pubDate>
		<guid isPermaLink="false">http://raymorgan.net/?p=6#comment-92</guid>
		<description>@vjeux - Yes, that&#039;s probably the easiest way to go, but that requires storing the pseudo-encrypted ID, which wouldn&#039;t satisfy the requirements.</description>
		<content:encoded><![CDATA[<p>@vjeux &#8211; Yes, that&#8217;s probably the easiest way to go, but that requires storing the pseudo-encrypted ID, which wouldn&#8217;t satisfy the requirements.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/comment-page-1/#comment-91</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 04 Sep 2011 00:27:05 +0000</pubDate>
		<guid isPermaLink="false">http://raymorgan.net/?p=6#comment-91</guid>
		<description>I made sure NOT to reinvent any encryption at all, but to extend an existing, well-established hash (MD5), to add tamper-resistance and reversibility.

All symmetric-key encryption approaches provide reversibility, but I did not find any that provided tamper-resistance, at least not resulting in a small, compact encrypted ID.

For what it&#039;s worth, I&#039;m in the process of evaluating other base algorithms, so I&#039;m wide open to suggestions.</description>
		<content:encoded><![CDATA[<p>I made sure NOT to reinvent any encryption at all, but to extend an existing, well-established hash (MD5), to add tamper-resistance and reversibility.</p>
<p>All symmetric-key encryption approaches provide reversibility, but I did not find any that provided tamper-resistance, at least not resulting in a small, compact encrypted ID.</p>
<p>For what it&#8217;s worth, I&#8217;m in the process of evaluating other base algorithms, so I&#8217;m wide open to suggestions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How to mask number to look as it would be random value - Programmers Goodies</title>
		<link>http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/comment-page-1/#comment-90</link>
		<dc:creator>How to mask number to look as it would be random value - Programmers Goodies</dc:creator>
		<pubDate>Sat, 03 Sep 2011 08:45:47 +0000</pubDate>
		<guid isPermaLink="false">http://raymorgan.net/?p=6#comment-90</guid>
		<description>[...] This page gives an algorithm. [...]</description>
		<content:encoded><![CDATA[<p>[...] This page gives an algorithm. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cson</title>
		<link>http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/comment-page-1/#comment-89</link>
		<dc:creator>cson</dc:creator>
		<pubDate>Sat, 03 Sep 2011 01:59:38 +0000</pubDate>
		<guid isPermaLink="false">http://raymorgan.net/?p=6#comment-89</guid>
		<description>Is there a good reason to go with this over just symmetric encryption (e.g. AES)?

Encrypting 4 bytes (Int32) with a 64-bit block size should spit out a result that is about 11 characters (after using base64, please check my math). This seems like a lot of re-inventing the wheel... Is computing these 3 hashes faster than a single AES encryption? I haven&#039;t done the benchmarking myself, but my gut says that even if it is, the benefit likely doesn&#039;t outweigh the use of a standardized encryption scheme.</description>
		<content:encoded><![CDATA[<p>Is there a good reason to go with this over just symmetric encryption (e.g. AES)?</p>
<p>Encrypting 4 bytes (Int32) with a 64-bit block size should spit out a result that is about 11 characters (after using base64, please check my math). This seems like a lot of re-inventing the wheel&#8230; Is computing these 3 hashes faster than a single AES encryption? I haven&#8217;t done the benchmarking myself, but my gut says that even if it is, the benefit likely doesn&#8217;t outweigh the use of a standardized encryption scheme.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/comment-page-1/#comment-88</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 02 Sep 2011 07:15:38 +0000</pubDate>
		<guid isPermaLink="false">http://raymorgan.net/?p=6#comment-88</guid>
		<description>Yes, I originally considered various alternatives for just hashing the id, but that didn&#039;t satisfy the requirement NOT to store an encrypted version of the id. With this approach, the only value stored for the id is the indexed serial integer, so lookups are fast and there&#039;s no storage overhead.</description>
		<content:encoded><![CDATA[<p>Yes, I originally considered various alternatives for just hashing the id, but that didn&#8217;t satisfy the requirement NOT to store an encrypted version of the id. With this approach, the only value stored for the id is the indexed serial integer, so lookups are fast and there&#8217;s no storage overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vjeux</title>
		<link>http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/comment-page-1/#comment-87</link>
		<dc:creator>vjeux</dc:creator>
		<pubDate>Thu, 01 Sep 2011 20:52:07 +0000</pubDate>
		<guid isPermaLink="false">http://raymorgan.net/?p=6#comment-87</guid>
		<description>Have you considered assigning a random number for each new id? It seems to be a much easier way to go.</description>
		<content:encoded><![CDATA[<p>Have you considered assigning a random number for each new id? It seems to be a much easier way to go.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/comment-page-1/#comment-84</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 20 May 2010 00:26:24 +0000</pubDate>
		<guid isPermaLink="false">http://raymorgan.net/?p=6#comment-84</guid>
		<description>You&#039;re correct that the colon has a special meaning in both the auth and protocol portion of a URI, but it doesn&#039;t cause any problem when used in the query string portion. Still, you can certainly replace it with %3A or change it to use other characters, like dash, dot, $ or underscore, on lines 18 and 24. Integers &gt; 2^31-1 would require a more complex implementation, as PHP&#039;s integer-handling gets sketchy above that number. </description>
		<content:encoded><![CDATA[<p>You&#8217;re correct that the colon has a special meaning in both the auth and protocol portion of a URI, but it doesn&#8217;t cause any problem when used in the query string portion. Still, you can certainly replace it with %3A or change it to use other characters, like dash, dot, $ or underscore, on lines 18 and 24. Integers > 2^31-1 would require a more complex implementation, as PHP&#8217;s integer-handling gets sketchy above that number.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: salentinux</title>
		<link>http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/comment-page-1/#comment-83</link>
		<dc:creator>salentinux</dc:creator>
		<pubDate>Wed, 19 May 2010 18:10:40 +0000</pubDate>
		<guid isPermaLink="false">http://raymorgan.net/?p=6#comment-83</guid>
		<description>Good article,

but it generates the &quot; : &quot; character in the encoded string that cannot be in a url because it is used for the authentication. For example encoding the int 1689 with CRYPT_SALT &quot;some random string&quot; generates &quot;NgvsvpI62eNcmhduKmX:w&quot; (without &quot;). This string pasted in a browser will fail due to &quot;:&quot; char.

Waht if I want to support a wider range of integers? (&gt; 2^31-1)

Thanks.</description>
		<content:encoded><![CDATA[<p>Good article,</p>
<p>but it generates the &#8221; : &#8221; character in the encoded string that cannot be in a url because it is used for the authentication. For example encoding the int 1689 with CRYPT_SALT &#8220;some random string&#8221; generates &#8220;NgvsvpI62eNcmhduKmX:w&#8221; (without &#8220;). This string pasted in a browser will fail due to &#8220;:&#8221; char.</p>
<p>Waht if I want to support a wider range of integers? (&gt; 2^31-1)</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention How to Obfuscate Integer IDs : Ray Morgan -- Topsy.com</title>
		<link>http://raymorgan.net/web-development/how-to-obfuscate-integer-ids/comment-page-1/#comment-82</link>
		<dc:creator>Tweets that mention How to Obfuscate Integer IDs : Ray Morgan -- Topsy.com</dc:creator>
		<pubDate>Thu, 21 Jan 2010 07:34:29 +0000</pubDate>
		<guid isPermaLink="false">http://raymorgan.net/?p=6#comment-82</guid>
		<description>[...] This post was mentioned on Twitter by alex knorr, Sam Hunt. Sam Hunt said: News Update: How to Obfuscate Integer IDs : Ray Morgan http://ow.ly/16o00Z [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by alex knorr, Sam Hunt. Sam Hunt said: News Update: How to Obfuscate Integer IDs : Ray Morgan <a href="http://ow.ly/16o00Z" rel="nofollow">http://ow.ly/16o00Z</a> [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

