CN113485676A - Method and system for randomly generating credit card number - Google Patents
Method and system for randomly generating credit card number Download PDFInfo
- Publication number
- CN113485676A CN113485676A CN202110776066.XA CN202110776066A CN113485676A CN 113485676 A CN113485676 A CN 113485676A CN 202110776066 A CN202110776066 A CN 202110776066A CN 113485676 A CN113485676 A CN 113485676A
- Authority
- CN
- China
- Prior art keywords
- sequence
- generating
- card
- card number
- sequence number
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/58—Random or pseudo-random number generators
- G06F7/588—Random number generators, i.e. based on natural stochastic processes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/03—Credit; Loans; Processing thereof
Abstract
The invention provides a method and a system for randomly generating a credit card number, wherein the method comprises the following steps: establishing a sequence number table of card numbers: firstly, determining the range of sequence numbers, generating a sequence array, then scrambling the generated sequence array by using a random scrambling algorithm, and finally storing the scrambled sequence into a sequence number table; generating a card number: when a request for generating the card number is received, the sequence numbers in the sequence number list are sequentially acquired, the acquired sequence numbers are deleted from the sequence number list, and the acquired sequence numbers generate complete card numbers according to the rule for generating the card numbers.
Description
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a method and a system for randomly generating a credit card number.
Background
The credit card number is typically composed of: a 6-bit card BIN (issuer identification code, specified by credit card organization) + several bits representing card products/regions etc. + several bit sequence numbers +1 bit check bits. In order to secure the information of the cardholder as much as possible, a random generation of the sequence number is generally required.
At present, it is common practice to generate a sequence number at a time purely randomly to form a card number, and then to search an existing card table for the presence of the card. If so, the random generation is repeated until an unused card number is obtained. The problems with this approach are: as the number of card numbers that have been assigned increases, the probability of attempting to generate card numbers repeats increases, resulting in a gradual degradation of the performance of the process of generating card numbers.
Disclosure of Invention
The present invention is made to solve the above-mentioned problems, and an object of the present invention is to provide a method and a system for randomly generating a credit card number, which are suitable for a highly concurrent real-time card-issuing scenario, without retry in generating the card number.
The invention provides a method for randomly generating a credit card number, which is characterized by comprising the following steps:
establishing a sequence number table of card numbers: firstly, determining the range of sequence numbers, generating a sequence array, then scrambling the generated sequence array by using a random scrambling algorithm, and finally storing the scrambled sequence into a sequence number table;
generating a card number: when a request for generating the card number is received, sequentially acquiring the sequence numbers in the sequence number table, deleting the acquired sequence numbers from the sequence number table, and generating the complete card number according to the rule for generating the card number.
Further, in the method for randomly generating a credit card number provided by the present invention, the method may further have the following characteristics: the random scrambling algorithm is a Fisher-Yate shuffle algorithm.
Further, in the method for randomly generating a credit card number provided by the present invention, the method may further have the following characteristics: the sequence number table contains two fields, one field indicating the insertion order of the stored sequences and the other field being the sequence number.
Further, in the method for randomly generating a credit card number provided by the present invention, the method may further have the following characteristics: the rule for generating the card number is as follows: and assembling and calculating a check digit according to the card issuing bank identification code, the card product or region and the sequence number of the service card to generate a complete card number.
The present invention also provides a system for randomly generating a credit card number, comprising:
the sequence number table generating module generates a sequence number array according to the determined range of the sequence number, scrambles the sequence number array by adopting a random scrambling algorithm, establishes a sequence number table, and stores the scrambled sequence into the sequence number table;
the card number forming module is used for sequentially acquiring the sequence numbers in the sequence number table when a request for generating the card number is received, and then generating the complete card number according to the rule for generating the card number by using the acquired sequence numbers; and
and the deleting module deletes the acquired sequence number from the sequence number list after the card number forming module acquires the sequence number in the sequence number list.
Further, in the system for randomly generating a credit card number provided by the present invention, the system may further have the following characteristics: the sequence number table contains two fields, one field indicating the insertion order of the stored sequences and the other field being the sequence number.
Further, in the system for randomly generating a credit card number provided by the present invention, the system may further have the following characteristics: the random scrambling algorithm is a Fisher-Yate shuffle algorithm.
Further, in the system for randomly generating a credit card number provided by the present invention, the system may further have the following characteristics: and when the card number forming module generates the card number, assembling and calculating a check digit according to the card issuing bank identification code, the card product or region and the sequence number of the service card to generate a complete card number.
The invention has the following advantages:
the method and the system for randomly generating the credit card number do not need to retry when the card number is generated, the newly-built sequence number table adopts an efficient scrambling algorithm, the algorithm complexity is O (n), and the method and the system are very efficient, so the method and the system are suitable for scenes with high concurrent real-time card issuing and high performance requirements.
Drawings
Fig. 1 is a flow chart of a method of randomly generating a credit card number in the present invention.
Fig. 2 is a structural diagram of a method of randomly generating a credit card number in the present invention.
Detailed Description
In order to make the technical means, creation features, achievement objects and effects of the present invention easy to understand, the following embodiments are made to describe the method and system for randomly generating a credit card number according to the present invention in detail with reference to the accompanying drawings.
As shown in FIG. 1, a method of randomly generating a credit card number includes the steps of:
a preparation stage, establishing a sequence number table of the card numbers: firstly, determining the range of sequence numbers, generating a sequence array, then scrambling the generated sequence array by using a random scrambling algorithm, and finally storing the scrambled sequence into a sequence number table. In the present embodiment, the random scrambling algorithm is the Fisher-Yate shuffle algorithm. For example, the sequence numbers range from 0000-. And (3) scrambling the 10 ten thousand sequence numbers by using a Fisher-Yate shuffle algorithm, and storing the scrambled 10 ten thousand sequences into a sequence number table.
In this embodiment, the sequence number table contains two fields, one field indicating the insertion order of the stored sequence and the other field being the sequence number.
An implementation stage, generating a card number: when a request for generating the card number is received, the sequence numbers in the sequence number table are sequentially acquired, the acquired sequence numbers are deleted from the sequence number table, and the acquired sequence numbers are used for generating the complete card number according to the rule for generating the card number. The method can receive a request for generating a card number at one time or simultaneously receive requests for generating a plurality of card numbers, and when one request for generating a card number is received at one time, the sequence number of the first record in the sequence number table is obtained, and when a plurality of requests for generating card numbers are received simultaneously, the sequence numbers are obtained from the sequence number table in sequence.
Specifically, the rule for generating the card number is as follows: and assembling and calculating a check digit according to information such as a card issuing Bank Identification Number (BIN) of the service card, card products or regions and the like and the sequence number to generate a complete card number.
As shown in FIG. 2, a system for randomly generating a credit card number includes: a sequence number table generating module 10, a card number forming module 20 and a deleting module 30.
The sequence number table generating module 10 generates a sequence number array according to the determined range of the sequence number, scrambles the sequence number array by using a random scrambling algorithm, establishes a sequence number table, and stores the scrambled sequence in the sequence number table. Specifically, the sequence number table contains two fields, one field indicating the insertion order of the stored sequence and the other field being the sequence number. The random scrambling algorithm is a Fisher-Yate shuffle algorithm.
The card number forming module 20 is used for sequentially acquiring the sequence numbers in the sequence number table when receiving a request for generating the card number, and then generating the complete card number according to the rule for generating the card number. Specifically, the rule for generating the card number is as follows: when generating card number, according to information of issuing Bank Identification Number (BIN) of service card, card product or region, etc. and sequence number, assembling and calculating check digit to generate complete card number.
The deletion module 30 deletes the acquired sequence number from the sequence number table after the card number formation module 20 acquires the sequence number in the sequence number table.
The above embodiments are preferred examples of the present invention, and are not intended to limit the scope of the present invention.
Claims (8)
1. A method of randomly generating a credit card number, comprising the steps of:
establishing a sequence number table of card numbers: firstly, determining the range of sequence numbers, generating a sequence array, then scrambling the generated sequence array by using a random scrambling algorithm, and finally storing the scrambled sequence into a sequence number table;
generating a card number: when a request for generating the card number is received, sequentially acquiring the sequence numbers in the sequence number table, deleting the acquired sequence numbers from the sequence number table, and generating the complete card number according to the rule for generating the card number.
2. The method of randomly generating a credit card number as set forth in claim 1, wherein: the random scrambling algorithm is a Fisher-Yateshouffle algorithm.
3. The method of randomly generating a credit card number as set forth in claim 1, wherein:
the sequence number table contains two fields, one field indicating the insertion order of the stored sequences and the other field being the sequence number.
4. The method of randomly generating a credit card number as set forth in claim 1, wherein:
the rule for generating the card number is as follows: and assembling and calculating a check digit according to the card issuing bank identification code, the card product or region and the sequence number of the service card to generate a complete card number.
5. A system for randomly generating a credit card number, comprising:
the sequence number table generating module generates a sequence number array according to the determined range of the sequence number, scrambles the sequence number array by adopting a random scrambling algorithm, establishes a sequence number table, and stores the scrambled sequence into the sequence number table;
the card number forming module is used for sequentially acquiring the sequence numbers in the sequence number table when a request for generating the card number is received, and then generating the complete card number according to the rule for generating the card number by using the acquired sequence numbers; and
and the deleting module deletes the acquired sequence number from the sequence number list after the card number forming module acquires the sequence number in the sequence number list.
6. The system for randomly generating a credit card number according to claim 5, wherein:
the sequence number table contains two fields, one field indicating the insertion order of the stored sequences and the other field being the sequence number.
7. The system for randomly generating a credit card number according to claim 5, wherein:
the random scrambling algorithm is a Fisher-Yateshouffle algorithm.
8. The system for randomly generating a credit card number according to claim 5, wherein:
and when the card number forming module generates the card number, assembling and calculating a check digit according to the card issuing bank identification code, the card product or region and the sequence number of the service card to generate a complete card number.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110776066.XA CN113485676A (en) | 2021-07-08 | 2021-07-08 | Method and system for randomly generating credit card number |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110776066.XA CN113485676A (en) | 2021-07-08 | 2021-07-08 | Method and system for randomly generating credit card number |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113485676A true CN113485676A (en) | 2021-10-08 |
Family
ID=77938233
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110776066.XA Pending CN113485676A (en) | 2021-07-08 | 2021-07-08 | Method and system for randomly generating credit card number |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113485676A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102609330A (en) * | 2012-02-06 | 2012-07-25 | 中国农业银行股份有限公司 | Document number generating method and document number generating system |
CN107203365A (en) * | 2016-03-17 | 2017-09-26 | 阿里巴巴集团控股有限公司 | The generation of random number and acquisition methods and device |
CN110069242A (en) * | 2019-04-26 | 2019-07-30 | 迅付信息科技有限公司 | A kind of generation method of randomizer and electronic ticket, dynamic payment code |
CN110543292A (en) * | 2019-07-26 | 2019-12-06 | 国电南京自动化股份有限公司 | random number sequence generation method |
CN111784393A (en) * | 2020-06-30 | 2020-10-16 | 中国工商银行股份有限公司 | Electronic ticket issuing method and device |
CN112884098A (en) * | 2021-01-25 | 2021-06-01 | 中国建设银行股份有限公司 | Card number generation method and device |
-
2021
- 2021-07-08 CN CN202110776066.XA patent/CN113485676A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102609330A (en) * | 2012-02-06 | 2012-07-25 | 中国农业银行股份有限公司 | Document number generating method and document number generating system |
CN107203365A (en) * | 2016-03-17 | 2017-09-26 | 阿里巴巴集团控股有限公司 | The generation of random number and acquisition methods and device |
CN110069242A (en) * | 2019-04-26 | 2019-07-30 | 迅付信息科技有限公司 | A kind of generation method of randomizer and electronic ticket, dynamic payment code |
CN110543292A (en) * | 2019-07-26 | 2019-12-06 | 国电南京自动化股份有限公司 | random number sequence generation method |
CN111784393A (en) * | 2020-06-30 | 2020-10-16 | 中国工商银行股份有限公司 | Electronic ticket issuing method and device |
CN112884098A (en) * | 2021-01-25 | 2021-06-01 | 中国建设银行股份有限公司 | Card number generation method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8942487B1 (en) | Similar image selection | |
Rathgeb et al. | On application of bloom filters to iris biometrics | |
US9864983B2 (en) | Payment method, payment server performing the same and payment system performing the same | |
CN103838753B (en) | A kind of storage of redemption code, verification method and device | |
CN107807982B (en) | Consistency checking method and device for heterogeneous database | |
US20040139072A1 (en) | System and method for locating similar records in a database | |
CN112487253B (en) | User invitation code generation method, verification method, device, equipment and storage medium | |
CN113485676A (en) | Method and system for randomly generating credit card number | |
CN116566585B (en) | Informationized intelligent storage method | |
CN112799943A (en) | Automatic testing method and device for business system | |
CN113821820B (en) | Method, device, medium and equipment for encrypting and decrypting resources in splitting mode | |
CN110245126A (en) | Block processes method, apparatus, computer equipment and storage medium | |
CN107392745B (en) | Reconciliation data fragmentation processing method | |
CN114297193A (en) | HASH-based data comparison method and device | |
CN108170403A (en) | Data screening method and apparatus | |
CN112182654A (en) | Identification number desensitization method capable of keeping statistical-level characteristic attributes | |
KR101895848B1 (en) | Document security method | |
CN106934041A (en) | image file management method and device | |
CN113177835A (en) | Science and technology loan online system based on government affair big data | |
US7389267B2 (en) | Electronic verification system and method | |
CN110458508A (en) | Processing method, processing unit and the Related product of document information | |
CN115223291B (en) | Business handling method and device for intelligent counter | |
CN111625369B (en) | Method, system and electronic equipment for limiting business handling of user through single channel | |
CN101772045B (en) | Method and device for detecting anti-cloning telecommunication intelligent card | |
US20180329687A1 (en) | Ascii-seeded random number generator |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20211008 |