VB.NET Serial Key Generation – Encryption, Hashing, and Encoding Algorithms

encryptionlicensingstringstext-encodingvb.net

I am trying to create a basic licensing system where I take a unique ID from the client computer, and I get this Hexadecimal string (hyphens removed e.g. "84-18-CE-…."):

"8418CFEE73FA22E6AB0760C73A496497C6C347DA88A9F63B95FE1E1D6A350AA1D7D3A9EE870795AECC3C109AA8B4A78C"

It's only encoded into this format to make the ID longer.

Basically what I've been trying to do (without success), is to create some routine that can transform this string into a 25-character long (minus the dashes) string like the one below:

"H8G02-J8293-L02O9-S920Q-F8D9X"

(An alpha-numeric key with numbers or letters in no particular pattern, preferably letter,number, letter or vice versa)

I just can't figure out how I could then validate this key, so that I could extract the untransformed Hex string we began with.

  • Note that the original Hex string will not always be the same length. Also, a routine that will convert ANY string into such a format (alpha-numeric, caps-only) will be acceptable.
  • I just realized that perhaps this isn't possible (to shorten the string down to 25 characters, and still retain the information (silly, I know). I will now accept anything that will allow me to create a 25-character OR LONGER string, from which I can select 25 characters.

Best Answer

Convert the hexadecimal number to base 36. Example here.

According to that page, Your input yields

1DWCLWKQZK16WMKIIEYVLLXA9E4OQ64P80KDOH4ALCYRCYCTKRUHQRXTM6HLDEV78E6APXQV1JG

in base 36.

Here is a Stack Overflow question that has an arbitrary base conversion function in c# (alas, couldn't get the online converter to properly convert it to VB). You can see it in action here: http://ideone.com/nDun6s

Related Topic