Random code generation method and device, computer device and storage medium
Patent Information
- Application Number
- CN202211017402.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-23
- Publication Date
- 2026-10-13
- Estimated Expiration
- 2042-08-23
AI Technical Summary
[0049]本申请实施例所述随机码生成方法,通过基于预训练的场景类别识别模型,对新录入的业务场景进行场景类别识别;根据场景类别识别结果,确定所述场景对应的安全级别;基于所述场景对应的安全级别选择相应的随机码生成器,生成随机码,以便于结合人工智能模型,自动化和智能化的进行多业务场景的可指定位数、指定字符集、指定有效时间的随机码筛选生成。
Smart Images

Figure CN115373634B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of artificial intelligence and security verification technology, and in particular to a random code generation method, apparatus, computer equipment and storage medium. Background Technology
[0002] Random numbers are ubiquitous in daily life, such as in SMS verification codes, dynamic verification codes for coupons, initial account passwords for users, and human verification codes for websites. Because the requirements for random numbers vary across different scenarios—for example, SMS verification codes are typically 4 or 6 digits long, dynamic verification codes for coupons are generally more than 10 digits long and allow both numbers and letters, while human verification codes also allow Chinese characters—there is currently a lack of a universal random number generation component that can automatically specify the number of digits, the character set, and the validity period of the random number across multiple business scenarios. Summary of the Invention
[0003] The purpose of this application is to provide a random code generation method, apparatus, computer device, and storage medium, so as to combine artificial intelligence models to automatically and intelligently generate random codes with specified length, specified character set, and specified validity period for multiple business scenarios.
[0004] To address the aforementioned technical problems, this application provides a random code generation method, employing the following technical solution:
[0005] A method for generating random codes includes the following steps:
[0006] Based on a pre-trained scene category recognition model, the newly entered business scenes are identified in terms of scene category.
[0007] Based on the scene category identification results, the security level corresponding to the scene is determined;
[0008] Select the appropriate random code generator based on the security level corresponding to the scenario, and generate a random code.
[0009] Furthermore, before the step of performing scene category recognition on newly entered business scenarios based on the pre-trained scene category recognition model, the method further includes:
[0010] N business scenarios are collected in advance, where N is a positive integer;
[0011] The N business scenarios are divided into a training set and a validation set according to a certain ratio;
[0012] The training set is classified and trained using natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model.
[0013] The validation set is input into the pre-trained classification model for validation training.
[0014] Sensitivity detection is performed on the verification training results based on a preset verification prediction form to determine whether the detection results meet the preset sensitivity threshold. The sensitivity represents the proportion of the number of correctly classified business scenarios in the verification set to the total number of business scenarios in the verification set.
[0015] If the conditions are not met, the classification parameters of the classification model are fine-tuned until the detection result meets the preset sensitivity threshold, at which point the pre-training of the scene category recognition model is complete.
[0016] Furthermore, the step of performing classification training on the training set based on natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model specifically includes:
[0017] Obtain the source code and annotation information from the training set;
[0018] Key fields in the source code and annotation information are identified and extracted using natural language processing technology.
[0019] The key fields are clustered using a preset classification algorithm, and the clustering results are used as the classification target results of the pre-trained classification model. The preset classification algorithm is the Naive Bayes algorithm.
[0020] Furthermore, the step of identifying the scene category of newly entered business scenarios based on the pre-trained scene category recognition model specifically includes:
[0021] Based on the natural language processing technology in the scene category recognition model, the estimated labels of newly entered business scenes are obtained;
[0022] Based on the estimated labels and the Naive Bayes algorithm in the scene category recognition model, the scene category corresponding to the newly entered business scene is predicted.
[0023] Furthermore, the step of determining the security level corresponding to the scene based on the scene category identification result specifically includes:
[0024] Pre-set a form that associates scene categories with security levels;
[0025] After the step of identifying the scenario category of the newly entered business scenario, the security level corresponding to the identified scenario category is determined based on the scenario category and security level association form.
[0026] Furthermore, the step of selecting an appropriate random code generator based on the security level corresponding to the scenario and generating a random code specifically includes:
[0027] Pre-set the correspondence between security levels and random code generators;
[0028] After determining the security level corresponding to the scenario category, based on the correspondence between the security level and the random code generator, the random code generator corresponding to the security level is selected to generate a random code.
[0029] Furthermore, the step of selecting a random code generator corresponding to the security level based on the correspondence between the security level and the random code generator, and performing random code generation, specifically includes:
[0030] The random code generator is pre-set with character combination rules and random code length rules. The character combination rules include selecting at least one preset character to generate random codes based on the security level. The random code length rules include setting the random code length based on the corresponding length between a first preset length and a second preset length. The preset characters include Arabic numerals, uppercase and lowercase English characters, uppercase and lowercase Greek letters, punctuation marks, and Chinese characters.
[0031] After the step of selecting the random code generator corresponding to the security level, the character combination method corresponding to the security level is determined based on the character combination rule, and the number of random code bits corresponding to the security level is determined according to the random code bit length rule.
[0032] Based on the character combination method and the number of random code bits, characters with the number of random code bits are selected from the character combination method to generate a random code.
[0033] Furthermore, after the step of selecting characters with the specified number of random code lengths from the character combination method and the random code lengths to generate a random code, the method further includes:
[0034] Get the current time, host ID, and request sequence generated by the random code;
[0035] The current time, host ID, request sequence, and random code are each converted to binary.
[0036] The binary conversion result is concatenated with a string sequence without concatenation symbols to generate a binary target random number of a preset number of bits, wherein the preset number of bits can be 64 bits;
[0037] Perform at least one of the following operations on the binary characters within the target random number: cyclic left shift, cyclic right shift, or number base conversion, to generate an intermediate binary random number;
[0038] The intermediate random number is encoded in decimal and a valid duration is set to form an irreversible random code.
[0039] To address the aforementioned technical problems, this application also provides a random code generation device, which employs the following technical solution:
[0040] A random code generation device, comprising:
[0041] The scene category recognition module is used to identify the scene category of newly entered business scenarios based on a pre-trained scene category recognition model.
[0042] The security level determination module is used to determine the security level corresponding to the scene based on the scene category identification result;
[0043] The random code generation module is used to select the appropriate random code generator based on the security level corresponding to the scenario and generate a random code.
[0044] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:
[0045] A computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the random code generation method described above.
[0046] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0047] A computer-readable storage medium storing computer-readable instructions, which, when executed by a processor, implement the steps of the random code generation method described above.
[0048] Compared with the prior art, the embodiments of this application have the following main advantages:
[0049] The random code generation method described in this application embodiment identifies the scenario category of newly entered business scenarios using a pre-trained scenario category recognition model; determines the security level corresponding to the scenario based on the scenario category recognition result; and selects a corresponding random code generator based on the security level corresponding to the scenario to generate random codes, so as to combine artificial intelligence models to automatically and intelligently filter and generate random codes with specified length, specified character set, and specified validity time for multiple business scenarios. Attached Figure Description
[0050] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0052] Figure 2 A flowchart of an embodiment of the random code generation method according to this application;
[0053] Figure 3 This is a flowchart illustrating a specific implementation method for pre-training the scene category recognition model in this application embodiment;
[0054] Figure 4 yes Figure 3 A flowchart of a specific implementation of step 303 shown;
[0055] Figure 5 yes Figure 2 A flowchart of a specific implementation of step 203 shown;
[0056] Figure 6 yes Figure 5 A flowchart of a specific implementation of step 502 shown;
[0057] Figure 7 This is a flowchart illustrating a specific implementation method for generating irreversible crackable random codes in the embodiments of this application;
[0058] Figure 8 A schematic diagram of the structure of an embodiment of the random code generation apparatus according to this application;
[0059] Figure 9 yes Figure 8 A schematic diagram of one embodiment of 803 is shown;
[0060] Figure 10 A schematic diagram of the structure of an embodiment of the computer device according to this application. Detailed Implementation
[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0062] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0063] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0064] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0065] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0066] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0067] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0068] It should be noted that the random code generation method provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the random code generation device is generally set in the server / terminal device.
[0069] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0070] Continue to refer to Figure 2 A flowchart of an embodiment of the random code generation method according to this application is shown. The random code generation method includes the following steps:
[0071] Step 201: Based on the pre-trained scene category recognition model, perform scene category recognition on the newly entered business scenarios.
[0072] In this embodiment, before the step of performing scene category recognition on newly entered business scenarios based on the pre-trained scene category recognition model, the method further includes: pre-collecting N business scenarios, where N is a positive integer; dividing the N business scenarios into a training set and a validation set according to a certain ratio; performing classification training on the training set based on natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model; inputting the validation set into the pre-trained classification model for validation training; performing sensitivity detection on the validation training results based on a preset validation prediction form to determine whether the detection results meet a preset sensitivity threshold, where the sensitivity represents the proportion of correctly classified business scenarios in the validation set to the total number of business scenarios in the validation set; if not, fine-tuning the classification parameters of the classification model until the detection results meet the preset sensitivity threshold, then the pre-training of the scene category recognition model is completed.
[0073] By using sampling machine learning, a scene category recognition model is trained and validated using training and validation sets to obtain a pre-trained scene category recognition model. Natural language processing technology is then used to obtain key fields of the business scenario, i.e., labels. The Naive Bayes algorithm is then used to predict the category of each label, and clustering is performed. Sensitivity detection is used for validation and fine-tuning of classification parameters to ensure the applicability of the pre-trained scene category recognition model.
[0074] In this embodiment, the step of fine-tuning the classification parameters of the classification model is specifically implemented by adjusting the classification parameters set for each cluster classification, i.e., the similarity, to adjust the cluster classification corresponding to different key fields.
[0075] By verifying the results through sensitivity testing and fine-tuning the classification parameters, the accuracy of the pre-trained scene category recognition model in scene category recognition is ensured.
[0076] Continue to refer to Figure 3 , Figure 3 This is a flowchart illustrating a specific implementation method for pre-training the scene category recognition model in this application embodiment, including the following steps:
[0077] Step 301: Collect N business scenarios in advance, where N is a positive integer;
[0078] Step 302: Divide the N business scenarios into a training set and a validation set according to a certain ratio;
[0079] Step 303: Perform classification training on the training set based on natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model;
[0080] In this embodiment, the step of classifying and training the training set based on natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model specifically includes: obtaining source code and annotation information in the training set; identifying and extracting key fields from the source code and annotation information based on natural language processing technology; clustering the key fields using a preset classification algorithm, and using the clustering results as the classification target result of the pre-trained classification model, wherein the preset classification algorithm is the Naive Bayes algorithm.
[0081] By directly obtaining the source code and annotation information from the training set, key fields are determined, and these key fields are used as the classification target results, i.e., the classification results corresponding to the business scenario. This allows the clustering classification results to rely more on the source code and annotation information, ensuring the accuracy of the clustering classification results.
[0082] Continue to refer to Figure 4 , Figure 4 yes Figure 3 A flowchart of a specific implementation of step 303 shown includes the following steps:
[0083] Step 401: Obtain the source code and annotation information in the training set;
[0084] Step 402: Identify and extract key fields from the source code and the comment information based on natural language processing technology;
[0085] Step 403: Use a preset classification algorithm to cluster the key fields, and use the clustering results as the classification target results of the pre-trained classification model, wherein the preset classification algorithm is the Naive Bayes algorithm.
[0086] Step 304: Input the validation set into the pre-trained classification model for validation training;
[0087] Step 305: Perform sensitivity detection on the verification training results based on the preset verification prediction form, and determine whether the detection results meet the preset sensitivity threshold, wherein the sensitivity represents the proportion of the number of business scenarios correctly classified in the verification set to the total number of business scenarios in the verification set.
[0088] Step 306: If the preset sensitivity threshold is not met, the classification parameters of the classification model are fine-tuned.
[0089] Step 307: If the preset sensitivity threshold is met, the pre-training of the scene category recognition model is complete.
[0090] In this embodiment, the step of identifying the scene category of a newly entered business scene based on the pre-trained scene category recognition model specifically includes: obtaining the estimated label of the newly entered business scene based on the natural language processing technology in the scene category recognition model; and predicting the scene category corresponding to the newly entered business scene based on the estimated label and the Naive Bayes algorithm in the scene category recognition model.
[0091] The scenario category recognition model is used to predict the scenario category of newly entered business scenarios, thereby providing an indicator reference for determining their corresponding security level.
[0092] Step 202: Determine the security level corresponding to the scene based on the scene category identification results.
[0093] In this embodiment, the step of determining the security level corresponding to the scene based on the scene category identification result specifically includes: pre-setting a scene category and security level association form; after the step of performing scene category identification on the newly entered business scene, determining the security level corresponding to the identified scene category based on the scene category and security level association form.
[0094] By setting a form that associates scene categories with security levels, the security level corresponding to the identified scene categories can be determined. The form can be configured such that one security level corresponds to one scene category, or one security level corresponds to multiple scene categories. The specific settings can be configured according to the security requirements of the business in the actual injected business scenario, which facilitates the generation of random codes for multiple business scenarios according to the security level requirements.
[0095] Step 203: Select the appropriate random code generator based on the security level corresponding to the scenario, and generate a random code.
[0096] In this embodiment, the step of selecting the appropriate random code generator based on the security level corresponding to the scenario and generating a random code specifically includes: pre-setting the correspondence between the security level and the random code generator; after the step of determining the security level corresponding to the scenario category, selecting the random code generator corresponding to the security level based on the correspondence between the security level and the random code generator, and generating a random code.
[0097] Continue to refer to Figure 5 , Figure 5 yes Figure 2 A flowchart of a specific implementation of step 203 shown includes the following steps:
[0098] Step 501: Pre-set the correspondence between security levels and random code generators;
[0099] Step 502: After determining the security level corresponding to the scene category, based on the correspondence between the security level and the random code generator, select the random code generator corresponding to the security level and generate a random code.
[0100] In this embodiment, the step of selecting a random code generator corresponding to the security level based on the correspondence between the security level and the random code generator, and generating random codes, specifically includes: pre-setting the character combination rules and random code length rules of the random code generator, wherein the character combination rules include selecting at least one preset character for random code generation based on the security level, and the random code length rules include selecting a corresponding number of digits between a first preset number of digits and a second preset number of digits for random code length setting, wherein the preset characters include Arabic numerals, uppercase and lowercase English characters, uppercase and lowercase Greek letters, punctuation marks, and Chinese characters; after the step of selecting a random code generator corresponding to the security level, determining the character combination method corresponding to the security level based on the character combination rules, and determining the random code length corresponding to the security level according to the random code length rules; and based on the character combination method and the random code length, selecting characters with the specified random code length from the character combination method to generate random codes.
[0101] By setting the character combination rules and random code length rules of the random code generator, the character selection during random code generation can be freely combined with Arabic numerals, uppercase and lowercase English characters, uppercase and lowercase Greek letters, punctuation marks, and Chinese characters according to the security requirements of the business scenario. The length of the random code can also be selected to ensure the security of the random code and its applicability to multiple business scenarios.
[0102] Continue to refer to Figure 6 , Figure 6 yes Figure 5 A flowchart of a specific implementation of step 502 shown includes the following steps:
[0103] Step 601: Pre-set the character combination rules and random code length rules of the random code generator. The character combination rules include selecting at least one preset character to generate random codes based on the security level. The random code length rules include setting the random code length based on the corresponding length between a first preset length and a second preset length. The preset characters include Arabic numerals, uppercase and lowercase English characters, uppercase and lowercase Greek letters, punctuation marks, and Chinese characters.
[0104] Step 602: After selecting the random code generator corresponding to the security level, determine the character combination method corresponding to the security level based on the character combination rules, and determine the number of random code bits corresponding to the security level according to the random code bit length rules.
[0105] Step 603: Based on the character combination method and the number of random code bits, select characters with the number of random code bits from the character combination method to generate a random code.
[0106] In this embodiment, after the step of selecting characters with the specified number of random code bits from the character combination method and generating a random code based on the character combination method and the random code bit length, the method further includes: obtaining the current time, host ID, and request sequence for random code generation; performing binary conversion on the current time, host ID, request sequence, and random code respectively; concatenating the binary conversion result into a string sequence without concatenation symbols to generate a binary target random number with a preset bit length, wherein the preset bit length can be 64 bits; performing at least one of the following operations on the binary characters within the target random number: cyclic left shift, cyclic right shift, and base conversion to generate an intermediate binary random number; and encoding the intermediate random number in decimal and setting a valid duration to constitute an irreversible and unbreakable random code.
[0107] By combining the current time, host ID, request sequence, and the random code, binary conversion is performed, followed by cyclic left and right shifts, number system conversion, decimal encoding, and setting the validity period. This ensures the irreversibility and timeliness of the final random code, providing a more secure method for generating random codes and improving security.
[0108] Continue to refer to Figure 7 , Figure 7 This is a flowchart illustrating a specific implementation of generating an irreversible, crackable random code in this application, including the following steps:
[0109] Step 701: Obtain the current time, host ID, and request sequence generated by the random code;
[0110] Step 702: Perform binary conversion on the current time, host ID, request sequence, and random code respectively;
[0111] Step 703: Concatenate the binary conversion result into a string sequence without concatenation symbols to generate a binary target random number of a preset number of bits, wherein the preset number of bits can be 64 bits;
[0112] Step 704: Perform at least one of the following operations on the binary characters in the target random number: cyclic left shift, cyclic right shift, or number base conversion, to generate an intermediate binary random number;
[0113] Step 705: Encode the intermediate random number in decimal and set a valid duration to form an irreversible random code.
[0114] This application uses a pre-trained scene category recognition model to identify the scene category of newly entered business scenarios; determines the security level corresponding to the scene based on the scene category recognition result; and selects a corresponding random code generator based on the security level corresponding to the scene to generate random codes, so as to combine artificial intelligence models to automatically and intelligently filter and generate random codes with specified length, specified character set, and specified validity time for multiple business scenarios.
[0115] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0116] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0117] In this embodiment, the scene category recognition model is trained using machine learning in artificial intelligence technology. The random code generation function is also improved by setting character combination rules and random code length rules for the random code generator. This makes the generation of random codes conform to various business scenarios and security requirements, and facilitates the automatic and intelligent generation of random codes with specified length, character set, and validity period for multiple business scenarios by combining artificial intelligence models.
[0118] Further reference Figure 8 As a response to the above Figure 2 To implement the method shown, this application provides an embodiment of a random code generation apparatus, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0119] like Figure 8 As shown, the random code generation device 800 described in this embodiment includes: a scene category recognition module 801, a security level determination module 802, and a random code generation module 803. Wherein:
[0120] The scene category recognition module 801 is used to perform scene category recognition on newly entered business scenes based on a pre-trained scene category recognition model.
[0121] The security level determination module 802 is used to determine the security level corresponding to the scene based on the scene category identification result;
[0122] The random code generation module 803 is used to select the appropriate random code generator based on the security level corresponding to the scenario and generate a random code.
[0123] This application uses a pre-trained scene category recognition model to identify the scene category of newly entered business scenarios; determines the security level corresponding to the scene based on the scene category recognition result; and selects a corresponding random code generator based on the security level corresponding to the scene to generate random codes, so as to combine artificial intelligence models to automatically and intelligently filter and generate random codes with specified length, specified character set, and specified validity time for multiple business scenarios.
[0124] In some specific embodiments of this application, the random code generation device 800 further includes a recognition model training module. This module is used to pre-collect N business scenarios, where N is a positive integer. The N business scenarios are divided into a training set and a validation set according to a certain ratio. The training set is then used for classification training based on natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model. The validation set is input into the pre-trained classification model for validation training. Sensitivity detection is performed on the validation training results based on a preset validation prediction form to determine whether the detection results meet a preset sensitivity threshold. The sensitivity represents the proportion of correctly classified business scenarios in the validation set to the total number of business scenarios in the validation set. If the threshold is not met, the classification parameters of the classification model are fine-tuned until the detection results meet the preset sensitivity threshold, at which point the pre-training of the scenario category recognition model is complete.
[0125] In some specific embodiments of this application, the random code generation device 800 further includes an unbreakable setting module. This module is used to acquire the current time, host ID, and request sequence for random code generation; to perform binary conversion on the current time, host ID, request sequence, and random code respectively; to concatenate the binary conversion results into a string sequence without concatenation symbols to generate a binary target random number of a preset number of bits, wherein the preset number of bits can be 64 bits; and to perform at least one of the following operations on the binary characters within the target random number: cyclic left shift, cyclic right shift, and base conversion, to generate an intermediate binary random number; to encode the intermediate random number in decimal and set a valid duration to constitute an unreversible and unbreakable random code.
[0126] Continue to refer to Figure 9 , Figure 9 yes Figure 8 The schematic diagram shown is a structural representation of a specific embodiment of the random code generation module 803. The random code generation module 803 includes: a first setting submodule 8031, a second setting submodule 8032, a selection mode determination submodule 8033, and a random code generation submodule 8034.
[0127] The first setting submodule 8031 is used to pre-set the correspondence between the security level and the random code generator;
[0128] The second setting submodule 8032 is used to pre-set the character combination rules and random code length rules of the random code generator after the step of determining the security level corresponding to the scene category. The character combination rules include selecting at least one preset character to generate random codes based on the security level. The random code length rules include selecting the corresponding number of digits between a first preset number of digits and a second preset number of digits to set the random code length. The preset characters include Arabic numerals, uppercase and lowercase English characters, uppercase and lowercase Greek letters, punctuation marks, and Chinese characters.
[0129] The selection method determination submodule 8033 is used to determine the character combination method corresponding to the security level based on the character combination rules and to determine the number of random code bits corresponding to the security level according to the random code bit length rules after the step of selecting the random code generator corresponding to the security level.
[0130] The random code generation submodule 8034 is used to generate a random code by selecting characters with the specified random code length from the character combination method based on the character combination method and the random code length.
[0131] The module provides character combination rules and random code length rules for random code generation through the first setting submodule, the second setting submodule, the selection method determination submodule, and the random code generation submodule. This enables the random code generation module to filter and generate random codes with specified length, character set, and validity period for multiple business scenarios.
[0132] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware through computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0133] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0134] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 10 , Figure 10 This is a basic structural block diagram of the computer device in this embodiment.
[0135] The computer device 10 includes a memory 10a, a processor 10b, and a network interface 10c that are interconnected via a system bus. It should be noted that only the computer device 10 with components 10a-10c is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0136] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0137] The memory 10a includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10a may be an internal storage unit of the computer device 10, such as the hard disk or memory of the computer device 10. In other embodiments, the memory 10a may also be an external storage device of the computer device 10, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Of course, the memory 10a may include both internal storage units and external storage devices of the computer device 10. In this embodiment, the memory 10a is typically used to store the operating system and various application software installed on the computer device 10, such as computer-readable instructions for random code generation methods. In addition, the memory 10a can also be used to temporarily store various types of data that have been output or will be output.
[0138] In some embodiments, the processor 10b may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 10b is typically used to control the overall operation of the computer device 10. In this embodiment, the processor 10b is used to execute computer-readable instructions stored in the memory 10a or to process data, for example, to execute computer-readable instructions of the random code generation method.
[0139] The network interface 10c may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 10 and other electronic devices.
[0140] The computer device proposed in this embodiment belongs to the field of security verification technology. This application uses a pre-trained scene category recognition model to identify the scene category of newly entered business scenarios; determines the security level corresponding to the scene based on the scene category recognition result; and selects a corresponding random code generator based on the security level corresponding to the scene to generate random codes, so as to combine artificial intelligence models to automatically and intelligently filter and generate random codes with specified length, specified character set, and specified validity time for multiple business scenarios.
[0141] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by a processor to cause the processor to perform the steps of the random code generation method described above.
[0142] The computer-readable storage medium proposed in this embodiment belongs to the field of security verification technology. This application uses a pre-trained scene category recognition model to identify the scene category of newly entered business scenarios; based on the scene category recognition results, it determines the security level corresponding to the scene; and selects a corresponding random code generator based on the security level of the scene to generate random codes, so as to automatically and intelligently filter and generate random codes with specified length, character set, and validity period for multiple business scenarios by combining artificial intelligence models.
[0143] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0144] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A method for generating random codes, characterized in that, Includes the following steps: Based on a pre-trained scene category recognition model, newly entered business scenarios are identified in terms of scene category, specifically including: Based on the natural language processing technology in the scene category recognition model, the estimated labels of newly entered business scenes are obtained, wherein the estimated labels include the key fields of the estimated business scene. Based on the estimated labels and the Naive Bayes algorithm in the scene category recognition model, predict the scene category corresponding to the newly entered business scene; Based on the scene category identification results, the security level corresponding to the scene is determined; Select the appropriate random code generator based on the security level corresponding to the scenario, and generate a random code. Also includes: Get the current time, host ID, and request sequence generated by the random code; The current time, host ID, request sequence, and random code are each converted to binary. The binary conversion result is concatenated with a string sequence without concatenation symbols to generate a binary target random number of a preset number of bits, wherein the preset number of bits is 64 bits; Perform at least one of the following operations on the binary characters within the target random number: cyclic left shift, cyclic right shift, or number base conversion, to generate an intermediate binary random number; The intermediate random number is encoded in decimal and a valid duration is set to form an irreversible random code.
2. The random code generation method according to claim 1, characterized in that, Before the step of performing scene category recognition on newly entered business scenarios based on the pre-trained scene category recognition model, the method further includes: N business scenarios are collected in advance, where N is a positive integer; The N business scenarios are divided into a training set and a validation set according to a certain ratio; The training set is classified and trained using natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model. The validation set is input into the pre-trained classification model for validation training. Sensitivity detection is performed on the verification training results based on a preset verification prediction form to determine whether the detection results meet the preset sensitivity threshold. The sensitivity represents the proportion of the number of correctly classified business scenarios in the verification set to the total number of business scenarios in the verification set. If the conditions are not met, the classification parameters of the classification model are fine-tuned until the detection result meets the preset sensitivity threshold, at which point the pre-training of the scene category recognition model is complete.
3. The random code generation method according to claim 2, characterized in that, The step of classifying and training the training set based on natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model specifically includes: Obtain the source code and annotation information from the training set; Key fields in the source code and annotation information are identified and extracted using natural language processing technology. The key fields are clustered using a preset classification algorithm, and the clustering results are used as the classification target results of the pre-trained classification model. The preset classification algorithm is the Naive Bayes algorithm.
4. The random code generation method according to claim 1, characterized in that, The step of determining the security level corresponding to the scene based on the scene category identification result specifically includes: Pre-set a form that associates scene categories with security levels; After the step of identifying the scenario category of the newly entered business scenario, the security level corresponding to the identified scenario category is determined based on the scenario category and security level association form.
5. The random code generation method according to claim 1, characterized in that, The step of selecting the appropriate random code generator based on the security level corresponding to the scenario and generating a random code specifically includes: Pre-set the correspondence between security levels and random code generators; After determining the security level corresponding to the scenario category, based on the correspondence between the security level and the random code generator, the random code generator corresponding to the security level is selected to generate a random code.
6. The random code generation method according to claim 5, characterized in that, The step of selecting a random code generator corresponding to the security level based on the correspondence between the security level and the random code generator, and generating a random code, specifically includes: The random code generator is pre-set with character combination rules and random code length rules. The character combination rules include selecting at least one preset character based on the security level to generate a random code. The random code length rules include selecting a corresponding number of digits between a first preset number of digits and a second preset number of digits based on the random code length rules to set the random code length. The preset characters include Arabic numerals, uppercase and lowercase English characters, uppercase and lowercase Greek letters, punctuation marks, and Chinese characters. After the step of selecting the random code generator corresponding to the security level, the character combination method corresponding to the security level is determined based on the character combination rule, and the number of random code bits corresponding to the security level is determined according to the random code bit length rule. Based on the character combination method and the number of random code bits, characters with the number of random code bits are selected from the character combination method to generate a random code.
7. A random code generation device, characterized in that, The random code generation device implements the steps of the random code generation method as described in any one of claims 1 to 6, and the random code generation device comprises: The scene category recognition module is used to identify the scene category of newly entered business scenarios based on a pre-trained scene category recognition model. The security level determination module is used to determine the security level corresponding to the scene based on the scene category identification result; The random code generation module is used to select the appropriate random code generator based on the security level corresponding to the scenario and generate a random code.
8. A computer device comprising a memory and a processor, the memory storing computer-readable instructions, wherein the processor, when executing the computer-readable instructions, implements the steps of the random code generation method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the random code generation method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Verification code generation method and device, storage medium and computer equipment
CN109918892A
Generation method based on machine learning and interactive man-machine distinguishing verification
CN114117390A