Re: Generating Unique Key (Finger Print) for a Computer for Licensing Purposes by GO

3,005 views
Skip to first unread message

Hotei

unread,
May 12, 2013, 10:30:09 PM5/12/13
to golan...@googlegroups.com
I think a simpler way would be to get the network interface id - also known as the MAC address.  It's already guaranteed to be unique.  A MB without a card or net-chip might present a problem but it would solve 99% of your needs I suspect.  I don't have any code handy for that but it's probably lurking in the go std library.

http://en.wikipedia.org/wiki/Mac_address

On Sunday, May 12, 2013 5:54:56 PM UTC-4, Aboozar Ghafari wrote:
Hi everyone,

For licensing purposes, according to me, the best and secure way is to generate a unique key for the client's machine and provide a corresponding license key for that key. 
For this purpose, you can take help of the unique id of the client's computer motherboard, BIOS and processor. When you get these IDs, you can generate any key of your preferable format.

I'm newbie in Go so now I want to know is it possible to do this with Go language? 
What is your solution for this problem? (By helping C o ....)

please add your sample code too :)

Thanks

dlin

unread,
May 12, 2013, 11:53:42 PM5/12/13
to golan...@googlegroups.com
Please write the function in C at first.
There are two possible methods:

1. use CGO to call your C function(not c++)  (if you C contains asm, I guess this is the only possible method)
2. convert your C code into pure Go code by calling unsafe package.(eg. syscall...)

BTW, if you successful, could you share your code on github Go package easy to import?

Archos

unread,
May 13, 2013, 2:51:06 AM5/13/13
to golan...@googlegroups.com
Other solution would be to get the serial number of the hard disk which would work in every case.

Devon H. O'Dell

unread,
May 13, 2013, 2:55:02 AM5/13/13
to Archos, golang-nuts
Except for systems without a hard disk.

2013/5/13 Archos <raul...@sent.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Hotei

unread,
May 13, 2013, 8:32:54 AM5/13/13
to golan...@googlegroups.com
Are you sure HD serial numbers are guaranteed to be unique among different vendors and over time?  I've looked at a fair number of them over the years and I've seen a huge variation in what vendors use for SNs.

Aram Hăvărneanu

unread,
May 13, 2013, 8:38:03 AM5/13/13
to Hotei, golang-nuts
Hardware fingerprints are useless today in the age of virtual machines.

--
Aram Hăvărneanu

Aboozar Ghafari

unread,
May 13, 2013, 3:11:47 AM5/13/13
to Devon H. O'Dell, Archos, golang-nuts
I know all of these ways but as i said I want a sample code. I've searched all go packages in golang.org, I've Googled too, ... but it's seems that there is no way to access to hardware information with GO libraries !!!

for example this is a solution in C#:

I need a solution like this.

Thanks everyone

Regards
Aboozar Ghafari

Aboozar Ghafari

unread,
May 13, 2013, 8:52:01 AM5/13/13
to golan...@googlegroups.com, Hotei
Virtual machine is not a problem at all.
If you make a real fingerprint for computer in a good algorithm then every virtual machine on a same hardware had to get a new license too.

Aboozar Ghafari

unread,
May 13, 2013, 8:54:33 AM5/13/13
to golan...@googlegroups.com
I want to use combination of different values like I did in C# before.

for example:

//BIOS Identifier
        private static string biosId()
        {
            return identifier("Win32_BIOS", "Manufacturer")
            + identifier("Win32_BIOS", "SMBIOSBIOSVersion")
            + identifier("Win32_BIOS", "IdentificationCode")
            + identifier("Win32_BIOS", "SerialNumber")
            + identifier("Win32_BIOS", "ReleaseDate")
            + identifier("Win32_BIOS", "Version");
        }
        //Main physical hard drive ID
        private static string diskId()
        {
            return identifier("Win32_DiskDrive", "Model")
            + identifier("Win32_DiskDrive", "Manufacturer")
            + identifier("Win32_DiskDrive", "Signature")
            + identifier("Win32_DiskDrive", "TotalHeads");
        }
        //Motherboard ID
        private static string baseId()
        {
            return identifier("Win32_BaseBoard", "Model")
            + identifier("Win32_BaseBoard", "Manufacturer")
            + identifier("Win32_BaseBoard", "Name")
            + identifier("Win32_BaseBoard", "SerialNumber");
        }
        //Primary video controller ID
        private static string videoId()
        {
            return identifier("Win32_VideoController", "DriverVersion")
            + identifier("Win32_VideoController", "Name");
        }
        //First enabled network card ID
        private static string macId()
        {
            return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled");
        }

Aboozar Ghafari

unread,
May 13, 2013, 8:57:38 AM5/13/13
to golan...@googlegroups.com, Hotei
For example : Every Normal virtual machine has different mac address, disk Id and different VGA card from its Host.


On Monday, May 13, 2013 5:08:03 PM UTC+4:30, Aram Hăvărneanu wrote:

Archos

unread,
May 13, 2013, 8:58:55 AM5/13/13
to golan...@googlegroups.com, Devon H. O'Dell
The .Net platform comes with a library to get that information: http://msdn.microsoft.com/en-us/library/system.management.aspx

If you want to get it in Go, somebody would have to create a library to wrap the systems calls of a system:

+ En windows is easy, e.g. this call gets info. from disks:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364993%28v=vs.85%29.aspx

+ En Linux, to get info. from disk you could look for in '/dev/disk', and to get info. from motherboard you could get that info. in '/proc'

Else, in general for unix systems, you could use a tool that already gets that information; then to use a tool to know which sytem calls do the first one; finally, to build the wraps in Go for those C system calls.

Archos

unread,
May 13, 2013, 9:06:44 AM5/13/13
to golan...@googlegroups.com
The truth is that I'm not really sure but if I were a hardware seller I would ensure that each serial number was unique; also doing agreements with other companies to have different values.

Aram Hăvărneanu

unread,
May 13, 2013, 9:21:35 AM5/13/13
to Aboozar Ghafari, golang-nuts, Hotei
> For example : Every Normal virtual machine has different mac address, disk
> Id and different VGA card from its Host.

You have misunderstood me. Yes, every virtual machine has a different
fingerprint by default, but it's trivial to change this fingerprint to
whatever else. It's a number in a text file.

--
Aram Hăvărneanu

Hotei

unread,
May 13, 2013, 2:59:19 PM5/13/13
to golan...@googlegroups.com, Aboozar Ghafari, Hotei
Aram,
Perhaps the problem original poster is trying to solve is not to keep all people from cheating, but to encourage basically honest people to pay him for his product.  The two problems are similar but not identical.  The first problem is in my opinion, unsolvable.  The second problem, well it's not trivial but he seems to have a start in the right general direction.  

Jan Mercl

unread,
May 13, 2013, 3:09:34 PM5/13/13
to Hotei, Aboozar Ghafari, golang-nuts

DRM is the most ineffective way how to secure any revenue.

Don't believe me, try it for yourself ;-)

-j

Aram Hăvărneanu

unread,
May 14, 2013, 9:46:07 AM5/14/13
to Hotei, golang-nuts, Aboozar Ghafari
> Perhaps the problem original poster is trying to solve is not to keep all
> people from cheating, but to encourage basically honest people to pay him
> for his product.

Honest people pay without any "encouragement".

--
Aram Hăvărneanu

Gerard

unread,
May 14, 2013, 10:03:16 AM5/14/13
to golan...@googlegroups.com, Hotei, Aboozar Ghafari
Google supports DRM in HTML5. See http://www.defectivebydesign.org/no-drm-in-html5

Personally I am against it btw.

Op maandag 13 mei 2013 21:09:34 UTC+2 schreef Jan Mercl het volgende:

Archos

unread,
May 14, 2013, 12:38:06 PM5/14/13
to golan...@googlegroups.com
Also Microsoft but there are many people who are against it.

The solution is very simple and individual. I stopped using Chromium and I hope that Mozilla is againt DRM on HTML; at least, I hope that they don't implement it in Firefox.

Gerard

unread,
May 14, 2013, 12:54:09 PM5/14/13
to golan...@googlegroups.com
Archos, that's not what I meant. Jan said that DRM is an ineffective way to secure any revenue. However Google supports it in HTML5 (probably because youtube). So they believe it is effective.

Op dinsdag 14 mei 2013 18:38:06 UTC+2 schreef Archos het volgende:
Reply all
Reply to author
Forward
0 new messages