Checksums
public static class ChecksumsPublic check digit algorithms used by the barcode symbologies (GS1 mod 10, Luhn, mod 11, Code 39 mod 43, Code 93 mod 47, ISO/IEC 7064, UPU S10, MSI variants …). All methods take the data without the check character.
Methods
| Method Signature | Returns | Description |
|---|---|---|
static # CodabarMod16(string data) | char | Codabar mod 16 check character over the data including start/stop characters. |
static # Code11(string data, bool twoDigits = true) | string | Code 11 C (and with twoDigits also K) check digits; '-' counts as 10. |
static # Code39Mod43(string data) | char | Code 39 mod 43 check character. |
static # Code93Mod47(string data) | string | Code 93 check characters C and K (mod 47, weights 1..20 and 1..15). Data must be in the Code 93 basic set. |
static # DeutschePostMod10(string digits) | int | Deutsche Post Leitcode / Identcode check digit (weights 4 and 9 from the left). |
static # DeutschePostMod11(string digits) | int | Deutsche Post mod 11 (weights 2..7 from the right; results 10 and 11 become 0). |
static # IsValidMod10(string digitsWithCheck) | bool | True when the last digit of digitsWithCheck is its GS1 mod 10 check digit. |
static # Iso7064Mod11_10(string digits) | int | ISO/IEC 7064 MOD 11-10 (hybrid system, numeric). |
static # Iso7064Mod37_2(string data) | char | ISO/IEC 7064 MOD 37-2 (alphanumeric, check character 0-9, A-Z or '*'); used by ISBT 128. |
static # Iso7064Mod97_10(string data) | int | ISO/IEC 7064 MOD 97-10 (as in IBAN): returns the two check digits 02..98. |
static # Luhn(string digits) | int | Luhn (mod 10, double every second digit from the right); also the MSI mod 10 check. |
static # Mod10(string digits) | int | GS1 mod 10 (weights 3,1 from the right): EAN/UPC, ITF-14, SSCC, GTIN, GLN. |
static # Mod10Weighted(string digits, params int[] weightsFromRight) | int | Weighted mod 10 with the given weights applied from the right (cycling), result (10 - sum mod 10) mod 10. |
static # Mod11(string digits, int maxWeight = 7) | int | Mod 11 with weights 2..maxWeight from the right; returns 0..10 (10 is usually printed as 'X'). |
static # Msi(string digits, MsiChecksum kind) | string | MSI check digits: "Mod10", "Mod11", "Mod1010" (two mod 10) or "Mod1110" (mod 11 then mod 10). |
static # Ppn(string data) | string | PPN (pharmacy product number) check digits: mod 97 over the character values with weights 2, 3, 4 … |
static # UpuS10(string serial8) | int | UPU S10 check digit over the 8-digit serial number (weights 8,6,4,2,3,5,9,7). |
static # Vin(string vin) | char | VIN check character (position 9) of a 17-character VIN (the check position itself is ignored). |

