How to generate Uuid based on system MAC address



  • Hi,

    I want to generate Uuid based on the system's MAC address using Qt. I could not find suitable example to do so. I am able to produce the mac address. Can someone guide me in order to implement this?

    Thanks & Regards


  • Moderators

    @rakeshthp
    i don't quite understand what you want.
    the MAC and UUID should both be unique per se.

    You want a "mapping" from MAC to UUID?!

    What you are looking for is some sort of hashing no? If so you can look at QCryptographicHash



  • @rakeshthp said in How to generate Uuid based on system MAC address:

    I want to generate Uuid based on the system's MAC address using Qt. I could not find suitable example to do so. I am able to produce the mac address. Can someone guide me in order to implement this?

    find MAC

        QStringList m_list_mac;
        foreach(QNetworkInterface interface, QNetworkInterface::allInterfaces())
        {
            // Return only the first non-loopback MAC Address
            if (!(interface.flags() & QNetworkInterface::IsLoopBack )&& (interface.flags() & QNetworkInterface::IsUp))
            {
                m_list_mac.append(interface.hardwareAddress());
    
            }
        }
    

    and used for crypt QCryptographicHash
    as recommended raven-worx


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.