Monday, May 16, 2011

Fun with QR codes

Ok, working on photo timestamping (forum), I've got 2 simple bash scripts:

- genQR.bash
- checkQR.bash

Using genQR is easy:

desktop:~/QR$ ./genQR.bash
stamp: 2011-05-17 06:01
hash: 659A54AB2E563038C5F77F3925A7F977D81EEB01

What it does is, generates a timestamp '2011-05-17 06:01' (utc time), salts with with a secret hash and then takes the resulting hash.

The timestamp has a minute resolution, so re-running ./genQR.bash within the same minute gives the same hash. The idea is to publish the stamp and resulting hash far and wide. People wanting to timestamp documents can include the hash before singing the document.

Using checkQR is also easy:

desktop:~/QR$ ./checkQR.bash '2011-05-17 06:01' '659A54AB2E563038C5F77F3925A7F977D81EEB01'
Encode string: 2011-05-17 06:01 | A2778CC2A16EEC5CC8EB867C30D550BB15B2A6BC
Right answer: 659A54AB2E563038C5F77F3925A7F977D81EEB01
Your answer: 659A54AB2E563038C5F77F3925A7F977D81EEB01

The (encode string) is secret, and should never be seen. But the other two lines are easily used to verify the timestamp.

The exciting part comes with how easily it is to timestamp images. The QR url from genQR.bash gives the following QR code:

And with a bit of scripting, we should be able to validate the timestamp of photos as long as the QR code is somewhere in the background (and of sufficient quality)

Check it out! Here's a picture of the QR code

Decode it here

Raw text 659A54AB2E563038C5F77F3925A7F977D81EEB01
Raw bytes 21 41 13 33 e3 94 e6 86 81 ce 21 c4 7a 21 55 45 28 48 05 f3 92 ab 0a 12 51 07 6a 04 00 80 ec 11 ec 11 ec 11
Barcode format QR_CODE
Parsed Result Type TEXT
Parsed Result 659A54AB2E563038C5F77F3925A7F977D81EEB01

No comments:

Post a Comment