A bank serial number generation method, system, device and storage medium
By combining pseudo-random number generators and true random number generators to generate bank transaction serial numbers, and combining timestamps and hash table verification, the problem of traditional pseudo-random number generators being vulnerable to attacks is solved, the uniqueness and security of the transaction serial numbers are achieved, and the reliability and scalability of bank transactions are guaranteed.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN BANK CO LTD
- Filing Date
- 2023-09-12
- Publication Date
- 2026-07-31
AI Technical Summary
Traditional bank transaction number generation methods rely on pseudo-random number generators, which are vulnerable to attacks and cracking, and cannot guarantee the uniqueness and security of the transaction number.
A combination of pseudo-random number generator and true random number generator is used to generate a first code and a second code, and a target serial number is generated through a preset combination method. The uniqueness and security are verified by combining the request timestamp and hash table.
It improves the uniqueness and security of serial numbers, prevents duplication and unauthorized cracking, and ensures the smooth operation of bank transactions and the reliability of data.
Smart Images

Figure CN117217169B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, system, device and storage medium for generating bank transaction numbers. Background Technology
[0002] Serial numbers play a crucial role in data management and system design, providing uniqueness, sequence, traceability, and controllability of data. This helps improve system reliability, scalability, and maintainability. Therefore, serial numbers are widely used across various industries and fields. For example, in banking transaction data management, serial numbers are fundamental to ensuring the security and smooth operation of bank transactions. However, traditional methods for generating serial numbers rely on pseudo-random number generators. These pseudo-random numbers are vulnerable to attacks and cracking, failing to guarantee the uniqueness and security of the serial number. Summary of the Invention
[0003] In view of this, one of the objectives of this application is to provide a method, system, computer device, and computer-readable storage medium for generating bank transaction numbers, which can at least solve some of the above-mentioned technical problems.
[0004] In a first aspect, embodiments of this application provide a method for generating bank transaction numbers, the method comprising:
[0005] In response to a serial number generation request, a first code and a second code are generated, and the request timestamp of the serial number generation request is obtained, wherein the first code is generated by a pseudo-random number generator, and the second code is generated by a true random number generator;
[0006] The target serial number is generated by combining the first code, the second code, and the request timestamp according to a preset combination method.
[0007] In one possible implementation, generating the first code and the second code in response to the serial number generation request includes:
[0008] If the total number of all serial number generation requests is greater than or equal to a preset threshold, all serial number generation requests are stored in a preset message queue, and at least two consumers are created.
[0009] Communication between each consumer and the pseudo-random number generator is established through a first API interface, and communication between each consumer and the true random number generator is established through a second API interface. The first API interface and the second API interface are different interfaces.
[0010] The consumer generates a first generation instruction and a second generation instruction when processing a serial number generation request stored in the preset message queue. The first generation instruction instructs the pseudo-random number generator to generate the first code, and the second generation instruction instructs the true random number generator to generate the second code.
[0011] In one possible implementation, generating the first code and the second code in response to the serial number generation request includes:
[0012] If the total number of all serial number generation requests is less than the preset threshold, all serial number generation requests are sent to a preset database; wherein,
[0013] The preset database is used to, upon receiving the serial number generation request, call the pseudo-random number generator through the first API interface to obtain the first code, and call the true random number generator through the second API interface to obtain the second code.
[0014] In one possible implementation, the serial number generation request includes a service identifier, and the generation of a first code and a second code in response to the serial number generation request includes:
[0015] The first code and the second code are generated based on the service identifier and service identifier table of the serial number generation request. The first code and / or the second code corresponding to the serial number generation request for different service identifiers have different formats; wherein,
[0016] The business identification table includes mapping relationships between different types of businesses, business identification for different types of businesses, and standard encoding formats for different types of businesses. The standard encoding format includes at least one of length and character type. Different types of businesses include businesses with different security levels, and the higher the security level of a business, the more complex its corresponding standard encoding format.
[0017] In one possible implementation, after generating the first and second codes in response to the serial number generation request, the method further includes:
[0018] The second encoding is converted according to the preset character conversion table to obtain a new second encoding;
[0019] The step of combining the first code and the second code according to a preset combination method to generate a target serial number includes:
[0020] The target serial number is generated by combining the first code and the new second code according to the preset combination method, wherein the preset combination method includes at least one of string concatenation and delimiter combination.
[0021] In one possible implementation, after generating the target serial number by combining the first code, the second code, and the requested timestamp according to a preset combination method, the method further includes:
[0022] The target hash value is obtained by calculating the target serial number according to the preset hash function;
[0023] Store the target serial number and the target hash value in a preset hash table;
[0024] In the case of detecting the generation of a new target serial number, the new target serial number is calculated according to the preset hash function to obtain a new target hash value;
[0025] If the new target hash value is found to be different from other target hash values in the preset hash table, the new target serial number and the new target hash value are stored in the preset hash table.
[0026] If the new target hash value is found to be the same as at least one other target hash value in the preset hash table, and the target serial number of the at least one other target hash value is different from the new target serial number, the new target serial number and the new target hash value are stored in the preset hash table.
[0027] If the new target hash value is found to be the same as at least one other target hash value in the preset hash table, and the target serial number of the at least one other target hash value is the same as the new target serial number, an alert instruction is generated to indicate the existence of the same target serial number.
[0028] In one possible implementation, the pseudo-random number generator includes at least one of a linear congruential generator, an adaptive random number generator, an encrypted pseudo-random number generator, and a white noise generator, and the true random number generator includes at least one of a quantum random number generator, a time-series random number generator, and a hardware random number generator.
[0029] Secondly, embodiments of this application provide a bank transaction number generation system, the system comprising:
[0030] The first generation module is used to generate a first code and a second code in response to a serial number generation request, and to obtain the request timestamp of the serial number generation request, wherein the first code is generated by a pseudo-random number generator and the second code is generated by a true random number generator.
[0031] The second generation module is used to combine the first code, the second code, and the request timestamp according to a preset combination method to generate a target serial number.
[0032] Thirdly, embodiments of this application provide a computer device, the computer device including a memory and a processor, the memory storing a computer program, and the computer program, when executed by the processor, implementing the method provided in the first aspect.
[0033] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by one or more processors, implements the method provided in the first aspect.
[0034] The serial number generation method provided in this application generates a first code and a second code in response to a serial number generation request, and obtains the request timestamp of the serial number generation request. The first code is generated using a pseudo-random number generator, and the second code is generated using a true random number generator. Then, the first code, the second code, and the request timestamp are combined according to a preset combination method to generate the target serial number, ensuring the uniqueness and security of the target serial number. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. It should be understood that the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0036] Figure 1 A flowchart illustrating a method for generating bank transaction numbers provided in this application embodiment;
[0037] Figure 2 A schematic diagram of the functional modules of a bank transaction number generation system provided in this application;
[0038] Figure 3 This is a diagram illustrating the internal structure of a computer device as provided in an embodiment of this application.
[0039] Explanation of reference numerals in the attached figures:
[0040] Bank transaction number generation system 200, first generation module 210, second generation module 220. Detailed Implementation
[0041] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0042] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0043] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0044] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0045] In various embodiments of this application, the expression "or" or "at least one of A and / or B" includes any combination or all combinations of the words listed simultaneously. For example, the expression "A or B" or "at least one of A and / or B" may include A, may include B, or may include both A and B.
[0046] In the description of this application, it should be noted that if terms such as "upper," "lower," "inner," or "outer" are used to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship in which the product of the invention is usually placed during use, they are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application.
[0047] Furthermore, the terms "first" and "second" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0048] It should be noted that, where there is no conflict, the features in the embodiments of this application can be combined with each other.
[0049] Please see Figure 1, Figure 1 This document presents a flowchart of a method for generating bank transaction numbers, as provided in an embodiment of this application. The following will describe each step of the method in detail.
[0050] S110, in response to the serial number generation request, generate a first code and a second code, and obtain the request timestamp of the serial number generation request, wherein the first code is generated by a pseudo-random number generator and the second code is generated by a true random number generator.
[0051] In this embodiment:
[0052] Transaction number generation requests can be initiated by customers. For example, when a customer performs banking transactions such as deposits, withdrawals, or transfers, they send a transaction number generation request to the banking system to generate a corresponding transaction number to record the transaction. Customers can initiate transaction number generation requests through online banking, mobile banking, or at a bank counter. Transaction number generation requests can also be internal requests from within the banking system. Internal business logic within the banking system may also trigger transaction number generation requests. For example, when batch processing tasks, accounting processing, or risk control operations within the banking system require recording related operations, they will also initiate transaction number generation requests.
[0053] The initial subscription request can be obtained through the computer device described in the following embodiments. The computer device may include various forms of electronic devices that can be used to process and perform computing tasks, including personal computers, servers, mobile devices, cloud computing platforms, and supercomputers.
[0054] A pseudo-random number generator is an algorithm or program that can generate seemingly random sequences of numbers. In this embodiment, the pseudo-random number generator is used to generate a first code, which can be considered a pseudo-random number. A true random number generator utilizes the unpredictability of physical processes to generate random numbers. It can utilize unpredictable physical events such as quantum noise, thermal noise, and radioactive decay. In this embodiment, the true random number generator is used to generate a second code, which can be considered a true random number. The process of generating the second code is not controlled by any pre-selected algorithm or rules and is not easily attacked or cracked, thus ensuring the uniqueness and security of the target serial number obtained in subsequent embodiments to a certain extent.
[0055] The request timestamp can be the time when the computer device receives the serial number generation request. The time precision of the request timestamp can be set according to actual needs, such as seconds, milliseconds, and microseconds. In this embodiment, the computer device can make the request timestamp accurate to the second when processing.
[0056] In some embodiments, before generating the first and second codes in response to the serial number generation request, the computer device may send feedback information indicating successful receipt, such as "received" or "processing," to the requesting end, such as the customer or the bank system, after receiving the serial number generation request. This can prevent situations where the failure to receive the serial number generation request affects the customer's business processing or the bank system's internal processing.
[0057] In one possible implementation, the pseudo-random number generator includes at least one of a linear congruential generator, an adaptive random number generator, an encrypted pseudo-random number generator, and a white noise generator, and the true random number generator includes at least one of a quantum random number generator, a time-series random number generator, and a hardware random number generator.
[0058] S120, combine the first code, the second code, and the requested timestamp according to the preset combination method to generate the target serial number.
[0059] In this embodiment, the preset combination method can be set according to actual needs. Optionally, the preset combination method includes at least one of string concatenation and delimiter combination. By combining the first code, the second code, and the request timestamp obtained in the above embodiment through the preset combination method, the target serial number is obtained. The request timestamp corresponding to each serial number generation request may be different. Using the request timestamp in the process of generating the target serial number can further improve the uniqueness of the target serial number.
[0060] In some embodiments, after generating the first and second codes in response to a serial number generation request, a string representing an increasing sequence of target serial numbers can also be generated by a computer device. This string can be used together with the first code, the second code, and the request timestamp to generate the target serial number. In this embodiment, the length of this string can be selected as 5 characters, such as the first target serial number being 00000, the second target serial number being 00001, and so on. When the number of target serial numbers reaches 99999, the string consisting of these 5 characters automatically cycles through the numbers. The string that enables the increasing cyclic counting is not split and combined with the first code, the second code, and the request timestamp during the generation of the target serial number. Similarly, the request timestamp is not split and combined with the first code, the second code, and the string consisting of these 5 characters. This string consisting of 5 characters can represent the increasing nature of the target serial number and further ensure the uniqueness of the target serial number.
[0061] In some embodiments, the request timestamp can be in the form of yyyy-mm-dd HH:mm:ss, which can clearly and completely represent the specific time corresponding to the receipt of the serial number generation request. The request timestamp can also be in the form of yy-mm-dd HH:mm:ss, which, by reducing the format by two characters, can also clearly represent the specific time corresponding to the receipt of the serial number generation request. It can also improve the speed of other devices in recognizing the target serial numbers when a large number of target serial numbers are generated, thereby improving the overall recognition efficiency of the target serial numbers.
[0062] In some embodiments, a maximum request quantity threshold can be configured for each request timestamp. If the number of serial number generation requests within any request timestamp exceeds the maximum request quantity threshold, the operation of S110 in the above embodiment can be paused, and S110 can be continued when the next adjacent request timestamp arrives to complete the processing of subsequent serial number generation requests.
[0063] For example, if the precision of the request timestamp is seconds, the maximum number of requests per second can be configured to be 10,000. For instance, the maximum number of serial number generation requests that can be processed within the request timestamp 23-12-31 12:00:00 is 10,000. The 10,000th serial number generation requests from 10,001 to 20,000 can be processed when the request timestamp 23-12-31 12:00:01 arrives.
[0064] This embodiment avoids the situation where a large number of serial number generation requests are generated at the same time, thus affecting the uniqueness of the target serial number, by configuring a maximum request quantity threshold for each request timestamp. This further ensures the uniqueness of the generated target serial number and avoids the problem of data loss and potential economic losses to the bank caused by duplicate target serial numbers.
[0065] As can be seen from the above analysis, the serial number generation method provided in this application generates a first code and a second code in response to a serial number generation request, and obtains the request timestamp of the serial number generation request. The first code is generated using a pseudo-random number generator, and the second code is generated using a true random number generator, ensuring the uniqueness and security of the target serial number. Then, the first code, the second code, and the request timestamp are combined according to a preset combination method to generate the target serial number. Furthermore, the uniqueness and security of the target serial number can be further ensured by configuring a maximum request quantity threshold for each request timestamp.
[0066] In one possible implementation, generating a first code and a second code in response to a serial number generation request includes:
[0067] If the number of all serial number generation requests is greater than or equal to a preset threshold, all serial number generation requests are stored in a preset message queue, and at least two consumers are created.
[0068] Communication between each consumer and the pseudo-random number generator is established through a first API interface, and communication between each consumer and the true random number generator is established through a second API interface. The first and second API interfaces are different interfaces.
[0069] The consumer generates a first generation instruction and a second generation instruction when processing a serial number generation request stored in a preset message queue. The first generation instruction is used to instruct the pseudo-random number generator to generate a first code, and the second generation instruction is used to instruct the true random number generator to generate a second code.
[0070] In this embodiment, considering the large number of serial number generation requests, a message queue can be used to handle these requests, improving efficiency. The preset message queue includes at least one of Kafka, Active, and Redis message queues. Kafka, with its distributed nature, provides high-throughput, persistent storage; Active supports multiple transport protocols and programming languages and offers high reliability; and Redis, leveraging the fast read / write and high concurrency of the Redis database, meets the needs of high-concurrency, high-throughput applications. Considering both the speed of serial number generation and storage security, Kafka is chosen as the preset message queue in this embodiment.
[0071] Specifically, the number of preset message queues can be increased or decreased based on the number of requests generated by serial numbers, and the number of consumers can be increased or decreased based on the number of requests generated by serial numbers and the processing speed. The number of preset message queues and the number of consumers created can be set according to actual needs, and no specific limit is set here.
[0072] Each consumer establishes communication with both a pseudo-random number generator and a true random number generator. When a consumer receives a serial number generation request stored in a preset message queue, it communicates with both the pseudo-random number generator and the true random number generator to obtain a first code and a second code. Specifically, communication can be established through a first API interface with the pseudo-random number generator and a second API interface with the true random number generator. The first and second API interfaces can be constructed and their corresponding communication protocols specified based on the bank's system architecture; no limitations are imposed here. The preset threshold can be set based on the data processing performance of the bank's system; no limitations are imposed here either.
[0073] In one possible implementation, generating a first code and a second code in response to a serial number generation request includes:
[0074] If the total number of serial number generation requests is less than a preset threshold, all serial number generation requests will be sent to a preset database; among which,
[0075] The preset database is used to call a pseudo-random number generator through the first API interface to obtain the first code when a serial number generation request is received, and to call a true random number generator through the second API interface to obtain the second code.
[0076] In this embodiment, the scenario where the number of serial number generation requests is relatively small is considered. The requests can be processed directly using a pre-set database. Directly using the database improves the efficiency of processing serial number generation requests, thereby increasing the efficiency of generating the target serial number. Specifically, when a serial number generation request is received, the database can call a pseudo-random number generator and a true random number generator respectively to obtain a first code and a second code. This can be implemented through the first API interface and the second API interface, as described in the above embodiment, and will not be repeated here.
[0077] The generation of a serial number inevitably indicates a new business transaction occurring either within the customer or the bank. Considering the diverse types of business transactions banks generate—such as customer deposits, transfers, and loans (financial data transactions), internal financial reporting and statistics (financial data statistics), and administrative management (administrative functions, meetings, training, etc.)—banks apply different security levels to different types of transactions.
[0078] In one possible implementation, the serial number generation request includes a business identifier, and in response to the serial number generation request, a first code and a second code are generated, including:
[0079] Based on the service identifier of the serial number generation request and the service identifier table, a first code and a second code are generated. The formats of the first code and / or the second code corresponding to different service identifiers are different; among them,
[0080] The business identification table includes mappings between different types of business, business identifiers for different types of business, and standard encoding formats for different types of business. The standard encoding format includes at least one of length and character type. Different types of business include businesses with different security levels, and the higher the security level of a business, the more complex its corresponding standard encoding format.
[0081] This embodiment can generate a first code and a second code using business identifiers and a business identifier table. Specifically, business identifiers can be used to represent different businesses, or business types. Different types of businesses include businesses with different security levels; the higher the security level, the more complex the corresponding standard encoding format. Taking the above examples of financial data transaction businesses, financial data statistics businesses, and work management businesses, the security level required when financial data is involved is higher. Therefore, it can be understood that the security level required by the bank for financial data transaction businesses and financial data statistics businesses is higher than that for work management businesses. Thus, business identifiers with the same character range can be assigned to financial data transaction businesses and financial data statistics businesses, while other types of business identifiers can be assigned to work management businesses, making it easier to distinguish between different types of businesses.
[0082] The standard encoding format in the business identifier table includes at least one of length and character type. In the above embodiments, the pseudo-random number generator needs to generate the first code and the true random number generator needs to generate the second code according to the standard encoding format. For example, for businesses with high security requirements, the generated first and / or second codes will be longer. This embodiment can determine the business type through the business identifier, and then generate the first and / or second codes according to the standard encoding format of the business identifier table for different security levels. This further improves the security of the generated target serial number while ensuring its uniqueness. Furthermore, the different formats of the first and / or second codes generated for different security levels result in different speeds for generating the target serial number, thus ensuring the overall efficiency of target serial number generation while maintaining its security.
[0083] Considering that the second code generated by the true random number generator may not be recognizable by other systems or devices, it is necessary to convert the second code.
[0084] Optionally, after generating the first and second codes in response to the serial number generation request, the method further includes:
[0085] The second encoding is converted according to the preset character conversion table to obtain a new second encoding;
[0086] The target serial number is generated by combining the first and second codes according to a preset combination method, including:
[0087] The target serial number is generated by combining the first code and the new second code according to the preset combination method.
[0088] In this embodiment, the preset character conversion table may include the character format generated by the true random number generator and the character format to be converted. After conversion, a new second code can be obtained and used to generate the target serial number. For example, if the second code generated by the true random number generator consists of numbers, the numbers 0-9 can be converted into the strings '0'-'9', and the numbers 10-35 can be converted into the strings 'A'-'Z', and then used in the process of generating the target serial number. Although this embodiment shows one way to convert the second code to obtain a new second code for illustrative purposes, other conversion methods can also be used as needed, as long as it can ensure that the second code generated by the true random number generator can be recognized by other systems or devices after conversion, avoiding the situation where some systems or devices cannot recognize the target serial number of the business during the business process, resulting in the business failing to complete smoothly.
[0089] The target serial number is obtained through the above embodiments. In order to further ensure the uniqueness of the target serial number and avoid the problem of duplicate target serial numbers affecting the normal progress of business or even causing serious economic and property losses.
[0090] In one possible implementation, after combining the first code, the second code, and the requested timestamp according to a preset combination method to generate the target serial number, the method further includes:
[0091] The target hash value is obtained by calculating the target serial number according to the preset hash function;
[0092] Store the target serial number and target hash value into a preset hash table;
[0093] In the case of detecting the generation of a new target serial number, the new target serial number is calculated according to the preset hash function to obtain a new target hash value;
[0094] If the new target hash value is different from all other target hash values in the preset hash table, store the new target serial number and the new target hash value in the preset hash table.
[0095] If the new target hash value is the same as at least one other target hash value in the preset hash table, and the target serial number of at least one other target hash value is different from the new target serial number, the new target serial number and the new target hash value are stored in the preset hash table.
[0096] An alert instruction is generated when a new target hash value is found to be the same as at least one other target hash value in a preset hash table, and the target serial number of at least one other target hash value is the same as the new target serial number. This alert is used to warn of the existence of the same target serial number.
[0097] In this embodiment, considering the large number of target serial numbers generated, it would be inefficient to traverse the historical target serial numbers every time a new target serial number is generated to determine if a target serial number is duplicated. This would also affect the generation of subsequent target serial numbers and the normal progress of banking operations. This embodiment stores the target serial numbers in a preset hash table and queries and compares the serial numbers in the preset hash table when a new target serial number is generated to determine if a duplicate target serial number exists. Since the time complexity of querying the target serial number in the hash table is O(1), it is not affected by the number of target serial numbers already stored in the preset hash table, and the comparison of target serial numbers can be achieved quickly without affecting the speed of generating new target serial numbers.
[0098] Specifically, each generated target serial number can be compared with the target serial numbers already stored in the preset hash table. If a duplicate target serial number is found, a warning instruction can be generated to remind that a fault has occurred and needs to be handled.
[0099] In some embodiments, generating an alert instruction to remind that a fault has occurred and needs to be handled can be achieved by modifying the duplicate target serial number using a computer device. The request timestamp can be modified to the time corresponding to the reprocessing, and an incrementing sequence of modification identifier characters can be added to the modified target serial number to ensure the uniqueness of the modified target serial number.
[0100] As mentioned above, each generated target serial number can be compared with the target serial numbers already stored in the preset hash table. If a duplicate target serial number is found, in some embodiments, step S110 in the above embodiments can be paused and an alert command can be generated to remind staff that a fault has occurred and needs to be handled. After the handling is completed, step S110 can continue to be executed. If no duplicate target serial number is found, step S110 is executed normally.
[0101] As mentioned above, each generated target serial number can be compared with the target serial numbers already stored in the preset hash table. If a duplicate target serial number is found, in some embodiments, the duplicate target serial number can be marked and the processing of the corresponding business can be suspended, but the steps of S110 in the above embodiments can continue to be executed. For the marked target serial number, relevant staff can be notified to manually modify it, or it can be modified through computer equipment as described in the above embodiments. After the modification is completed, the business corresponding to the modified target serial number will continue to be executed. Among them, when the staff manually modifyes it, the request timestamp will be re-determined and the staff's identity identifier and a fixed-length incrementing character will be added to generate a new target serial number. This ensures that the modified target serial numbers are not duplicated, and are not duplicated with the already generated or ungenerated target serial numbers, thus ensuring the uniqueness and security of all target serial numbers. The method of modification through computer equipment can be found in the above embodiments, and will not be repeated here.
[0102] In summary, the serial number generation method provided in this application generates a first code and a second code in response to a serial number generation request, and obtains the request timestamp of the serial number generation request. The first code is generated using a pseudo-random number generator, and the second code is generated using a true random number generator, ensuring the uniqueness and security of the target serial number. Then, the first code, the second code, and the request timestamp are combined according to a preset combination method to generate the target serial number. Furthermore, the uniqueness and security of the target serial number can be further guaranteed by configuring a maximum request quantity threshold for each request timestamp and by comparing the target serial number using a hash table.
[0103] Corresponding to the above method embodiments, this application also provides a bank transaction number generation system. Please refer to [link to relevant documentation]. Figure 2 , Figure 2 This application provides a functional module diagram of a bank transaction number generation system, wherein the bank transaction number generation system 200 includes:
[0104] The first generation module 210 is used to generate a first code and a second code in response to a serial number generation request, and to obtain the request timestamp of the serial number generation request. The first code is generated by a pseudo-random number generator, and the second code is generated by a true random number generator.
[0105] The second generation module 220 is used to combine the first code, the second code, and the request timestamp according to a preset combination method to generate the target serial number.
[0106] This application provides a bank transaction number generation system. A first generation module generates a first code and a second code in response to a transaction number generation request, and obtains the request timestamp. The first code is generated using a pseudo-random number generator, and the second code is generated using a true random number generator. Then, a second generation module combines the first code, the second code, and the request timestamp according to a preset combination method to generate the target transaction number, ensuring the uniqueness and security of the target transaction number.
[0107] This application also provides a computer device; please refer to [link to relevant documentation]. Figure 3 , Figure 3 This is a diagram illustrating the internal structure of a computer device according to an embodiment of this application. The computer device includes a processor, a memory, and a network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, this computer program enables the processor to implement the bank transaction number generation method applied to the computer device in the above embodiment. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to execute the bank transaction number generation method. Those skilled in the art will understand that… Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0108] This application also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the bank transaction number generation method as described in the method embodiment.
[0109] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0110] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
Claims
1. A method for generating bank transaction numbers, characterized in that, The method includes: In response to a serial number generation request, a first code and a second code are generated, and the request timestamp of the serial number generation request is obtained, wherein the first code is generated by a pseudo-random number generator, and the second code is generated by a true random number generator; The target serial number is generated by combining the first code, the second code, and the request timestamp according to a preset combination method. The process of generating the first and second codes in response to the serial number generation request includes: If the total number of serial number generation requests is greater than or equal to a preset threshold, all serial number generation requests are stored in a preset message queue, and at least two consumers are created. Communication between each consumer and the pseudo-random number generator is established through a first API interface, and communication between each consumer and the true random number generator is established through a second API interface, wherein the first API interface and the second API interface are different interfaces. The consumer generates a first generation instruction and a second generation instruction when processing serial number generation requests stored in the preset message queue. The first generation instruction instructs the pseudo-random number generator to generate the first code, and the second generation instruction instructs the true random number generator to generate the second code. The serial number generation request includes a business identifier, and the generation of a first code and a second code in response to the serial number generation request includes: The first code and the second code are generated based on the service identifier and service identifier table of the serial number generation request. The first code and / or the second code corresponding to the serial number generation request of different service identifiers have different formats. The service identifier table includes a mapping relationship between different types of services, service identifiers of different types of services, and standard encoding formats of different types of services. The standard encoding format includes at least one of length and character type. Different types of services include services with different security levels. The higher the security level of the service, the more complex the standard encoding format. After generating the first and second codes in response to the serial number generation request, the method further includes: The second encoding is converted according to the preset character conversion table to obtain a new second encoding; The step of generating a target serial number by combining the first code, the second code, and the request timestamp according to a preset combination method includes: combining the first code, the new second code, and the request timestamp according to the preset combination method to generate the target serial number, wherein the preset combination method includes at least one of string concatenation and delimiter combination.
2. The method as described in claim 1, characterized in that, The process of generating the first and second codes in response to the serial number generation request includes: If the total number of all serial number generation requests is less than the preset threshold, all serial number generation requests are sent to a preset database; wherein, The preset database is used to, upon receiving the serial number generation request, call the pseudo-random number generator through the first API interface to obtain the first code, and call the true random number generator through the second API interface to obtain the second code.
3. The method as described in claim 1, characterized in that, After generating the target serial number by combining the first code, the second code, and the requested timestamp according to a preset combination method, the method further includes: The target hash value is obtained by calculating the target serial number according to the preset hash function; Store the target serial number and the target hash value in a preset hash table; In the case of detecting the generation of a new target serial number, the new target serial number is calculated according to the preset hash function to obtain a new target hash value; If the new target hash value is found to be different from other target hash values in the preset hash table, the new target serial number and the new target hash value are stored in the preset hash table. If the new target hash value is found to be the same as at least one other target hash value in the preset hash table, and the target serial number of the at least one other target hash value is different from the new target serial number, the new target serial number and the new target hash value are stored in the preset hash table. If the new target hash value is found to be the same as at least one other target hash value in the preset hash table, and the target serial number of the at least one other target hash value is the same as the new target serial number, an alert instruction is generated to indicate the existence of the same target serial number.
4. The method as described in claim 1, characterized in that, The pseudo-random number generator includes at least one of a linear congruent generator, an adaptive random number generator, an encrypted pseudo-random number generator, and a white noise generator, and the true random number generator includes at least one of a quantum random number generator, a time-series random number generator, and a hardware random number generator.
5. A bank transaction number generation system, characterized in that, The system for performing the method as described in any one of claims 1-4 includes: The first generation module is used to generate a first code and a second code in response to a serial number generation request, and to obtain the request timestamp of the serial number generation request, wherein the first code is generated by a pseudo-random number generator and the second code is generated by a true random number generator. The second generation module is used to combine the first code, the second code, and the request timestamp according to a preset combination method to generate a target serial number.
6. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores a computer program that, when executed by the processor, implements the method of any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by one or more processors, implements the method of any one of claims 1-4.