Random key generation method based on QRNG generative adversarial network

By using quantum random number generator and generation adversarial network to generate high-quality random keys, the resource and cost problems of traditional encryption methods in key generation and management are solved, and extremely high key security and efficient management are achieved.

CN119602957AInactive Publication Date: 2025-03-11SICHUAN BRANCH OF CHINA TOBACCO
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510124779.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-26
Publication Date
2025-03-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional encryption methods have huge resources and costs burdens in key generation and management, especially in large-scale data transmission, which is difficult to ensure the security and efficiency of keys.

Method used

A random number sequence generated by a quantum random number generator (QRNG) is used to obtain a random key generation model by generating adversarial network (GAN) training, thereby generating high-quality random keys.

Benefits of technology

By leveraging quantum-level randomness and GAN adversarial training, the generated keys have extremely high randomness and unpredictability, which are difficult to crack, simplifying the key management process and reducing costs and resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119602957A_ABST
    Figure CN119602957A_ABST
Patent Text Reader

Abstract

The invention relates to a random key generation method based on a QRNG generative adversarial network. The method comprises the following steps: generating a group of initial random number sequences by using a quantum random number generator; the initial random key generation model comprises a generator and a discriminator, segmenting the initial random number sequence into a plurality of sequence samples, inputting the sequence samples into the initial random key generation model, and alternately training the generator and the discriminator; and after the training is finished, obtaining a random key generation model, and generating a random key based on the random key generation model. A random key generation model is obtained by training a generative adversarial network model through a random number sequence generated by QRNG, so that a high-quality key can be generated according to different application scenes and security requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a random key generation method based on a QRNG generation adversarial network. Background Art

[0002] In the field of information security, key generation and management are of vital importance. Traditional encryption methods (such as symmetric encryption and asymmetric encryption) mainly rely on the complexity and confidentiality of keys. One-Time Pad (OTP) is considered one of the most secure encryption methods in the field of encryption. It is an encryption method that cannot be cracked in theory and has absolute security. However, OTP faces many challenges in practical applications. It is difficult to ensure that keys are not leaked during transmission and storage. In addition, for large-scale data transmission, the practical difficulty of using OTP is also very large. Generating and managing such a large number of random keys has a huge burden in terms of resources and costs. Summary of the invention

[0003] The purpose of the present invention is to improve the problems existing in the above-mentioned prior art and provide a random key generation method based on a QRNG generative adversarial network. Since the random numbers generated by a quantum random number generator (QRNG) are generated based on quantum phenomena and have the characteristics of high entropy and unpredictability, a random key generation model is obtained by training a generative adversarial network model through a random number sequence generated by QRNG, so that high-quality keys can be generated according to different application scenarios and security requirements.

[0004] In order to achieve the above-mentioned object of the invention, an embodiment of the present invention provides a random key generation method based on a QRNG generative adversarial network, comprising the following steps:

[0005] S1, using a quantum random number generator to generate an initial random number sequence;

[0006] S2, constructing an initial random key generation model: the initial random key generation model includes a generator and a discriminator, dividing the initial random number sequence into multiple sequence samples and inputting them into the initial random key generation model, and alternately training the generator and the discriminator;

[0007] S3, after the training is completed, a random key generation model is obtained, and a random key is generated based on the random key generation model.

[0008] Furthermore, the step of generating a set of initial random number sequences by using a quantum random number generator in S1 specifically includes:

[0009] Generate random number sequences using quantum random number generators;

[0010] Performing a randomness test on the random number sequence to obtain a test result;

[0011] Determining the randomness of the random number based on the test result;

[0012] The randomness of the random number sequence is determined based on the test result. If the test result is greater than a set threshold, the randomness test of the random number passes, otherwise it fails;

[0013] If the randomness test of the random number sequence fails, a new random number sequence is generated; if the randomness test of the random number passes, the random number sequence is used as the initial random number sequence.

[0014] The beneficial effect of the above scheme is that the initial random number sequence obtained by using QRNG has quantum-level randomness and unpredictability. Combined with the optimization of GAN, the generated key has extremely high security and is difficult to predict or crack.

[0015] Furthermore, the generator in the initial random key generation model includes a first input layer, a first fully connected layer, a second fully connected layer, a third fully connected layer and a first output layer connected in sequence, wherein the dimension of the first input layer is 128; the activation functions of the first fully connected layer, the second fully connected layer and the third fully connected layer are all RuLU functions, and the dimensions of the first fully connected layer, the second fully connected layer and the third fully connected layer are 256, 512 and 1024 respectively; the dimension of the first output layer is 128, and the activation function is Tanh.

[0016] Furthermore, the discriminator in the initial random key generation model includes a second input layer, a fourth fully connected layer, a fifth fully connected layer, a sixth fully connected layer, and a second output layer connected in sequence, wherein: the dimension of the second input layer is 128; the dimensions of the fourth fully connected layer, the fifth fully connected layer, and the sixth fully connected layer are 1024, 512, and 256, respectively, and the activation functions are all Leaky RuLU; the output dimension of the second output layer is 1, and the activation function is Sigmoid.

[0017] Furthermore, the step of alternately training the generator and the discriminator includes:

[0018] In the 2i-1th round of training, the discriminator training is performed, and the network parameters of the discriminator are updated using the discriminator loss function; in the 2ith round of training, the generator training is performed, and the network parameters of the generator are updated using the generator loss function; the loss function of the initial random key generation model is expressed as:

[0019] ;

[0020] in, represents the discriminator loss function; Represents the generator loss function; N represents the training round, and i represents the current training round.

[0021] Furthermore, the training step of performing discriminator training includes:

[0022] Initializing the network parameters of the discriminator;

[0023] Sampling a sequence sample from the initial random number sequence as a real sample, and obtaining a forged sample generated by the generator;

[0024] Constructing a discriminator loss function, inputting the real sample and the forged sample into the discriminator loss function, and calculating the loss of the discriminator;

[0025] The discriminator loss function is back-propagated and gradient updated to gradually adjust the network parameters of the discriminator.

[0026] Furthermore, the discriminator loss function is expressed as:

[0027] ,

[0028] in, Represents the loss of the discriminator; N represents the training round; i represents the current training round; represents the real sample; Indicates a forged sample; Indicates that the discriminator judges the forged sample The probability of being true.

[0029] Furthermore, the training step of performing generator training includes:

[0030] Initializing the network parameters of the generator;

[0031] Sample a random noise from the noise distribution and generate fake samples;

[0032] Constructing a generator loss function, inputting the forged sample into the generator loss function, and calculating the loss of the generator;

[0033] The generator loss function is back-propagated and gradient updated to gradually adjust the network parameters of the generator.

[0034] Furthermore, the expression of the generator loss function is:

[0035] ,

[0036] in, Represents the loss of the generator; N represents the training round; i represents the current training round; Indicates a forged sample; Indicates that the discriminator judges the forged sample The probability of being true.

[0037] Compared with the existing methods, the present invention has the following beneficial effects:

[0038] (1) With the help of the random number sequence generated by QRNG and the adversarial training of the generative adversarial network, the generated key sequence is ensured to be highly random and unpredictable;

[0039] (2) Generate high-quality keys directly through the random key generation model trained by the generative adversarial network, which simplifies the key management process, avoids the leakage of the key generation method, and reduces costs and improves efficiency;

[0040] (3) The method of the present invention is also applicable to large-scale data transmission, and can efficiently generate and manage a large number of random keys, solving the problem that the traditional one-time pad scheme is not feasible;

[0041] (4) Reduced dependence on expensive quantum equipment and lowered the construction and maintenance costs of the overall system. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0043] Figure 1 is an exemplary flow chart of a random key generation method based on a QRNG generative adversarial network described in an embodiment;

[0044] Figure 2 It is a structural schematic diagram of the random key generation model described in the embodiment. DETAILED DESCRIPTION

[0045] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.

[0046] Figure 1 is an exemplary flow chart of a random key generation method based on a QRNG generative adversarial network described in an embodiment, such as Figure 1 As shown, the method comprises the following steps:

[0047] S1, use the quantum random number generator to generate the initial random number sequence.

[0048] The steps of S1 using a quantum random number generator to generate an initial random number sequence specifically include:

[0049] S11, using a quantum random number generator to generate a random number sequence.

[0050] In some embodiments, a quantum random number generator (QRNG) is a new type of random number generating device based on the principles of quantum mechanics. The core principle of the quantum random number generator is the uncertainty principle of quantum mechanics. QRNG can generate true random numbers based on the inherent randomness of quantum physics without relying on the hardware devices of the system. In this embodiment, a set of random number sequences with a length of 1,000,000 bits is generated by the quantum random number generator.

[0051] S12, performing a randomness test on the random number sequence to obtain a test result.

[0052] In some embodiments, the random number sequence can be subjected to multiple randomness tests using the NIST randomness test suite, including frequency test, block frequency test, run test, and overlapping run test. Each randomness test returns a test result, namely the P-value. The P-value is an important parameter used in statistics to determine the results of hypothesis testing, which is used to indicate the probability of the test statistic obtaining the observed value or a more extreme value under the assumption that the input random number sequence is random.

[0053] S13, judging the randomness of the random number sequence based on the test result, if the test result is greater than a set threshold, the randomness test of the random number sequence passes, otherwise it fails.

[0054] Generally speaking, if the P value is higher than the threshold, it is assumed that the random number sequence is random. That is to say, when the P value is greater than the threshold (for example, the threshold is 0.01, the P value is greater than 0.01), the sequence passes the randomness test, otherwise it fails.

[0055] S14, if the random number fails the randomness test, a new random number sequence is generated; if the randomness test of the random number sequence passes, the random number sequence is used as the initial random number sequence.

[0056] The beneficial effect of the above scheme is that the initial random number sequence obtained by using QRNG has quantum-level randomness and unpredictability. Combined with the subsequent optimization of the generative adversarial network, the generated key has extremely high security and is difficult to predict or crack.

[0057] S2, constructing an initial random key generation model: the initial random key generation model includes a generator and a discriminator, the initial random number sequence is divided into multiple sequence samples and input into the initial random key generation model, and the generator and the discriminator are alternately trained. Specifically, the initial random number sequence with a length of 1,000,000 bits can be divided into multiple sequence samples according to the length requirement, and the multiple sequence samples are input into the initial random key generation model in batches for multiple rounds of training until the training is completed.

[0058] like Figure 2 As shown, a schematic diagram of the structure of the random key generation model described in the embodiment is shown. The random key generation model is obtained by training the initial random key generation model based on a generative adversarial network. The generative adversarial network (GAN) is a technology that has made significant progress in the field of deep learning in recent years. GAN can generate high-quality random data through adversarial training between two neural networks, namely a generator and a discriminator.

[0059] Specifically, the initial random key generation model includes a generator and a discriminator.

[0060] Furthermore, the generator in the initial random key generation model includes a first input layer, a first fully connected layer, a second fully connected layer, a third fully connected layer and a first output layer connected in sequence, wherein the dimension of the first input layer is 128; the activation functions of the first fully connected layer, the second fully connected layer and the third fully connected layer are all RuLU functions, and the dimensions of the first fully connected layer, the second fully connected layer and the third fully connected layer are 256, 512 and 1024 respectively; the dimension of the first output layer is 128, and the activation function is Tanh.

[0061] In some embodiments, the output of the generator is a forged sample, in which the dimensions of the three fully connected layers are increased layer by layer, and the output dimension of each fully connected layer is twice that of the previous layer, which can gradually extract more information features without making the network structure too large, and can also increase the complexity and diversity of the forged samples. Finally, the dimension of the forged sample output by the generator corresponds to the length of the sequence sample, so that the generated forged sample is close to a real random number.

[0062] The discriminator in the initial random key generation model includes a second input layer, a fourth fully connected layer, a fifth fully connected layer, a sixth fully connected layer, and a second output layer connected in sequence, wherein: the dimension of the second input layer is 128; the dimensions of the fourth fully connected layer, the fifth fully connected layer, and the sixth fully connected layer are 1024, 512, and 256, respectively, and the activation functions are all Leaky RuLU; the output dimension of the second output layer is 1, and the activation function is Sigmoid.

[0063] In a complete training cycle, the network parameters of the discriminator need to be updated first, and then the network parameters of the generator need to be updated. The update of the network parameters of the discriminator depends on the forged samples generated by the generator, and the update of the network parameters of the generator depends on the output feedback of the discriminator. Therefore, the discriminator and the generator are trained alternately to compete with each other. The step of alternately training the generator and the discriminator includes:

[0064] In the 2i-1th round of training, the discriminator training is performed, and the network parameters of the discriminator are updated using the discriminator loss function; in the 2ith round of training, the generator training is performed, and the network parameters of the generator are updated using the generator loss function; the loss function L of the initial random key generation model is expressed as:

[0065] ;

[0066] in, represents the loss of the discriminator; represents the loss of the generator; N represents the training round, and i represents the current training round. Specifically, the training round N is a natural number and can be determined according to the number of sequence samples.

[0067] The training steps for discriminator training include:

[0068] Initializing the network parameters of the discriminator;

[0069] Sampling a sequence sample from the initial random number sequence as a real sample, and obtaining a forged sample generated by the generator;

[0070] Constructing a discriminator loss function, inputting the real sample and the forged sample into the discriminator loss function, and calculating the loss of the discriminator;

[0071] The discriminator loss function is back-propagated and gradient updated to gradually adjust the network parameters of the discriminator. Specifically, the Adam optimizer can be used to back-propagate and gradient update the discriminator loss function. The learning rate is set to 0.0002, and the momentum parameters are set to , , gradually adjust the network parameters of the discriminator to make the discriminator more confident about real samples and more accurate in judging forged samples.

[0072] The expression of the discriminator loss function is:

[0073] ,

[0074] in, Represents the loss of the discriminator; N represents the training round; i represents the current training round; represents the real sample; represents said forged sample; Indicates that the discriminator judges the forged sample The probability of being true.

[0075] is the loss of the real sample, It is the loss of forged samples. By updating the network parameters of the discriminator, it is expected that the final discriminator will distinguish real samples as real and forged samples as forged.

[0076] The training steps for generator training include:

[0077] Initializing the network parameters of the generator;

[0078] Sample a random noise from the noise distribution and generate a forged sample; specifically, randomly sample a batch of noise from a standard normal distribution, and generate a forged sample through a generator based on the noise;

[0079] Constructing a generator loss function, inputting the forged sample into the generator loss function, and calculating the loss of the generator;

[0080] The generator loss function is back-propagated and gradient updated to gradually adjust the network parameters of the generator. Specifically, the Adam optimizer is used to back-propagate and gradient update the generator loss function. The same learning rate and discriminator parameters are used, that is, the learning rate is set to 0.0002, and the momentum parameters are set to , , the network parameters of the generator are updated so that the generator gradually learns to generate high-quality samples, thereby better deceiving the discriminator.

[0081] In optimizers such as the Adam optimizer, momentum parameters β1 and β2 are used to control the degree of smoothness during the gradient update process. β1 is the first-order momentum parameter responsible for performing an exponentially weighted moving average of the mean of the gradient (i.e., the first-order momentum). Larger β1 values ​​make the historical gradients have a greater impact on the current gradient, making the update smoother, while smaller values ​​emphasize the contribution of the current gradient and make the update faster. β2 is the second-order momentum parameter used to perform an exponentially weighted moving average of the squared gradient (i.e., variance). Larger β2 values ​​can smooth the changes in the gradient variance and alleviate the oscillation problem, while smaller values ​​make the optimization process more sensitive to changes in the current gradient. In the training of generative adversarial networks (GANs), the settings of β1 and β2 are critical because the adversarial relationship between the generator and the discriminator may lead to unstable training. To accelerate convergence and improve stability, β1 is usually set to 0.5, while β2 is kept at 0.999. The momentum parameter can improve the stability and efficiency of the optimizer by smoothing the gradient information, allowing the discriminator to more accurately distinguish between real and forged samples during training.

[0082] The expression of the generator loss function is:

[0083] ,

[0084] in, Represents the loss of the generator; N represents the training round; i represents the current training round; Indicates a forged sample; Indicates that the discriminator judges the forged sample The probability of being true.

[0085] Specifically, the generator loss function is , update the network parameters of the generator to generate more realistic forged samples, so that the forged samples The discriminator D considers it to be true.

[0086] The learning rate and momentum parameters used in the training process are empirical parameters that have been proven through a large amount of practice. They are very effective for the stability of generative adversarial network training. Momentum accumulation and adaptive learning rate accelerate the training process and reduce gradient oscillation, especially in adversarial training, which can maintain the dynamic balance between the generator and the discriminator.

[0087] S3, after the training is completed, a random key generation model is obtained, and a random key is generated based on the random key generation model.

[0088] Those of ordinary skill in the art will appreciate that the modules of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the constituent modules and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0089] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A random key generation method based on QRNG generative adversarial network, characterized in that: include: S1, using a quantum random number generator to generate an initial random number sequence; S2, constructing an initial random key generation model: the initial random key generation model includes a generator and a discriminator, dividing the initial random number sequence into multiple sequence samples and inputting them into the initial random key generation model, and alternately training the generator and the discriminator; S3, after the training is completed, a random key generation model is obtained, and a random key is generated based on the random key generation model.

2. A random key generation method based on QRNG generative adversarial network according to claim 1, characterized in that: The S1 generates an initial random number sequence using a quantum random number generator, including: Generate random number sequences using quantum random number generators; Performing a randomness test on the random number sequence to obtain a test result; The randomness of the random number sequence is determined based on the test result. If the test result is greater than a set threshold, the randomness test of the random number sequence passes, otherwise it fails; If the randomness test of the random number sequence fails, a new random number sequence is generated; if the randomness test of the random number sequence passes, the random number sequence is used as the initial random number sequence.

3. A random key generation method based on QRNG generative adversarial network according to claim 1, characterized in that: The generator in the initial random key generation model includes a first input layer, a first fully connected layer, a second fully connected layer, a third fully connected layer and a first output layer connected in sequence, wherein the dimension of the first input layer is 128; the activation functions of the first fully connected layer, the second fully connected layer and the third fully connected layer are all RuLU functions, and the dimensions of the first fully connected layer, the second fully connected layer and the third fully connected layer are 256, 512 and 1024 respectively; the dimension of the first output layer is 128, and the activation function is Tanh.

4. A random key generation method based on QRNG generative adversarial network according to claim 1, characterized in that: The discriminator in the initial random key generation model includes a second input layer, a fourth fully connected layer, a fifth fully connected layer, a sixth fully connected layer, and a second output layer connected in sequence, wherein: the dimension of the second input layer is 128; the dimensions of the fourth fully connected layer, the fifth fully connected layer, and the sixth fully connected layer are 1024, 512, and 256, respectively, and the activation function is Leaky RuLU; the output dimension of the second output layer is 1, and the activation function is Sigmoid.

5. A random key generation method based on QRNG generative adversarial network according to claim 1, characterized in that: The step of alternately training the generator and the discriminator comprises: In the 2i-1th round of training, the discriminator training is performed, and the network parameters of the discriminator are updated using the discriminator loss function; in the 2ith round of training, the generator training is performed, and the network parameters of the generator are updated using the generator loss function; the loss function of the initial random key generation model is expressed as: ; in, represents the discriminator loss function; Represents the generator loss function; N represents the training round; i represents the current training round.

6. A random key generation method based on QRNG generative adversarial network according to claim 5, characterized in that: The training step of performing discriminator training includes: Initializing the network parameters of the discriminator; Sampling a sequence sample from the initial random number sequence as a real sample, and obtaining a forged sample generated by the generator; Constructing a discriminator loss function, inputting the real sample and the forged sample into the discriminator loss function, and calculating the loss of the discriminator; The discriminator loss function is back-propagated and gradient updated to gradually adjust the network parameters of the discriminator.

7. A random key generation method based on QRNG generative adversarial network according to claim 6, characterized in that: The expression of the discriminator loss function is: , in, Represents the loss of the discriminator; N represents the training round; i represents the current training round; represents the real sample; represents said forged sample; Indicates that the discriminator judges the forged sample The probability of being true.

8. A random key generation method based on QRNG generative adversarial network according to claim 5, characterized in that: The training step of performing generator training includes: Initializing the network parameters of the generator; Sample a random noise from the noise distribution and generate fake samples; Constructing a generator loss function, inputting the forged sample into the generator loss function, and calculating the loss of the generator; The generator loss function is back-propagated and gradient updated to gradually adjust the network parameters of the generator.

9. A random key generation method based on QRNG generative adversarial network according to claim 8, characterized in that: The expression of the generator loss function is: , in, Represents the loss of the generator; N represents the training round; i represents the current training round; Indicates a forged sample; Indicates that the discriminator judges the forged sample as Real probability.

Citation Information

Patent Citations

  • Generative adversarial network-based grayscale picture colorizing method

    CN108711138A

  • Key generation method based on deep learning generative adversarial network

    CN111654368A

  • Network background traffic generation method based on generative adversarial network

    CN115277086A

  • Gene text data amplification method based on generative adversarial network

    CN119360978A

  • Generative Adversarial Network-Based Optimization Method And Application

    US20200311558A1