Key generation method and device based on diffusion model, electronic equipment and medium

Through the key generation method based on the diffusion model, the problem that traditional key generation methods cannot resist quantum computing attacks is solved, and high randomness and high security keys are generated, adapted to different application scenarios, and the security of key generation is improved. and flexibility.

CN119182525AActive Publication Date: 2024-12-24ELECTRIC POWER RESEARCH INSTITUTE OF STATE GRID SHANDONG ELECTRIC POWER COMPANY

Patent Information

Application Number
CN202411304783.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-12-24
Estimated Expiration
2044-09-19

AI Technical Summary

Technical Problem

Traditional key generation methods rely on deterministic algorithms and cannot withstand the attacks of quantum computing, especially the threat of the Xiuer algorithm to existing public key encryption algorithms, resulting in reduced security.

Method used

Using the key generation method based on the diffusion model, by constructing the initial noise distribution and diffusion model, secret information is input into the diffusion model for denoising processing, generating high randomness and high security target keys, and performing multi-level verification and optimization .

Benefits of technology

It effectively resists quantum computing attacks, improves the security and randomness of key generation, adapts to the needs of different application scenarios, and has high application value and broad prospects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119182525A_ABST
    Figure CN119182525A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a key generation method and device based on a diffusion model, electronic equipment and a storage medium. The method comprises the following steps: constructing an initial noise distribution and diffusion model; inputting secret information and the initial noise distribution into the diffusion model to obtain noisy data, and performing denoising processing on the noisy data by adopting the diffusion model to obtain target distribution; determining a target random sample from the target distribution, and taking the target random sample as an initial key; and performing multi-level verification and optimization on the initial key to generate a target key. According to the technical scheme provided by the embodiment of the invention, the high-randomness and high-security key is generated by using the diffusion model, so that the attack of quantum computing is effectively resisted, and the security of key generation is improved; the flexibility and expandability of the diffusion model enable the diffusion model to adapt to the requirements of different application scenes, and the method has high application value and wide application prospects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the technical fields of information security and cryptography, and in particular to a method, device, electronic device and medium for generating a key based on a diffusion model. Background Art

[0002] Traditional key generation methods usually rely on deterministic algorithms, such as generating keys based on mathematical puzzles. These methods are secure on classical computers because the time and computing resources required for classical computers to solve these mathematical problems are very high. However, with the development of quantum computing, these algorithms based on mathematical puzzles are facing unprecedented threats. Quantum computing can effectively crack many existing encryption algorithms through methods such as Shor's algorithm, greatly reducing the security of traditional key generation methods.

[0003] Shor's algorithm is a quantum algorithm that can solve large integer factorization and discrete logarithm problems in polynomial time, both of which are the basis of many traditional public key encryption algorithms. This means that once quantum computers reach sufficient scale and stability, existing public key encryption algorithms will no longer provide security.

[0004] Therefore, there is an urgent need to develop new key generation methods to ensure communication and data security in the era of quantum computing. Summary of the invention

[0005] The purpose of the present invention is to overcome the defects in the prior art and provide a key generation method, device, electronic device and storage medium based on a diffusion model, so as to generate highly random and highly secure keys through the diffusion model, effectively resist quantum computing attacks, and improve the security of key generation.

[0006] In a first aspect, an embodiment of the present invention provides a key generation method based on a diffusion model, comprising:

[0007] Construct initial noise distribution and diffusion model;

[0008] Inputting secret information and initial noise distribution into the diffusion model to obtain noisy data, and using the diffusion model to denoise the noisy data to obtain a target distribution;

[0009] Determine a target random sample from the target distribution, and use the target random sample as an initial key;

[0010] The initial key is verified and optimized at multiple levels to generate a target key.

[0011] In a second aspect, an embodiment of the present invention further provides a key generation device based on a diffusion model, comprising:

[0012] Noise and model generation module, used to build initial noise distribution and diffusion model;

[0013] A diffusion model application module, used for inputting secret information and initial noise distribution into the diffusion model to obtain noisy data, and using the diffusion model to denoise the noisy data to obtain a target distribution;

[0014] A key extraction module, used for determining a target random sample from the target distribution and using the target random sample as an initial key;

[0015] The verification and optimization module is used to perform multi-level verification and optimization on the initial key to generate a target key.

[0016] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0017] one or more processors;

[0018] A storage device for storing one or more programs;

[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the key generation method based on the diffusion model described in any embodiment of the present invention.

[0020] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for generating a key based on a diffusion model described in any embodiment of the present invention is implemented.

[0021] In order to achieve the above objectives, the beneficial effects of the present invention are: by using a diffusion model to generate highly random and highly secure keys, the attack of quantum computing can be effectively resisted, and the security of key generation is improved; the flexibility and scalability of the diffusion model enable it to adapt to the needs of different application scenarios, and it has high application value and broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Other features, objects and advantages of the present invention will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings. The drawings are only for the purpose of illustrating preferred embodiments and are not to be considered as limiting the present invention. Also, the same reference symbols are used throughout the drawings to represent the same parts. In the drawings:

[0023] Figure 1 is a flow chart of a key generation method based on a diffusion model provided in Embodiment 1 of the present invention;

[0024] Figure 2This is a schematic diagram of constructing a diffusion model provided by the first embodiment of the present invention;

[0025] Figure 3 is a flow chart of a key generation method based on a diffusion model provided in Embodiment 2 of the present invention;

[0026] Figure 4 is a schematic diagram of a modular system structure provided in an embodiment of the present invention;

[0027] Figure 5 It is a structural schematic diagram of a key generation device based on a diffusion model provided in Embodiment 3 of the present invention;

[0028] Figure 6 It is a structural schematic diagram of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0029] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0030] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the operations (or steps) as sequential processes, many of the operations (or steps) therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0031] Among them, the acquisition, storage, use and processing of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations. It should be noted that in the embodiments of this application, some existing solutions in the industry such as certain software, components or models may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.

[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.

[0033] Embodiment 1

[0034] Figure 1 This is a flowchart of a key generation method based on a diffusion model provided in the first embodiment of the present invention. This embodiment is applicable to the case of key generation based on a diffusion model. The method of this embodiment can be executed by a key generation device based on a diffusion model, and the device can be implemented in hardware and / or software. The device can be configured in a server for key generation based on a diffusion model. The method specifically includes the following steps:

[0035] S110, constructing an initial noise distribution and diffusion model.

[0036] The initial noise distribution may refer to the starting point of the diffusion process, which is the initial noise distribution generated by a high-quality pseudo-random number generator. The generation of the initial noise is crucial and needs to be sufficiently random and unpredictable to ensure that the diffusion model can generate high-quality keys from it.

[0037] Diffusion models are a class of probabilistic models used to generate data, especially in generating images. The working principle of this type of model is to gradually add noise to the data to destroy the data distribution, and then gradually remove the noise through the inverse process to generate new data. The core idea of ​​the diffusion model is to gradually add noise to the data through a forward process model, making it more and more random until it becomes a pure Gaussian noise; then, through an inverse process, gradually remove the noise from the pure noise and restore it to the original data. This step-by-step adjustment method can ensure the stability and diversity of the generation process and avoid the generation results from falling into the local optimum.

[0038] Optionally, the diffusion model is also highly flexible and scalable. By adjusting the parameters of the diffusion process, keys of different lengths and different security levels can be generated to meet the needs of various application scenarios; the parameters include time steps, noise intensity, and denoising algorithms. For example, in scenarios that require high security, a longer time step and a more complex denoising algorithm can be selected to generate a long key with high entropy; while in a resource-constrained environment, a shorter time step and a simpler denoising algorithm can be selected to generate a short key.

[0039] S120, inputting the secret information and the initial noise distribution into the diffusion model to obtain noisy data, and using the diffusion model to denoise the noisy data to obtain the target distribution.

[0040] The embodiment of the present invention applies the diffusion model to key generation, and generates highly random and highly secure keys by introducing randomness and complexity, thereby effectively resisting the attack of quantum computing. The core of the diffusion model lies in the iterative process of step-by-step denoising, in which an appropriate amount of noise is introduced in each step to maintain the diversity of the sample, while gradually approaching the target distribution through the denoising operation.

[0041] Among them, the diffusion model is a type of probabilistic model for generating data, especially performing well in generating images. The working principle of this type of model is to destroy the data distribution by gradually adding noise, and to generate new data by gradually removing the noise through the inverse process. In the embodiment of the present invention, the diffusion model is used to gradually add noise to the secret information to obtain noisy data, and to gradually remove the noise through the inverse process to obtain the target distribution.

[0042] Specifically, first prepare a training dataset, such as an image dataset. Define a forward process model that adds noise, and generate noisy data by gradually adding noise. Use a neural network (usually U-Net) to fit the inverse process and learn how to recover the original data from the noisy data. Train the inverse process model by maximizing the likelihood estimation (Maximum Likelihood Estimation, MLE). Start with Gaussian noise and use the trained inverse process model to gradually denoise and generate new data. See Figure 2 , SECRET KEY PROMPT is the input part of a secret key prompt, including secret information input by the user or provided by other means. τ(Tau) is a transformation module used to process the input secret information and generate some form of encoding or feature representation. Latent space, in this space, the data undergoes a series of processing to generate multiple latent representations (such as Zt). The figure shows multiple layers of latent representations, representing a deep neural network structure. Each layer processes the latent representation and adds noise Nt. KEY is a secret key module that is used in each layer of the latent space. The secret key module may be used to add or remove specific information so that the data is properly encrypted or decrypted in the latent space. D(Decoder) represents the decoder, which is used to decode the representation in the latent space back to the original information; for example, convert the last layer representation Zt-1 of the latent space back to the key.

[0043] Optionally, the diffusion model works by starting with an initial noise distribution and gradually reducing the noise through a series of iterative steps, each step introducing appropriate randomness to the generated samples. This step-by-step optimization process makes the generated samples have high entropy and high randomness, which are difficult to predict and crack. These characteristics of the diffusion model are particularly important during the key generation process because they ensure the unpredictability and security of the key.

[0044] S130: Determine a target random sample from the target distribution, and use the target random sample as an initial key.

[0045] Among them, the most representative and secure sample is selected from the target distribution as the target random sample, and the target random sample is used as the initial key. The target random sample is selected in a manner including but not limited to entropy value calculation and frequency detection. For example, the entropy value of each sample in the target distribution is determined, and the sample with the highest entropy value is used as the initial key.

[0046] S140, performing multi-level verification and optimization on the initial key to generate a target key.

[0047] The initial key is verified and optimized multiple times to ensure that the generated target key has high randomness and high entropy. The verification and optimization methods include but are not limited to frequency detection, sequence detection and entropy calculation. Frequency detection may refer to detecting the frequency of occurrence of each symbol in the initial key; sequence detection may refer to determining the sequence length of the initial key; and entropy calculation may refer to determining the entropy value of the initial key.

[0048] Optionally, if the initial key fails to be verified, the parameters of the diffusion model for constructing the initial key need to be dynamically adjusted. For example, the time step or initial noise distribution of the diffusion model is adjusted to make the initial key pass the verification, thereby improving the security and reliability of key generation.

[0049] The embodiment of the present invention provides a key generation method based on a diffusion model, by constructing an initial noise distribution and a diffusion model; inputting secret information and the initial noise distribution into the diffusion model to obtain noisy data, and using the diffusion model to denoise the noisy data to obtain a target distribution; determining a target random sample from the target distribution, and using the target random sample as an initial key; performing multi-level verification and optimization on the initial key to generate a target key. The technical solution of the embodiment of the present invention is adopted, and by using the diffusion model to generate a highly random and highly secure key, it is effectively protected against quantum computing attacks, and the security of key generation is improved; the flexibility and scalability of the diffusion model enable it to adapt to the needs of different application scenarios, and it has high application value and broad application prospects.

[0050] Embodiment 2

[0051] Figure 3 The flowchart of a key generation method based on a diffusion model is provided for the second embodiment of the present invention. The embodiment of the present invention further optimizes the above embodiment on the basis of the above embodiment, and the embodiment of the present invention can be combined with various optional solutions in one or more of the above embodiments. Figure 3As shown, the key generation method based on the diffusion model provided in the embodiment of the present invention may include the following steps:

[0052] S310: construct an initial noise distribution and diffusion model.

[0053] Among them, the initial noise distribution is crucial as the starting point of the diffusion process. The initial noise distribution needs to be sufficiently random and unpredictable to ensure that the diffusion model can generate high-quality keys from it.

[0054] As an optional but non-limiting implementation, the constructing the initial noise distribution includes:

[0055] A pseudo-random number generator is used to generate a pseudo-random number sequence using a given seed, and the pseudo-random number sequence is used as an initial noise distribution.

[0056] The embodiment of the present invention provides a modular system structure, including a noise generation module, a diffusion model module, a key extraction module and a verification and optimization module. The modules interact with each other through standard interfaces, which has high flexibility and scalability.

[0057] The noise generation module is the basis of the key generation system. Its main task is to generate an initial noise distribution with high entropy and high randomness. To achieve this goal, the noise generation module relies on a high-quality pseudo-random number generator (PRNG). The pseudo-random number generator generates a pseudo-random number sequence through a given seed, expressed as:

[0058] N 0 =PRNG(seed)

[0059] Among them, N 0 is the initial noise distribution, and seed is the seed of the pseudo-random number generator. In order to ensure the high entropy of the noise, the following entropy calculation formula is used to measure the quality of the generated noise:

[0060]

[0061] Among them, H(N 0 ) represents the noise quality, P(N 0 =i) represents the probability of the i-th value in the noise distribution.

[0062] Optionally, the pseudo-random number generator can provide high-quality randomness and ensure high entropy of the initial noise. The pseudo-random number generator includes but is not limited to the Mersenne Twister algorithm, Xorshift, and Cryptographically Secure PRNG. Among them, xorshift is a pseudo-random number generator algorithm that uses bit operations and XOR operations to generate random numbers. Cryptographically Secure PRNG is a cryptographically secure pseudo-random number generator, which is a special type of pseudo-random number generator. The random number sequence generated is unpredictable in cryptographic applications. This pseudo-random number generator must be able to resist various cryptographic attacks to ensure that the generated random values ​​are safe in an environment with high security requirements.

[0063] The initial noise distribution will directly affect the performance of the subsequent diffusion model, so it is crucial to ensure the quality of the initial noise. To further improve security, the PRNG seed can be changed regularly, or a hardware random number generator (such as a quantum random number generator) can be used to enhance the randomness and unpredictability of noise generation.

[0064] In an optional solution of an embodiment of the present invention, the entropy value of the initial noise distribution can be verified and improved by a variety of methods. For example, multiple independent noise distributions can be generated, and their entropy values ​​can be calculated, and the distribution with the highest entropy value can be selected as the final initial noise distribution. In addition, the randomness and entropy value of the noise can be further improved by combining the outputs of multiple PRNGs.

[0065] Diffusion model can refer to a generative model, which is widely used to generate data samples with complex distributions. The basic idea is to gradually transform the initial random noise into the target data distribution by simulating the diffusion process of data. Diffusion model is based on the idea of ​​Markov chain, and simulates a process from a simple noise distribution to a complex data distribution through multi-step iteration. Each iteration can be regarded as a small adjustment to the current state to make it closer to the target distribution. This step-by-step adjustment method can ensure the stability and diversity of the generation process and avoid the generation result falling into the local optimum.

[0066] As an optional but non-limiting implementation, the construction of the diffusion model includes but is not limited to steps A1-A3:

[0067] Step A1: Determine a diffusion model training data set; wherein the diffusion model includes a forward process model and a reverse process.

[0068] Step A2: construct a forward process model, and gradually add initial noise distribution to the training data set through the forward process model to generate noisy data.

[0069] The forward process model is a set of Markov chains that add some small Gaussian noise at each time step. Suppose there is a data point X 0 The forward process model can be defined as:

[0070]

[0071] This formula means that at time step t, given the sample X of the previous time step t-1 , the sample X at the current time step t The conditional probability distribution of is a distribution with a mean of The covariance is β t I is a Gaussian distribution. Among them, β t is the noise intensity at time step t, and I is the identity matrix.

[0072]

[0073] Indicates that from X 0 To X t The joint distribution of is the product of the conditional probability distributions at each time step. This is because the forward process model is a Markov chain, so the sample at each time step only depends on the sample at the previous time step.

[0074] In general, each step of the forward process model generates samples at the current time step by adding Gaussian noise to the samples at the previous time step. The whole process is composed of the initial data point X 0 We begin by repeatedly applying the conditional probability distribution q(x t |x t-1 ) until the final time step X t .

[0075] Step A3: construct an inverse process model, and train the inverse process model using maximum likelihood estimation until the loss function converges; wherein the inverse process model is used to denoise the noisy data to obtain the original data.

[0076] The reverse process is a trained denoising process, the purpose of which is to generate data from pure noise. This process can also be defined as a Markov chain, and the joint probability distribution of the reverse process can be expressed as:

[0077]

[0078] Among them, p(x T ) is the prior distribution of time step T, usually a standard normal distribution; p θ (x t-1 |x t is the conditional probability distribution from time step t to t-1.

[0079] The conditional probability distribution of each step in the reverse process can be expressed as:

[0080]

[0081] in, represents a Gaussian distribution with mean μ θ (x t ,t), the covariance is Σ θ (x t ,t). θ (x t ,t) and Σ θ (x t ,t) is a parameterized function, usually learned by a neural network. During the training process, the model learns the parameters θ in the reverse process so that the data generated by the reverse process matches the original data as much as possible. This process is usually achieved by maximizing the log-likelihood or minimizing the KL divergence.

[0082] Optionally, the loss function used during training is usually the variational lower bound (VLB):

[0083]

[0084] Among them, Eq represents the expected symbol, which represents the forward process model q(x 1:T |x 0 ) samples to be expected. represents the KL divergence term, q(x t-1 |x t ,x 0 represents the inverse conditional distribution in the forward process model, taking into account the real data X 0 And the data X at the current time step t ;p θ (x t-1 |x t ) represents the conditional distribution of the backward process, parameterized by the model parameters θ. KL divergence measures the difference between the two distributions, and minimizing this term means that we hope that the backward process can well approximate the inverse conditional distribution in the forward process model.

[0085] -logp θ (x 0 |x 1 ) represents the log-likelihood term, which means that in the first step (from X 1 To X 0 ) to generate the original data X 0Maximizing the log-likelihood is equivalent to minimizing its negative value, thereby improving the model's ability to generate data. By minimizing this defined loss function, the model can learn how to generate real data from noisy data.

[0086] S320, inputting the secret information into the forward process model of the diffusion model, and adding an initial noise distribution to the secret information of the current time step according to the secret information of the previous time step at each time step to obtain noisy data.

[0087] Before adding noise to the secret information, the initial parameters of the diffusion model are set, including the time step and the initial noise distribution; the setting of the initial parameters will directly affect the quality and security of the final generated key. The stability and efficiency of the generation process can be ensured by accurately controlling the initial parameters. After determining the initial parameters, the secret information is input into the diffusion model, and the initial noise distribution is introduced at each time step to obtain noisy data to ensure the randomness and security of the generation process.

[0088] The main goal of the diffusion model is to transform the initial noise distribution N 0 Transformed into a high-quality target distribution N T .

[0089] The basic iterative formula of the diffusion model is as follows:

[0090] N t+1 =f(N t ,θ)

[0091] Among them, N t is the noise distribution at step t, f is the update function of the diffusion model, and θ is the model parameter. The noise distribution at step t+1 is obtained based on the noise distribution at step t.

[0092] S330, inputting the noisy data into the inverse process of the diffusion model, iterating and denoising the noisy data to obtain a target distribution.

[0093] The noisy data is iterated and denoised so that the noise is gradually reduced to obtain the target distribution. In each iterative step, the diffusion model performs denoising according to the current noise state and the preset diffusion rules. The more iterations there are, the closer the generated samples are to the target distribution, and the higher the quality of the key. For example, a specific denoising algorithm, a variational autoencoder, is used to gradually reduce the impact of noise and generate samples that are closer to the target distribution.

[0094] As an optional but non-limiting implementation, in the inverse process of inputting the noisy data into the diffusion model, iterating and denoising the noisy data to obtain the target distribution includes:

[0095] The noisy data is input into the inverse process of the diffusion model for denoising, which can be expressed as:

[0096] N t+1 =D(N t ,η)

[0097] Where D is the denoising function, η is the denoising parameter, N t Represents the noisy data before denoising, N t+1 Represents the noisy data after denoising;

[0098] The noisy data is processed through multiple iterations and denoising to finally generate the target distribution, which can be expressed as:

[0099] N T =D T (N 0 ,η)

[0100] Among them, N T Indicates the target, N 0 represents the initial noise distribution.

[0101] Optionally, the diffusion model module is the core part of the key generation process. The diffusion model module performs multiple iterations and step-by-step denoising based on the set diffusion process parameters to finally generate the target distribution. In order to optimize the effect of the diffusion model, an adaptive time step is used to dynamically adjust the step size according to the changes in the noise distribution; a multi-scale modeling method is used to perform diffusion and denoising at different scales to capture the multi-level structure of the noise distribution. In addition, the regularization term can be introduced to prevent the model from overfitting and improve the generalization ability of the generated distribution. The parameters of the diffusion model need to be adjusted according to the specific application scenario to achieve the best key generation effect. Experiments and simulations can be used to evaluate the generation effect under different parameter configurations and select the optimal parameter combination.

[0102] S340: Determine a target random sample from the target distribution, and use the target random sample as an initial key.

[0103] At the end of the diffusion process, highly random samples are extracted from the generated target distribution as the final key. These samples should have high entropy and high unpredictability to ensure the security of the key. Samples are usually selected directly from the target distribution at random, or keys are generated through a specific transformation function. Depending on security requirements, keys of different lengths are generated, such as 128 bits, 256 bits, and 512 bits.

[0104] As an optional but non-limiting implementation, determining a target random sample from the target distribution and using the target random sample as an initial key includes:

[0105] According to the preset sample extraction standard, the target random sample is determined from the target distribution; the preset sample extraction standard can be expressed as:

[0106]

[0107] Among them, K is the target random sample, N T is the target distribution; R(k) is the randomness measurement function of sample k, and the randomness measurement method includes entropy calculation and frequency detection.

[0108] Optionally, the key extraction module extracts highly random samples from the generated target distribution to generate a final key. The key extraction module selects the most representative and secure samples as the key by analyzing the target distribution.

[0109] Assume the target distribution is N T , we need to extract the target random sample K from it, which can be expressed as:

[0110] K=E(N T )

[0111] Where E is the extraction function.

[0112] S350, performing multi-level verification and optimization on the initial key to generate a target key.

[0113] After the initial key is generated, the security of the generated initial key is verified, and the diffusion model parameters are adjusted for optimization when necessary. Through multi-level security verification, it is ensured that the generated target key has high randomness and high entropy. According to the verification results, the parameters of the diffusion model can be dynamically adjusted to improve the security and reliability of the target key generation process.

[0114] As an optional but non-limiting implementation, the multi-level verification and optimization of the initial key to generate the target key includes but is not limited to steps B1-B2:

[0115] Step B1: Perform multi-level verification on the initial key and determine whether the verification result meets the preset verification conditions.

[0116] Step B2: If the initial key does not meet the preset verification conditions, the parameters of the diffusion model are dynamically adjusted until the initial key meets the preset verification conditions to obtain the target key.

[0117] Among them, multi-level verification includes frequency detection, sequence detection and entropy calculation; the preset verification conditions include that the symbol occurrence frequency is less than the preset frequency threshold, the sequence length is less than the preset length threshold, and the entropy value is greater than the preset entropy value threshold.

[0118] The frequency detection is used to detect the frequency of occurrence of each symbol in the initial key to ensure its uniform distribution.

[0119]

[0120] Among them, n k is the number of times symbol k appears in the key, and N is the total length of the key.

[0121] Sequence detection detects whether there is a long sequence in the initial key to prevent the occurrence of low randomness sequences. For example, run detection is used to evaluate the presence of long sequences in the initial key. If a long sequence is detected, the key is reselected or regenerated.

[0122] Entropy calculation is used to calculate the entropy value of the initial key to ensure that the initial key has high entropy.

[0123]

[0124] According to the verification results, the parameters of the diffusion model, such as the number of time steps, noise distribution type, and denoising algorithm, are dynamically adjusted to improve the security and reliability of the target key generation process. For example, the number of time steps can be increased to improve the meticulousness of the diffusion process; a more suitable noise distribution type can be selected to better simulate the noise characteristics in actual applications; and the denoising algorithm can be optimized to improve the denoising effect, thereby generating a higher quality target distribution.

[0125] In an optional solution of the embodiment of the present invention, see Figure 4 The embodiment of the present invention designs a modular system structure, including a noise generation module, a diffusion model module, a key extraction module and a verification and optimization module. By designing a modular system structure, the whole process of noise generation, diffusion model, key extraction and verification and optimization is realized. Each module interacts through a standard interface, which has high flexibility and scalability. Through multi-level security verification and dynamic optimization, it is ensured that the generated key has high randomness and high entropy, which greatly improves the security and reliability of the key generation process.

[0126] The embodiment of the present invention provides a key generation method based on a diffusion model, by inputting secret information into the forward process model of the diffusion model, and adding an initial noise distribution to the secret information of the current time step according to the secret information of the previous time step at each time step, to obtain noisy data; the noisy data is input into the reverse process of the diffusion model, and the noisy data is iterated and denoised to obtain the target distribution. A target random sample is determined from the target distribution, and the target random sample is used as an initial key; the initial key is multi-level verified and optimized to generate a target key. The technical solution of the embodiment of the present invention is adopted, and a diffusion model is used to generate an initial key with high randomness and high security, which can effectively resist the attack of quantum computing, and has high application value and broad application prospects. The flexibility and scalability of the diffusion model enable it to adapt to the needs of different application scenarios and generate keys of different lengths and security levels. The initial key is verified and optimized to make the generated target key more unpredictable and secure.

[0127] Embodiment 3

[0128] Figure 5 This is a schematic diagram of the structure of a key generation device based on a diffusion model provided by the third embodiment of the present invention. The technical solution of this embodiment can be applied to the case of key generation based on a diffusion model. The device can be implemented by software and / or hardware and is generally integrated on any electronic device with network communication function, including but not limited to: servers, computers, personal digital assistants and other devices. Figure 5 As shown, the key generation device based on the diffusion model provided in this embodiment may include: a noise and model generation module 510, a diffusion model application module 520, a key extraction module 530 and a verification and optimization module 540; wherein,

[0129] Noise and model generation module 510, used to construct initial noise distribution and diffusion model;

[0130] The diffusion model application module 520 is used to input the secret information and the initial noise distribution into the diffusion model to obtain noisy data, and use the diffusion model to denoise the noisy data to obtain the target distribution;

[0131] A key extraction module 530, configured to determine a target random sample from the target distribution and use the target random sample as an initial key;

[0132] The verification and optimization module 540 is used to perform multi-level verification and optimization on the initial key to generate a target key.

[0133] Based on the above embodiment, optionally, the noise and model generation module is specifically used to:

[0134] A pseudo-random number generator is used to generate a pseudo-random number sequence using a given seed, and the pseudo-random number sequence is used as an initial noise distribution.

[0135] Based on the above embodiment, optionally, the noise and model generation module is specifically used to:

[0136] Determining a diffusion model training data set; wherein the diffusion model includes a forward process model and a reverse process;

[0137] Constructing a forward process model, and gradually adding an initial noise distribution to the training data set through the forward process model to generate noisy data;

[0138] A reverse process model is constructed, and the reverse process model is trained by maximizing likelihood estimation until the loss function converges; wherein the reverse process model is used to denoise the noisy data to obtain the original data.

[0139] Based on the above embodiment, optionally, the diffusion model application module is specifically used to:

[0140] The secret information is input into the forward process model of the diffusion model, and at each time step, an initial noise distribution is added to the secret information of the current time step according to the secret information of the previous time step to obtain noisy data;

[0141] The noisy data is input into the inverse process of the diffusion model, and the noisy data is iterated and denoised to obtain the target distribution.

[0142] Based on the above embodiment, optionally, the diffusion model application module is further specifically used for:

[0143] The noisy data is input into the inverse process of the diffusion model for denoising, which can be expressed as:

[0144] N t+1 =D(N t ,η)

[0145] Where D is the denoising function, η is the denoising parameter, N t Represents the noisy data before denoising, N t+1 Represents the noisy data after denoising;

[0146] The noisy data is processed through multiple iterations and denoising to finally generate the target distribution, which can be expressed as:

[0147] N T =D T (N 0 ,η)

[0148] Among them, N T Indicates the target, N 0 represents the initial noise distribution.

[0149] Based on the above embodiment, optionally, the key extraction module is specifically used to:

[0150] According to the preset sample extraction standard, the target random sample is determined from the target distribution; the preset sample extraction standard can be expressed as:

[0151]

[0152] Among them, K is the target random sample, N T is the target distribution; R(k) is the randomness measurement function of sample k, and the randomness measurement method includes entropy calculation and frequency detection.

[0153] Based on the above embodiment, optionally, the verification and optimization module is specifically used to:

[0154] Performing multi-level verification on the initial key and determining whether the verification result meets the preset verification conditions;

[0155] If the initial key does not meet the preset verification conditions, dynamically adjust the parameters of the diffusion model until the initial key meets the preset verification conditions to obtain the target key;

[0156] Among them, multi-level verification includes frequency detection, sequence detection and entropy calculation; frequency detection is used to detect the frequency of occurrence of each symbol in the initial key; sequence detection is used to determine the sequence length of the initial key; entropy calculation is used to determine the entropy value of the initial key; the preset verification conditions include the symbol occurrence frequency being less than the preset frequency threshold, the sequence length being less than the preset length threshold, and the entropy value being greater than the preset entropy value threshold.

[0157] The key generation device based on the diffusion model provided in the embodiment of the present invention can execute the key generation method based on the diffusion model provided in any embodiment of the present invention mentioned above, and has the corresponding functions and beneficial effects of executing the key generation method based on the diffusion model. For the detailed process, please refer to the relevant operations of the key generation method based on the diffusion model in the aforementioned embodiment.

[0158] Embodiment 4

[0159] Figure 61 is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0160] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0161] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0162] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a key generation method based on a diffusion model.

[0163] In some embodiments, the key generation method based on the diffusion model can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the key generation method based on the diffusion model described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the key generation method based on the diffusion model in any other appropriate manner (for example, by means of firmware).

[0164] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0165] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0166] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0167] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0168] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0169] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0170] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0171] The above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the invention.

Claims

1. A key generation method based on a diffusion model, characterized in that: The method comprises: Construct initial noise distribution and diffusion model; Inputting secret information and initial noise distribution into the diffusion model to obtain noisy data, and using the diffusion model to denoise the noisy data to obtain a target distribution; Determine a target random sample from the target distribution, and use the target random sample as an initial key; The initial key is verified and optimized at multiple levels to generate a target key.

2. The method according to claim 1, characterized in that: The constructing of the initial noise distribution comprises: A pseudo-random number generator is used to generate a pseudo-random number sequence using a given seed, and the pseudo-random number sequence is used as an initial noise distribution.

3. The method according to claim 1, characterized in that The construction of the diffusion model comprises: Determining a diffusion model training data set; wherein the diffusion model includes a forward process model and a reverse process; Constructing a forward process model, and gradually adding an initial noise distribution to the training data set through the forward process model to generate noisy data; A reverse process model is constructed, and the reverse process model is trained by maximizing likelihood estimation until the loss function converges; wherein the reverse process model is used to denoise the noisy data to obtain the original data.

4. The method according to claim 1, characterized in that The step of inputting the secret information and the initial noise distribution into the diffusion model to obtain noisy data, and using the diffusion model to denoise the noisy data to obtain the target distribution includes: The secret information is input into the forward process model of the diffusion model, and at each time step, an initial noise distribution is added to the secret information of the current time step according to the secret information of the previous time step to obtain noisy data; The noisy data is input into the inverse process of the diffusion model, and the noisy data is iterated and denoised to obtain the target distribution.

5. The method according to claim 4, characterized in that In the inverse process of inputting the noisy data into the diffusion model, iterating and denoising the noisy data to obtain a target distribution, including: The noisy data is input into the inverse process of the diffusion model for denoising, which can be expressed as: N t+1 =DN t ,or Where D is the denoising function, η is the denoising parameter, N t Represents the noisy data before denoising, N t+1 Represents the noisy data after denoising; The noisy data is processed through multiple iterations and denoising to finally generate the target distribution, which can be expressed as: N T =D T No. Among them, N T represents the target distribution, and N0 represents the initial noise distribution.

6. The method according to claim 1, characterized in that The step of determining a target random sample from the target distribution and using the target random sample as an initial key comprises: According to the preset sample extraction standard, the target random sample is determined from the target distribution; the preset sample extraction standard can be expressed as: Among them, K is the target random sample, N T is the target distribution; Rk is the randomness measurement function of sample k, and the randomness measurement method includes entropy calculation and frequency detection.

7. The method according to claim 1, characterized in that The multi-level verification and optimization of the initial key to generate the target key includes: Performing multi-level verification on the initial key and determining whether the verification result meets the preset verification conditions; If the initial key does not meet the preset verification conditions, dynamically adjust the parameters of the diffusion model until the initial key meets the preset verification conditions to obtain the target key; Among them, multi-level verification includes frequency detection, sequence detection and entropy calculation; frequency detection is used to detect the frequency of occurrence of each symbol in the initial key; sequence detection is used to determine the sequence length of the initial key; entropy calculation is used to determine the entropy value of the initial key; the preset verification conditions include the symbol occurrence frequency being less than the preset frequency threshold, the sequence length being less than the preset length threshold, and the entropy value being greater than the preset entropy value threshold.

8. A key generation device based on a diffusion model, characterized in that: The device comprises: Noise and model generation module, used to build initial noise distribution and diffusion model; A diffusion model application module, used for inputting secret information and initial noise distribution into the diffusion model to obtain noisy data, and using the diffusion model to denoise the noisy data to obtain a target distribution; A key extraction module, used for determining a target random sample from the target distribution and using the target random sample as an initial key; The verification and optimization module is used to perform multi-level verification and optimization on the initial key to generate a target key.

9. The device according to claim 8, characterized in that The noise and model generation module is specifically used for: A pseudo-random number generator is used to generate a pseudo-random number sequence using a given seed, and the pseudo-random number sequence is used as an initial noise distribution.

10. The device according to claim 8, characterized in that The noise and model generation module is specifically used for: Determining a diffusion model training data set; wherein the diffusion model includes a forward process model and a reverse process; Constructing a forward process model, and gradually adding an initial noise distribution to the training data set through the forward process model to generate noisy data; A reverse process model is constructed, and the reverse process model is trained by maximizing likelihood estimation until the loss function converges; wherein the reverse process model is used to denoise the noisy data to obtain the original data.

11. The device according to claim 8, characterized in that The diffusion model application module is specifically used for: The secret information is input into the forward process model of the diffusion model, and at each time step, an initial noise distribution is added to the secret information of the current time step according to the secret information of the previous time step to obtain noisy data; The noisy data is input into the inverse process of the diffusion model, and the noisy data is iterated and denoised to obtain the target distribution.

12. The device according to claim 11, characterized in that The diffusion model application module is further specifically used for: The noisy data is input into the inverse process of the diffusion model for denoising, which can be expressed as: N t+1 =DN t ,or Where D is the denoising function, η is the denoising parameter, N t Represents the noisy data before denoising, N t+1 Represents the noisy data after denoising; The noisy data is processed through multiple iterations and denoising to finally generate the target distribution, which can be expressed as: N T =D T No. Among them, N T represents the target distribution, and N0 represents the initial noise distribution.

13. The device according to claim 8, characterized in that The key extraction module is specifically used for: According to the preset sample extraction standard, the target random sample is determined from the target distribution; the preset sample extraction standard can be expressed as: Among them, K is the target random sample, N T is the target distribution; Rk is the randomness measurement function of sample k, and the randomness measurement method includes entropy calculation and frequency detection.

14. The device according to claim 8, characterized in that The verification and optimization module is specifically used for: Performing multi-level verification on the initial key and determining whether the verification result meets the preset verification conditions; If the initial key does not meet the preset verification conditions, dynamically adjust the parameters of the diffusion model until the initial key meets the preset verification conditions to obtain the target key; Among them, multi-level verification includes frequency detection, sequence detection and entropy calculation; frequency detection is used to detect the frequency of occurrence of each symbol in the initial key; sequence detection is used to determine the sequence length of the initial key; entropy calculation is used to determine the entropy value of the initial key; the preset verification conditions include the symbol occurrence frequency being less than the preset frequency threshold, the sequence length being less than the preset length threshold, and the entropy value being greater than the preset entropy value threshold.

15. An electronic device, characterized in that: include: at least one processor; A storage device for storing at least one computer program; When the at least one computer program is executed by the at least one processor, the at least one processor is enabled to implement the key generation method based on the diffusion model as described in any one of claims 1 to 7.

16. A storage medium containing computer executable instructions, characterized in that: When the computer executable instructions are executed by a computer processor, they are used to perform the key generation method based on the diffusion model as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Model security assessment method based on de-noising diffusion model

    CN116644439A

  • Voice watermark injection and right confirmation method and system based on diffusion model

    CN117894323A

  • Data encryption storage and transmission method, device and system

    CN118175539A

  • Image digital watermark embedding method, image digital watermark extracting method and image digital watermark embedding system

    CN118632012A

  • Model deployment method and apparatus, and electronic device

    WO2024149202A1

Cited By

  • AIGC image watermarking method and system based on diffusion model generation path deflection

    CN120339030A