Click here to Skip to main content
13,199,669 members (42,097 online)
Click here to Skip to main content
Add your own
alternative version


15 bookmarked
Posted 8 Sep 2016

Machine Finger Print - The Right and Efficient Way

, 8 Sep 2016
Rate this:
Please Sign up or sign in to vote.
Protecting your work - use the right way to identify your client machine


Many of us programmers are constantly banging our heads to the wall – how to positively and efficiently protect our project?

Many keep asking about how to identify the machine and the answers are very creative.

Since I had to work on such a solution for a sensitive project, I had to look into the matter myself.

This is my first contribution to this great community and I hope it will solve an issue for anyone who finds it relevant.

In this article, I will explain the steps, the how-to and provide a very simple code sample that works.


Let's put first in first place and get the background clear.

For most machines, the CPU id is no real element to rely on as it is not there, or not unique, etc. so no CPU id in this article.

Mother board serial is also not a very reliable element for the very same reasons. Naturally MAC address is also not a good factor as it may be changed and we wouldn't want the hassle to re-license on every simple hardware modification like network card and we should also take into consideration that we will most probably have 2 addresses for laptops…

Volume serial? naaa… nor reliable and may change.

Windows product key? maybe, but for many large organizations, it is not unique as they have site or large account license – so for us, not good enough.

There are only 2 elements that are constant, stable, unique, reliable and easy to handle. They are Machine UUID and Windows Machine GUID. These elements won't change or modify unless Windows is re-installed or a hardware basic change is made.

So we can rely on them and forget the other elements.

Using the Code

The sample code is in simple VB.NET.

The code is NOT the most efficient and may be improved, it is presented this way to ensure it is kept easy and simple to follow and understand.

The code was tested on both 64 and 32 bits machines.

Firstly – import the following:

Imports System.Management
Imports Microsoft.Win32

We will have 3 functions:

  1. p>The first one is Get_WindowsGUID. This one retries the windows GUID created when Windows was installed and will be fixed until it is being re-installed.
    Public Function Get_WinGUID() As String
            Dim sRet As String = ""
                Dim readValue = My.Computer.Registry.GetValue_
                ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography", "MachineGUID", Nothing)
                sRet = readValue
            Catch ex As Exception
                sRet = ""
            End Try
            Return sRet
    End Function
  2. The second one is Get_MachineUUID. This one gets the machine unique UUID.
    Public Function Get_PC_UUID() As String
            Dim UUID As String = ""
                Dim searcher As New ManagementObjectSearcher(
                    "SELECT * FROM Win32_ComputerSystemProduct")
                For Each queryObj As ManagementObject In searcher.Get()
                    UUID += queryObj("UUID")
            Catch err As ManagementException
            End Try
            Return UUID
    End Function
  3. The last one is MD5Hash. This one gets a string and MD5Hash it = one way crypto to create a "simple" string in a fixed length, so we can use it as a standard outcome of our process. This function is not mandatory and if one chooses to use the plain raw IDs as they are generated – that's fine too.
    Public Function GET_MD5Hash(ByVal strToHash As String) As String
            Dim md5Obj As New Security.Cryptography.MD5CryptoServiceProvider
            Dim bytesToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash)
            bytesToHash = md5Obj.ComputeHash(bytesToHash)
            Dim strResult As String = ""
            For Each b As Byte In bytesToHash
                strResult += b.ToString("x2")
            Return strResult
    End Function

The technique is very simple.

Get the windowsGUID into a string and the UUID into a second string.

Add them into one string.

Remove dashes (-) and spaces to create one simple string.

Send it to the MD5Hash function and you've got a returned string to be used as the machine unique ID / finger Print.

I hope it did help those who struggled with this topic.

The use of this code is free and subject to no restrictions, but one only – I take no liability, so use it with caution…



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Zeev Goldstein
Israel Israel
more than 30 years in software development/ business development / mentoring
mainly in financial industry (banking & credit cards)
run my own companies and act as consultant to startups and othe ventures globally

You may also be interested in...


Comments and Discussions

QuestionPecision if diferent OS used Pin
josam712-Sep-16 20:09
memberjosam712-Sep-16 20:09 
AnswerRe: Pecision if diferent OS used Pin
Zeev Goldstein12-Sep-16 20:39
memberZeev Goldstein12-Sep-16 20:39 
GeneralRe: Pecision if diferent OS used Pin
josam712-Sep-16 23:56
memberjosam712-Sep-16 23:56 
GeneralMy vote of 5 Pin
alajev9-Sep-16 21:41
memberalajev9-Sep-16 21:41 
QuestionMy vote of 5 Pin
mmarques_mdc9-Sep-16 7:22
membermmarques_mdc9-Sep-16 7:22 
GeneralMy vote of 5 Pin
_Vitor Garcia_9-Sep-16 4:34
member_Vitor Garcia_9-Sep-16 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171020.1 | Last Updated 8 Sep 2016
Article Copyright 2016 by Zeev Goldstein
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid