The Global Language of Business

GS1 Healthcare GMN (Global Model Number) Helper Libraries

The GS1 Healthcare GMN Helper Libraries is an open source project that contains a set of official helper libraries written by GS1 for check character generation and verification of a GMN (Basic UDI-DI) when it is used for identifying regulated healthcare medical devices that fall under the regulations EU MDR 2017/745 and EU IVDR 2017/746. The Global Model Number (GMN) is also used for identification of product models in apparel and construction industries.

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:




Java helper library


C# helper library


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.