# Moseycode Encoding

The Moseycode system uses the 96 bits of storage available in the symbology in a constrained, but flexible way. This document outlines how these 96 bits are currently used to define Moseycode portals. It does not describe any of the functional aspects of the barcode system. The document is intended to be useful to software developers who may wish to use Moseycode Barcodes without the semantics implied by the entire system.

## Portals

A portal is the name given to any valid barcode. The term is extended to describe any sequence of bits that define a barcode. The portal bits include a 16 bit checksum. The checksum is derived from the remaining 80 bits of the portal. Thus there are 280 portals.

The defining 80 bits are provided by three numbers, these are:

The chamber ID (32 bits)
The unique ID of a chamber that defines the barcode's content and functionality (see below).
The short data (16 bits)
Specifies further attributes of the portal — interpretation is dependent on the chamber definition.
The int data (32 bits)
as above

Together, they form a 80 bit sequence as big-endian binary numbers sequenced in the order above.

In principle, these numbers are unsigned, but any internal representation can be used by applications that process Moseycode portals.

A checksum is derived from this sequence of 80 bit numbers using a 16 bit Cyclic Redundancy Check with polynomial x16 + x15 + x2 + 1 (0x8005) and initial value 0xFFFF. The result is appended to the 80 bit sequence to form a complete 96 bit sequence that can then be presented using the Moseycode symbology.

## Chamber IDs

Each chamber is uniquely identified by a 32 bit value which, for external purposes, is treated as an unsigned integer. The ID values that are currently available for use in Moseycode barcodes are a (large) subset of all possible values: those between 65,536 (0x10000) and 1,073,741,823 (0x3FFFFFFF) inclusive. All values below 65,536 are reserved for development of the Moseycode system. The two highest order bits are reserved for future expansion.

## Data values

The values of short-data and int-data are not constrained by this specification their validity and interpretations depend entirely on the definition of the chamber to which the chamber ID refers.

The short and int data values are often combined into a single 48 bit number (with the short value supplying the most significant bits); the number so derived is referred to as the long data.