How to generate product key?

A

Antonio

Hi,

I would like to have my users register their name and organization name and
submit them through email so that we can generate a product key for them.
But we have no idea how to generate a product key something look like
Microsoft's product key. In addition, I would like to have the key generated
based on their name and company name.

Any idea on how to go about doing this using VB.NET? Thanks in advance.

Regards,
Antonio
 
T

Terry Olsen

Why not use an encryption algorithm such as Blowfish (.NET version avail
here: http://www.hotpixel.net/software.html). Encrypt the Organization Name
using the User Name as the password. Take the encrypted output and format it
how you wish (divide it into 5-character segments, delimited with dashes,
chopping it down to the length you want).
 
N

Newbie Coder

Almost weekly the same question is asked in this newsgroup & you'll get
pointed to the same few controls like the ASPOSE one by the MVP's

Doesn't anyone write there own one of do like the MVP's & search Google for
the answer?
 
G

Guest

Doesn't anyone write there own one of do like the MVP's & search
Google for the answer?

Writing a licensing control is a lot of work - especailly to make it
bulletproof and reliable...
 
S

ShaneO

Newbie said:
Almost weekly the same question is asked in this newsgroup & you'll get
pointed to the same few controls like the ASPOSE one by the MVP's

Doesn't anyone write there own one of do like the MVP's & search Google for
the answer?
There are problems with simply supplying code samples for what the OP is
seeking -

1. To provide the functionality required needs much more than a code
snippet, it usually requires an entire application to show how you might
do it.

2. Showing someone's solution may pose a risk of exposing
Code/Algorithms that people have spent a long time perfecting and don't
want to become public knowledge. (For obvious reasons).


Nonetheless, I HAVE provided details in earlier posts, and do so again
now, in hope that the OP will obtain some inspiration to develop his/her
own -

(Sample of my Code that uses the Serial Number of the HDD as part of the
Application Serial Number)

*******
I use the following code (watch for wrapping!) -

Imports System.Management

''' <summary>
''' String of 1 to 2 chars. eg. "C" or "C:".
''' </summary>
''' <param name="sDriveLetter"></param>
''' <returns></returns>
''' <remarks></remarks>
Public Function GetDriveSerialNumber(ByVal sDriveLetter As String) As String

If Len(sDriveLetter) = 1 Then
sDriveLetter &= ":"
Else
sDriveLetter = Strings.Left(Environment.SystemDirectory, 2)
End If

Dim HardDiskInfo As New ManagementObject("Win32_LogicalDisk.DeviceID="
& ChrW(34) & sDriveLetter & ChrW(34))
Dim HardDiskProperty As PropertyData =
HardDiskInfo.Properties("VolumeSerialNumber")
Return HardDiskProperty.Value.ToString

End Function

I first obtain the Drive Serial Number and then ensure it is
8-Characters in length -

Dim sA As String =
GetDriveSerialNumber(Strings.Left(Environment.SystemDirectory, 2))

Dim N As UInt16 = Len(sA)
If N < 8 Then
sA = sA.PadRight(8 - N, "0")
ElseIf N > 8 Then
sA = Strings.Left(sA, 8) 'Truncate to 8 Chars.
End If

After this I "AND" the value with another routine that automatically
generates an 8-Character HEX number based on the title of my software.
I then end up with a 16-Character HEX number, which is unique to each of
my applications and unique on every computer, I then do some more
XOR'ing and present this to the User as the Application Serial Number.

I obviously have another application that reverses all of this to
provide an Unlock Code that the User enters.

There are literally hundreds of Users running my applications using this
method, and although it really only stops the honest pirates, it serves
my purposes well.

If you'd like to see an example, please download one of my apps (written
for specific clients) from the following site -

www.arnfieldcomputerservices.com/apps/sdi/publish.htm

This will provide an example of what my Registration Screen looks like.

If you require any further assistance, please feel free to contact me
direct via the email address used in this post.

*******
FootNote: When this code sample was last posted, I received warnings
from others that not all systems have drives with Serial Numbers. I
don't dispute this (although I've NEVER seen it) so you might want to
consider an additional or an alternative means of obtaining a unique
number from the system. (ie. MAC Address etc.)


ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
 
C

Cor Ligthert [MVP]

Shane

In my opinion very correct especially about this one
2. Showing someone's solution may pose a risk of exposing Code/Algorithms
that people have spent a long time perfecting and don't want to become
public knowledge. (For obvious reasons).
Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top