Yet another podcast: lugradio

September 25, 2007 · Comment 

Today I added the Linux radio show lugradio to my ever growing feed list in jsiPodFetch. Since I am very close to filling all available time now I think it will take quite long for me to catch up, but I’ll give it a try.

One more podcast

September 23, 2007 · Comment 

Today I added Rubiverse, a podcast about Ruby, to my jsiPodFetch feed list.

I’ve recently learned some Ruby and I like it a lot. I will definitively install IronRuby when it is properly released. Currently I’m using ‘real’ Ruby for my jsiPodFetch build scripts and for aggregating data from my weblogs. It feels a bit awkward to install something like Ruby just to do some scripting in Windows though, maybe I should look at Powershell instead. That is a bit more classic shell scripting. I think the things I’m using it for is more like programming. I’m not sure when something is to be called a program and when it should be called a script.

The best thing to do is probably to learn lots of languages and frameworks so that one can make educated decisions when it comes to solving new problems.

Shareware license key

September 21, 2007 · Comment 

This article will describe how I have implemented license keys in jsiPodFetch. I hope it will help someone else trying to do this. It would also be nice if someone reading this gave me feedback if this solution doesn’t work in practice since I haven’t analyzed this solution thoroughly enough to swear by it, but I think it will work.

Through out this code there are places that are open for variation. Most important if you reuse my code here is that you use your own unique strings.

Most payment processors (SWReg, Plimus, and so on) will be able to query a URL of your choice to create a license key. This solution uses a PHP-script to create a license key that can be validated by code written in any .NET-language. I will use C# for my examples.

The solution uses a multi part license key so that you can change the application code that checks the license when/if it gets cracked or keygened.

Let’s start with the PHP-code that creates the license key.

I start by creating three unique strings. Let’s use ‘AAA’, ‘BBB’, ‘CCC’. (I use more than three, but it will be enough to make my point.)

$g1 = 'AAA';
$g2 = 'BBB';
$g3 = 'CCC';

…then I create a hash from the unique string concatenated with the e-mail address used for registering the application.
By the way; I am constantly truncating the values at five characters to make the key a bit smaller. It will make the hash values weaker, but I think it will OK anyway.

$key1 = substr(md5($g1 . $_GET["email"]), 1, 5);
$key2 = substr(md5($g2 . $_GET["email"]), 1, 5);
$key3 = substr(md5($g3 . $_GET["email"]), 1, 5);

… and that’s about it. Now I can concatenate the individual hashes and the e-mail address.

$license = $_GET["email"] . "-" . $key1 . "-" . $key2 . "-" . $key3;

…then I create a hash of the license and concatenate that with the license.

$hash = substr(md5($license), 1, 5);
$license = $license . "-" . $hash;

Finally I return the license key:

echo ($license);

The result is this:

foo@foo.com-fb821-90d34-8b8c6-ca6ab

Now it’s time for some C# code. The main obstacle was getting a PHP compatible hash value out of strings in .NET. I googled a bit and found this (I’m not sure where it came from though so I can’t give proper credit.):

public static string Md5Hash (string pass)
{
  MD5 md5 = MD5CryptoServiceProvider.Create ();
  byte[] dataMd5 = md5.ComputeHash (Encoding.Default.GetBytes (pass));
  StringBuilder sb = new StringBuilder();
  for (int i = 0; i < dataMd5.Length; i++)
  sb.AppendFormat("{0:x2}", dataMd5[i]);
  return sb.ToString().Substring(1, 5);
}

This method will return the same string as the PHP md5() method given the same input.

Since I hashed all concatenated sub keys I can now validate a given license key with this:

public static bool LicenseIsValid(string license)
{
   int lastHyphen = license.LastIndexOf("-");
   if(lastHyphen < 4 )
   {
     return false;
   }
   string l = license.Substring(0, lastHyphen);
   string hash = Md5Hash(l);
   string[] lines = license.Split('-');
   return (hash == lines[lines.Length -1]);
}

I could include a fourth secret string when I do the hash of the full key, but at this stage I only want to validate that it is a license key for my program. I don't want to check its authenticity yet.

To authenticate a key I get one of the hashed sub keys. With this function:

public static string GetKey(int n, string license)
{
   string[] lines = license.Split('-');
   return lines[n];
}

I then hash the secret string I used for the n'th value together with the email and compare the result with the sub key from the license.


string email = GetKey(0);
string validHash = Md5Hash ("AAA" + email);
if(validHash == GetKey(1))
{
   //Allow registered stuff
}
else
{
   //Inform user that thy have to pay.
}

To make it a little bit harder to crack this, make sure to write this code in several places. If you encapsulate it in a method there is only one place to bypass.

When someone has created valid keys you can recompile the application and use your second secret key so that the key maker has to restart his work. You could also move the checking code around a bit so the cracker has to redo his work.

That's all there is to it.

One thing I miss with this solution is the ability to encode data, like a date, into the key.

New podcasts

September 20, 2007 · Comment 

While taking the survey on Software Engineering Radio I got noticed of a couple of other technical podcast so I have added IT Conversations and ARCast to my jsiPodFetch feed list.

Shrinking podcast backlog

September 19, 2007 · Comment 

My list of new shows in jsiPodFetch is getting very short. It will be empty before the weekend. So I need to find some new podcasts to subscribe to.

Currently I subscribe only to software related podcasts, but I might try to find something else now. I listen to podcasts mainly on my commute to/from work so it doesn’t really bother me that the current selection is a bit single minded. It would be nice to, occasionally, be mentally kicked in the *ss though.

Encourage users to pay

September 18, 2007 · Comment 

I will probably start differencing the functionality for registered and unregistered users of jsiPodFetch. Since it doesn’t do much there is not many functions to take out. I will start by directing unregistered users to a downloading page when there are upgrades instead of downloading the new installer automatically. Nag screens are also a viable solution, but I will give that a second thought. Nag screens has converted me from a free rider to a paying customer some times. I have on the other hand completely abandoned software that was a bit too intrusive.

jsiPodFetch is a utility for getting podcasts to your phone or ipod clone. It will create a well ordered playlist and keep track of what shows can be deleted from the media player.

jsiPodFetch 7.37

September 13, 2007 · Comment 

I just did a new release of jsiPodFetch.

Unless I get distracted by user reported errors the next release will include support for downloading media via BitTorrent.

CHANGE LOG
7.37

  • Fixed an error because of mismatch between the meta data and the file system that could happen if a user for some reason killed the process in the wrong millisecond.
  • Added call in uninstaller to remove jsiPodFetch related data
  • Added -uninstall as a commandline argument to remove all jsiPodFetch related data. (To be used by the uninstaller.)
  • Fixed a bug that left done files on the player.
  • Now detects when a USB device is added or removed and does a refresh automatically.

FreeMind and the current job

September 7, 2007 · Comment 

The current job is about defining/refining and documenting a system that is a couple of years old. I was a big part in building it initially but it has grown without much control since then.
As I see it, the main reason it is hard to get a grasp of it now is because there is (or has never been) a central role to consolidate the development. For each little project there has been a new project manager who only wanted to do his part at the lowest cost or him. No one has taken, or gotten, responsibility for all of it. This has led to more than one ugly hack to solve the same issue in different sub projects.
Now they have taken the opportunity to try to figure out what functionality there actually is, and what should be reused or refactored.

This is the first time my deliverables aren’t code. Starting with a blank sheet is always hard, but I remembered FreeMind, a free mind mapping tool. It helps a lot with the blank sheet syndrome since one can start dumping information in it and organize it later. Of course that is possible in any other text editor, but the graphical metaphor of FreeMind helps, at least me, get over the writers block.

I haven’t run FreeMind in Vista before so it was not very pleasant to discover that all file operations on new files failed. I solved it by copying one of the document that came with the install. When I double click it in my favorite file manager it starts FreeMind and I can save changes to ‘old’ documents. It is apparently a known bug so I will keep recommending FreeMind to any one who wants to listen.

I used to build my documentation for logview4net in a commercial competitor called Mind Manager. I think I will start using FreeMind for both logveiw4net and jsiPodFetch in the future.

New release of jsiPodFetch

September 2, 2007 · Comment 

I encountered a couple of severe errors in jsiPodFetch this week so there was a new release yesterday.

Changes in 7.36

- When adding new feed it didn’t show up in the list.
- Don’t download items marked as done.
- Woops; If a feed was deleted while one of its files were on the player; the app couldn’t display any items.
- Added a content menu to the tray icon.
- Added a play button when an item is selected so that one can listen to the media on the PC
- Extended tooltip on ‘blue light’ when downloading content.

First service release of jsiPodFetch

August 27, 2007 · Comment 

Today I did the first service release of my podcast downloader; jsiPodFetch.
The new version is 7.35 (I use year and week for version numbering) and this is what i have fixed since 7.33:

  • App disappears when minimizing.
  • Blue ‘light’ turned of after first downloaded item. Even if there were more.
  • It takes to long to open the initial window.
  • Items in new feed wasn’t downloaded until restart of application.
  • The free space calculation fails when copying files.
  • Add a license dialog to installer.
  • Removed the question for folder on start when the player is not connected.
  • Send user to website on F1
  • Missing data in feeds causes internal exceptions. (Changed exception text. Errors on per item, not per feed.)
  • Lowering the size limit on the player while having ‘to much’ data on the player will create internal errors. (The app works OK though.)

jsiPodFetch is an application that helps when listening to podcasts in phones or other media players. It downloads media to your PC, creates a playlist and copies the media to your player.

« Previous PageNext Page »