How to encrypt to xxxx-xxxx-xxxx-xxxx

  • Thread starter Thread starter Henke
  • Start date Start date
H

Henke

Hi!

Are there any built in classes (or methods) in the framework that can
encrypt to some simple string like the one you enter when registring an
Microsoft application (xxxx-xxx-xxxx-xxxx)?
I have tried using i.e. DESCryptoServiceProvider (and other) and
ConvertToBase64String but these strings gets quite long and complicated.

Thanks in advance
/Henke
 
What you could look into is a Base32 encoding, which will be more compact
than hex, but be case-insensitive.

The length is related to the block size of the cipher (the .NET Framework
only has block ciphers). DES is 64-bit, so in Base32, that's gonna be 13
chars. Not too bad (DES is probably strong enough for keycodes, since an
app can be cracked anyways). Decent algorithms (like Rijndael) is going to
have a 128-bit block (for AES), 26 chars. Somewhat longer, but I think the
MS keys are the same size (or near that).

On my site (www.atrevido.net) I just posted a sample Base32 encoding. This
does not follow a standard Base32 encoding, but instead a modified one I've
used for keycodes, removing certain chars that are easily confused. You can
google for Base32 and get other implementations and find the standard.

As far as delimiting the sections with dashes, that's completely up to how
you want to do that. You could also add a check-character for every group
(as I believe the MS keycodes have).

-mike
MVP
 
Back
Top