<?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>∞ Infinite ∞ Resolution &#187; Microsoft Visual C# .NET</title>
	<atom:link href="http://blog.stupidpoodles.com/category/microsoft-visual-c-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.stupidpoodles.com</link>
	<description>How big is that?</description>
	<lastBuildDate>Wed, 28 Jul 2010 02:40:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>The Hash Class</title>
		<link>http://blog.stupidpoodles.com/2009/11/the-hash-class/</link>
		<comments>http://blog.stupidpoodles.com/2009/11/the-hash-class/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 23:35:54 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Microsoft Visual C# .NET]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blog.stupidpoodles.com/?p=739</guid>
		<description><![CDATA[Update: I plan to remake this using the new features C# 4.0 brings to the table. Hopefully, additions like optional parameters will make the code and class much more compact. I&#8217;ve been working on a C# Library to make hashing strings an easy (and fun?) task. I&#8217;ll show you the very basic bare-bones usage here: [...]]]></description>
			<content:encoded><![CDATA[<p>Update: I plan to remake this using the new features C# 4.0 brings to the table. Hopefully, additions like optional parameters will make the code and class much more compact.</p>
<p>I&#8217;ve been working on a C# Library to make hashing strings an easy (and fun?) task. I&#8217;ll show you the very basic bare-bones usage here:</p>
<pre class="brush: csharp;">
Hashing mudkipz = new Hashing();
string m5 = mudkipz.md5(&quot;So, I herd u liek mudkipz.&quot;);
string s1 = mudkipz.sha1(&quot;So, I herd u liek mudkipz.&quot;);
string s256 = mudkipz.sha256(&quot;So, I herd u liek mudkipz.&quot;);
string s384 = mudkipz.sha384(&quot;So, I herd u liek mudkipz.&quot;);
string s512 = mudkipz.sha512(&quot;So, I herd u liek mudkipz.&quot;);
</pre>
<p>The library currently supports md5, sha1, sha256, sha384, and sha512. So yeah that&#8217;s all nice and easy to use and such but it there more? Yes, there is! There are four different formats your string can be hashed into:</p>
<ol>
<li>AB-CD-EF (default)</li>
<li>ab-cd-ef</li>
<li>ABCDEF</li>
<li>abcdef</li>
</ol>
<p>For any of you that have used PHP&#8217;s hashing functions you&#8217;ll notice that format number 4 is identical. Let&#8217;s say you want to have everything be formatted like PHP does. Using format 4.</p>
<pre class="brush: csharp;">
Hashing mudkipz = new Hashing();
mudkipz.setFormat(4);
string blah1 = mudkipz.md5(&quot;So, I herd u liek mudkipz.&quot;);
string blah2 = mudkipz.sha1(&quot;So, I herd u liek mudkipz.&quot;);
</pre>
<p>You&#8217;ll notice that both strings will be formatted in the same way PHP would. We can switch back in the middle too.</p>
<pre class="brush: csharp;">
Hashing mudkipz = new Hashing();
mudkipz.setFormat(4);
string blah1 = mudkipz.md5(&quot;So, I herd u liek mudkipz.&quot;);
string blah2 = mudkipz.sha1(&quot;So, I herd u liek mudkipz.&quot;);
mudkipz.setFormat(1);
string blah3 = mudkipz.md5(&quot;So, I herd u liek mudkipz.&quot;);
string blah4 = mudkipz.sha1(&quot;So, I herd u liek mudkipz.&quot;);
</pre>
<p>What if you want everything to be formatted with format 3 except for just one? Ya know, the odd man out. Instead of switching default formats you can just specify a extra format parameter.</p>
<pre class="brush: csharp;">
Hashing mudkipz = new Hashing();
mudkipz.setFormat(3);
string blah1 = mudkipz.md5(&quot;So, I herd u liek mudkipz.&quot;);
string blah2 = mudkipz.sha1(&quot;So, I herd u liek mudkipz.&quot;, 4);
string blah3 = mudkipz.sha256(&quot;So, I herd u liek mudkipz.&quot;);
</pre>
<p><code>blah2</code> would then be formatted using format 4. All the others would use format 3.</p>
<p>That&#8217;s just about it. It&#8217;s licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. A link back would be nice, but not necessary. <img src='http://blog.stupidpoodles.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Use the following links to download. Enjoy!</p>
<a class="downloadlink" href="http://blog.stupidpoodles.com/downloads/4" title="Version1.0.3592.34207 downloaded 60 times" >Complete Hashing Class Source (60)</a><br />
<a class="downloadlink" href="http://blog.stupidpoodles.com/downloads/5" title="Version1.0.3592.34207 downloaded 67 times" >Hashing DLL (67)</a>
<p style="text-align: center;"><a href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img class="alignnone" title="Attribution-Share Alike 3.0 United States" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" alt="" width="88" height="31" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.stupidpoodles.com/2009/11/the-hash-class/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to use MD5 and SHA in C#</title>
		<link>http://blog.stupidpoodles.com/2009/07/how-to-use-md5-and-sha-in-csharp/</link>
		<comments>http://blog.stupidpoodles.com/2009/07/how-to-use-md5-and-sha-in-csharp/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 21:00:20 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Microsoft Visual C# .NET]]></category>
		<category><![CDATA[System Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Hashing]]></category>
		<category><![CDATA[MD5]]></category>
		<category><![CDATA[SHA]]></category>

		<guid isPermaLink="false">http://blog.stupidpoodles.com/?p=636</guid>
		<description><![CDATA[EDIT: To remove the &#8216;-&#8217; in the hashes, replace your &#8216;return&#8217; line with this: Regex.Replace(BitConverter.ToString(hashedBytes), "-", ""); Hashing in C# is quite a bit different then languages like PHP. In PHP to hash a string via MD5 you would simply use the md5 function as so: md5("string") Let&#8217;s stop complaining and get right down to [...]]]></description>
			<content:encoded><![CDATA[<p>EDIT: To remove the &#8216;-&#8217; in the hashes, replace your &#8216;return&#8217; line with this:</p>
<pre class="brush:csharp">Regex.Replace(BitConverter.ToString(hashedBytes), "-", "");</pre>
<p>Hashing in C# is quite a bit different then languages like PHP. In PHP to hash a string via MD5 you would simply use the md5 function as so:</p>
<pre class="brush:csharp">md5("string")</pre>
<p>Let&#8217;s stop complaining and get right down to it.</p>
<p>Create  a new Console project in either MS Visual C# or Mono. Make a new class after your main one. We&#8217;ll call it Hasher. Add the following to the top of your file.</p>
<pre class="brush:csharp">using System.Security.Cryptography;</pre>
<p>Now add the following code to your Hasher class</p>
<pre class="brush:csharp">public string Hash(string originalString)
{
Byte[] originalBytes;
Byte[] hashedBytes;
System.Security.Cryptography.MD5 md5;
md5 = new MD5CryptoServiceProvider();
originalBytes = ASCIIEncoding.Default.GetBytes(originalPassword);
encodedBytes = md5.ComputeHash(originalBytes);
return BitConverter.ToString(hashedBytes);
}</pre>
<p>I won&#8217;t explain this in much detail. Mainly for the reason that it&#8217;s fairly simple and for the most part self explanatory.</p>
<p>Now we need to make the front end. Add the following to your Main class.</p>
<pre class="brush:csharp">Console.Write("Enter your string: ");
string text = Console.ReadLine();
Hasher crypt = new Hasher();
string md5 = crypt.Hash(text);
Console.WriteLine("MD5: " + md5);</pre>
<p>That takes the input it gets in the terminal, puts it in the Hash function and then writes the result (the MD5 hash) to the console. Pretty simple stuff. Now we&#8217;re gonna do this with SHA.</p>
<p>C# supports four different types of SHA. SHA1, SHA256, SHA384, and finally SHA512. Here is the entire code for converting text to SHA1.</p>
<pre class="brush: csharp;">using System;
using System.Text;
using System.Security.Cryptography;
namespace SHA1
{
class MainClass
{
public static void Main(string[] args)
{
Console.Write(&quot;Enter your string: &quot;);
string text = Console.ReadLine();
Hasher crypt = new Hasher();
string sha1 = crypt.Hash(text);
Console.WriteLine(&quot;SHA1: &quot; + sha1);
}
}
class Hasher
{
public string Hash(string originalString)
{
Byte[] originalBytes;
Byte[] hashedBytes;
System.Security.Cryptography.SHA1 sha1;
sha1 = new SHA1CryptoServiceProvider();
originalBytes = ASCIIEncoding.Default.GetBytes(originalString);
hashedBytes = sha1.ComputeHash(originalBytes);
return BitConverter.ToString(hashedBytes);
}
}
}</pre>
<p>As you might have noticed it was largely a copy and paste of our MD5 hasher. The above script can also be modified to create different types of SHA hashes like those previously mentioned. Really, you can just switch out SHA1 with the other kind of SHA hash you want.  For instance instead of <code>System.Security.Cryptography.SHA1 sha1;</code> you could put <code>System.Security.Cryptography.SHA256 sha256;</code> And then change a few other instances.</p>
<p>I sorta wish C# provided an easy(er) way to convert hashes on the fly but to my knowledge it does not. You can stick these in your application and use them to give you the functionality C# doesn&#8217;t give us on its own. By the way, if you get any errors with the stuff I posted, all of them should be easily fixed. Let me know of my errors so I can fix them! <img src='http://blog.stupidpoodles.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Good luck! <img src='http://blog.stupidpoodles.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.stupidpoodles.com/2009/07/how-to-use-md5-and-sha-in-csharp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3GS &amp; WPF Apps in the System Tray</title>
		<link>http://blog.stupidpoodles.com/2009/07/3gs-wpf-apps-in-the-system-tray/</link>
		<comments>http://blog.stupidpoodles.com/2009/07/3gs-wpf-apps-in-the-system-tray/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 20:05:08 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Microsoft Visual C# .NET]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Visual C# .NET]]></category>
		<category><![CDATA[Windows Presentation Foundation]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://blog.stupidpoodles.com/?p=628</guid>
		<description><![CDATA[http://gizmodo.com/5307693/iphone-3gs-unlocked-with-purplera1n-%252B-ultrasn0w http://tippu.blog.co.in/2009/03/09/wpf-placing-your-wpf-application-on-the-system-tray/ First, I just learned that the 3GS is now jailbreakable with publically accessable tools for both Windows and Mac. I don&#8217;t have one, but this is great news. The iPhone Dev-Team Blog also has a post regarding the release of their own version of the jailbreak. There&#8217;s more to it than this but [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gizmodo.com/5307693/iphone-3gs-unlocked-with-purplera1n-%252B-ultrasn0w">http://gizmodo.com/5307693/iphone-3gs-unlocked-with-purplera1n-%252B-ultrasn0w</a></p>
<p><a href="http://tippu.blog.co.in/2009/03/09/wpf-placing-your-wpf-application-on-the-system-tray/">http://tippu.blog.co.in/2009/03/09/wpf-placing-your-wpf-application-on-the-system-tray/</a></p>
<p>First, I just learned that the 3GS is now jailbreakable with publically accessable tools for both Windows and Mac. I don&#8217;t have one, but this is great news. The iPhone Dev-Team Blog also has a post regarding the release of their own version of the jailbreak. There&#8217;s more to it than this but if you wanna know more: Google.</p>
<p>Second, I was wondering how you could put your Windows Presentaiton Foundation C# Application in the system tray. I found a good tutorail (second down link at the top) but it had some places where it needed fixing (or at least one).</p>
<p>C# had a problem with the Window_Closing event. First &#8220;Window&#8221; needs to be the name of your window. Mine was &#8220;Tray&#8221; so it would be &#8220;Tray_Closing&#8221;. Next, in your xaml file (in my case, &#8220;Tray.xaml&#8221;) you need to add this to the end of your opening <code>&lt;Window&gt;</code> tag: <code>Closing="Tray_Closing"</code> again, you need to change &#8220;Tray&#8221; accordingly. So it might end up looking like this:</p>
<p><code>&lt;Window x:Class="myApp.Tray"<br />
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br />
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br />
Title="Tray" Height="300" Width="300" Name="winTray"<br />
Closing="Tray_Closing"&gt;</code></p>
<p>For any of you guys that wanna do this, it&#8217;s here. <img src='http://blog.stupidpoodles.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Hope I could help somebody!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.stupidpoodles.com/2009/07/3gs-wpf-apps-in-the-system-tray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPF vs. Windows Forms « Josh Smith on WPF</title>
		<link>http://blog.stupidpoodles.com/2009/06/wpf-vs-windows-forms-%c2%ab-josh-smith-on-wpf/</link>
		<comments>http://blog.stupidpoodles.com/2009/06/wpf-vs-windows-forms-%c2%ab-josh-smith-on-wpf/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 16:20:06 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Microsoft Visual C# .NET]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Visual C# .NET]]></category>
		<category><![CDATA[Windows Forms]]></category>
		<category><![CDATA[Windows Presentation Foundation]]></category>
		<category><![CDATA[WinForms]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://blog.stupidpoodles.com/?p=605</guid>
		<description><![CDATA[WPF vs. Windows Forms « Josh Smith on WPF. I&#8217;ve always wondered about those two options in Microsoft Visual C# .NET The question of whether to use WinForms (Windows Forms) or WPF (Windows Presentation Foundation). The above blog post has given me the answer. Just wanted to share it with you. I hope any of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://joshsmithonwpf.wordpress.com/2007/09/05/wpf-vs-windows-forms/">WPF vs. Windows Forms « Josh Smith on WPF</a>.</p>
<p>I&#8217;ve always wondered about those two options in Microsoft Visual C# .NET The question of whether to use WinForms (Windows Forms) or WPF (Windows Presentation Foundation). The above blog post has given me the answer.</p>
<p>Just wanted to share it with you. <img src='http://blog.stupidpoodles.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I hope any of you Visual C# guys find it just as helpful as I did.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.stupidpoodles.com/2009/06/wpf-vs-windows-forms-%c2%ab-josh-smith-on-wpf/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
