Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Most efficient barcode to store a GUID

Tags:

I have a system that I'm working on at the moment that requires users to log into the system, and the client wants to use a barcode scanner and cards to keep prices down. (Yes username and password cheaper, but she wants a card type solution so she gets one.)

All my data uses GUIDs as key fields, so I'd like to store the GUID directly on the card in the barcode. While its simple enough to code it as 3 of 9 its not going to be the most efficient use of space.

Is there a best practice or most efficient method for storing GUIDs in a barcode? I'd have assumed that since there's a consistent length, and depth to the data there would be a standard, but I can't find it. Would be easy enough to generate my own - control char either end and then binary data between, but would like something that standard readers will know how to interpret.

Any help gratefully received.

like image 383
Matthew Baker Avatar asked Jul 29 '15 09:07

Matthew Baker


People also ask

Which barcode can store the most data?

A Data Matrix barcode can store up to 2,335 alphanumeric characters. PDF417 barcodes are capable of encoding large amounts of data and are commonly used postage, shipping and personal identification.

What is the best type of barcode?

Code 128 is the most easily read barcode. It also has the highest message integrity because of several separate message check routines. UPC UPC (Universal Product Code) is the most common barcode for retail product labeling. It is seen in most grocery stores across the United States.

What is the most popular barcode format?

UPC CODES: The UPC-E barcode is a universal product code and the most used in the United States. These can be read in any direction and are characterized by always starting with the numerical value 0.

Which code is more useful than barcodes?

The amount of data a QR code can hold over a barcode is arguably the most significant difference. QR codes are two-dimensional as opposed to their one-dimensional barcode counterparts. This means that QR codes can contain much more data.


1 Answers

There are no open standards for special-purpose data compaction with generic linear barcodes such as Code 39 and Code 128. Most ISO/IEC-standardised 2D barcodes do support a special-purpose data encoding mechanism called Extended Channel Interpretation (ECI) which allows you to specify that data conforms to a certain application standard or encoding regime, for example ECI 298765 for IPv4 address compaction [*]. Unfortunately GUID compaction isn't amongst those that have been registered and even if it were you would nevertheless need to handle this within your application as reader support would be lacking.

That leaves you with having to pre-encode (and subsequently decode) the GUID into a format that can be handled efficiently by some ubiquitous barcode symbology.

An efficient way to store a GUID would be to convert it to a 40-digit[†] decimal representation and store the result in a Code 128 barcode using double-density numeric compression ("Mode C").

For example, consider the GUID:

cd171f7c-560d-4a62-8d65-16b87419a58c 

Expressed as a hexadecimal number:

0xCD171F7C560D4A628D6516B87419A58C 

Converted to 40 decimal digits:

0272611800569275698104677545117639878028 

Encoded within a Code 128 barcode:

GUID encoded in decimal within a Code 128

Your application would of course need to recognise this input as a decimal-encoded GUID and reverse the above process but I doubt that a significantly more efficient approach exists that doesn't require you to transform the data into an unusual radix and then deal with the complexities of handling ASCII control characters at scan time.

[*] The register of assigned ECI codes is available from the AIM store as "ECI Part 3: Register".

[†] Whilst it is possible to store the entire GUID range within 39 digits a 39-digit Mode C Code 128 symbol is in fact longer than a 40-digit symbol.

like image 176
Terry Burton Avatar answered Sep 23 '22 08:09

Terry Burton