0

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.
0

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

  • Awesome! This is exactly the kind of thing I was looking for! Could you please include an example piece of code that would allow me to do this (or at least a namespace/class to look for)? – SolaGratia Jul 15 '14 at 15:47
  • C++ :S. Could you include a simple example in VB.NET? And is it possible to define the possible characters (map then out perhaps?) so I could exclude "O", like you were saying? – SolaGratia Jul 15 '14 at 15:51
  • It will take me a few minutes to knock something together. – Robert Harvey Jul 15 '14 at 15:52
  • I would really appreciate it :) – SolaGratia Jul 15 '14 at 15:53
  • Well, it's not VB.NET, but there you go. – Robert Harvey Jul 15 '14 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.