CN115373634A - Random code generation method and device, computer equipment and storage medium - Google Patents

Random code generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115373634A
CN115373634A CN202211017402.3A CN202211017402A CN115373634A CN 115373634 A CN115373634 A CN 115373634A CN 202211017402 A CN202211017402 A CN 202211017402A CN 115373634 A CN115373634 A CN 115373634A
Authority
CN
China
Prior art keywords
random code
scene
security level
random
classification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211017402.3A
Other languages
Chinese (zh)
Inventor
邓涵量
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202211017402.3A priority Critical patent/CN115373634A/en
Publication of CN115373634A publication Critical patent/CN115373634A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/588Random number generators, i.e. based on natural stochastic processes

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Machine Translation (AREA)

Abstract

The embodiment of the application belongs to the field of artificial intelligence, is applied to the field of safety verification, and relates to a random code generation method, a random code generation device, computer equipment and a storage medium, wherein the method comprises the steps of carrying out scene type identification on a newly input service scene based on a pre-trained scene type identification model; determining the security level corresponding to the scene according to the scene type identification result; and selecting a corresponding random code generator based on the security level corresponding to the scene to generate random codes, so that the random code which can specify the digit, the character set and the effective time of the multi-service scene is automatically and intelligently screened and generated by combining an artificial intelligence model.

Description

Random code generation method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence and security verification technologies, and in particular, to a random code generation method and apparatus, a computer device, and a storage medium.
Background
The random number is visible everywhere in life, such as a short message authentication code, a dynamic authentication code of a card ticket, a primary account password of a user, a man-machine authentication code of a website and the like. Because the random number requirements of various scenes are different, for example, the length of a short message verification code is generally 4 bits or 6 bits, the length of a card dynamic verification code is generally more than ten bits, numbers and letters are allowed to appear, and Chinese characters are allowed to appear in a man-machine verification code, a general random number generation component for a multi-service scene, which can automatically specify digits, specify a character set and configure the effective time of random numbers, is lacked at present.
Disclosure of Invention
The embodiment of the application aims to provide a random code generation method, a random code generation device, computer equipment and a storage medium, so that the random code which can specify the digit, the character set and the effective time in a multi-service scene can be automatically and intelligently screened and generated by combining an artificial intelligence model.
In order to solve the foregoing technical problem, an embodiment of the present application provides a random code generation method, which adopts the following technical solutions:
a random code generation method, comprising the steps of:
based on a pre-trained scene category identification model, carrying out scene category identification on a newly input service scene;
determining the security level corresponding to the scene according to the scene type identification result;
and selecting a corresponding random code generator based on the security level corresponding to the scene to generate a random code.
Further, before the step of performing scene category identification on the newly entered service scene based on the pre-trained scene category identification model, the method further includes:
acquiring N service scenes in advance, wherein N is a positive integer;
dividing the N service scenes into a training set and a verification set according to a certain proportion;
performing classification training on the training set based on a natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model;
inputting the verification set into a classification model which is trained in advance, and performing verification training;
carrying out sensitivity detection on a verification training result based on a preset verification prediction form, and judging whether the detection result meets a preset sensitivity threshold value, wherein the sensitivity represents the proportion value of the number of correctly classified service scenes in the verification set to the total service scenes in the verification set;
and if not, carrying out classification parameter fine adjustment on the classification model until the detection result meets a preset sensitivity threshold value, and finishing the pre-training of the scene classification recognition model.
Further, the step of performing classification training on the training set based on the natural language processing technology and a preset classification algorithm to obtain a classification model for the pre-training specifically includes:
acquiring source codes and annotation information in the training set;
identifying and extracting key fields in the source code and the annotation information based on natural language processing technology;
and performing cluster classification on the key fields by using a preset classification algorithm, and taking a cluster classification result as a classification target result of the pre-trained classification model, wherein the preset classification algorithm is a naive Bayes algorithm.
Further, the step of performing scene category identification on the newly entered service scene based on the pre-trained scene category identification model specifically includes:
acquiring a pre-estimated label of a newly input service scene based on a natural language processing technology in the scene category identification model;
and predicting the scene category corresponding to the newly input service scene according to the pre-estimated label and a naive Bayesian algorithm in the scene category identification model.
Further, the step of determining the security level corresponding to the scene according to the scene category identification result specifically includes:
presetting a scene category and security level association form;
after the step of identifying the scene category of the newly entered service scene, determining the security level corresponding to the identified scene category based on the scene category and the security level association form.
Further, the step of selecting a corresponding random code generator based on the security level corresponding to the scene to generate a random code specifically includes:
presetting a corresponding relation between a security level and a random code generator;
after the step of determining the security level corresponding to the scene category, selecting a random code generator corresponding to the security level based on the corresponding relationship between the security level and the random code generator, and generating a random code.
Further, 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 to generate a random code specifically includes:
presetting a character combination rule and a random code digit rule of the random code generator, wherein the character combination rule comprises that at least one preset character can be selected based on the security level to generate a random code, the random code digit rule comprises that the random code digit is set based on the corresponding digit between a first preset digit and a second preset digit which can be selected by the random code digit rule, and the preset character comprises Arabic numerals, capital and small English characters, capital and small Greek letters, punctuation marks and Chinese characters;
after the step of selecting the random code generator corresponding to the security level, determining a character combination mode corresponding to the security level based on the character combination rule, and determining a random code number corresponding to the security level according to the random code number rule;
and based on the character combination mode and the random code number, screening the characters of the random code number from the character combination mode, and generating a random code.
Further, after the step of screening the characters of the random code number from the character combination mode and generating the random code based on the character combination mode and the random code number, the method further includes:
acquiring a request sequence generated by current time, host ID and a random code;
respectively carrying out binary conversion on the current time, the host ID, the request sequence and the random code;
splicing the character string sequence without the spliced symbols of the binary conversion result to generate a binary target random number with a preset digit, wherein the preset digit can be 64 digits;
performing at least any one of cyclic left shift operation, cyclic right shift operation and binary conversion operation on the binary characters in the target random number to generate a binary intermediate random number;
and carrying out decimal coding on the intermediate random number, and setting effective duration to form a random code which cannot be reversely cracked.
In order to solve the above technical problem, an embodiment of the present application further provides a random code generating apparatus, which adopts the following technical solutions:
a random code generation apparatus, comprising:
the scene type identification module is used for carrying out scene type identification on the newly input service scene based on a pre-trained scene type identification model;
the safety level determining module is used for determining the safety level corresponding to the scene according to the scene type identification result;
and the random code generation module is used for selecting a corresponding random code generator based on the security level corresponding to the scene to generate a random code.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which adopts the following technical solutions:
a computer device comprising a memory and a processor, the memory having computer readable instructions stored therein, the processor implementing the steps of the random code generation method when executing the computer readable instructions.
In order to solve the foregoing technical problem, an embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solutions:
a computer readable storage medium having computer readable instructions stored thereon which, when executed by a processor, implement the steps of the random code generation method as described above.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
according to the random code generation method, scene type recognition is carried out on a newly input service scene through a scene type recognition model based on pre-training; determining the security level corresponding to the scene according to the scene type identification result; and selecting a corresponding random code generator based on the security level corresponding to the scene to generate random codes, so that the random code which can specify the digit, the character set and the effective time of the multi-service scene is automatically and intelligently screened and generated by combining an artificial intelligence model.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram to which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a random code generation method according to the present application;
FIG. 3 is a flowchart illustrating an embodiment of pre-training the scene classification recognition model according to the present disclosure;
FIG. 4 is a flowchart of one embodiment of step 303 of FIG. 3;
FIG. 5 is a flow diagram of one embodiment of step 203 shown in FIG. 2;
FIG. 6 is a flow diagram for one embodiment of step 502 of FIG. 5;
FIG. 7 is a flowchart of one embodiment of generating non-reverse-breakable random codes in an embodiment of the present application;
FIG. 8 is a schematic block diagram of one embodiment of a random code generator according to the present application;
FIG. 9 is a schematic diagram of the structure of one embodiment of 803 shown in FIG. 8;
FIG. 10 is a schematic block diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, 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 belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the foregoing drawings are used for distinguishing between different objects and not for describing a particular sequential order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture experts Group Audio Layer III, motion Picture experts compression standard Audio Layer 3), MP4 players (Moving Picture experts Group Audio Layer iv, motion Picture experts compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that the random code generation method provided in the embodiments of the present application is generally executed by a server/terminal device, and accordingly, the random code generation apparatus is generally disposed in the server/terminal device.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow diagram of one embodiment of a random code generation method according to the present application is shown. The random code generation method comprises the following steps:
step 201, based on the pre-trained scene category identification model, performing scene category identification on the newly entered service scene.
In this embodiment, before the step of performing scene type recognition on the newly entered service scene based on the pre-trained scene type recognition model, the method further includes: acquiring N service scenes in advance, wherein N is a positive integer; dividing the N service scenes into a training set and a verification set according to a certain proportion; performing classification training on the training set based on a natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model; inputting the verification set into a classification model which is pre-trained to perform verification training; carrying out sensitivity detection on a verification training result based on a preset verification prediction form, and judging whether the detection result meets a preset sensitivity threshold value, wherein the sensitivity represents the proportion value of the number of correctly classified service scenes in the verification set to the total service scenes in the verification set; and if not, carrying out classification parameter fine adjustment on the classification model until the detection result meets a preset sensitivity threshold value, and finishing the pre-training of the scene classification recognition model.
The method comprises the steps of training and verifying a scene category recognition model by using a training set and a verification set in a sampling machine learning mode, obtaining the scene category recognition model after pre-training, obtaining key fields, namely labels, of a service scene by combining a natural language processing technology, predicting each label category by a naive Bayes algorithm, performing cluster classification, performing verification and classification parameter fine adjustment by sensitivity detection, and ensuring the applicability of the scene category recognition model after pre-training.
In this embodiment, the step of performing fine adjustment on the classification parameters of the classification model is specifically implemented as follows: and adjusting the cluster classification corresponding to different key fields by adjusting the classification parameters, namely the similarity, set by each cluster classification.
The verification and the classification parameter fine adjustment are carried out through sensitivity detection, so that the accuracy of scene category identification of the pre-trained scene category identification model is ensured.
With continuing reference to fig. 3, fig. 3 is a flowchart of a specific implementation of pre-training the scene classification recognition model in the embodiment of the present application, including the steps of:
step 301, acquiring N service scenes in advance, wherein N is a positive integer;
step 302, dividing the N service scenes into a training set and a verification set according to a certain proportion;
step 303, performing classification training on the training set based on a natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model;
in this embodiment, the step of performing classification training on the training set based on a natural language processing technique and a preset classification algorithm to obtain a classification model for the pre-training specifically includes: acquiring source codes and annotation information in the training set; identifying and extracting key fields in the source code and the annotation information based on natural language processing technology; and performing cluster classification on the key fields by using a preset classification algorithm, and taking a cluster classification result as a classification target result of the pre-trained classification model, wherein the preset classification algorithm is a naive Bayes algorithm.
And determining a key field directly by acquiring the source code and the annotation information in the training set, and taking the key field as a classification target result, namely a classification result corresponding to a service scene, so that the clustering classification result is more according to the source code and the annotation information, and the accuracy of the clustering classification result is ensured.
With continued reference to FIG. 4, FIG. 4 is a flowchart of one embodiment of step 303 of FIG. 3, comprising the steps of:
step 401, acquiring source codes and annotation information in the training set;
step 402, identifying and extracting key fields in the source code and the annotation information based on a natural language processing technology;
and 403, performing cluster classification on the key fields by using a preset classification algorithm, and taking a cluster classification result as a classification target result of the pre-trained classification model, wherein the preset classification algorithm is a naive Bayes algorithm.
Step 304, inputting the verification set into a classification model which is trained in advance, and performing verification training;
305, detecting the sensitivity of a verification training result based on a preset verification prediction form, and judging whether the detection result meets a preset sensitivity threshold, wherein the sensitivity represents the proportion value of the number of correctly classified service scenes in the verification set to the total service scenes in the verification set;
step 306, if the preset sensitivity threshold value is not met, fine adjustment of classification parameters is carried out on the classification model;
and 307, if the preset sensitivity threshold is met, completing the pre-training of the scene type recognition model.
In this embodiment, the step of performing scene type identification on the newly entered service scene based on the pre-trained scene type identification model specifically includes: acquiring a pre-estimated label of a newly input service scene based on a natural language processing technology in the scene category identification model; and predicting the scene category corresponding to the newly input service scene according to the pre-estimated label and a naive Bayesian algorithm in the scene category identification model.
And carrying out scene type prediction on the newly input service scene through the scene type identification model, thereby providing index reference for determining the corresponding security level.
Step 202, according to the scene type identification result, determining the security level corresponding to the scene.
In this embodiment, the step of determining the security level corresponding to the scene according to the scene type identification result specifically includes: presetting a scene category and security level association form; after the step of performing scene category identification on the newly entered service scene, determining a security level corresponding to the identified scene category based on the scene category and security level association form.
The method comprises the steps of determining the security level corresponding to the identified scene category by setting a scene category and security level association form, wherein the scene category and security level association form can correspond to one category of scene categories for one security level and also can correspond to a plurality of scene categories for one security level, specifically setting the security requirement of the service in the service scene which can be actually injected, and facilitating the random code generation of the plurality of service scenes respectively according to the security level requirement.
Step 203, selecting a corresponding random code generator based on the security level corresponding to the scene, and generating a random code.
In this embodiment, the step of selecting a corresponding random code generator based on the security level corresponding to the scene to generate a random code specifically includes: presetting a corresponding relation between a security level and a random code generator; after the step of determining the security level corresponding to the scene category, selecting a random code generator corresponding to the security level based on the corresponding relationship between the security level and the random code generator, and generating a random code.
With continued reference to FIG. 5, FIG. 5 is a flowchart of one embodiment of step 203 shown in FIG. 2, comprising the steps of:
step 501, presetting a corresponding relation between a security level and a random code generator;
step 502, after the step of determining the security level corresponding to the scene category, 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.
In this embodiment, the step of selecting the random code generator corresponding to the security level based on the correspondence between the security level and the random code generator to generate a random code specifically includes: presetting a character combination rule and a random code digit rule of the random code generator, wherein the character combination rule comprises that at least one preset character can be selected based on the security level to generate a random code, and the random code digit rule comprises that the random code digit is set based on a corresponding digit between a first preset digit and a second preset digit which can be selected by the random code digit rule, wherein the preset character comprises Arabic numerals, capital and small English characters, capital and small Greece letters, punctuation marks and Chinese characters; after the step of selecting the random code generator corresponding to the security level, determining a character combination mode corresponding to the security level based on the character combination rule, and determining a random code number corresponding to the security level according to the random code number rule; and screening the characters of the random code number from the character combination mode based on the character combination mode and the random code number, and generating a random code.
By setting the character combination rule and the random code number rule of the random code generator, the character selection during the random code generation can carry out the free combination among Arabic numerals, capital and small English characters, capital and small Greek letters, punctuation marks and Chinese characters according to the safety requirement of a service scene, and can also carry out the random code number selection, thereby ensuring the safety of the random code and the applicability of multiple service scenes.
With continued reference to FIG. 6, FIG. 6 is a flowchart of one embodiment of step 502 shown in FIG. 5, comprising the steps of:
step 601, presetting a character combination rule and a random code digit rule of the random code generator, wherein the character combination rule comprises that at least one preset character can be selected based on the security level to generate a random code, and the random code digit rule comprises that the random code digit is set based on a corresponding digit between a first preset digit and a second preset digit which can be selected by the random code digit rule, wherein the preset character comprises Arabic numerals, capital and small English characters, capital and small Greek letters, punctuation marks and Chinese characters;
step 602, after the step of selecting the random code generator corresponding to the security level, determining a character combination mode corresponding to the security level based on the character combination rule, and determining a random code number corresponding to the security level according to the random code number rule;
step 603, based on the character combination mode and the random code number, screening the characters of the random code number from the character combination mode, and generating a random code.
In this embodiment, after the step of selecting the characters of the random code number from the character combination mode based on the character combination mode and the random code number and generating a random code, the method further includes: acquiring a request sequence generated by current time, host ID and a random code; respectively carrying out binary conversion on the current time, the host ID, the request sequence and the random code; splicing the character string sequence without the spliced symbols of the binary conversion result to generate a binary target random number with a preset digit, wherein the preset digit can be 64 digits; performing at least any one of cyclic left shift operation, cyclic right shift operation and binary conversion operation on the binary characters in the target random number to generate a binary intermediate random number; and carrying out decimal coding on the intermediate random number, and setting effective duration to form a random code which cannot be reversely cracked.
By combining the current time, the host ID, the request sequence and the random code, binary conversion is carried out, left shift, right shift and binary conversion are circularly carried out, decimal coding is carried out, effective duration is set, the non-reverse cracking performance and the timeliness of the final random code are guaranteed, a safer random code generation method is provided, and the safety is improved.
With continuing reference to fig. 7, fig. 7 is a flowchart of a specific implementation of generating a non-reverse-breakable random code in the embodiment of the present application, including the steps of:
step 701, acquiring a request sequence generated by current time, host ID and a random code;
step 702, respectively performing binary conversion on the current time, the host ID, the request sequence and the random code;
step 703, performing character string sequence splicing without splicing symbols on the binary conversion result to generate a binary target random number with a preset digit, wherein the preset digit can be 64 digits;
step 704, performing at least any one of a cyclic left shift operation, a cyclic right shift operation and a binary conversion operation on the binary character in the target random number to generate a binary intermediate random number;
step 705, decimal coding is carried out on the intermediate random number, effective duration is set, and random codes which can not be decoded reversely are formed.
According to the method, scene type recognition is carried out on a newly input service scene through a pre-trained scene type recognition model; determining a security level corresponding to the scene according to a scene category identification result; and selecting a corresponding random code generator based on the security level corresponding to the scene to generate random codes, so that the random code which can specify the digit, the character set and the effective time of the multi-service scene is automatically and intelligently screened and generated by combining an artificial intelligence model.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
In the embodiment of the application, the mode of machine learning in the artificial intelligence technology is used for training the scene category identification model, and the random code generation function is also perfected by setting the character combination rule and the random code digit rule of the random code generator, so that the generation of the random code meets various service scenes and safety requirements, the artificial intelligence model is convenient to combine, and the automatic and intelligent random code screening generation of the multiple service scenes, which can specify the digit, the specified character set and the specified effective time, is carried out.
With further reference to fig. 8, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a random code generating apparatus, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 8, the random code generating apparatus 800 according to this embodiment includes: a scene category identification module 801, a security level determination module 802, and a random code generation module 803. Wherein:
a scene type identification module 801, configured to perform scene type identification on a newly entered service scene based on a pre-trained scene type identification model;
a security level determining module 802, configured to determine, according to a scene type identification result, a security level corresponding to the scene;
a random code generating module 803, configured to select a corresponding random code generator based on the security level corresponding to the scene, and generate a random code.
According to the method, scene type recognition is carried out on a newly input service scene through a pre-trained scene type recognition model; determining the security level corresponding to the scene according to the scene type identification result; and selecting a corresponding random code generator based on the security level corresponding to the scene to generate a random code, so as to automatically and intelligently screen and generate the random code with the assignable digit, the assigned character set and the assigned effective time of the multi-service scene in combination with an artificial intelligence model.
In some embodiments of the present application, the random code generating apparatus 800 further includes an identification model training module, the identification model training module is configured to pre-collect N service scenarios, where N is a positive integer, and is right the N service scenarios are divided into a training set and a verification set according to a certain proportion, and it is right based on a natural language processing technique and a preset classification algorithm that the training set performs classification training to obtain a classification model of pre-training, and the verification set is input into the classification model of pre-training completion to perform verification training, and performs sensitivity detection on a verification training result based on a preset verification estimation form, and determines whether a detection result satisfies a preset sensitivity threshold, where the sensitivity represents that the number of correctly classified service scenarios in the verification set accounts for a proportion value of a total service scenario in the verification set, and if not, performs classification parameter fine tuning on the classification model until the detection result satisfies the preset sensitivity threshold, and then the scene classification model performs pre-training completion.
In some embodiments of the present application, the random code generating apparatus 800 further includes a non-hackable setting module, where the non-hackable setting module is configured to obtain a current time, a host ID, and a request sequence generated by a random code, perform binary conversion on the current time, the host ID, the request sequence, and the random code, respectively, perform string sequence splicing without a splicing symbol on a binary conversion result, and generate a binary target random number with a preset number of bits, where the preset number of bits may be 64 bits; and performing at least any one of cyclic left shift operation, cyclic right shift operation and binary conversion operation on the binary characters in the target random number to generate a binary intermediate random number, performing decimal coding on the intermediate random number, and setting effective duration to form a random code which cannot be reversely cracked.
With continuing reference to fig. 9, fig. 9 is a schematic structural diagram of an embodiment of 803 shown in fig. 8, where the random code generating module 803 includes: a first setting submodule 8031, a second setting submodule 8032, a selection mode determining submodule 8033, and a random code generating submodule 8034. Wherein the content of the first and second substances,
a first setting submodule 8031 for presetting a correspondence between the security level and the random code generator;
a second setting sub-module 8032, configured to, after the step of determining the security level corresponding to the scene category, preset a character combination rule and a random number rule of the random number generator, where the character combination rule includes random number generation based on at least one preset character selectable by the security level, and the random number rule includes random number setting based on a corresponding number between a first preset number and a second preset number selectable by the random number rule, where the preset character includes an arabic number, a case-and-case english character, a case-and-case greek letter, a punctuation mark, and a chinese character;
a selection mode determining submodule 8033, configured to determine, after the step of selecting the random code generator corresponding to the security level, a character combination mode corresponding to the security level based on the character combination rule, and determine, according to the random code number rule, a random code number corresponding to the security level;
and the random code generation sub-module 8034 is configured to, based on the character combination mode and the random code number, screen the characters of the random code number from the character combination mode to generate a random code.
The random code generating module can screen and generate the random code which can specify the digit, the character set and the effective time in a multi-service scene by providing a character combination rule and a random code digit rule through the first setting submodule, the second setting submodule, the selection mode determining submodule and the random code generating submodule to generate the random code.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware associated with computer readable instructions, which can be stored in a computer readable storage medium, and when executed, the programs can include the processes of the embodiments of the methods described above. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless otherwise indicated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
In order to solve the technical problem, the embodiment of the application further provides computer equipment. Referring to fig. 10, fig. 10 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 10 includes a memory 10a, a processor 10b, and a network interface 10c, which are communicatively connected to each other via a system bus. It should be noted that only a computer device 10 having components 10a-10c is shown, but it should be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 10a includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 10a may be an internal storage unit of the computer device 10, such as a hard disk or a 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, a Smart Media Card (SMC), a Secure Digital (SD) Card, a flash Card (FlashCard), or the like provided on the computer device 10. Of course, the memory 10a may also include both an internal storage unit and an external storage device of the computer device 10. In this embodiment, the memory 10a is generally used for storing an operating system installed in the computer device 10 and various application software, such as computer readable instructions of a random code generation method. Further, the memory 10a may also be used to temporarily store various types of data that have been output or are to be output.
The processor 10b may be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor, or other data Processing chip in some embodiments. The processor 10b is generally used to control the overall operation of the computer device 10. In this embodiment, the processor 10b is configured to execute computer readable instructions stored in the memory 10a or process data, for example, execute computer readable instructions of the random code generation method.
The network interface 10c may comprise a wireless network interface or a wired network interface, and the network interface 10c is generally used for establishing a communication connection between the computer device 10 and other electronic devices.
The embodiment provides computer equipment, and belongs to the technical field of security verification. According to the method, the newly input service scene is subjected to scene type recognition through a pre-trained scene type recognition model; determining a security level corresponding to the scene according to a scene category identification result; and selecting a corresponding random code generator based on the security level corresponding to the scene to generate random codes, so that the random code which can specify the digit, the character set and the effective time of the multi-service scene is automatically and intelligently screened and generated by combining an artificial intelligence model.
The present application further provides another embodiment, which is to provide a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, which can be executed by a processor, so as to cause the processor to execute the steps of the random code generation method as described above.
The embodiment provides a computer-readable storage medium, and belongs to the technical field of security verification. According to the method, scene type recognition is carried out on a newly input service scene through a pre-trained scene type recognition model; determining the security level corresponding to the scene according to the scene type identification result; and selecting a corresponding random code generator based on the security level corresponding to the scene to generate random codes, so that the random code which can specify the digit, the character set and the effective time of the multi-service scene is automatically and intelligently screened and generated by combining an artificial intelligence model.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It should be understood that the above-described embodiments are merely exemplary of some, and not all, embodiments of the present application, and that the drawings illustrate preferred embodiments of the present application without limiting the scope of the claims appended hereto. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields, and all the equivalent structures are within the protection scope of the present application.

Claims (11)

1. A random code generation method, comprising the steps of:
based on a pre-trained scene category identification model, carrying out scene category identification on a newly input service scene;
determining the security level corresponding to the scene according to the scene type identification result;
and selecting a corresponding random code generator based on the security level corresponding to the scene to generate a random code.
2. The random code generation method according to claim 1, wherein before the step of performing scene class recognition on the newly entered service scene based on the pre-trained scene class recognition model, the method further comprises:
n service scenes are collected in advance, wherein N is a positive integer;
dividing the N service scenes into a training set and a verification set according to a certain proportion;
performing classification training on the training set based on a natural language processing technology and a preset classification algorithm to obtain a pre-trained classification model;
inputting the verification set into a classification model which is trained in advance, and performing verification training;
carrying out sensitivity detection on a verification training result based on a preset verification prediction form, and judging whether the detection result meets a preset sensitivity threshold value, wherein the sensitivity represents the proportion value of the number of correctly classified service scenes in the verification set to the total service scenes in the verification set;
if not, fine-tuning the classification parameters of the classification model until the detection result meets a preset sensitivity threshold, and completing the pre-training of the scene classification recognition model.
3. The method for generating random codes according to claim 2, wherein the step of performing classification training on the training set based on a natural language processing technique and a preset classification algorithm to obtain a pre-trained classification model specifically comprises:
acquiring source codes and annotation information in the training set;
identifying and extracting key fields in the source code and the annotation information based on natural language processing technology;
and performing cluster classification on the key fields by using a preset classification algorithm, and taking a cluster classification result as a classification target result of the pre-trained classification model, wherein the preset classification algorithm is a naive Bayes algorithm.
4. The method for generating random codes according to claim 3, wherein the step of performing scene type recognition on the newly entered service scene based on the pre-trained scene type recognition model specifically includes:
acquiring a pre-estimated label of a newly input service scene based on a natural language processing technology in the scene category identification model;
and predicting the scene category corresponding to the newly input service scene according to the pre-estimated label and a naive Bayesian algorithm in the scene category identification model.
5. The method for generating a random code according to claim 1, wherein the step of determining the security level corresponding to the scene according to the scene type identification result specifically includes:
presetting a scene category and security level association form;
after the step of identifying the scene category of the newly entered service scene, determining the security level corresponding to the identified scene category based on the scene category and the security level association form.
6. The method for generating a random code according to claim 1, wherein the step of selecting a corresponding random code generator based on the security level corresponding to the scene to generate a random code specifically includes:
presetting a corresponding relation between a security level and a random code generator;
after the step of determining the security level corresponding to the scene category, selecting a random code generator corresponding to the security level based on the corresponding relationship between the security level and the random code generator, and generating a random code.
7. The method according to claim 6, wherein the step of selecting the random code generator corresponding to the security level based on the correspondence between the security level and the random code generator to generate the random code specifically comprises:
presetting a character combination rule and a random code digit rule of the random code generator, wherein the character combination rule comprises that at least one preset character can be selected based on the security level to generate a random code, the random code digit rule comprises that the random code digit is set based on the corresponding digit between a first preset digit and a second preset digit which can be selected by the random code digit rule, and the preset character comprises Arabic numerals, capital and small English characters, capital and small Greek letters, punctuation marks and Chinese characters;
after the step of selecting the random code generator corresponding to the security level, determining a character combination mode corresponding to the security level based on the character combination rule, and determining a random code number corresponding to the security level according to the random code number rule;
and screening the characters of the random code number from the character combination mode based on the character combination mode and the random code number, and generating a random code.
8. The method according to claim 7, wherein after the step of selecting the characters of the random code number from the character combination manner based on the character combination manner and the random code number and performing random code generation, the method further comprises:
acquiring a request sequence generated by current time, host ID and a random code;
respectively carrying out binary conversion on the current time, the host ID, the request sequence and the random code;
splicing the character string sequence without the spliced symbols of the binary conversion result to generate a binary target random number with a preset digit, wherein the preset digit can be 64 digits;
performing at least any one of cyclic left shift operation, cyclic right shift operation and binary conversion operation on the binary characters in the target random number to generate a binary intermediate random number;
and carrying out decimal coding on the intermediate random number, and setting effective duration to form a random code which cannot be reversely cracked.
9. A random code generation apparatus, comprising:
the scene type identification module is used for carrying out scene type identification on the newly input service scene based on a pre-trained scene type identification model;
the safety level determining module is used for determining the safety level corresponding to the scene according to the scene type identification result;
and the random code generation module is used for selecting a corresponding random code generator based on the security level corresponding to the scene to generate a random code.
10. A computer device comprising a memory having computer readable instructions stored therein and a processor which when executed implements the steps of the random code generation method of any of claims 1 to 8.
11. A computer-readable storage medium having computer-readable instructions stored thereon which, when executed by a processor, implement the steps of the random code generation method of any one of claims 1 to 8.
CN202211017402.3A 2022-08-23 2022-08-23 Random code generation method and device, computer equipment and storage medium Pending CN115373634A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211017402.3A CN115373634A (en) 2022-08-23 2022-08-23 Random code generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211017402.3A CN115373634A (en) 2022-08-23 2022-08-23 Random code generation method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115373634A true CN115373634A (en) 2022-11-22

Family

ID=84068180

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211017402.3A Pending CN115373634A (en) 2022-08-23 2022-08-23 Random code generation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115373634A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116488810A (en) * 2023-06-21 2023-07-25 鼎铉商用密码测评技术(深圳)有限公司 Identity authentication method, identity authentication system, and readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116488810A (en) * 2023-06-21 2023-07-25 鼎铉商用密码测评技术(深圳)有限公司 Identity authentication method, identity authentication system, and readable storage medium
CN116488810B (en) * 2023-06-21 2023-10-20 鼎铉商用密码测评技术(深圳)有限公司 Identity authentication method, identity authentication system, and readable storage medium

Similar Documents

Publication Publication Date Title
CN112685565B (en) Text classification method based on multi-mode information fusion and related equipment thereof
CN113326991B (en) Automatic authorization method, device, computer equipment and storage medium
CN112084752B (en) Sentence marking method, device, equipment and storage medium based on natural language
CN112446209A (en) Method, equipment and device for setting intention label and storage medium
CN112699213A (en) Speech intention recognition method and device, computer equipment and storage medium
CN113947095A (en) Multilingual text translation method and device, computer equipment and storage medium
CN115544560A (en) Desensitization method and device for sensitive information, computer equipment and storage medium
CN115757731A (en) Dialogue question rewriting method, device, computer equipment and storage medium
CN111639360A (en) Intelligent data desensitization method and device, computer equipment and storage medium
CN115373634A (en) Random code generation method and device, computer equipment and storage medium
CN114386013A (en) Automatic student status authentication method and device, computer equipment and storage medium
CN115730237B (en) Junk mail detection method, device, computer equipment and storage medium
CN115967549A (en) Anti-leakage method based on internal and external network information transmission and related equipment thereof
CN115564000A (en) Two-dimensional code generation method and device, computer equipment and storage medium
CN112396111A (en) Text intention classification method and device, computer equipment and storage medium
CN114358023A (en) Intelligent question-answer recall method and device, computer equipment and storage medium
CN113505595A (en) Text phrase extraction method and device, computer equipment and storage medium
CN114117037A (en) Intention recognition method, device, equipment and storage medium
CN112417886A (en) Intention entity information extraction method and device, computer equipment and storage medium
CN112949320A (en) Sequence labeling method, device, equipment and medium based on conditional random field
CN112733645A (en) Handwritten signature verification method and device, computer equipment and storage medium
CN112949317B (en) Text semantic recognition method and device, computer equipment and storage medium
CN115250200B (en) Service authorization authentication method and related equipment thereof
CN112966085A (en) Intelligent control method and device for human-computer conversation, electronic equipment and storage medium
CN113761577B (en) Big data desensitization method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination