Obtain a unique hardware identifier in C++ in Windows

11,822

Encrypt any value with the machine's DPAPI key and use the encrypted value as your ID.

Note: I copied my original answer to the question that this one duplicates.

Share:
11,822
Didac Perez Parera
Author by

Didac Perez Parera

Originally from Barcelona, currently living in Seattle. I make software. I also make music. I love life, and I love beer. http://es.linkedin.com/in/perezdidac http://www.didacperez.cat

Updated on June 04, 2022

Comments

  • Didac Perez Parera
    Didac Perez Parera almost 2 years

    Possible Duplicate:
    Reliable way of generating unique hardware ID

    I would like to retrieve an unique hardware identifier for a single machine in C++. Any suggestions? I need this software working in Windows XP, Vista, 7, 8. I just need a few system calls to retrieve MAC address, hard disk serial number, or something like this.

  • ahmd0
    ahmd0 about 8 years
    DPAPI will use PBKDF2 encryption method that uses random "salt", which will produce a resulting cipher text with random values every time you generate it. So unless you specify how to make PBKDF2 not use random "salt" (I'm guessing, via CryptProtectData API) I don't see how your suggestion would work? More info: msdn.microsoft.com/en-us/library/ms995355.aspx