It is possible to code this on PHP?

311 views Asked by At

i coded some vb.net application, for security i use HWID security method...

vb.net code to generate unique key is:

Dim hwid As String = System.Security.Principal.WindowsIdentity.GetCurrent.User.Value

it will return some unique key for every pc like this

S-1-2324-34242FDF-SDWQ3Q-Q3WR4CWRWCE1321SXS32

currently i am learning & developing PHP scripts...

i want to know it is possible to generate the same unique key using PHP???

1

There are 1 answers

3
Dave Chen On

Let's break it down.

System.Security.Principal.WindowsIdentity.GetCurrent()

Is a method that returns the current user.

.User.Value

Is actually calling:

.User.toString()

The method is actually:

System.Security.Principal.WindowsIdentity.GetCurrent().User.toString()

This is simply the User's Security Identifier (SID).

Running wmic useraccount get name,sid returns all the SIDs found on the machine.

Now, what does this mean for PHP? Well since PHP is ran on the server only, I doubt this number will change based on which visitor visits. So using this number in PHP is pointless, as it will always be the same.

A better approach for generating a random ID is uniqid.

Check out this for information on how this SID is derived from the registry.