For purely numerical data, such as the library barcode pictured above, the Luhn algorithm is popular.