<?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>felix ker&#039;s blog &#187; .NET</title>
	<atom:link href="http://felixker.com/category/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://felixker.com</link>
	<description>Codes, Life, Love, Media, Money, Tips &#38; Tricks, Web 2.0 &#38; all</description>
	<lastBuildDate>Sun, 06 Nov 2011 07:25:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How to generate random password (VB.Net/C#[ASP.Net]/PHP)</title>
		<link>http://felixker.com/technology/net/how-to-generate-random-password-vbnetcaspnetphp/</link>
		<comments>http://felixker.com/technology/net/how-to-generate-random-password-vbnetcaspnetphp/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 14:33:48 +0000</pubDate>
		<dc:creator>Felix Ker</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASp.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Generate]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[vb.net]]></category>

		<guid isPermaLink="false">http://felixker.com/net/how-to-generate-random-password-vbnetcaspnetphp/</guid>
		<description><![CDATA[Lately I was googling for the shortest and simplest way of generating some random passwords. So here we go. I&#8217;ll share with you what I found and how I applied them. VB.Net Public Function GenerateRandomPassword(ByVal length as Integer) as String Dim strGuid as String = System.Guid.NewGuid().ToString() strGuid= strGuid.Replace(&#8220;-&#8221;, String.Empty) Return strGuid.Substring(0, length) End Function C# [...]


Related posts:<ol><li><a href='http://felixker.com/so-random/php-what-did-i-learn/' rel='bookmark' title='Permanent Link: PHP &#8211; What did I learn?'>PHP &#8211; What did I learn?</a></li>
<li><a href='http://felixker.com/so-random/7-random-facts-about-me/' rel='bookmark' title='Permanent Link: 7 Random Facts about Me'>7 Random Facts about Me</a></li>
<li><a href='http://felixker.com/so-random/random-news-2903/' rel='bookmark' title='Permanent Link: Random news 29/03'>Random news 29/03</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Lately I was googling for the shortest and simplest way of generating some random passwords. So here we go. I&#8217;ll share with you what I found and how I applied them.</p>
<p><strong>VB.Net</strong></p>
<blockquote><p>Public Function GenerateRandomPassword(ByVal length as Integer) as String<br />
Dim strGuid as String = System.Guid.NewGuid().ToString()<br />
strGuid= strGuid.Replace(&#8220;-&#8221;, String.Empty)<br />
Return strGuid.Substring(0, length)<br />
End Function</p></blockquote>
<p><span id="more-1353"></span></p>
<p><strong>C#</strong></p>
<blockquote><p>public string GenerateRandomPassword(int length)<br />
{<br />
string strGuid = System.Guid.NewGuid().ToString();<br />
strGuid = strGuid.Replace(&#8220;-&#8221;, string.Empty);<br />
return guidResult.Substring(0, length);<br />
}</p></blockquote>
<p><strong>Explanation (for VB.Net and C#)</strong></p>
<p>For C# and VB.Net, they both utilise .Net&#8217;s System.Guid class. (Correct me if I&#8217;m wrong) NewGuid().ToString() returns a string of 32 hexadecimals (excluding the &#8220;-&#8221;).</p>
<p>Although its only 0-9 and A-F, I like it as it&#8217;s a very simple way to generate the password of my desired length.</p>
<p>Now, let&#8217;s move on to PHP. For PHP, it can be very simple too!</p>
<p><strong>PHP</strong></p>
<blockquote><p>function createRandomPassword($length) {<br />
return substr(md5(date(&#8220;D dS M,Y h:i:s a&#8221;)),0,$length);<br />
}</p></blockquote>
<p>Did you see how short things can be?</p>
<p><strong>Explanation (for PHP)</strong></p>
<p>Firstly, I&#8217;m generating a string from Datetime with a simple format. Next, I&#8217;ll md5 it. You can choose to sha1 it, which is the same. And finally to choose a length of password. Thats all.</p>
<p><strong>Disadvantages for my way of generating (for C#, VB.Net and PHP)</strong></p>
<ol>
<li>Only &#8220;A-F&#8221;. But it doesn&#8217;t really matter to me.</li>
<li>Maximum length of 32. You can ofcourse re-generate, but who will need such a long password?</li>
</ol>
<p>Generating passwords can be simple, right? What other ways can you share with me?</p>
<p>---<br />Related Articles at felix ker&#039;s blog:<ul><li><a href="http://felixker.com/so-random/7-random-facts-about-me/" rel="bookmark" title="Permanent Link: 7 Random Facts about Me">7 Random Facts about Me</a></li><li><a href="http://felixker.com/so-random/something-random/" rel="bookmark" title="Permanent Link: Something random">Something random</a></li><li><a href="http://felixker.com/so-random/randomness/" rel="bookmark" title="Permanent Link: Randomness">Randomness</a></li><li><a href="http://felixker.com/daily-rants/just-another-random-update/" rel="bookmark" title="Permanent Link: Just another random update">Just another random update</a></li><li><a href="http://felixker.com/technology/felixkercom-hacked-defaced-and-how-to-prevent-hacking/" rel="bookmark" title="Permanent Link: felixker.com hacked &amp; defaced and how to prevent hacking">felixker.com hacked &amp; defaced and how to prevent hacking</a></li></ul></p><br />

<p>Related posts:<ol><li><a href='http://felixker.com/so-random/php-what-did-i-learn/' rel='bookmark' title='Permanent Link: PHP &#8211; What did I learn?'>PHP &#8211; What did I learn?</a></li>
<li><a href='http://felixker.com/so-random/7-random-facts-about-me/' rel='bookmark' title='Permanent Link: 7 Random Facts about Me'>7 Random Facts about Me</a></li>
<li><a href='http://felixker.com/so-random/random-news-2903/' rel='bookmark' title='Permanent Link: Random news 29/03'>Random news 29/03</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://felixker.com/technology/net/how-to-generate-random-password-vbnetcaspnetphp/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 6/33 queries in 0.021 seconds using memcached
Object Caching 790/832 objects using apc
Content Delivery Network via a.felixker.com

Served from: felixker.com @ 2012-02-10 08:33:29 -->
