The origin of the algorithm:
It’s roughly like this. The 9th digit of the vehicle identification code is the check digit. The check digit can be represented by any number from 0 to 9 or the letter "X". The meanings of numbers and letters in other positions may differ from manufacturer to manufacturer, but after the other 16-digit codes of the VIN code are determined, the ninth digit of the check digit is calculated according to the following method.
First convert the other 16 letters into numbers according to the following relationship:
A=1 B=2 C=3 D=4 E=5 F=6 G=7 H= 8 J=1 K=2 L=3 M=4 N=5 P=7 R=9 S=2 T=3 U=4 V=5 W=6 X=7 Y=8 Z=9
Every Each position has a weighted number:
Position: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Weight: 8 7 6 5 4 3 2 10 * 9 8 7 6 5 4 3 2
Finally, multiply the weighted coefficient of each 16-bit bit except the check digit by the corresponding value of this bit, then add the products, divide the sum by 11, and the remainder is the check digit. value. If the remainder is 10, the check digit is the letter "X".
JS code: