Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-23071

Add md5(v3) and sha1(v5) version for DCE in QUuid

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P2: Important
    • 5.0.0
    • 5.0.0
    • Core: Other, Core: Plugins
    • None
    • 8c72dc5907a97fce718f6810d446ecf6ea41b588

    Description

      We don't support md5(v3) and sha1(v5) method in QUuid yet, they are part of standard, rfc4122.
      http://www.ietf.org/rfc/rfc4122.txt

      And there is an implementation for md5(v3) in QtJsonDB,

      src/qson/qsonuuid_p.h
      Q_ADDON_JSONDB_QSON_EXPORT QByteArray QsonUUIDv3(const QString &source);
      
      src/qson/qsonuuid.cpp
      QByteArray QsonUUIDv3(const QString &source) {
          QCryptographicHash md5(QCryptographicHash::Md5);
          md5.addData((char *) &QsonUuidNs, sizeof(QsonUuidNs));
          md5.addData((char *) source.constData(), source.size() * 2);
          
          QByteArray result = md5.result();
          
          qson_uuid_t *uuid = (qson_uuid_t*) result.data();
          uuid->time_hi_and_version &= 0x0FFF;
          uuid->time_hi_and_version |= (3 << 12);
          uuid->clock_seq_hi_and_reserved &= 0x3F;
          uuid->clock_seq_hi_and_reserved |= 0x80;
              
          return result;
      }
      

      Attachments

        For Gerrit Dashboard: QTBUG-23071
        # Subject Branch Project Status CR V

        Activity

          People

            liaqi Liang Qi
            liaqi Liang Qi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes