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. QCryptographicHash embed a checksum into a file (wav)
Forum Updated to NodeBB v4.3 + New Features

QCryptographicHash embed a checksum into a file (wav)

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 2 Posters 2.3k Views 2 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.
  • I Offline
    I Offline
    ilian
    wrote on last edited by
    #1

    Hello,

    I am quite new to crypto, and I have a task to add a checksum to a files. To be more descriptive they are wave files, and the checksum is contained withing the LSB on each N samples. So the idea is to find if the file has been modified. I saw that QCryptographicHash is something I may use, but if somebody has an experience with it, could you give a point or two. Would be most appreciated.

    Regards.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Do you mean you want to modfiy a wav file and embed the checksum of the complete file within the file ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      I 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Do you mean you want to modfiy a wav file and embed the checksum of the complete file within the file ?

        I Offline
        I Offline
        ilian
        wrote on last edited by
        #3

        @SGaist

        Yes, the algorithm I am thinking is to generate a checksum on each 256 sampleses first bit (lest significent bit), and each new checksum will depend on the previous checksum so we can detect where a wav manipulation has been made.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You are aware that you'll be adding noise to your audio file doing that ?

          In any case, when doing a checksum for a file, you usually do it for the whole unmodified file, you don't embed it within a file because that would mean that you are modifying the file that you want to make verifiable.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          I 1 Reply Last reply
          0
          • SGaistS SGaist

            You are aware that you'll be adding noise to your audio file doing that ?

            In any case, when doing a checksum for a file, you usually do it for the whole unmodified file, you don't embed it within a file because that would mean that you are modifying the file that you want to make verifiable.

            I Offline
            I Offline
            ilian
            wrote on last edited by
            #5

            @SGaist
            I know I am making noise inside of it, but as far as I know the 1 bit is always a noise, 0, 1 mostly... so I am OK adding my own noise to the file and make it to be a checksum. I saw QCryptographicHash so I wonder if this is easy to do with it instead of using a openssl/md5 or HMAC. Also a point or two would be welcome.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              How big is that file and would you be distributing it ?

              Also, why not make a file wide md5 ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              I 1 Reply Last reply
              0
              • SGaistS SGaist

                How big is that file and would you be distributing it ?

                Also, why not make a file wide md5 ?

                I Offline
                I Offline
                ilian
                wrote on last edited by
                #7

                @SGaist

                Well the problem is that the file would be of unknown size, but at least the size must be MD5-able if I can say so. It won't be needed to checksum a file of 1-2 seconds. I don't know yet the full requirements, that's why I ask for advice and a simple hint how to use the QCrypto for this since it sounds OK for the job.

                Regards.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Then it's best to have all the requirement before continuing. Like I said modifying a file content to add checksum here and there sounds pretty strange.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  I 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Then it's best to have all the requirement before continuing. Like I said modifying a file content to add checksum here and there sounds pretty strange.

                    I Offline
                    I Offline
                    ilian
                    wrote on last edited by
                    #9

                    @SGaist
                    OK, I am adding a tag "I know what I am doing", so could you just point me a good example of the QCryptographicHash of a 256 byte key, so I can start doing it?

                    Thanks.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      QByteArray hashed = QCryptographicHash::hash("stuff-to-hash", QCryptographicHash::Md5);

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      2

                      • Login

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