# code-32

The code-32 bar code type is a variant of code-39.

The code represents a decimal number with 9 digits. The last digit is the check character. The
check character is calculated as follows: ```
CS=Sum(i=1 to 8 of
CT((i-1)%2*2*Ref(i))) mod 10
```

where Ref(i) denotes the value of the digit at
position i (the leftmost digit has the index 1) and CT() denotes the cross total of its
argument (e.g. CT(18)=1+8=9).

The rightmost digit (checksum digit) can be omitted. When the system is supplied with a 8 digit value then the check digit is automatically calculated.

The specified 9 digit decimal value is translated into a 6 digit base 32 value which is then drawn using characters from the base 39 character set and bar drawing scheme. This character table is used to encode the 6 digit base 32 value:

Reference Number | Character |
---|---|

0 | 0 |

1 | 2 |

2 | 3 |

3 | 4 |

4 | 5 |

5 | 6 |

6 | 7 |

7 | 8 |

8 | 9 |

9 | B |

10 | C |

11 | C |

12 | D |

13 | F |

14 | G |

15 | H |

16 | J |

17 | K |

18 | L |

19 | M |

20 | N |

21 | P |

22 | Q |

23 | R |

24 | S |

25 | T |

26 | U |

27 | V |

28 | W |

29 | X |

30 | Y |

31 | Z |

Based on this table the following bar codes will produce identical bar pattern: <BARCODEBOX codeType="code 32" check="true" codeValue="026089019" noText="true" orientation="vertical" mirrored="true"/><BARCODEBOX codeType="code 39" check="false" codeValue="0SW5KV" noText="true" orientation="vertical" mirrored="true"/> Note that the bars are drawn without text by setting noText="true". This is necessary to produce identical output since otherwise the code 32 box draws the decimal number "026089019" while the code 39 box would draw the string "0SW5KV".

The nominal height is 1in. Each digit is drawn using a pattern of two wide and three thin bars making a total of 5 bars per digit. The nominal width of a thin bar is THINBARWIDTH=0.0197in. The width of a thick bar is THICKBARWIDTH=THINBARWIDTH/ thinToThickRelation where thinToThickRelation should take values between1/3 and1/2. Between digits a gap with the width GAPWIDTH=THINBARWIDTH/ thinToGapRelation is drawn. The padding on both sides measures 10*THINBARWIDTH.