Decrypt QMessageAuthenticationCode
-
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? -
Hi,
Are you trying to get back the original data based on the hash ?
-
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.
-
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