For example, the text is something like

"Hello world!"

And after that text should be new line with hash (sha256):


So, now it is not possible to modify QR code (recoloring some squares) without loosing it.

Is something like this implemented for QR coding outside, where it is possible to modify the code?

  • 1
    $\begingroup$ QR codes already do make use of error-correcting codes, if that's what you are asking. $\endgroup$ – yyyyyyy Jul 25 '19 at 14:15
  • $\begingroup$ What's your actual goal here? There are several ways in which one could detect unauthorized modifications to a piece of data (none of which, AFAIK, are specific to QR codes), but the details depend on what you want. For example, do you want anyone to be able to read the code and detect any possible modifications, or is it enough if only people who know a specific secret key can do that (and can also create new codes or modify them)? $\endgroup$ – Ilmari Karonen Jul 25 '19 at 15:59
  • 1
    $\begingroup$ In any case, entirely preventing modifications seems impossible: for example, someone could just cover the original code with a sticker bearing a new one (or even a copy of another valid code). The best you could do would be to digitally sign the data encoded in the code, allowing anyone who reads it (and knows your public key) to verify that it has been signed with your private key. $\endgroup$ – Ilmari Karonen Jul 25 '19 at 16:02
  • 2
    $\begingroup$ It doesn't prevent tampering. Anyone that can verify the hash can also compute the hash of a different message. At best you could detect accidental corruption, and that scenario is already covered by error correction codes. (Redundancy in the pattern which can be used to recover data even if part of the QR code is corrupted or misread.) $\endgroup$ – Future Security Jul 25 '19 at 17:52

There are encrypted QR codes from DENSO ADC. I know that these can be encrypted or just signed; however, DENSO ADC has never been forthcoming with how they work. They seem to work by putting data after the "data section" of the QR code that would otherwise be ignored. If you were going to have something similar, I would take that approach.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.