The Global Language of Business

Check Character Generation and Validation

The unique constraints placed upon the check character scheme for a GMN (Basic UDI-DI) identifier have resulted in an error detection algorithm that is unique among detection schemes currently in use for GS1 structured data. These libraries are intended to simplify adoption of GS1 GMN (Basic UDI-DI) for healthcare purposes and to minimise the likelihood of a flawed implementation when used alongside the GS1 General Specifications. The error detection scheme for a GMN (Basic UDI-DI) is non-trivial: it is the sum of the products of data character values with decreasing prime weights, modulo a large prime, with the resulting value being represented by appending two check characters from an alphanumeric subset of the original data character set selected by partitioning the value bitwise in two. This project demonstrates clearly how to implement the details of this algorithm in different well-known programming languages, and each library can be relied upon as an accurate implementation of the check character pair generation and validation processes.


Designed for Study

The libraries are provided in source form which is clearly structured and descriptively commented enabling developers to research precisely what is required to create an implementation of the specification with whatever development platform they are using. Furthermore, the libraries each include comprehensive unit tests that can be re-purposed and applied to a specialised implementation to ensure results that are consistent with a correct implementation of the standard.

Designed for Integration

In addition to source form, the libraries are provided in standard packaged formats, e.g. JAR and NuGet. Either the source can be vendored in to your application code or the packages can be imported into your development environment and shipped with your software application, according to preference. Standard API documentation in HTML format is provided for the public methods provided by each library.


Batteries Included

Each library is provided with example source code for an interactive console application that demonstrates how to correctly call the library functions. The demonstration applications will also accept command line arguments in which case the behave as a utility that is appropriate for use by sysadmins with only basic scripting experience. The examples demonstrate how to create and validate the check character pair for a GMN (Basic UDI-DI) whether data is statically coded, supplied interactively or processed by consuming each line of a file.

Batteries Included

Available Libraries

The helper libraries are provided in these directories:

Directory Purpose
java/ Java helper library
cs/ C# helper library
js/ JavaScript helper library


Copyright 2019 GS1 AISBL

Licensed under the Apache Licence, Version 2.0 (the "Licence");
you may not use this file except in compliance with the Licence.
You may obtain a copy of the Licence at .
Unless required by applicable law or agreed to in writing, software
distributed under the Licence is distributed on an "AS IS" BASIS,
See the Licence for the specific language governing permissions and
limitations under the Licence.


The initial libraries and tests were written (under the commission of GS1 AISBL) by one of the experts in the technical group that selected the algorithm based on its performance during the analysis of several alternative schemes under consideration.

Which of the following best describes the primary purpose of your visit?


Thank you for your feedback!

Were you able to find the information you were looking for on our website?


Thank you for your feedback!