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