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 27 Jul 2016, 13:23 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.

    R B K 3 Replies Last reply 28 Jul 2016, 14:20
    0
    • A AliReza Beytari
      27 Jul 2016, 13:23

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

      Thanks.

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 28 Jul 2016, 14:20 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
        27 Jul 2016, 13:23

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

        Thanks.

        B Offline
        B Offline
        beecksche
        wrote on 28 Jul 2016, 22:45 last edited by
        #3

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

        R 1 Reply Last reply 29 Jul 2016, 05:56
        0
        • B beecksche
          28 Jul 2016, 22:45

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

          R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 29 Jul 2016, 05:56 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
            27 Jul 2016, 13:23

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

            Thanks.

            K Offline
            K Offline
            kshegunov
            Moderators
            wrote on 29 Jul 2016, 12:58 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

            R 1 Reply Last reply 29 Jul 2016, 13:00
            0
            • K kshegunov
              29 Jul 2016, 12:58

              @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.

              R Offline
              R Offline
              raven-worx
              Moderators
              wrote on 29 Jul 2016, 13:00 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

              K 1 Reply Last reply 29 Jul 2016, 13:01
              0
              • R raven-worx
                29 Jul 2016, 13:00

                @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 ;)

                K Offline
                K Offline
                kshegunov
                Moderators
                wrote on 29 Jul 2016, 13:01 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 7 Apr 2019, 06:20 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