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. Decrypt QMessageAuthenticationCode
QtWS25 Last Chance

Decrypt QMessageAuthenticationCode

Scheduled Pinned Locked Moved Unsolved General and Desktop
encryptdecrypthash-basedqcryptographichqmessageauthent
6 Posts 3 Posters 2.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.
  • N Offline
    N Offline
    Nouriemm
    wrote on 18 Jul 2016, 15:52 last edited by Nouriemm
    #1

    Dear friends,

    I've used QMessageAuthenticationCode in order to protect some data.
    Successfully, I have encrypted my data with a given KEY.
    QByteArray result=QMessageAuthenticationCode::hash("some data", "KEY", QCryptographicHash::Sha3_256);

    Now I want to reverse it by using my KEY.
    Would you please explain how it can be done?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 18 Jul 2016, 22:44 last edited by
      #2

      Hi,

      Are you trying to get back the original data based on the hash ?

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

      N 1 Reply Last reply 19 Jul 2016, 13:13
      0
      • S SGaist
        18 Jul 2016, 22:44

        Hi,

        Are you trying to get back the original data based on the hash ?

        N Offline
        N Offline
        Nouriemm
        wrote on 19 Jul 2016, 13:13 last edited by
        #3

        @SGaist
        exactly

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 19 Jul 2016, 13:27 last edited by
          #4

          That's not how a hash works.

          You seem to rather look at how to encrypt your data on one and and decrypt it on the other end.

          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
          1
          • V Offline
            V Offline
            VRonin
            wrote on 19 Jul 2016, 13:34 last edited by VRonin
            #5

            Hashes do not retain the original data. It easily understood when you think that you can hash a 2GB file in 256bit, you are clearly loosing data there.

            Hashes are used to compare, they satisfy the fact that if a=b then hash(a)=hash(b) so if you have the some hashed data stored somewhere (the hash of a password for example) you can check if the entered password is the same as the stored one without actually storing the password but just its hash

            Looks like what you want is encryption and decryption. OpenSSL can do the job, see http://stackoverflow.com/questions/1007337/encrypting-and-decrypting-a-small-file-using-openssl

            "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
            • N Offline
              N Offline
              Nouriemm
              wrote on 19 Jul 2016, 15:34 last edited by
              #6

              Thanks folks
              That is what I was looking for.

              1 Reply Last reply
              0

              1/6

              18 Jul 2016, 15:52

              • Login

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