Hello,

First, thank you all for your comments.
In fact the idea is to generate a install ID of my application to use 
some kind of a registration system. The user will send me an INSTALL ID 
plus a SERIAL and I will return an AUTHORIZATION key.

Most of MS Windows applications get the GUID (UUID) number from the 
installed system which is unique from machine to machine. Some combine 
this number with HD serial, BIOS identification, etc.

Of course it is almost impossible to build a 100% secure registration 
system and as you all said the hardware can be moved from machine to 
machine.

My idea is to generate this unique ID from HD serial, mac address and OS 
identification(a combination of all these).

Another approach I'm thinking about is to create a platform dependent 
executable module which can be called from inside Ruby script and return 
the machine GUID. This way for Windows I can create an EXE module, for 
Mac I can create an EXEC module and so on.

Any ideas?

Regards,
Fernando.

Pascal J. Bourguignon wrote:
> Heesob Park <phasis / gmail.com> writes:
> 
>>>>>> How can I unique identify the OS where my Ruby code is running?
>>>> Regards,
>>>>
>>>> Dan
>>>>
>>>
>>> I believe the OP wants to get a unique identifier for each host, something
>>> like a GUID. I have no idea how you would make this cross platform though,
>>> maybe IP address but those change, or HD serial, but again that's
>>> changable...
> 
> HD move from one computer to the other.  The OP asked for a computer
> ID, not a HD ID.  The IP addresses identify interfaces.  There may be
> several or no interface per computer.  Which IP address would you use?
> Nowadays, most users are behind a NAT with private IP, so this won't
> identify anything.
> 
> 
>>> Windows supports GUIDs inherantly however AFAIK *nix systems don't.
>>>
>>> Sorry I don't have a solution.
>>>
>>> Matt
>>>
>>>
>> If the OP wants the unique ID per computer in cross platform way, the
>> mac address is one solution.
> 
> Network cards move from computer to the other.  Network cards break
> down and are changed.  MAC addresses are not always stored in ROM,
> some cards allow changing the MAC address.  And a computer has several
> MAC addresses (even if with only one ethernet address, MAC addresses
> are also used on Wifi and Firewire).
> 
> It's a problem of definition.  What do you consider the computer?  Is
> that the CPU?  Is that an installation of the system?  Is that some
> given configuration of hardware?
> 
> 
> If Internet connectivity is assumed, I would propose a server issuing
> unique IDs, and a procedure to mark an "OS" like the OP names it,
> which would fetch a new unique ID from the server and store it in some
> global file.  Then the ID would be retrieved from this global file
> named for example, /etc/com.gmail.fpmalard.unique-id  on unix systems
> and something else on the other systems.
> 
> 
> If Internet connectivity cannot be assumed, then you would have to
> build a unique ID trying to gather specific data and random data to
> reduce the probabilities of a collision.  There are several web pages
> indicating how to build such an ID.  The point is that the specific
> data about the computer is gathered only when the ID is made, not when
> it's used.  If you change your hardware configuration, or move your
> "OS" to some other hardware, you should be able to keep your ID.

-- 
Posted via http://www.ruby-forum.com/.