cozmo / jsQR

A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.
https://cozmo.github.io/jsQR/
Apache License 2.0
3.67k stars 606 forks source link

Test raw binary data. #130

Open kousu opened 5 years ago

kousu commented 5 years ago

Many QR decoders do not handle this case well (but jsQR does!). I didn't find a test case that explicitly included embedded nulls, so I added one to protect this feature.

The source of this was a public domain sound sample, clipped to fit into a QR code:

$ curl "https://sampleswap.org//samples-ghost/DRUM%20LOOPS%20and%20BREAKS/161%20to%20180%20bpm/128\[kb\]161_amenvar3.aif.mp3" | 
  head -c 300 |
  qrencode -8 -v 10 \
  -o embedded-nul/input.png
kousu commented 5 years ago

Heh, the author of qrencode has a page detailing this bug/feature: https://fukuchi.org/works/qrhack/qrhack1.html.en :P