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 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
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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
      0
      • SGaistS SGaist

        Hi,

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

        N Offline
        N Offline
        Nouriemm
        wrote on last edited by
        #3

        @SGaist
        exactly

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on 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
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on 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 last edited by
              #6

              Thanks folks
              That is what I was looking for.

              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