0

I am trying to squeeze the size of one of the popular barcodes to store around 580 bits, the output of this example. (i.e. an encrypted hash)

I need to make it work in datamatrix and pdf417

I know that I can convert to base64 but I want to know if there is a way to be more space efficient?

I control the writing and reading so i can use the encoding I choose.

Community
  • 1
  • 1
David Hofmann
  • 5,683
  • 12
  • 50
  • 78
  • I think what you're after is compression, not encoding. See if this helps - https://dzone.com/articles/how-compress-and-uncompress or maybe gzip – Passer by Jan 22 '17 at 23:19
  • Not really. I would hardly think that the encrypted version of a hash will benefit from compression. It's actually encoding. But not necessarily character encoding. – David Hofmann Jan 23 '17 at 02:28

1 Answers1

2

If it's a proper hash, then all 256 values are equally likely, so using the Base256 mode in DataMatrix and PDF417 is the way to go. In DataMatrix—and also in Aztec Code—this is a control code followed by a length flag and a raw stream of bytes, just like the Byte mode in QR. In PDF417, it's a control code followed by packing of 6 bytes into 5 data points.

silverpie
  • 66
  • 1