Determine whether it is a credit card based on the card number

In 2000, the People's Bank of China (PBOC) organized the formulation of a series of bank card business specifications and technical standards to promote networking. With the rapid development of China's bank card industry and increasing international exchanges, cardholders have more and more overseas payment needs. According to the International Organization for Standardization (ISO), bank cards with "9" BIN prefix can only be used in China. This means that after the free conversion of RMB, a large number of "9" BIN bank cards issued by domestic card issuers may not be available abroad at that time. The contradiction between the restriction that bank cards with "9" BIN prefix can only be used in China and the demand of the majority of cardholders for card payments abroad has gradually emerged. In order to promote the healthy and sustainable development of the national bank card industry, safeguard the long-term interests of card issuers, and overcome the restrictions on the overseas use of bank cards with the "9" BIN prefix, under the guidance and assistance of the People's Bank of China (PBOC), China UnionPay applied to the ISO (International Organization for Standardization) for the 800 international standards prevailing at home and abroad in 2002. BIN (622126 to 622925). After obtaining the approval of the People's Bank of China on the opening of the UnionPay International Standard Issuing Bank BIN numbers, in July 2003, China UnionPay issued the "Letter on the Opening of the UnionPay International Standard Issuing Bank BIN Numbers" to all member organizations. In order to standardize, use and manage the UnionPay international standard BIN number and the original "9" prefix BIN number, which has been widely used, China UnionPay issued the Interim Measures for Allocation and Management of UnionPay Identification Card BIN Number. As a result, the issuance and use of the UnionPay international standard "62" BIN number was officially launched, and member organizations were urged to start issuing UnionPay standard cards, i.e. cards with the "UnionPay" logo and the first six digits of the card number adopting the UnionPay international standard. That is, bank cards bearing the "UnionPay" logo and adopting the UnionPay international standard BIN number in the first six digits of the card number. The card conforms to China's unified business norms and technical standards, and is a high-quality, internationalized national bank card brand with independent intellectual property rights in China.

The bank card number consists of up to 19 digits.1. The first six digits are called the Issuing Bank Identification Number (IIN), also known as the Bank Identification Number (BIN). It is often referred to as the card BIN, and China UnionPay applies to ISO on behalf of all domestic card issuers.

The first of the 6-digit IIN is the Major Industry Identifier (MII).

Distributed as follows:

-0-ISO/TC 68 and other industry mandates

-1-Aviation

-2-Future industry distributions for aviation, finance, etc.

-3-Tourism and Entertainment

-4-Banking and Finance

-5-Banking and Finance

-6-. Commerce and banking/finance

-7- Distribution of oil industry and other future industries

-8- Distribution of healthcare industry, telecommunication industry, and other future industries

-9- Specified by national standards bodies.2. The middle 7-18 bits are defined by the issuing bank to indicate different individual account numbers up to a maximum of 12 bits.3. The last bit is the check digit, which is calculated using the Luhn algorithm to calculate it. Note: In ISO/IEC 7812-1 released in 2017, the definition description of MII was removed and the IIN code was extended from 6 to 8 bits. However, since the total number of digits is still a maximum of 19, the maximum number of digits corresponding to the individual account number in the middle was reduced from 12 to 10 digits. So the card BIN is no longer just 6-bit, but also has to consider 8-bit compatibility.

The Luhn algorithm, also known as the "modulo 10" algorithm, is a simple checksum algorithm that is generally used to validate identity numbers, such as credit card numbers, International Mobile Equipment Identifiers (IMEIs), U.S. Vendor Identification Numbers, Canadian Social Security Numbers, Israeli Identity Card Numbers, Greek Social Security Numbers, and so on. The Luhn algorithm is defined in ISO/IEC 7812-1. It is not a secure cryptographic hash function. It is designed to prevent accidental mistakes rather than malicious attacks, which is often referred to as defense against gentlemen and not against villains. Steps for checking with Luhn's algorithm: 1. Starting with the first digit on the right (the check digit), multiply an even number of digits by 2; 2. Add the number of digits of the product obtained in step 1 to the number of digits of the original number that have not been multiplied by 2; 3. If the modulo 10 sum obtained in step 2 is 0, the verification passes. Example: I an expired credit card card number is 6225760008219524, in accordance with the above steps to verify. Figure 260% 10=0, the validation passes. You can try to verify your bank card number accordingly. After understanding how the LUHN algorithm verifies the bank card number, it is easy to derive how the Luhn algorithm calculates the check digit of the digit string. Take the above bank card number as an example. After removing the check number, the remaining number is 622576000821952. assuming that the check number is xx, still follow the above steps to calculate. Figure 3 If the equation (56 xx)% 10=0 holds, it is easy to get xx=4, which agrees with the actual bank card number.

Related Q&A: