convert MAC addres to a unique serial number

J

Jassim Rahma

my CPU mac address is BFEBFBFF000006F6

and my software name is : shefa

is there any function or encryption way in C# to generate a 24 digits (alpha
numeric) from both CPu MAC address and software name?
 
G

Guest

There are lots of ways to do this, it depends on what kind of encryption you
need and how strong it should be. For starters (not that I'd necessarily
recommend this) you could pad the combined string with zeroes to reach 24
characters, and then do simple XOR replacement on each character to get a new
string. The advantage of this (although it is very easy to break "the code")
is that XOR is 2-way - if you pass the encrypted string into the same method,
you get back the original, and no key is required.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Jassim said:
my CPU mac address is BFEBFBFF000006F6

and my software name is : shefa

is there any function or encryption way in C# to generate a 24 digits
(alpha numeric) from both CPu MAC address and software name?

Plenty.

You could just concatenate the two and pad with something.

If you have more specific requirements then tell us.

Arne
 
R

rossum

my CPU mac address is BFEBFBFF000006F6

and my software name is : shefa

is there any function or encryption way in C# to generate a 24 digits (alpha
numeric) from both CPu MAC address and software name?
How secure does this need to be?
Does it need to be reversible?

Your options include some or all of: Base64 encoding, a cryptographic
hash function, a cryptographic cypher.

Given that most cryptographic functions work on 128 bit (16 byte)
blocks then the Base64 encoding of a block will give you 24
characters,though it might contain "/" and will certainly contain "="
at the end.

rossum
 
J

Jassim Rahma

i want to generate somthing like:

xxxx-xxxx-xxxx-xxxx-xxxx-xxxx

from the MAC address without letting the user know how it was generated.
 
R

rossum

i want to generate somthing like:

xxxx-xxxx-xxxx-xxxx-xxxx-xxxx

from the MAC address without letting the user know how it was generated.
This is something simple and not very secure, based on Vigenere
encryption.

1 Start with the alphabet of characters you want to use:

0 ... 9 a ... z A ... Z

and assign each character a number, starting from 0. The characters
do not have to be in order.

2 Now concatenate the MAC address and username:

BFEBFBFF000006F6shefaXXX

with padding or truncation to make the length exactly 24 characters.
Random padding will be better, otherwise the last few characters might
come out the same every time.

3 Now pick a 24 character long encryption key:

NowIsTheWinterOfOurDisco

4 Go through the concatenation from 2 and add each letter to the
corresponding letter in the key, modulo the length of your alphabet
from 1. Turn the result back into a letter from your alphabet.

That will give you a random seeming 24 character string.

This method is far from unbreakable if that is important to you. To
make it much more difficult to break then use a cryptographic hash of
the string in 2 instead and turn it into Base64.

rossum
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Jassim said:
i want to generate somthing like:

xxxx-xxxx-xxxx-xxxx-xxxx-xxxx

from the MAC address without letting the user know how it was generated.

There are lots of ways of doing this.

You can just take the MAC in hex and take 1 hex digit of MAX + random
byte + second hex digit of MAC + random digit etc..

Or you can come up with more complex schemes.

If it is a licensing scheme, then you should be aware that
..NET assemblies are easy to decompile and check how the serial
is obtained and checked.

Arne
 

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