Password generation method and device, password identification method and device, and electronic device
By segmenting high-frequency strings and generating passwords through generative adversarial network training, the problem of low password dictionary hit rate in existing password guessing tools is solved, and the versatility and security of passwords are improved.
Patent Information
- Application Number
- CN202011643390.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-30
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2040-12-30
AI Technical Summary
The password dictionary hit rate of existing password guessing tools is low, lacks versatility, and is difficult to effectively identify weak passwords.
By obtaining real passwords, segmenting high-frequency strings, constructing feature vectors, and using generative adversarial networks for training, more versatile passwords can be generated.
The generated password is more in line with user habits, has higher versatility and actual use value, and improves password security and identification capabilities.
Smart Images

Figure CN112667979B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a password generation method and device, a password recognition method and device, an electronic device, and a computer-readable storage medium. Background Art
[0002] In the continuous development of society, passwords have always been a popular authentication method for people, and people have been using passwords for thousands of years. The main reason is that passwords are easy to implement, do not require special hardware or software, are low-cost, and users and developers are familiar with password-related businesses. However, users tend to choose passwords that are easy to guess, which are mainly composed of common strings such as password, 123456, iloveyou, etc. and their variants.
[0003] Currently, password guessing tools provide an effective way to identify weak passwords. The effectiveness of password guessing software depends on the ability to quickly detect a large number of passwords that are likely to be weak. Instead of exhaustively trying all possible character combinations, password guessing tools use dictionary words and previously leaked passwords as candidate passwords. If the password entered by the user is directly a word from the dictionary, or a previously leaked password, the password entered by the user is considered to be a weak password.
[0004] However, actual users seldom use a single word as their password, or still use leaked passwords. Therefore, the password dictionary hit rate of password guessing tools is low, and the passwords included lack universality. Summary of the invention
[0005] The embodiment of the present application provides a password generation method for generating a more universal password.
[0006] In a first aspect, an embodiment of the present application provides a password generation method, comprising:
[0007] Get the real password;
[0008] Segment the real password according to the known high-frequency character string to obtain a segmentation result of the real password;
[0009] Constructing a feature vector of the real password according to the segmentation result of the real password;
[0010] Using the feature vector of the real password as a training sample, training a generative adversarial network to obtain a generative adversarial model;
[0011] The generative model in the generative adversarial model is used to generate a password.
[0012] The technical solution provided in this application segments real passwords based on "high-frequency character strings", generates feature vectors based on the segmentation results, performs innovative optimization from the feature level, and then uses the feature vectors of the real passwords as training samples to train a generative adversarial network. The generative model in the trained generative adversarial model is then used to generate passwords, so that the generated passwords are more in line with the habits of real users in setting passwords and are more universal.
[0013] In one embodiment, before segmenting the real password according to the known high-frequency character string to obtain the segmentation result of the real password, the method further includes:
[0014] The high-frequency character string is obtained according to the frequencies of occurrence of different character sequences in the real password library.
[0015] By determining high-frequency character strings based on the frequencies of occurrence of different character sequences, the segmentation results of the real password can be made more consistent with the character composition habits of the public when setting passwords, thereby improving the accuracy of the feature vector of the real password.
[0016] In one embodiment, obtaining the high-frequency character string according to the frequencies of occurrence of different character sequences in the real password library includes:
[0017] Segmenting the real passwords in the real password database into character units;
[0018] Count the occurrence frequency of character sequences consisting of any two consecutive characters, select the character sequence with the highest occurrence frequency as a word, and construct a word list;
[0019] On the basis of the character sequence with the highest frequency, the next character is added to obtain a new character sequence, and the character sequence with the highest frequency is selected as a word each time to update the word list; until the number of words in the sub-word list is greater than a threshold or the number of occurrences of the next highest frequency character sequence is a set value; the words in the word list are used as the known high-frequency character strings.
[0020] Through the above method, the high-frequency character string can contain as many characters as possible and the frequency of occurrence of the high-frequency character string can be relatively high, which is more in line with the public's habit of forming characters when setting passwords and improves the accuracy of the feature vector of the real password.
[0021] In one embodiment, before obtaining the high-frequency character string according to the frequencies of occurrence of different character sequences in the real password library, the method further includes:
[0022] Get the initial password library,
[0023] The real password library is obtained by removing the real passwords whose formats, password lengths or characters do not meet the preset requirements in the initial password library.
[0024] Through the above method, the initial password library can be cleaned and screened to obtain a more valuable real password library to provide data support for the establishment of subsequent models.
[0025] In one embodiment, removing the real passwords whose format, password length or characters do not meet the preset requirements in the initial password library to obtain the real password library includes:
[0026] The intermediate password library is obtained by removing the real passwords whose formats, password lengths or characters do not meet the preset requirements in the initial password library;
[0027] Calculating the distribution of any real password in the intermediate password library;
[0028] The real passwords whose distribution amount is less than the quantity threshold are divided into a first set, and the real passwords whose distribution amount is greater than or equal to the quantity threshold are divided into a second set;
[0029] Randomly sampling from the first set to form a first real password set, and for each real password in the second set, performing downsampling in proportion to the corresponding distribution amount in the intermediate password library to form a second real password set;
[0030] The first real password set and the second real password set are aggregated to obtain the real password library.
[0031] Through the above method, the problems of excessive amount of data in the initial password library, excessive time cost of subsequent data processing, and downsampling greatly changing the data distribution can be solved. The embodiment of the present application performs segmented sampling, which can greatly reduce the impact on the data distribution in the real password library, and the amount of data will not be too large, thereby improving the accuracy of the trained model.
[0032] In one embodiment, segmenting the real password according to the known high-frequency character string to obtain the segmentation result of the real password includes:
[0033] According to the known high-frequency character string, the real password is segmented to obtain a single character and / or a character string consisting of multiple characters.
[0034] The real password is segmented according to the "high-frequency character string". Different segmentation results can be obtained based on the different real passwords. Subsequently, a feature vector can be constructed based on the segmentation results to improve the accuracy of the feature vector.
[0035] In one embodiment, constructing a feature vector of the real password according to the segmentation result of the real password includes:
[0036] If the segmentation result of the real password includes a single character and a character string consisting of multiple characters, a feature vector of the real password is formed by concatenating the feature value of the single character and the feature value of the character string.
[0037] Based on the eigenvalues of individual characters and the eigenvalues of character strings, a eigenvector of the real password is obtained, which can improve the accuracy of the eigenvector and further improve the accuracy of the model obtained by subsequent training.
[0038] In one embodiment, the feature vector of the real password is used as a training sample to train a generative adversarial network to obtain a generative adversarial model, including:
[0039] Generate a feature vector of a pseudo password through a generator of the generative adversarial network; the generator is an intermediate model or an initial model of the generative model;
[0040] Using the feature vector of the pseudo password and the feature vector of the real password as inputs of the discriminator of the generative adversarial network respectively, and obtaining the probability value of the authenticity of the password output by the discriminator;
[0041] According to the password authenticity probability value output by the discriminator, the network parameters of the generator and the discriminator are optimized alternately until the network converges to obtain the generative adversarial model.
[0042] The generative adversarial model trained in the above manner can generate passwords that are close to real passwords, thereby improving the accuracy of the model.
[0043] In one embodiment, the feature vector of the pseudo password and the feature vector of the real password are respectively used as inputs of the discriminator of the generative adversarial network to obtain the password authenticity probability value output by the discriminator, including:
[0044] After concatenating the feature vector of the pseudo password with the character string category constituting the pseudo password, the concatenated feature vector is used as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the pseudo password output by the discriminator;
[0045] After concatenating the feature vector of the real password with the character string category constituting the real password, the concatenated feature vector is used as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the real password output by the discriminator;
[0046] The generation model in the generative adversarial model is used to generate a password, including:
[0047] Using a specified string category and random noise as inputs of a generation model in the generative adversarial model, and obtaining a password feature vector corresponding to the specified string category output by the generation model;
[0048] The characteristic value of each dimension in the password characteristic vector is converted into a corresponding character or character string for output.
[0049] In the above embodiment, the network architecture is innovated and character string categories are introduced, so that passwords of specified categories can be generated on demand to meet the needs of various different scenarios.
[0050] In one embodiment, the step of generating a feature vector of a pseudo password by a generator of the generative adversarial network includes:
[0051] Any string category and random noise are used as inputs of the generator of the generative adversarial network to obtain a feature vector of the pseudo password output by the generator.
[0052] In the above embodiment, during the training phase of the generator, the input of the generator introduces a string category, so that the generation model obtained by subsequent training can generate passwords of different categories based on category requirements.
[0053] In one embodiment, after the generation of the password using the generative model in the generative adversarial model, the method further includes:
[0054] The passwords generated by the generation model are added to the simulation password set, and the simulation password set is deduplicated to obtain a target password set.
[0055] The above embodiment can avoid duplicate passwords in the target password set that is finally generated.
[0056] In a second aspect, an embodiment of the present application provides a password generation method, comprising:
[0057] Get the real password;
[0058] Segment the real password according to the known high-frequency character string to obtain a segmentation result of the real password;
[0059] Constructing a feature vector of the real password according to the segmentation result of the real password;
[0060] Using the feature vector of the real password and the character string category constituting the real password as training samples, training a generative adversarial network to obtain a generative adversarial model;
[0061] Taking a specified string category as input, a generative model in the generative adversarial model is used to generate a password corresponding to the specified string category.
[0062] In the above embodiment, the architecture of the generative adversarial network is improved, and string categories are introduced into the training of the generative adversarial model, so that the generative model obtained by subsequent training can generate passwords of different categories based on category requirements.
[0063] In a third aspect, an embodiment of the present application provides a password generation method, comprising:
[0064] Get random noise;
[0065] Taking the random noise as input, generating a password through a generative model in a trained generative adversarial model;
[0066] The generative adversarial model is trained by taking the feature vector of the real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string and then segmenting the real password according to the segmentation result.
[0067] The password generated by the above method conforms to the password setting habits of the general users, has strong versatility, and has greater utilization value.
[0068] In one embodiment, the step of taking random noise as input and generating a password through a generative model in a trained generative adversarial model comprises:
[0069] Using the random noise and the specified character string category as inputs of a generative model in the generative adversarial model, and obtaining a password feature vector corresponding to the specified character string category output by the generative model;
[0070] The characteristic value of each dimension in the password characteristic vector is converted into a corresponding character or character string for output.
[0071] The above method can generate passwords of specified categories on demand to meet the needs of different scenarios.
[0072] In a fourth aspect, an embodiment of the present application provides a password recognition method, comprising:
[0073] Get the password to be identified;
[0074] Determine whether the password to be identified is the same as any password in the simulation password set, and obtain an identification result of the password to be identified according to the determination result;
[0075] Wherein, the passwords in the simulated password set are generated by a generative model in a trained generative adversarial model;
[0076] The generative adversarial model is trained by taking the feature vector of the real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string and based on the segmentation result.
[0077] Through the above method, weak passwords can be identified and security can be improved.
[0078] In a fifth aspect, an embodiment of the present application provides a password generation device, comprising:
[0079] Password acquisition module, used to obtain the real password;
[0080] A password segmentation module, used to segment the real password according to known high-frequency character strings to obtain a segmentation result of the real password;
[0081] A feature extraction module, used to construct a feature vector of the real password according to the segmentation result of the real password;
[0082] A model training module, used to train a generative adversarial network using the feature vector of the real password as a training sample to obtain a generative adversarial model;
[0083] A password generation module is used to generate a password using a generation model in the generative adversarial model.
[0084] In a sixth aspect, an embodiment of the present application provides a password generation device, including:
[0085] Password acquisition module, used to obtain the real password;
[0086] A password segmentation module, used to segment the real password according to known high-frequency character strings to obtain a segmentation result of the real password;
[0087] A feature extraction module, used to construct a feature vector of the real password according to the segmentation result of the real password;
[0088] A model training module, used to train a generative adversarial network using the feature vector of the real password and the character string category constituting the real password as training samples to obtain a generative adversarial model;
[0089] The password generation module is used to take a specified string category as input and use the generation model in the generative adversarial model to generate a password corresponding to the specified string category.
[0090] In a seventh aspect, an embodiment of the present application provides a password generation device, including:
[0091] A noise acquisition module, used to acquire random noise;
[0092] A password generation module, configured to take the random noise as input and generate a password through a generative model in a trained generative adversarial model;
[0093] The generative adversarial model is trained by taking the feature vector of the real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string and then segmenting the real password according to the segmentation result.
[0094] In an eighth aspect, an embodiment of the present application provides a password recognition device, including:
[0095] A password acquisition module, used to acquire the password to be identified;
[0096] A password identification module, used to determine whether the password to be identified is the same as any password in the simulation password set, and obtain an identification result of the password to be identified according to the determination result;
[0097] Wherein, the passwords in the simulated password set are generated by a generative model in a trained generative adversarial model;
[0098] The generative adversarial model is trained by taking the feature vector of the real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string and based on the segmentation result.
[0099] In a ninth aspect, an embodiment of the present application provides an electronic device, the electronic device comprising:
[0100] processor;
[0101] a memory for storing processor-executable instructions;
[0102] The processor is configured to execute the password generation method or the password recognition method.
[0103] In the tenth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program can be executed by a processor to complete the above-mentioned password generation method or execute the above-mentioned password recognition method.
[0104] In an eleventh aspect, an embodiment of the present application provides a computer program product, which, when running on a computer, enables the computer to execute the above-mentioned password generation method or password identification method. BRIEF DESCRIPTION OF THE DRAWINGS
[0105] In order to more clearly illustrate the technical solution of the embodiments of the present application, the drawings required for use in the embodiments of the present application are briefly introduced below.
[0106] Figure 1 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application;
[0107] Figure 2 It is a flowchart of a password generation method provided in an embodiment of the present application;
[0108] Figure 3 It is a schematic diagram of the principle of feature extraction provided by an embodiment of the present application;
[0109] Figure 4 Schematic diagram of the architecture of a generative adversarial network provided in an embodiment of the present application;
[0110] Figure 5 is a flowchart of a password generation method provided by another embodiment of the present application;
[0111] Figure 6 yes Figure 5 Detailed flowchart of step 200 in the corresponding embodiment;
[0112] Figure 7 It is a statistical password length distribution chart;
[0113] Figure 8 It is a schematic diagram of the data sampling process provided by the embodiment of the present application;
[0114] Fig. 9 Schematic diagram of the training process of the generative adversarial network provided in the embodiment of the present application;
[0115] Fig.10 is a schematic diagram of the architecture of a generative adversarial network provided in another embodiment of the present application;
[0116] Fig.11 It is a complete flowchart of a password generation method provided by another embodiment of the present application;
[0117] Fig.12 is a flowchart of a password generation method provided by another embodiment of the present application;
[0118] Fig.13 is a flowchart of a password generation method provided by another embodiment of the present application;
[0119] Fig.14 It is a flowchart of a password recognition method provided in an embodiment of the present application;
[0120] Fig.15 is a block diagram of a password generating device provided in an embodiment of the present application;
[0121] Fig.16A block diagram of a password generating device provided by another embodiment of the present application;
[0122] Fig.17 A block diagram of a password recognition device provided by another embodiment of the present application. DETAILED DESCRIPTION
[0123] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0124] Similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0125] Figure 1 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 100 can be used to execute the password generation method provided in the embodiment of the present application or the password recognition method provided in the embodiment of the present application below. Figure 1 As shown, the electronic device 100 includes: one or more processors 102, and one or more memories 104 storing processor executable instructions. The processor 102 is configured to execute the password generation method or password identification method provided in the following embodiments of the present application.
[0126] The processor 102 can be a gateway, a smart terminal, or a device including a central processing unit (CPU), a graphics processing unit (GPU), or other forms of processing units with data processing capabilities and / or instruction execution capabilities. It can process data of other components in the electronic device 100 and control other components in the electronic device 100 to perform desired functions.
[0127] The memory 104 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 102 may run the program instructions to implement the password generation method described below. Various applications and various data, such as various data used and / or generated by the application, may also be stored in the computer-readable storage medium.
[0128] In one embodiment, Figure 1 The electronic device 100 shown may also include an input device 106, an output device 108, and a data acquisition device 110, which are interconnected via a bus system 112 and / or other forms of connection mechanisms (not shown). Figure 1 The components and structures of the electronic device 100 shown are merely exemplary and non-limiting. The electronic device 100 may also have other components and structures as required.
[0129] The input device 106 may be a device for a user to input instructions, and may include one or more of a keyboard, a mouse, a microphone, a touch screen, etc. The output device 108 may output various information (e.g., images or sounds) to the outside (e.g., a user), and may include one or more of a display, a speaker, etc. The data acquisition device 110 may acquire an image of an object, and store the acquired image in the memory 104 for use by other components. Exemplarily, the data acquisition device 110 may be a camera.
[0130] In one embodiment, the various components in the example electronic device 100 for implementing the password generation method or password recognition method of the embodiment of the present application can be integrated or dispersed, such as integrating the processor 102, memory 104, input device 106 and output device 108 into one, while separating the data acquisition device 110.
[0131] In one embodiment, the example electronic device 100 for implementing the password generation method or password identification method of the embodiment of the present application can be implemented as a laptop computer, a desktop computer, a server, or a server cluster.
[0132] An embodiment of the present application provides a computer program product. When the computer program product is run on a computer, the computer executes the following password generation method or password identification method.
[0133] The password generation method and password identification method are described in detail below.
[0134] Figure 2 Schematic diagram of a password generation method provided in an embodiment of the present application. The method can be executed by the electronic device 100, such as Figure 2 As shown, the method includes the following steps S210-S250.
[0135] Step S210: Obtain the real password.
[0136] Among them, the real password is relative to the passwords in the pseudo-password and simulation password set below, which can be passwords that have been used by actual users in password dictionaries or on the Internet. For the purpose of distinction, the passwords in the existing weak password library can be considered as real passwords. The passwords generated by the generative adversarial model below can be called passwords, or, before being used as formal passwords, they are first added to the simulation password set (in this case, they can be called simulation passwords), and after specific processing, they are used as passwords. Before the training of the generative adversarial model is completed, the passwords generated by the untrained generative adversarial network can be called pseudo-passwords.
[0137] In one embodiment, the real password can be obtained from an existing weak password library, which can be stored locally in advance or obtained from an external device. Generally, a password that can be guessed can be called a weak password, and the weak password library can include words in a dictionary and previously leaked passwords. It should be noted that the weak password in this embodiment is only one type of real password, and the real password is not limited to weak passwords, but can also include strong passwords that have been disclosed. In principle, any password that has been actually used by the user can be used as the real password here. Based on the fact that there are fewer ways to obtain strong passwords, and it is relatively easy to obtain weak passwords, therefore, in actual use, a large number of weak passwords are often obtained as real passwords.
[0138] Step S220: segmenting the real password according to the known high-frequency character string to obtain the segmentation result of the real password.
[0139] Among them, the known high-frequency character string refers to a known character sequence with a high frequency of occurrence. For example, a character sequence with a frequency greater than a threshold can be considered a high-frequency character string. The threshold value can be set based on experience. In one embodiment, it can be considered that which character sequences are known to belong to high-frequency character strings. Assuming that "low" and "est" have a high frequency of occurrence in the weak password library, "low" and "est" can be called high-frequency character strings.
[0140] The segmentation results may vary depending on the actual password. For example, the segmentation results may include a single character and a string consisting of multiple characters. The segmentation results may include a string consisting of multiple characters. The segmentation results may include multiple characters.
[0141] For example, assuming the real password is "newest", since "est" is a known high-frequency string, it can be divided into four parts: "n / e / w / est"; that is, the real password can be divided into single characters "n", "e", "w" and a high-frequency string "est" composed of multiple characters.
[0142] For example, assuming that the real password is "low" and the known high-frequency character string is "low", the real password "low" can be segmented into a whole, and the segmentation result is the character string "low".
[0143] For example, assuming the real password is "lower", and the known high-frequency character string is "low", the real password "lower" can be divided into a character string "low" containing multiple characters and single characters "e" and "r".
[0144] For example, assuming the real password is "lowest", and the known high-frequency character strings are "low" and "est", the real password "lowest" can be divided into a character string "low" containing multiple characters, and a character string "est" containing multiple characters.
[0145] For example, if the real password is "abcd" and does not contain a known high-frequency character string, the real password can be divided into single characters "a", "b", "c", and "d".
[0146] Step S230: constructing a feature vector of the real password according to the segmentation result of the real password.
[0147] The feature vector refers to the character features of the real password in vector form. Different real passwords have different feature vectors.
[0148] In one embodiment, assuming that the segmentation result includes a single character and a character string consisting of multiple characters, the feature vector of the real password can be obtained by concatenating the feature value of the single character and the feature value of the character string.
[0149] For example, the real password "lower" can be divided into a string "low" containing multiple characters and single characters "e" and "r". Then the feature value of the string "low", the feature value of the single character "e", and the feature value of the single character "r" can be concatenated in sequence according to the order of the strings and characters in the real password to obtain the feature vector of the real password "lower".
[0150] The characteristic value of a character or a string can be used to represent the ID (serial number) of the character or the string.
[0151] Similarly, assuming that the segmentation result only contains characters or strings, the feature vector of the real password can be obtained based only on the feature values of the characters or strings.
[0152] Figure 3 This is a schematic diagram of the principle of feature extraction. Figure 3 As shown, the real password is segmented by characters, such as Figure 3There are 4 real passwords in the text file: low, lower, newest, and widest. After step ①, they are formed into l / o / w, l / o / w / e / r, n / e / w / e / s / t, and w / i / d / e / s / t (" / " indicates segmentation), which are segmented into characters. After step ②, the frequency of occurrence of different character sequences is counted, and it can be seen that low and est are high-frequency strings with high frequency of occurrence. Therefore, the final segmentation method is low, low / e / r, n / e / w / est, and w / i / d / est. The feature vector obtained based on the segmentation result in step ③ can be used as a training sample to input into the network model (i.e., the generative adversarial network).
[0153] The main purpose of extracting feature vectors is to serve as the input of the subsequent generative adversarial network. Generating feature vectors in units of characters will cause the problem of easily generating random passwords. The embodiment of the present application segments real passwords according to known high-frequency character strings and generates feature vectors. This can further improve the semantic information of the passwords generated by the model, so that they can better meet people's tendencies or habits in actual password usage scenarios, and optimize and innovate at the feature level.
[0154] Step S240: Using the feature vector of the real password as a training sample, training the generative adversarial network to obtain a generative adversarial model.
[0155] For the purpose of distinction, a generative adversarial network refers to a network model before training is completed, which may include untrained generators and discriminators. A generative adversarial model refers to a network model obtained by training a generative adversarial network, which may include trained generative models and trained discriminative models. For the purpose of distinction, a generator is called a generative model after training, and a discriminator is called a discriminative model after training.
[0156] Among them, the generative adversarial model can be trained by the generative adversarial network through a large number of training samples. The feature vector of a real password can be used as a training sample. The training sample is used as the input of the discriminator of the generative adversarial network to train the generative adversarial network, automatically learn the multi-dimensional and high-order characteristics of a large number of passwords, and obtain the optimal generator to generate passwords in the next step. This makes the generated password pattern more diverse, and has better generalization and versatility, reduces the overall cost, and is easy to be widely used in actual usage scenarios.
[0157] Generative Adversarial Network (GAN): It is a method of unsupervised learning. The generator (G) randomly samples from the latent space as input, and its output needs to imitate the real samples in the training set as much as possible to deceive the discriminator as much as possible. The input of the discriminator (D) is the training sample (i.e. the real password) or the output of the generator. Its purpose is to distinguish the output of the generated network from the real password as much as possible. The two networks compete with each other and continuously adjust the parameters. The ultimate goal is to make it impossible for the discriminator to determine whether the output of the generator is real.
[0158] In one embodiment, the generator G and the discriminator D in the generative adversarial network can be structures such as a fully connected neural network (FCN), a convolutional neural network (CNN), a recurrent neural network (RNN), a long short-term memory model (LSTM), etc. Among them, the architecture of the generative adversarial network can be as follows: Figure 4 The PassGAN network structure shown in Figure 2 is shown in Figure 2. Figure 4 As shown in the figure, the generative adversarial network consists of two parts: the generator G and the discriminator D. In order to learn deeper features and improve the model's capabilities, a deep convolutional network, namely a 5-layer Residual Block, is used in the structure. The residual structure Shortcut Connection is used in each Residual Block to effectively prevent the gradient vanishing problem caused by the deepening of the number of layers.
[0159] The input of the generator is random noise (i.e., random numbers), the input of the discriminator is the training sample or the output of the generator, and the output of the discriminator is used to indicate the probability that the input of the discriminator belongs to the training sample, that is, the probability of belonging to the real password. A large number of training samples are used as the input of the discriminator, and the generator and discriminator are repeatedly optimized and iterated. The goal is to enable the discriminator to accurately judge the training samples, that is, the probability of the output corresponding to the training samples is as close to 1 as possible, and the password generated by the generator makes it impossible for the discriminator to distinguish the authenticity, that is, when the output of the generator is used as the input of the discriminator, the output probability is as close to 0.5 as possible. Finally, the optimal generative adversarial network is obtained, which is the trained generative adversarial model.
[0160] Step S250: Generate a password using the generative model in the generative adversarial model.
[0161] The generative adversarial model includes the trained generative model and discriminative model. The output of the generative model can be obtained by taking random noise as the input of the generative model. The output of the generative model can be considered as the feature vector of the password. By converting the feature value of each dimension into the corresponding character or string, the required password can be obtained.
[0162] The embodiment of the present application segments the real password based on the "high-frequency character string", generates a feature vector according to the segmentation result, performs innovative optimization from the feature level, uses the feature vector of the real password as a training sample, trains the generative adversarial network, and then uses the generative model in the generative adversarial model obtained by training to generate passwords, so that the generated passwords are more in line with the habits of real users in setting passwords, and the generated passwords are more practical in use.
[0163] In one embodiment, if Figure 5 As shown, before the above step S220, the method provided in the embodiment of the present application further includes step S200: obtaining the high-frequency character string according to the frequency of occurrence of different character sequences in the real password library.
[0164] Among them, the real password library can be the weak password library mentioned above, the passwords in the real password library can be called real passwords, and step S210 can obtain the real passwords from the real password library. A character sequence refers to multiple characters arranged in a certain order. For example, "low" can be considered as a character sequence, "lo" can be considered as a character sequence, and "lowe" can be considered as a character sequence. Assuming there are 100 real passwords, and the character sequence "low" appears 50 times, the frequency of occurrence can be considered to be 50%, and the high-frequency character string can be considered to be a character sequence with a higher frequency of occurrence. A threshold can be set as needed. If the frequency of occurrence of a character sequence is greater than the threshold, it can be considered as a high-frequency character string.
[0165] By determining high-frequency character strings based on the frequencies of occurrence of different character sequences, the segmentation results of the real password can be made more consistent with the character composition habits of the public when setting passwords, thereby improving the accuracy of the feature vector of the real password.
[0166] In one embodiment, if Figure 6 As shown, the above step 200 specifically includes the following steps S201-S203.
[0167] Step S201: segmenting the real passwords in the real password database into character units.
[0168] The segmentation based on characters refers to segmenting the real password into individual characters.
[0169] Step S202: Count the occurrence frequencies of character sequences composed of any two consecutive characters, select the character sequence with the highest occurrence frequency as a word, and construct a word list;
[0170] For example, assuming that there are four real passwords in the real password database, low, lower, newest, and widest, you can first combine any two consecutive characters in pairs to form multiple character sequences, namely lo combination, ow combination, we combination, er combination, ne combination, ew combination, we combination, es combination, and so on, to form a large number of character sequences composed of two consecutive characters. Taking these four passwords as an example, lo appears twice, es appears twice, and other sequences appear only once, so lo and es can be considered as the most frequently occurring character sequences, and lo and es can be used as words. Based on words, the segmentation method of the real password is lo / w, lo / w / e / r, n / e / w / es / t, w / i / d / es / t. At this time, it can be obtained that the word list contains characters and words, the words are lo and es, and the characters are w, e, r, n, t, i, d.
[0171] Step S203: On the basis of the character sequence with the highest frequency, add the next character to obtain a new character sequence, select the character sequence with the highest frequency as a word each time, and update the word list; until the number of words in the sub-word list is greater than the threshold or the number of occurrences of the next highest frequency character sequence is a set value; the words in the word list are used as the known high-frequency character strings.
[0172] Based on the real password segmentation method of lo / w, lo / w / e / r, n / e / w / es / t, w / i / d / es / t, lo and w can be combined to obtain a new character sequence low, and further, we combination, er combination, ne combination, ew combination, wes combination, est combination, wi combination, id combination, des combination, est combination.
[0173] Obviously, low appears twice and est appears twice, which can be considered as the character sequence with the highest frequency. Therefore, low can be used as a word and est can be used as a word. At this time, the real password is segmented as low, low / e / r, n / e / w / est, w / i / d / est. At this time, the word list contains the words low and est, and the characters are e, r, n, w, i, d.
[0174] Afterwards, it is found that the combination of low and e, er, ne, ew, west, wi, id, dest and other character sequences all appear only once, that is, the number of occurrences of the highest frequency character series is 1 at this time. In one embodiment, the set value can be 1, so the next character is stopped. At this time, the words low and est in the word list can be considered as known high-frequency character strings. In other embodiments, if the number of words in the word list is greater than the threshold, that is, when there are many words in the word list, it can also be stopped and the words in the word list at this time are regarded as known high-frequency character strings.
[0175] In one embodiment, before the above step S200, an initial password library may be obtained first, and the initial password library may be preprocessed to obtain a real password library. The initial password library may be an existing weak password library. The preprocessing includes data filtering: that is, removing the real passwords in the initial password library whose format, password length or characters do not meet the preset requirements to obtain the real password library.
[0176] Among them, the removal of real passwords whose formats do not meet the preset requirements can be done by detecting the data format of the real passwords and filtering out missing or erroneous data in the fields. The corresponding field information is shown in Table 1 below.
[0177] Table 1 Password dataset fields
[0178] Field English name Field Chinese name email Mail password password
[0179] For example, if the data corresponding to the field "email" or "mailbox" is missing or wrong, the corresponding password is removed.
[0180] Among them, removing the real password whose characters do not meet the preset requirements refers to determining whether each character of the real password is one of 95 printable ASCII codes, and if not, the real password is removed.
[0181] Figure 7 This is a statistical distribution diagram of password length. Figure 7 It can be seen that the commonly used password length ranges from 5 characters to 18 characters, so removing the real passwords whose character length does not meet the preset requirements can be removing the real passwords whose character length is less than 5 or greater than 18 characters.
[0182] In one embodiment, after the initial password library removes the real passwords that do not meet the format, character and character length requirements, the resulting password library can be used as an intermediate password library. Downsampling operations are performed on the basis of the intermediate password library. This solves the problem of too much data in the intermediate password library and too much time overhead. At the same time, in order to reduce the impact of random downsampling on the distribution and diversity of the real password library, the embodiment of the present application introduces a segmented sampling method. The specific flow chart of data sampling is as follows Figure 8 As shown, the following steps S801-S804 are included.
[0183] Step S801: Calculate the distribution of any real password in the intermediate password library.
[0184] The distribution refers to the number of times a real password appears in the real password database. The number of times each real password appears in the real database can be counted.
[0185] Step S802: the real passwords whose distribution amount is less than the quantity threshold are divided into a first set, and the real passwords whose distribution amount is greater than or equal to the quantity threshold are divided into a second set;
[0186] The real passwords with a distribution amount less than the quantity threshold, that is, the real passwords with a small number of occurrences, are divided into the same set, called the first set. The real passwords with a distribution amount greater than or equal to the quantity threshold, that is, the real passwords with a large number of occurrences, are divided into another set, called the second set. That is, the intermediate password library is divided into the first set and the second set.
[0187] Step S803: randomly sampling from the first set to form a first real password set, and for each real password in the second set, performing proportional downsampling according to the corresponding distribution amount in the intermediate password library to form a second real password set.
[0188] The first real password set is a set consisting of multiple real passwords randomly obtained from the first set. The second real password set refers to a password set obtained by downsampling the second set. For example, assuming that there are 20,000 passwords "123456" in the second set and the preset ratio is 0.01, then 200 passwords "123456" can be extracted from the second set and put into the second real password set. Similarly, assuming that there are 10,000 passwords "666888" in the second set and the preset ratio is 0.01, then 100 passwords "666888" can be extracted from the second set and put into the second real password set, and so on. The second real password set greatly maintains the distribution of high-frequency passwords in the initial password library, thereby reducing the impact on the sample distribution.
[0189] Step S804: Aggregate the first real password set and the second real password set to obtain a real password library.
[0190] The real password library includes a first real password set and a second real password set. In one embodiment, the statistics of the high-frequency character strings mentioned above can be performed based on the real password library obtained by sampling.
[0191] In one embodiment, if Fig. 9 As shown, the training process of the generative adversarial network specifically includes: the following steps S910-S930.
[0192] Step S910: Generate a feature vector of a pseudo password through the generator of the generative adversarial network.
[0193] Among them, the generative adversarial network refers to an untrained network model, the generator refers to the generative network in the untrained generative adversarial network, so the generator can be considered as an intermediate model or initial model of the generative model; the feature vector of the pseudo password refers to the feature vector of the password generated by the untrained generator, which is distinguished from the feature vector of the real password.
[0194] Step S920: Using the feature vector of the pseudo password and the feature vector of the real password as inputs of the discriminator of the generative adversarial network respectively, and obtaining the password authenticity probability value output by the discriminator.
[0195] Here, the discriminator refers to the untrained discriminant network in the untrained generative adversarial network. The password authenticity probability value is used to represent the possibility that the input feature vector belongs to the training sample, with a maximum value of 1 and a minimum value of 0.
[0196] Step S930: According to the password authenticity probability value output by the discriminator, the network parameters of the generator and the discriminator are alternately optimized until the network converges to obtain the generative adversarial model.
[0197] Among them, alternating optimization means first solidifying the parameters of the generator, optimizing the parameters of the discriminator, making the password authenticity probability value corresponding to the training sample as large as possible, and using the result generated by the generator as the input of the discriminator to make the password authenticity probability value of the discriminator's corresponding output as small as possible.
[0198] Then, the parameters of the discriminator are fixed, the parameters of the generator are adjusted, and the result generated by the generator is used as the input of the discriminator, so that the probability value of the password authenticity of the corresponding output of the discriminator is as large as possible.
[0199] In one embodiment, based on the above requirements, a loss function can be constructed by alternately optimizing the network parameters of the generator and the discriminator until the loss function meets preset conditions, such as when the loss function is stable, the network can be considered to have converged.
[0200] In another embodiment, the network parameters of the generator and the discriminator are alternately optimized until the error of the output result of the generative adversarial model reaches a set error range, for example, the error is less than the target value (i.e., an acceptable error level), and the network is considered to have converged. After the network converges, the training of the generative adversarial network can be considered to be completed, and a generative adversarial model is obtained.
[0201] In one embodiment, in order to meet the requirement of generating a specified type of password, the architecture of the generative adversarial network can be as follows: Fig.10As shown, label information is introduced into the input of the generator and the discriminator. The label information can be a string category, for example, the string category of pure numbers is represented by 111, the string category of pure letters is represented by 222, the string category of numbers + letters is represented by 333, and so on.
[0202] Therefore, the above step S910 may be to use any string category and random noise as the input of the generator of the generative adversarial network to obtain the feature vector of the pseudo-password output by the generator. The above step S920 may be to concatenate the feature vector of the pseudo-password with the string category constituting the pseudo-password, and use it as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the pseudo-password output by the discriminator; concatenate the feature vector of the real password with the string category constituting the real password, and use it as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the real password output by the discriminator.
[0203] By concatenating the string category and the feature vector as the input of the generative adversarial network, the generative adversarial network can mine the deep features of real passwords and pseudo passwords, and learn the connection between the string category and the input password, so that the trained generative model can generate passwords of different categories on demand.
[0204] In one embodiment, a specified string category and random noise can be used as inputs of a generation model in a generative adversarial model to obtain a password feature vector corresponding to the specified string category output by the generation model; the feature values of each dimension in the password feature vector are converted into corresponding characters or strings for output to obtain a password of the required category.
[0205] Among them, the specified string category refers to any string category among all string categories. The password generated by the generative adversarial model can be called a simulated password. The password feature vector refers to the feature vector of the simulated password of the specified string category. For example, assuming that the specified string category is "111", that is, a purely digital simulated password needs to be generated, then "111" and random noise (i.e., random values) can be used as the input of the generative model in the trained generative adversarial model to obtain the password feature vector output by the generative model. The password feature vector can be considered as the feature vector of the purely digital simulated password.
[0206] Among them, the eigenvalue of each dimension in the password feature vector can represent the ID of a character or string. Therefore, according to the eigenvalue of each dimension, the character or string of the corresponding ID can be found, and the characters and strings can be arranged as needed in the order of the eigenvalues to obtain a simulated password.
[0207] The above-mentioned embodiments of the present application carry out innovative optimization from the network architecture level, introduce string categories, and improve the model, so that the improved model has the ability to generate different categories of passwords on demand, which can better meet the needs of specific scenarios in actual use than before.
[0208] The following Tables 2 and 3 respectively give the different scenarios through the generation model G * The following table 2 lists some password samples generated by the model after innovative optimization at the feature level in order to better meet people's habits or tendencies in using passwords in actual usage scenarios. It can be seen that the generated passwords are basically composed of words with semantic information, such as lovely, hello, windows, etc., or numbers with special meanings, such as 1992 (year).
[0209] Table 2 Password sample table
[0210]
[0211] Table 3 below lists some password samples of five categories generated after improving the model from the model structure level to meet the specific scenario of generating passwords of specified categories on demand. It can be seen that the generated passwords of each category basically meet the characteristics of each category of passwords. For example, the passwords generated by pure numbers are composed of numbers from 0 to 9.
[0212] Table 3 Controllable password sample table (partial)
[0213]
[0214] Fig.11 This is a complete flowchart of a password generation method provided by another embodiment of the present application. Fig.11 As shown, the main steps are as follows:
[0215] (1) Preprocessing, including four sub-steps: data filtering, data sampling, feature extraction, and data partitioning.
[0216] The data filtering refers to removing the real passwords in the initial password library whose format, password length or characters do not meet the preset requirements. The data sampling process refers to the above steps S801 to S804, that is, the intermediate password library obtained after the initial password library is filtered is downsampled.
[0217] Feature extraction refers to extracting the feature vector of the real password. Specifically, the real password can be segmented according to the known high-frequency character strings with high occurrence frequency, and the feature vector of the real password can be constructed based on the segmentation results.
[0218] Data partitioning refers to dividing the set of feature vectors of all real passwords into a training sample set and a test sample set. The training sample set is used to train the generative adversarial model. The test sample set can be used to evaluate the universality of the passwords generated by the generative model. That is, whether the password feature vector output by the generative model will appear in the test sample set, thereby determining the accuracy of the generative model.
[0219] (2) Training: using the training sample set obtained by data partitioning to iteratively train the generative adversarial network to obtain a generative adversarial model.
[0220] Specifically, the training sample set can be used as the input of the discriminator in the generative adversarial network, and the network parameters of the generator and discriminator can be optimized alternately until the model converges.
[0221] (3) Generation, including two sub-steps: simulated password generation and password deduplication. The simulated password generation is to use the generative model in the trained generative adversarial model to generate a simulated password set, and then deduplication the simulated password set to obtain the target password set.
[0222] In one embodiment, the passwords generated by the generation model may be added to a simulation password set, and the simulation password set may be deduplicated to obtain a target password set.
[0223] Among them, the simulation password set refers to the set of passwords generated by the generation model. For the purpose of distinction, the passwords generated by the generation model can be called simulation passwords, so the set of simulation passwords can be called the simulation password set. Deduplication means that only one simulation password that appears multiple times in the simulation password set is retained. For the purpose of distinction, the simulation password set after deduplication is called the target password set, thereby avoiding repeated storage of simulation passwords.
[0224] In order to solve the problem that the deduplication phase is time-consuming and costly when the number of generated simulated passwords reaches hundreds of millions, a distributed processing method can be introduced. The specific process is as follows:
[0225] a) Upload the generated simulation password set to the HDFS (distributed file system) cluster. HDFS includes multiple computing nodes and can process tasks in parallel.
[0226] b) Use MapReduce technology to perform a simple deduplication task on the simulated password set to form a new password set S (i.e., the target password set) after deduplication. Specifically, the simulated password set can be divided into multiple data blocks and distributed to multiple map nodes. The multiple map nodes perform the deduplication task in parallel. Then, the deduplication results of the multiple map nodes are summarized and distributed to multiple reduce nodes. The multiple reduce nodes perform the deduplication task in parallel. Then, the deduplication results of the multiple reduce nodes are summarized to obtain the target password set.
[0227] c) Pull the password set S from the cluster and enter it into the database for storage, so as to serve as the data source for subsequent brute force cracking, weak password detection and other practical scenarios.
[0228] Fig.12 FIG. 1 is a flowchart of a password generation method provided by another embodiment of the present application. Fig.12 As shown, the method includes the following steps S1110-S1120.
[0229] Step S1110: Obtain the real password;
[0230] Step S1120: segmenting the real password according to the known high-frequency character string to obtain the segmentation result of the real password;
[0231] Step S1130: constructing a feature vector of the real password according to the segmentation result of the real password;
[0232] Step S1140: using the feature vector and the character string category of the real password as training samples, training a generative adversarial network to obtain a generative adversarial model;
[0233] Step S1150: taking a designated string category as input, and using a generative model in the generative adversarial model to generate a password corresponding to the designated string category.
[0234] Among them, the above steps S1110 to S1130 can refer to Figure 2 The specific details of the above steps S1130 and S1140 can be found in Fig.10 as well as Fig.10 The training process of the generative adversarial network in the corresponding embodiment.
[0235] It should be understood that the above embodiments of the present application describe a method of first training a generative adversarial model and then using the generative adversarial model to generate a password. Optionally, as an embodiment, it is also possible not to train the generative adversarial model, that is, the adversarial network model can be obtained in advance, for example, it can be obtained by pre-training, or the adversarial network model can be obtained from a third party, and the embodiments of the present application are not limited to this. Fig.13 The present invention describes a method for generating a password after an adversarial network model has been pre-acquired.
[0236] Fig.13 FIG. 1 is a flowchart of a password generation method provided by another embodiment of the present application. Fig.13 As shown, the method includes the following steps S1210-S1220.
[0237] Step S1210: Obtain random noise.
[0238] The random noise may be a random number.
[0239] Step S1220: using the random noise as input, and generating a password through a generative model in a trained generative adversarial model.
[0240] The generative adversarial model is trained by taking the feature vector of the real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string and then segmenting the real password according to the segmentation result.
[0241] In one embodiment, the above-mentioned step S1220 specifically includes: using the random noise and the specified string category as the input of the generation model in the generative adversarial model, and obtaining the password feature vector corresponding to the specified string category output by the generation model; converting the eigenvalue of each dimension in the password feature vector into a corresponding character or string for output, so as to obtain the required password containing the specified string category.
[0242] The training process of the generative adversarial model and the password generation process can be found above, so I will not go into details here.
[0243] Combined with the previous article Figures 2 to 13 The password generation method of the embodiment of the present application is described below. Fig.14 A password recognition method is described. The password recognition method can be based on the password generated by the generation model above to identify weak passwords in actual applications.
[0244] Fig.14 A flowchart of a password recognition method provided in an embodiment of the present application is shown as follows: Fig.14 As shown, the method includes: step S1310-step S1320.
[0245] Step S1310: Obtain the password to be identified.
[0246] The password to be identified may be a password entered by the user, for example, a password entered by the user when registering an account.
[0247] Step S1320: Determine whether the password to be identified is the same as any password in the simulation password set, and obtain an identification result of the password to be identified based on the determination result.
[0248] The passwords in the simulated password set are generated by a generative model in a trained generative adversarial model.
[0249] The generative adversarial model is trained by taking the feature vector of the real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string and based on the segmentation result.
[0250] The training process of the generative adversarial model and the process of generating passwords by the generative model can be found above. I will not go into details here.
[0251] The following is an embodiment of the device of the present application, which can be used to execute the above-mentioned password generation method embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the password generation method of the present application.
[0252] Fig.15 A block diagram of a password generating device provided in an embodiment of the present application. Fig.15 As shown, the device includes a password acquisition module 1410, a password segmentation module 1420, a feature extraction module 1430, a model training module 1440 and a password generation module 1450.
[0253] Password acquisition module 1410, used to obtain the real password;
[0254] The password segmentation module 1420 is used to segment the real password according to the known high-frequency character string to obtain the segmentation result of the real password;
[0255] A feature extraction module 1430 is used to construct a feature vector of the real password according to the segmentation result of the real password;
[0256] A model training module 1440 is used to train a generative adversarial network using the feature vector of the real password as a training sample to obtain a generative adversarial model;
[0257] The password generation module 1450 is used to generate a password using the generative model in the generative adversarial model.
[0258] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned password generation method, which will not be repeated here.
[0259] In one embodiment, the password generating device further includes:
[0260] The high-frequency character string statistics module is used to obtain the high-frequency character string according to the frequency of occurrence of different character sequences in the real password library.
[0261] In one embodiment, the high-frequency character string statistics module includes:
[0262] A character segmentation unit, used for segmenting the real password in the real password library in units of characters;
[0263] A frequency counting unit is used to count the occurrence frequency of a character sequence composed of any two consecutive characters, select the character sequence with the highest occurrence frequency as a word, and construct a word list;
[0264] A vocabulary updating unit is used to add the next character to the character sequence with the highest frequency to obtain a new character sequence, and each time the character sequence with the highest frequency is selected as a word to update the vocabulary; until the number of words in the sub-vocabulary is greater than a threshold or the number of occurrences of the next highest frequency character sequence is a set value; the words in the vocabulary are used as the known high-frequency character strings.
[0265] In one embodiment, the password generating device further includes:
[0266] A password library acquisition module is used to obtain an initial password library;
[0267] The password screening module is used to remove the real passwords whose format, password length or characters do not meet the preset requirements in the initial password library to obtain the real password library.
[0268] In one embodiment, the password screening module includes:
[0269] A password filtering unit, used to remove real passwords whose format, password length or characters do not meet preset requirements in the initial password library, to obtain an intermediate password library;
[0270] A distribution amount calculation unit, used to calculate the distribution amount of any real password in the intermediate password library;
[0271] A password classification unit, configured to classify the real passwords whose distribution amount is less than a quantity threshold into a first set, and classify the real passwords whose distribution amount is greater than or equal to the quantity threshold into a second set;
[0272] a sampling unit, configured to randomly sample from the first set to form a first real password set, and to perform downsampling in proportion to the corresponding distribution amount in the intermediate password library for each real password in the second set to form a second real password set;
[0273] The aggregation unit is used to aggregate the first real password set and the second real password set to obtain the real password library.
[0274] In one embodiment, the password segmentation module 1420 is specifically used to segment the real password according to known high-frequency character strings to obtain single characters and / or character strings composed of multiple characters.
[0275] In one embodiment, the feature extraction module 1430 is specifically used to: when the segmentation result of the real password includes a single character and a string consisting of multiple characters, splice the feature value of the single character and the feature value of the string to form a feature vector of the real password.
[0276] In one embodiment, the model training module 1440 includes:
[0277] A generating unit, configured to generate a feature vector of a pseudo password through a generator of the generative adversarial network; the generator is an intermediate model or an initial model of the generative model;
[0278] A discriminant unit, used to use the feature vector of the pseudo password and the feature vector of the real password as inputs of the discriminator of the generative adversarial network respectively, and obtain a probability value of the authenticity of the password output by the discriminator;
[0279] The optimization unit is used to alternately optimize the network parameters of the generator and the discriminator according to the password authenticity probability value output by the discriminator until the network converges to obtain the generative adversarial model.
[0280] In one embodiment, the discriminating unit is specifically used to: concatenate the feature vector of the pseudo password with the character string category constituting the pseudo password, and use the concatenated feature vector as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the pseudo password output by the discriminator;
[0281] After concatenating the feature vector of the real password with the character string category constituting the real password, the concatenated feature vector is used as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the real password output by the discriminator;
[0282] The password generation module 1450 is specifically used to: use the specified string category and random noise as the input of the generation model in the generative adversarial model, obtain the password feature vector corresponding to the specified string category output by the generation model, and convert the feature value of each dimension in the password feature vector into a corresponding character or string for output.
[0283] In one embodiment, the generating unit is specifically used to: use any string category and random noise as input of the generator of the generative adversarial network to obtain a feature vector of the pseudo-password output by the generator.
[0284] In one embodiment, the password generation device provided in the embodiment of the present application further includes:
[0285] The deduplication module is used to add the passwords generated by the generation model to the simulation password set, and to dedupe the simulation password set to obtain a target password set.
[0286] Fig.15 A block diagram of a password generating device provided in an embodiment of the present application. Fig.15 As shown, the device includes a password acquisition module 1410, a password segmentation module 1420, a feature extraction module 1430, a model training module 1440 and a password generation module 1450.
[0287] Password acquisition module 1410, used to obtain the real password;
[0288] The password segmentation module 1420 is used to segment the real password according to the known high-frequency character string to obtain the segmentation result of the real password;
[0289] A feature extraction module 1430 is used to construct a feature vector of the real password according to the segmentation result of the real password;
[0290] A model training module 1440 is used to train a generative adversarial network using the feature vector of the real password and the character string category constituting the real password as training samples to obtain a generative adversarial model;
[0291] The password generation module 1450 is used to take a specified string category as input and use a generation model in the generative adversarial model to generate a password corresponding to the specified string category.
[0292] Fig.16 Another embodiment of the present application provides a block diagram of a password generating device. Fig.16 As shown, the device includes a noise acquisition module 1510 and a password generation module 1520.
[0293] The noise acquisition module 1510 is used to acquire random noise.
[0294] The password generation module 1520 is used to generate a password by taking the random noise as input through a generative model in a trained generative adversarial model.
[0295] The generative adversarial model is trained by taking the feature vector of the real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string and then segmenting the real password according to the segmentation result.
[0296] In one embodiment, the password generation module 1520 is specifically used to: use the random noise and the specified string category as the input of the generation model in the generative adversarial model, obtain the password feature vector corresponding to the specified string category output by the generation model; convert the feature value of each dimension in the password feature vector into a corresponding character or string for output.
[0297] Fig.17 A block diagram of a password recognition device provided by another embodiment of the present application is as follows: Fig.17 As shown, the device includes: a password acquisition module 1610 and a password identification module 1620.
[0298] The password acquisition module 1610 is used to acquire the password to be identified;
[0299] The password identification module 1620 is used to determine whether the password to be identified is the same as any password in the simulation password set, and obtain an identification result of the password to be identified according to the determination result;
[0300] Wherein, the passwords in the simulated password set are generated by a generative model in a trained generative adversarial model;
[0301] The generative adversarial model is trained by taking the feature vector of the real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string and based on the segmentation result.
[0302] In several embodiments provided in the present application, the disclosed devices and methods may also be implemented in other ways. The device embodiments described above are merely schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram may represent a module, a program segment or a part of a code, and a module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0303] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0304] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
Claims
1. A password generation method, characterized in that: include: Get the real password; Segment the real password according to the known high-frequency character string to obtain a segmentation result of the real password; The segmentation result includes a character string consisting of multiple characters; Constructing a feature vector of the real password according to the segmentation result of the real password; Using the feature vector of the real password as a training sample, training a generative adversarial network to obtain a generative adversarial model; Generate a password using a generative model in the generative adversarial model; The method of using the feature vector of the real password as a training sample to train the generative adversarial network to obtain a generative adversarial model includes: Generate a feature vector of a pseudo password through a generator of the generative adversarial network; the generator is an intermediate model or an initial model of the generative model; Using the feature vector of the pseudo password and the feature vector of the real password as inputs of the discriminator of the generative adversarial network respectively, and obtaining the probability value of the authenticity of the password output by the discriminator; According to the password authenticity probability value output by the discriminator, the network parameters of the generator and the discriminator are optimized alternately until the network converges to obtain the generative adversarial model.
2. The method according to claim 1, characterized in that Before segmenting the real password according to the known high-frequency character string to obtain the segmentation result of the real password, the method further includes: The high-frequency character string is obtained according to the frequencies of occurrence of different character sequences in the real password library.
3. The method according to claim 2, characterized in that The method of obtaining the high-frequency character string according to the frequencies of occurrence of different character sequences in the real password library includes: Segmenting the real passwords in the real password database into character units; Count the occurrence frequency of character sequences consisting of any two consecutive characters, select the character sequence with the highest occurrence frequency as a word, and construct a word list; On the basis of the character sequence with the highest frequency, the next character is added to obtain a new character sequence, and the character sequence with the highest frequency is selected as a word each time to update the word list; until the number of words in the word list is greater than a threshold or the number of occurrences of the next highest frequency character sequence is a set value; the words in the word list are used as the known high-frequency character strings.
4. The method according to claim 2, characterized in that Before obtaining the high-frequency character string according to the frequencies of occurrence of different character sequences in the real password library, the method further includes: Get the initial password library; The real password library is obtained by removing the real passwords whose formats, password lengths or characters do not meet the preset requirements in the initial password library.
5. The method according to claim 4, characterized in that The step of removing the real passwords whose format, password length or characters do not meet the preset requirements in the initial password library to obtain the real password library comprises: Remove the real passwords whose format, password length or characters do not meet the preset requirements in the initial password library to obtain an intermediate password library; Calculating the distribution of any real password in the intermediate password library; The real passwords whose distribution amount is less than the quantity threshold are divided into a first set, and the real passwords whose distribution amount is greater than or equal to the quantity threshold are divided into a second set; Randomly sampling from the first set to form a first real password set, and for each real password in the second set, performing downsampling in proportion to the corresponding distribution amount in the intermediate password library to form a second real password set; The first real password set and the second real password set are aggregated to obtain the real password library.
6. The method according to any one of claims 1 to 5, characterized in that: The segmenting of the real password according to the known high-frequency character string to obtain the segmentation result of the real password includes: The real password is segmented according to the known high-frequency character string, and the segmentation results obtained include a single character and a character string composed of multiple characters.
7. The method according to claim 6, characterized in that The step of constructing a feature vector of the real password according to the segmentation result of the real password includes: If the segmentation result of the real password includes a single character and a character string consisting of multiple characters, a feature vector of the real password is formed by concatenating the feature value of the single character and the feature value of the character string.
8. The method according to claim 1, characterized in that Using the feature vector of the pseudo password and the feature vector of the real password as inputs of the discriminator of the generative adversarial network respectively, and obtaining the probability value of the authenticity of the password output by the discriminator, including: After concatenating the feature vector of the pseudo password with the character string category constituting the pseudo password, the concatenated feature vector is used as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the pseudo password output by the discriminator; After concatenating the feature vector of the real password with the character string category constituting the real password, the concatenated feature vector is used as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the real password output by the discriminator; The generation model in the generative adversarial model is used to generate a password, including: Using a specified string category and random noise as inputs of a generation model in the generative adversarial model, and obtaining a password feature vector corresponding to the specified string category output by the generation model; The characteristic value of each dimension in the password characteristic vector is converted into a corresponding character or character string for output.
9. The method according to claim 8, characterized in that The generating a feature vector of a pseudo password by a generator of the generative adversarial network comprises: Any string category and random noise are used as inputs of the generator of the generative adversarial network to obtain a feature vector of the pseudo password output by the generator.
10. The method according to claim 1, characterized in that After the generation of the password using the generative model in the generative adversarial model, the method further includes: The passwords generated by the generation model are added to the simulation password set, and the simulation password set is deduplicated to obtain a target password set.
11. A password generation method, characterized in that: include: Get the real password; Segment the real password according to the known high-frequency character string to obtain a segmentation result of the real password; The segmentation result includes a character string consisting of multiple characters; Constructing a feature vector of the real password according to the segmentation result of the real password; Using the feature vector of the real password and the character string category constituting the real password as training samples, training a generative adversarial network to obtain a generative adversarial model; Taking a specified string category as input, and using a generative model in the generative adversarial model to generate a password corresponding to the specified string category; The method of using the feature vector of the real password and the character string category constituting the real password as training samples to train the generative adversarial network to obtain a generative adversarial model includes: Generate a feature vector of a pseudo password through a generator of the generative adversarial network; the generator is an intermediate model or an initial model of the generative model; After concatenating the feature vector of the pseudo password with the character string category constituting the pseudo password, the concatenated feature vector is used as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the pseudo password output by the discriminator; After concatenating the feature vector of the real password with the character string category constituting the real password, the concatenated feature vector is used as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the real password output by the discriminator; According to the password authenticity probability value output by the discriminator, the network parameters of the generator and the discriminator are optimized alternately until the network converges to obtain the generative adversarial model.
12. A password generation method, characterized in that: include: Get random noise; Taking the random noise as input, generating a password through a generative model in a trained generative adversarial model; The generative adversarial model is trained by taking the feature vector of the real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string and the segmentation result; the segmentation result includes a character string composed of multiple characters; The training process of the generative adversarial model includes: Generate a feature vector of a pseudo password through a generator of the generative adversarial network; the generator is an intermediate model or an initial model of the generative model; Using the feature vector of the pseudo password and the feature vector of the real password as inputs of the discriminator of the generative adversarial network respectively, and obtaining the probability value of the authenticity of the password output by the discriminator; According to the password authenticity probability value output by the discriminator, the network parameters of the generator and the discriminator are optimized alternately until the network converges to obtain the generative adversarial model.
13. The method according to claim 12, characterized in that The method of using the random noise as input and generating a password through a generative model in a trained generative adversarial model comprises: Using the random noise and the specified character string category as inputs of a generative model in the generative adversarial model, and obtaining a password feature vector corresponding to the specified character string category output by the generative model; The characteristic value of each dimension in the password characteristic vector is converted into a corresponding character or character string for output.
14. A password recognition method, characterized in that: include: Get the password to be identified; Determine whether the password to be identified is the same as any password in the simulation password set, and obtain an identification result of the password to be identified according to the determination result; Wherein, the passwords in the simulated password set are generated by a generative model in a trained generative adversarial model; The generative adversarial model is trained by using a feature vector of a real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string, and the segmentation result includes a character string composed of multiple characters; The training process of the generative adversarial model includes: Generate a feature vector of a pseudo password through a generator of the generative adversarial network; the generator is an intermediate model or an initial model of the generative model; Using the feature vector of the pseudo password and the feature vector of the real password as inputs of the discriminator of the generative adversarial network respectively, and obtaining the probability value of the authenticity of the password output by the discriminator; According to the password authenticity probability value output by the discriminator, the network parameters of the generator and the discriminator are optimized alternately until the network converges to obtain the generative adversarial model.
15. A password generating device, characterized in that: include: Password acquisition module, used to obtain the real password; A password segmentation module, used to segment the real password according to a known high-frequency character string to obtain a segmentation result of the real password; the segmentation result includes a character string composed of multiple characters; A feature extraction module, used to construct a feature vector of the real password according to the segmentation result of the real password; A model training module, used to train a generative adversarial network using the feature vector of the real password as a training sample to obtain a generative adversarial model; A password generation module, used to generate a password using a generation model in the generative adversarial model; The method of using the feature vector of the real password as a training sample to train the generative adversarial network to obtain a generative adversarial model includes: Generate a feature vector of a pseudo password through a generator of the generative adversarial network; the generator is an intermediate model or an initial model of the generative model; Using the feature vector of the pseudo password and the feature vector of the real password as inputs of the discriminator of the generative adversarial network respectively, and obtaining the probability value of the authenticity of the password output by the discriminator; According to the password authenticity probability value output by the discriminator, the network parameters of the generator and the discriminator are optimized alternately until the network converges to obtain the generative adversarial model.
16. A password generating device, characterized in that: include: Password acquisition module, used to obtain the real password; A password segmentation module, used to segment the real password according to a known high-frequency character string to obtain a segmentation result of the real password; the segmentation result includes a character string composed of multiple characters; A feature extraction module, used to construct a feature vector of the real password according to the segmentation result of the real password; A model training module, used to train a generative adversarial network using the feature vector of the real password and the character string category constituting the real password as training samples to obtain a generative adversarial model; A password generation module, configured to take a specified string category as input and use a generative model in the generative adversarial model to generate a password corresponding to the specified string category; The method of using the feature vector of the real password and the character string category constituting the real password as training samples to train the generative adversarial network to obtain a generative adversarial model includes: Generate a feature vector of a pseudo password through a generator of the generative adversarial network; the generator is an intermediate model or an initial model of the generative model; After concatenating the feature vector of the pseudo password with the character string category constituting the pseudo password, the concatenated feature vector is used as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the pseudo password output by the discriminator; After concatenating the feature vector of the real password with the character string category constituting the real password, the concatenated feature vector is used as the input of the discriminator of the generative adversarial network to obtain the password authenticity probability value of the real password output by the discriminator; According to the password authenticity probability value output by the discriminator, the network parameters of the generator and the discriminator are optimized alternately until the network converges to obtain the generative adversarial model.
17. A password generating device, characterized in that: include: A noise acquisition module, used to acquire random noise; A password generation module, configured to take the random noise as input and generate a password through a generative model in a trained generative adversarial model; The generative adversarial model is trained by taking the feature vector of the real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string and generating the segmentation result according to the segmentation result; the segmentation result includes a character string composed of multiple characters; The training process of the generative adversarial model includes: Generate a feature vector of a pseudo password through a generator of the generative adversarial network; the generator is an intermediate model or an initial model of the generative model; Using the feature vector of the pseudo password and the feature vector of the real password as inputs of the discriminator of the generative adversarial network respectively, and obtaining the probability value of the authenticity of the password output by the discriminator; According to the password authenticity probability value output by the discriminator, the network parameters of the generator and the discriminator are optimized alternately until the network converges to obtain the generative adversarial model.
18. A password recognition device, characterized in that: include: A password acquisition module, used to acquire the password to be identified; A password identification module, used to determine whether the password to be identified is the same as any password in the simulation password set, and obtain an identification result of the password to be identified according to the determination result; Wherein, the passwords in the simulated password set are generated by a generative model in a trained generative adversarial model; The generative adversarial model is trained by using a feature vector of a real password as a training sample; the feature vector of the real password is generated by segmenting the real password according to a known high-frequency character string, and the segmentation result includes a character string composed of multiple characters; The training process of the generative adversarial model includes: Generate a feature vector of a pseudo password through a generator of the generative adversarial network; the generator is an intermediate model or an initial model of the generative model; Using the feature vector of the pseudo password and the feature vector of the real password as inputs of the discriminator of the generative adversarial network respectively, and obtaining the probability value of the authenticity of the password output by the discriminator; According to the password authenticity probability value output by the discriminator, the network parameters of the generator and the discriminator are optimized alternately until the network converges to obtain the generative adversarial model.
19. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing processor-executable instructions; The processor is configured to execute the password generation method described in any one of claims 1 to 13 or the password recognition method described in claim 14.
20. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program can be executed by a processor to complete the password generation method described in any one of claims 1 to 13 or execute the password recognition method described in claim 14.
