Unsolved QCryptographicHash embed a checksum into a file (wav)
-
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.
-
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 ?
-
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.
-
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.
-
@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 sawQCryptographicHash
so I wonder if this is easy to do with it instead of using aopenssl/md5
orHMAC
. Also a point or two would be welcome. -
How big is that file and would you be distributing it ?
Also, why not make a file wide md5 ?
-
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.
-
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.
-
@SGaist
OK, I am adding a tag "I know what I am doing", so could you just point me a good example of theQCryptographicHash
of a 256 byte key, so I can start doing it?Thanks.
-
QByteArray hashed = QCryptographicHash::hash("stuff-to-hash", QCryptographicHash::Md5);