Wednesday, October 15, 2014

Hashing Short Strings

Back in 2005 I wrote a small Windows desktop program to plot the distribution of 32-bit integer values generated by the .NET Framework String GetHashCode method. I was curious about how well the hash algorithm behaved, especially for short strings. How widely distributed are the hash values? What are the chances of collisions?

In mid 2014 I resurrected the program, modernised it a bit and added a pick list of 22 different hashing and checksum algorithms to see how their behaviour compared to String GetHashCode. The results were so interesting that I have placed the program's C# Source Code on Bitbucket and I composed the following article to discuss the results in detail:

Hashing Short Strings

The hashing article is buried deep inside my personal web site with one obscure link to it, so I thought it was wise to mentioned in this Blog to boost its publicity. Fellow geeks who like maths, crypto and hashing should enjoy the article.

Friday, October 3, 2014

sc.exe syntax trick

For the first time in 10 years I had to create a Windows Service manually. This was caused by an issue described in my previous post The installer was interrupted. I look at the sc.exe command documentation and start typing at the DOS prompt. Everything I try doesn't work and all I get back is the help text. I'm puzzled why something like this command doesn't work:

sc create FooService binPath="C:\blah\foo.exe" start=auto

After staring and squinting at the documentation for some time I eventually notice that the documentation has a space after the = sign on the options. I have never seen a command in any platform on any operating system (including Windows) in the last 30 years that used a syntax like this:

option= SomeValue

(note the space) But it's true! Putting a space after the = signs in my create command makes it work. As the self-described criminal genius Vizzini said, "Inconceivable!".