How to Compute an MD5 Hash in VB.NET (System.Security.Cryptography)

Recently I was writing a password generator and needed to compute an MD5 hash. In PHP I can just call md5() to get an MD5 hash, but I had never actually tried MD5 in VB. I was worried that .NET might not have any MD5 support, in which case I would have to write it myself…. Orz. Luckily, when I checked MSDN, it turned out to be there. The process was a bit of a hassle, but fortunately MSDN provides a getMD5hash function, so I simply reused it. ...

July 26, 2011 · 2 min

How to Read Windows Environment Variables (System Variables) in a .NET Program - VB.NET Example

Anyone who has written CMD knows about environment variables. They let you easily get information that differs from one computer to another, such as the user name. In CMD, using an environment variable is simple: you just write it in the %environment variable name% format. In a .NET program, though, it isn't that simple. You need to use the Environ function. ...

February 11, 2011 · 2 min

DNS Firewall - Block Access to Specific Websites and Quickly Edit DNS Mappings

DNS Firewall is a program recently written by a webmaster. Its main function is to block access to certain websites. For example, if you have kids at home and you don't want them visiting adult sites or Facebook, you enter the URLs of those two sites into the program, and then this computer can no longer connect to them! The principle behind DNS Firewall is actually very simple. It modifies the hosts file built into Windows and maps the DNS entries of the blocked sites to 127.0.0.1, which is your own computer, so the browser simply can't reach those sites xD...

January 21, 2011 · 2 min

[VB] [C++] Calculating n! (Factorial)

Calculating the factorial of n is very simple. I wrote this program for permutations and combinations: I wanted a rough idea of how many possible answers there would be, so I wrote an n! function to compute the factorial value. A factorial is 123…..n. In a permutation of 5 items, the result is at most 5432*1, which means there are at most 120 possible answers. Below, I’ve made n! into a Function, with a VB version and a C++ version. People who are just starting to learn loops can use this function to practice how loops work. Also, because I was worried that an integer wouldn’t be able to hold the result, I used a string to return the value. When you use this Function, you need to convert the return value to a numeric type first. ...

January 5, 2011 · 1 min

[VB] Splitting a String into Characters (Mid + For Loop)

Splitting a string into characters is actually very simple, but it comes up a lot in ACM problems. For example, permutation and combination problems require you to split a string into characters before doing any calculation. The Caesar cipher also uses this technique. Below I'll demonstrate with VB.NET. Other programming languages can do the same thing, and the principle is identical....

December 28, 2010 · 2 min

[VB.Net] Get File Paths of a Specific Format in a Folder and Store Them in an ArrayList (Easily Adapted to Other .NET Languages)

Last time, while I was working on the entertainment feature of the new version of Desktop Locker, I needed to automatically get all the music files in its Resources folder. That led me to work out the code below, which collects the file paths of a specific format in a folder into an ArrayList. For example, if you want all the mp3 files in a music folder, you can use this code to do it....

November 7, 2010 · 1 min

How to Access Yahoo! Messenger from Code (Change Status, Log In/Out, etc.) (VB Example)

The day before yesterday, a few classmates got bored and started passing around prank programs that change Yahoo! Messenger statuses. That gave me the inspiration to design an advanced version of this status prank program. Writing a program that changes the status in Yahoo! Messenger is actually not hard, because Yahoo itself provides a COM component that makes it easy to configure the messenger. This COM component is called YahooMessengerLib. As far as I know, it can do the following: change the status, get the current status, and log in or out of Yahoo! Messenger. So let me show you how to use the YahooMessengerLib COM component~...

November 7, 2010 · 4 min

Keyboard Scan Code Chart (Not Made by Me)

Here’s a chart to share. If you’re doing keyboard simulation with postmessage, you’ll need this. I found this on the internet.

July 12, 2009 · 1 min

VB Ctrl+F5 Compile

Here’s a useful tip to share~ From now on, it’s best to compile your VB programs with the Ctrl+F5 shortcut. Because the compiled file is smaller. Also, if you compile your program with Ctrl+F5, the compiled program is placed in the binRelease folder inside the project folder. ...

July 4, 2009 · 1 min

VB - Resizing an Array with Redim

Anyone who has learned VB has surely come across the Dim syntax, right? It declares a variable (an array) and tells the computer to set aside a block of space for the program. But sometimes you don’t know how many items an array will hold. So setting its size to something huge is a waste. Today’s topic, Redim, is a statement that lets you reset an array’s size. ...

July 2, 2009 · 1 min