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. QDomDocument toString() producing different results
Qt 6.11 is out! See what's new in the release blog

QDomDocument toString() producing different results

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt 5.9.0qtxml
3 Posts 2 Posters 1.4k Views
  • 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.
  • G Offline
    G Offline
    goldstar2154
    wrote on last edited by goldstar2154
    #1

    Hi everyone.

    So situation is:

    QDomDocument::toString()
    

    producing different results.
    This happens cause of QHash now have random seeding (against hash attacks).

    Problem is - we generate sign based on xml-string produced by toString() , so when we check sign we got sign mismatch because of different strings.

    Possible solutions like

    qSetGlobalQHashSeed(0);
    

    is not solution because it works only at same machine but not work on different machines.

    So is there are way produce identical xml-strings on different PCs?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      The only possibility I see is to find-and-replace QHash with QMap inside QDomDocument sources and re-compile Qt. This would also have licensing implications though

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • G Offline
        G Offline
        goldstar2154
        wrote on last edited by goldstar2154
        #3

        @VRonin said in QDomDocument toString() producing different results:

        This would also have licensing implications though

        Thanks for idea, i think we can build our own QDom* classes and make lib for application.
        Also possible solution is canonical serializer, that will save xml in right way, but both solutions require much more code than .toString() :)

        This link demonstrate canonical serializer
        https://stackoverflow.com/questions/27378143/qt-5-produce-random-attribute-order-in-xml

        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