The “Export Specified Packets” Dialog Box 5.7.2. The “Import From Hex Dump” Dialog Box 5.5.4. The “Merge With Capture File” Dialog Box 5.5. The “Save Capture File As” Dialog Box 5.3.2. The “Open Capture File” Dialog Box 5.2.2. The “Compiled Filter Output” Dialog Box 4.8. The “Capture” Section Of The Welcome Screen 4.5. Building from source under UNIX or Linux 2.8. Installing from packages under FreeBSD 2.7. Installing from portage under Gentoo Linux 2.6.4. Installing from debs under Debian, Ubuntu and other Debian derivatives 2.6.3. Installing from RPMs under Red Hat and alike 2.6.2. Installing the binaries under UNIX 2.6.1. Windows installer command line options 2.3.6. Installing Wireshark under Windows 2.3.1. Obtaining the source and binary distributions 2.3. Reporting Crashes on Windows platforms 2. Reporting Crashes on UNIX/Linux platforms 1.6.8. Reporting Problems And Getting Help 1.6.1. Development And Maintenance Of Wireshark 1.6. Export files for many other capture programs 1.1.6. Import files from many other capture programs 1.1.5. Live capture from many different network media 1.1.4. Providing feedback about this document 7. Where to get the latest copy of this document? 6. Enter the first 11 digits into your program and see if you get the 12th.Table of Contents Preface 1. Find anything with a bar code on it: if it has 12 digits, it's probably a UPC. That is, an input of 12345 would correspond to a UPC start of 00000012345.Īlso, if you live in a country that uses UPCs, you can generate all the examples you want by picking up store-bought items or packages around your house. If you treat it as a number, you may need to consider the case of leading 0's to get up to 11 digits. You may treat the input as a string if you prefer, whatever is more convenient. Given an 11-digit number, find the 12th digit that would make a valid UPC. So the check digit is 2, and the complete UPC is 036000291452. If M is not 0, subtract M from 10 to get the check digit (10 - M = 10 - 8 = 2). Sum the odd-numbered digits (0 + 6 + 0 + 2 + 1 + 5 = 14).Īdd the even-numbered digits (42 + (3 + 0 + 0 + 9 + 4) = 58).įind the result modulo 10 (58 divided by 10 is 5 remainder 8, so M = 8). If M is 0, then the check digit is 0 otherwise the check digit is 10 - M.įor example, given the first 11 digits of a UPC 03600029145, you can compute the check digit like this: the remainder, when divided by 10) and call it M. , 10th) in the original number, and add this sum to the result from step 2.įind the result from step 3 modulo 10 (i.e. Take the sum of digits at even-numbered positions (2nd, 4th, 6th. If you use 0-based indexing, this is the even-numbered positions (0th, 2nd, 4th. Sum the digits at odd-numbered positions (1st, 3rd, 5th. (Check digits have previously appeared in this subreddit: see Intermediate 30 and Easy 197.) UPC's check digit is calculated as follows (taken from Wikipedia): Using some simple calculations, a scanner can determine, given the first 11 digits, what the check digit must be for a valid code. The 12th digit (4 in this case) is a redundant check digit, used to catch errors. The bars encode a 12-digit number used to identify a product for sale, for example: The Universal Product Code (UPC-A) is a bar code used in many parts of the world.
0 Comments
Leave a Reply. |