Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Generate unique hardware id - Cross platform
Forum Updated to NodeBB v4.3 + New Features

Generate unique hardware id - Cross platform

Scheduled Pinned Locked Moved Unsolved General and Desktop
hardwareunique
8 Posts 5 Posters 5.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AliReza Beytari
    wrote on last edited by
    #1

    Hi. Dose Qt have any reference to generate a unique hardware id?!
    If not, please submit a code of pure C++!

    Thanks.

    raven-worxR beeckscheB kshegunovK 3 Replies Last reply
    0
    • A AliReza Beytari

      Hi. Dose Qt have any reference to generate a unique hardware id?!
      If not, please submit a code of pure C++!

      Thanks.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @AliReza-Beytari
      No, since there is no generic way to do so.

      But you should be able to get the MAC address (which can get easily spoofed by the user though) and/or CPU id (shouldn't be too hard to get on various systems.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • A AliReza Beytari

        Hi. Dose Qt have any reference to generate a unique hardware id?!
        If not, please submit a code of pure C++!

        Thanks.

        beeckscheB Offline
        beeckscheB Offline
        beecksche
        wrote on last edited by
        #3

        @AliReza-Beytari
        Maybe this can help: http://doc.qt.io/qt-5.7/quuid.html

        raven-worxR 1 Reply Last reply
        0
        • beeckscheB beecksche

          @AliReza-Beytari
          Maybe this can help: http://doc.qt.io/qt-5.7/quuid.html

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @beecksche
          this generates a random unique ID. So creating such ID multiple times on the same machine creates different IDs, which is not desired.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • A AliReza Beytari

            Hi. Dose Qt have any reference to generate a unique hardware id?!
            If not, please submit a code of pure C++!

            Thanks.

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by kshegunov
            #5

            @AliReza-Beytari

            What one usually does is to put a bunch of hardware ids (macs, cpu id, mb id) together, as @raven-worx suggested, and then to run a hash function over them (e.g. sha1). However, generating such identifiers is a pretty suspicious design in my opinion, as any change in the used (for ids) hardware will break the id matching.

            Read and abide by the Qt Code of Conduct

            raven-worxR 1 Reply Last reply
            0
            • kshegunovK kshegunov

              @AliReza-Beytari

              What one usually does is to put a bunch of hardware ids (macs, cpu id, mb id) together, as @raven-worx suggested, and then to run a hash function over them (e.g. sha1). However, generating such identifiers is a pretty suspicious design in my opinion, as any change in the used (for ids) hardware will break the id matching.

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              @kshegunov said:

              However, generating such identifiers is a pretty suspicious design in my opinion, as any change in the used (for ids) hardware will break the id matching.

              which may be the goal after all ;)

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              kshegunovK 1 Reply Last reply
              0
              • raven-worxR raven-worx

                @kshegunov said:

                However, generating such identifiers is a pretty suspicious design in my opinion, as any change in the used (for ids) hardware will break the id matching.

                which may be the goal after all ;)

                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by
                #7

                @raven-worx said:

                which may be the goal after all

                Okay, I haven't thought about that ... it might be. :)

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  AshkanV
                  wrote on last edited by
                  #8

                  Hi to all
                  As of Qt 5.11 there is a static function in QSysInfo class:
                  QByteArray QSysInfo::machineUniqueId()
                  https://doc.qt.io/qt-5/qsysinfo.html#machineUniqueId

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved