A key generation method, apparatus and storage medium

CN116781255BActive Publication Date: 2026-08-14SHRONG ENERGY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310593575.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-24
Publication Date
2026-08-14
Estimated Expiration
2043-05-24

AI Technical Summary

Benefits of technology

[0041]采用本公开的上述方法,具有以下有益效果:本公开中的密钥生成方法不需要额外的电路,实现简单,并且,所生成的密钥序列具有不可预测性,也无法根据已经生成的序列破译,因此,能够简化密钥生成过程的同时保证密钥的安全性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116781255B_ABST
    Figure CN116781255B_ABST
Patent Text Reader

Abstract

This disclosure discloses a key generation method, apparatus, and storage medium. The key generation method includes: obtaining an N-order target matrix, where the sum of all elements in each row and / or column of the target matrix is ​​1; generating a set corresponding one-to-one with each row and / or column of the target matrix, the set comprising N consecutively connected sub-intervals, the set covering [0,1]; generating random probability values ​​corresponding one-to-one with each row and / or column of the target matrix, determining the position identifier of the sub-interval to which the random probability value belongs in the set corresponding to the corresponding row and / or column; and generating a key sequence based on the number of random probability values ​​corresponding to each position identifier. The key generation method in this disclosure does not require additional circuitry, is simple to implement, and the generated key sequence is unpredictable and cannot be deciphered from an already generated sequence. Therefore, it simplifies the key generation process while ensuring key security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of cryptography, and in particular to a key generation method, apparatus and storage medium. Background Technology

[0002] Cryptography is an ancient discipline concerning information security. Due to the widespread use of information transmission, storage, and processing in modern information society, the need for information security is ubiquitous, making cryptographic technology even more crucial. In related technologies, a random number generator generates a key, which is then used to encrypt plaintext information and decrypt ciphertext information. To improve key security, the random numbers used to generate the key need to be unpredictable, meaning that future random numbers cannot be predicted from already generated random numbers. Simultaneously, the key generated from random numbers needs to possess good statistical properties. Summary of the Invention

[0003] To overcome the problems existing in related technologies, this disclosure provides a key generation method, apparatus and storage medium.

[0004] According to a first aspect of the present disclosure, a key generation method is provided, the key generation method comprising:

[0005] Obtain an N-order target matrix, wherein the sum of all elements in each row and / or column of the target matrix is ​​1;

[0006] Generate a set that corresponds one-to-one with the rows and / or columns of the target matrix, the set comprising N consecutively connected sub-intervals, the set covering [0,1];

[0007] Generate random probability values ​​that correspond one-to-one with the rows and / or columns of the target matrix, and determine the position identifier of the sub-interval to which the random probability value belongs in the set corresponding to the corresponding row and / or column;

[0008] A key sequence is generated based on the number of random probability values ​​corresponding to each location identifier.

[0009] In an exemplary embodiment, generating a key sequence based on the number of random probability values ​​corresponding to each location identifier includes:

[0010] If the number of random probability values ​​corresponding to the location identifier is greater than 0, then the key value corresponding to the location identifier is 1;

[0011] If the number of random probability values ​​corresponding to the location identifier is equal to 0, then the key value corresponding to the location identifier is 0;

[0012] The key sequence is formed by sequentially arranging the key values ​​corresponding to all the location identifiers.

[0013] In one exemplary embodiment, the method further includes:

[0014] If the key sequence is reused, determine the number of 0s and 1s in the key sequence, delete the key value where one number is greater than the other, and obtain the target key sequence in which the number of 0s and 1s are equal.

[0015] If the key sequence is not reused, the key sequence is determined to be the target key sequence.

[0016] In one exemplary embodiment, obtaining the N-order target matrix includes:

[0017] Generate an N-order random unitary matrix, and determine the element at the same position in the target matrix by the square of the modulus of the element at each position in the random unitary matrix.

[0018] In one exemplary embodiment, obtaining the N-order target matrix includes:

[0019] Generate an N-order random matrix, and determine the element at the same position in the target matrix as the ratio of each element in the random matrix to the sum of all elements in the row and / or column containing that element.

[0020] According to a second aspect of the present disclosure, a key generation apparatus is provided, the key generation apparatus comprising:

[0021] The acquisition module is configured to acquire an N-order target matrix, wherein the sum of all elements in each row and / or column of the target matrix is ​​1;

[0022] The first generation module is configured to generate a set that corresponds one-to-one with the rows and / or columns of the target matrix, the set comprising N consecutively connected sub-intervals, the set covering [0,1];

[0023] The sampling module is configured to generate random probability values ​​that correspond one-to-one with the rows and / or columns of the target matrix, and to determine the position identifier of the sub-interval to which the random probability value belongs in the set corresponding to the corresponding row and / or column;

[0024] The second generation module is configured to generate a key sequence based on the number of random probability values ​​corresponding to each of the location identifiers.

[0025] In one exemplary embodiment, the second generation module is further configured to:

[0026] If the number of random probability values ​​corresponding to the location identifier is greater than 0, then the key value corresponding to the location identifier is 1;

[0027] If the number of random probability values ​​corresponding to the location identifier is equal to 0, then the key value corresponding to the location identifier is 0;

[0028] The key sequence is formed by sequentially arranging the key values ​​corresponding to all the location identifiers.

[0029] In one exemplary embodiment, the second generation module is further configured to:

[0030] If the key sequence is reused, determine the number of 0s and 1s in the key sequence, delete the key value where one number is greater than the other, and obtain the target key sequence in which the number of 0s and 1s are equal.

[0031] If the key sequence is not reused, the key sequence is determined to be the target key sequence.

[0032] In one exemplary embodiment, the acquisition module is further configured to:

[0033] Generate an N-order random unitary matrix, and determine the element at the same position in the target matrix by the square of the modulus of the element at each position in the random unitary matrix.

[0034] In one exemplary embodiment, the acquisition module is further configured to:

[0035] Generate an N-order random matrix, and determine the element at the same position in the target matrix as the ratio of each element in the random matrix to the sum of all elements in the row and / or column containing that element.

[0036] According to a third aspect of the present disclosure, a key generation apparatus is provided, comprising:

[0037] processor;

[0038] Memory used to store processor-executable instructions;

[0039] The processor is configured to perform the method described in the first aspect of the embodiments of this disclosure.

[0040] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, wherein when instructions in the storage medium are executed by a processor of a device, the device is enabled to perform the method described in the first aspect of the present disclosure.

[0041] The method described in this disclosure has the following advantages: the key generation method in this disclosure does not require additional circuitry, is simple to implement, and the generated key sequence is unpredictable and cannot be deciphered based on the generated sequence. Therefore, it can simplify the key generation process while ensuring key security.

[0042] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0043] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0044] Figure 1 This is a schematic diagram illustrating an encryption and decryption system according to an exemplary embodiment;

[0045] Figure 2 This is a flowchart illustrating a key generation method according to an exemplary embodiment;

[0046] Figure 3 This is a schematic diagram of line segments illustrating each set according to an exemplary embodiment;

[0047] Figure 4 This is a graph illustrating the relationship between the order of the target matrix and the total number of different sampled samples generated, according to an exemplary embodiment.

[0048] Figure 5A This is a probability distribution diagram of a sampled sample according to an exemplary embodiment;

[0049] Figure 5B It is a probability histogram of a sampling process illustrated according to an exemplary embodiment;

[0050] Figure 6 This is a block diagram illustrating a key generation apparatus according to an exemplary embodiment;

[0051] Figure 7 This is a block diagram illustrating a key generation apparatus according to an exemplary embodiment. Detailed Implementation

[0052] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention as detailed in the appended claims.

[0053] Figure 1 This is a schematic diagram illustrating an encryption and decryption system according to an exemplary embodiment, such as... Figure 1As shown, at the sending end, the encryption module E encrypts the plaintext information s using the encryption key e, generating ciphertext y = E(s, e). The ciphertext y is transmitted to the receiving end via a public channel. At the receiving end, the decryption module D uses the decryption key d to restore the ciphertext y, obtaining the plaintext information s = D(y, d). If the encryption key e and the decryption key d are equal, the system is called a symmetric encryption system; if the encryption key e and the decryption key d are not equal, the system is called an asymmetric encryption system. A cryptographic system contains the following elements: plaintext, key, cryptographic algorithm, and ciphertext. The security of a cryptographic system usually depends on the security of the key. Cryptographic security assessment is usually based on the Kerckhoff hypothesis, which states that all details of the cryptographic algorithm, except for the key, are known. The plaintext or ciphertext can be intercepted, and the encryption or decryption machine can also be intercepted. In other words, the cryptographic algorithm in a cryptographic system is generally public and standardized, while only the key needs to be kept secret. Therefore, attacks on a cryptographic system mainly target the key; key security is the security of the cryptographic system.

[0054] In related technologies, the main methods for generating keys include the following three types: 1. Generating pseudo-random numbers based on deterministic algorithms; 2. Generating physical noise random numbers based on the noise generation principle in classical physics; 3. Generating quantum random numbers based on the principles of quantum physics.

[0055] However, these three methods have the following limitations and drawbacks:

[0056] First, the pseudo-random numbers generated by deterministic algorithms have a fixed pattern. If the seeds are the same, the generated sequences will be exactly the same. Furthermore, the algorithms of such pseudo-random number generators are generally public. Based on the already generated sequences, the seeds for generating the sequences can be calculated. Therefore, the pseudo-random numbers generated by these algorithms are not unpredictable.

[0057] Second, random numbers generated based on classical physics principles are physical processes with controllable parameters. If there are sufficient computing resources, these random sequences can also be predicted. Therefore, the physical noise random numbers generated by this method are not unpredictable. In addition, by applying external electromagnetic interference to such random number generators, it is easy to interfere with and control them.

[0058] Third, the use of quantum random number generators based on quantum physics principles is not widespread, and it is currently difficult to integrate them with silicon-based integrated circuits, resulting in high generator costs. In addition, the classical physics devices required in such generators, such as detectors, amplifiers, and analog-to-digital converters, are easily controlled by externally applied electromagnetic interference.

[0059] Therefore, pseudo-random numbers generated by algorithms have very poor security. Both classical physical random number generators and quantum physical random number generators require additional physical circuits to implement, which makes engineering implementation difficult and makes them susceptible to electromagnetic interference.

[0060] In an exemplary embodiment of this disclosure, to address the problems existing in key generation methods in related technologies, a key generation method is provided. This method involves obtaining an N-order target matrix, where the sum of all elements in each row and / or column of the target matrix is ​​1; generating sets corresponding one-to-one with the rows and / or columns of the target matrix, each set comprising N sequentially connected sub-intervals, each set covering [0,1]; generating random probability values ​​corresponding one-to-one with the rows and / or columns of the target matrix; determining the position identifier of the sub-interval to which the random probability value belongs in the set corresponding to the row and / or column; and generating a key sequence based on the number of random probability values ​​corresponding to each position identifier. The key generation method in this disclosure does not require additional circuitry, is simple to implement, and the generated key sequence is unpredictable and cannot be deciphered from an already generated sequence. Therefore, it simplifies the key generation process while ensuring key security.

[0061] In the specific implementation scheme of this disclosure, different implementation forms can be set such that the sum of all elements in each column of the target matrix is ​​1, or the sum of each row is 1, or the sum of each column and the sum of each row are both 1. In the exemplary embodiment of this disclosure, the sum of all elements in each column of the target matrix is ​​1 is used as an example.

[0062] In an exemplary embodiment of this disclosure, a key generation method is provided. Figure 2 This is a flowchart illustrating a key generation method according to an exemplary embodiment, such as... Figure 2 As shown, it includes the following steps:

[0063] Step S201: Obtain the N-order target matrix, where the sum of all elements in each column of the target matrix is ​​1.

[0064] Let the N-order target matrix be denoted as matrix A, and matrix A is expressed as:

[0065]

[0066] Among them, a NN This represents the value of the element in the Nth row and Nth column of the target matrix A.

[0067] The target matrix A satisfies that the sum of all elements in each column is 1, that is:

[0068]

[0069] Where i represents the i-th row of the target matrix A, and j represents the j-th column of the target matrix A.

[0070] The method for generating the N-order target matrix can be arbitrary, and this disclosure does not impose any restrictions. For example, pseudo-random numbers can be generated using pseudo-random number generation algorithms in related technologies as elements in the target matrix.

[0071] In some exemplary embodiments, the N-order target matrix can be obtained in one of the following two ways:

[0072] The first method involves generating an N-order random unitary matrix, and determining the element at the same position in the target matrix by the square of the modulus of each element in the random unitary matrix.

[0073] Let the random unitary matrix be denoted as matrix U. Then the random unitary matrix U satisfies the relation: U·U * =I, where U * Let I denote the transpose and conjugate of the random unitary matrix U, and let I denote the identity matrix. The random unitary matrix U can be represented as:

[0074]

[0075] but:

[0076]

[0077] Among them, |U| 2 Let |U| be a matrix composed of the squares of the moduli of the elements at each position in matrix U, such that the sum of all elements in each column and each row is 1. 2 The target matrix is ​​determined.

[0078] The second method involves generating an N-order random matrix and determining the element at the same position in the target matrix as the ratio of each element in the random matrix to the sum of all elements in the column containing that element.

[0079] Let the Nth-order random matrix be denoted as matrix B, and expressed as:

[0080]

[0081] Each element in a random matrix B follows the same probability distribution, such as a uniform distribution.

[0082] Calculate the sum of all elements in each column of a random matrix B. j :

[0083]

[0084] Where i represents the i-th row of random matrix B, and j represents the j-th column of random matrix B.

[0085] Based on the sum of all elements in each column, column normalization is performed on the random matrix B, then:

[0086]

[0087] Among them, matrix If the sum of all elements in each column is 1, then the target matrix A is determined as follows:

[0088]

[0089] Step S202: Generate a set that corresponds one-to-one with the columns of the target matrix. The set includes N consecutively connected sub-intervals and covers [0,1].

[0090] Let the target matrix be denoted as matrix A:

[0091]

[0092] In this case, the sum of all elements in each column is 1, which satisfies:

[0093]

[0094] Where i represents the i-th row of the target matrix, and j represents the j-th column of the target matrix.

[0095] Based on the element values ​​of each column in the target matrix, generate a set that corresponds one-to-one with each column of the target matrix. Within each set, divide the value range [0,1] into N sub-intervals. The length of each sub-interval is equal to the value of each element in that column, i.e., the length of each sub-interval is a. ij Each sub-interval in each set corresponds one-to-one with an element in the corresponding column. The position of a sub-interval in the N sub-intervals is the same as the position of the corresponding element in the N elements of that column.

[0096] Figure 3 This is a schematic diagram of line segments for each set according to an exemplary embodiment, such as... Figure 3 As shown, a set corresponding to the j-th column of the target matrix is ​​generated. This set is divided into N sub-intervals, where the value range [0,1] is divided into N sub-intervals, and sub-interval a... 1j The length of the subinterval a is the value of the first element in the j-th column of the target matrix. 2j The length of is the value of the second element in the j-th column of the target matrix, and the subinterval a kj The length of the subinterval a is the value of the k-th element in the j-th column of the target matrix. Nj If the length of the first subinterval is the value of the Nth element in the j-th column of the target matrix, then the range of the first subinterval is [0, a]. 1j The range of values ​​for the second subinterval is [a] 1j a 1j +a2j The range of values ​​for the k-th subinterval is [a 1j +a 2j +…++a (k-1)j a 1j +a 2j +…++a kj The range of values ​​for the Nth subinterval is [a 1j +a 2j +…++a (N-1)j ,1).

[0097] In one example, the target matrix A is:

[0098]

[0099] The first column of the target matrix corresponds to the set {0.4, 0.2, 0.4}, with the first sub-interval having a length of 0.4 and a value range of [0, 0.4). The second sub-interval has a length of 0.2 and a value range of [0.4, 0.6). The third sub-interval has a length of 0.4 and a value range of [0.6, 1]. The second column of the target matrix corresponds to the set {0.3, 0.4, 0.3}, with the first sub-interval having a length of 0.3 and a value range of [0, 0.3]. The length of the first two sub-intervals is 0.4, with a value range of [0.3, 0.7), and the length of the third sub-interval is 0.3, with a value range of [0.7, 1]. The set corresponding to the third column of the target matrix is ​​{0.5, 0.4, 0.1}, with the length of the first sub-interval being 0.5, with a value range of [0, 0.5), the length of the second sub-interval being 0.4, with a value range of [0.5, 0.9), and the length of the third sub-interval being 0.1, with a value range of [0.9, 1].

[0100] Step S203: Generate random probability values ​​that correspond one-to-one with the columns of the target matrix, and determine the position identifier of the sub-interval to which the random probability value belongs in the set corresponding to the column.

[0101] Generate the random probability value p corresponding to the j-th column of the target matrix. j random probability value p j Given a uniform distribution between [0, 1], determine the random probability value p. j The position identifier of the sub-interval in the set corresponding to column j. The position identifier represents the position number of the sub-interval in this column, for example, a. 1j <p j 1j +a 2j At that time, a 1j Let a represent the first element in the j-th column of the matrix. 2j Let p represent the second element of the j-th column of the matrix, which indicates the random probability value p. j ​The value belongs to the second sub-interval in the set corresponding to column j, i.e., the position identifier is 2. Generate the random probability value corresponding to each column of the target matrix, and obtain the position identifier of the sub-interval to which the random probability value of each column belongs in the set of the corresponding column.

[0102] In one example, the target matrix A is:

[0103]

[0104] The generated columns correspond to random probability values ​​of 0.5, 0.2, and 0.6, respectively. The random probability value of 0.5 in column 1 belongs to the second sub-interval, with position identifier 2; the random probability value of 0.2 in column 2 belongs to the first sub-interval, with position identifier 1; and the random probability value of 0.6 in column 3 belongs to the second sub-interval, with position identifier 2. At this point, position identifier 1 corresponds to 1 random probability value, position identifier 2 corresponds to 2 random probability values, and position identifier 3 corresponds to 0 random probability values.

[0105] Step S204: Generate a key sequence based on the number of random probability values ​​corresponding to each location identifier.

[0106] Count the number of random probability values ​​within each subinterval of position identifier k, and denote the number of random probability values ​​within the subinterval of position identifier k as s. k Then the number of random probability values ​​corresponding to the sub-intervals of N location identifiers can be represented as the set S = {s1, s2, ..., s...} k ,…,s N Generate a key sequence based on set S.

[0107] In one example, the target matrix A is:

[0108]

[0109] When the random probability values ​​corresponding to each generated column are 0.5, 0.2, and 0.6, the set S is: S = {1, 2, 0}; when the random probability values ​​corresponding to each generated column are 0.5, 0.2, and 0.95, the set S is: S = {1, 1, 1}; when the random probability values ​​corresponding to each generated column are 0.1, 0.2, and 0.95, the set S is: S = {2, 0, 1}.

[0110] When generating a key sequence based on set S, a 0 / 1 key sequence can be generated through any transformation relation.

[0111] In one example, if the number of random probability values ​​corresponding to a location identifier is greater than 0, then the key value corresponding to the location identifier is 1; if the number of random probability values ​​corresponding to a location identifier is equal to 0, then the key value corresponding to the location identifier is 0; the key sequence is formed by arranging the key values ​​corresponding to all location identifiers in sequence.

[0112] For example, when the set S is S = {1, 2, 0}, it means that the number of random probability values ​​corresponding to position identifiers 1 and 2 is greater than 0, and the number of random probability values ​​corresponding to position identifier 3 is equal to 0, so the generated key sequence is 110; when the set S is S = {1, 1, 1}, it means that the number of random probability values ​​corresponding to position identifiers 1, 2, and 3 is greater than 0, so the generated key sequence is 111; when the set S is S = {2, 0, 1}, it means that the number of random probability values ​​corresponding to position identifiers 1 and 3 is greater than 0, and the number of random probability values ​​corresponding to position identifier 2 is equal to 0, so the generated key sequence is 101.

[0113] In another example, if the number of random probability values ​​corresponding to a location identifier is greater than 0, then the key value corresponding to the location identifier is 0; if the number of random probability values ​​corresponding to a location identifier is equal to 0, then the key value corresponding to the location identifier is 1; the key sequence is formed by arranging the key values ​​corresponding to all location identifiers in sequence.

[0114] For example, when the set S is S = {1, 2, 0}, it means that the number of random probability values ​​corresponding to position identifiers 1 and 2 is greater than 0, and the number of random probability values ​​corresponding to position identifier 3 is equal to 0, so the generated key sequence is 001; when the set S is S = {1, 1, 1}, it means that the number of random probability values ​​corresponding to position identifiers 1, 2, and 3 is greater than 0, so the generated key sequence is 000; when the set S is S = {2, 0, 1}, it means that the number of random probability values ​​corresponding to position identifiers 1 and 3 is greater than 0, and the number of random probability values ​​corresponding to position identifier 2 is equal to 0, so the generated key sequence is 010.

[0115] In the above embodiments, the sum of all elements in each column of the target matrix is ​​1. In a specific implementation of this disclosure, the sum of all elements in each row of the target matrix can also be set to 1, correspondingly, such as... Figure 3 The set interval division shown can also be set according to the elements of each row of the matrix, and then a random probability value corresponding one-to-one with the row of the target matrix is ​​generated, and the position identifier of the sub-interval to which the random probability value belongs in the set corresponding to the row is determined. The method disclosed herein is applicable to different implementations where the sum of each column of different matrices is 1, or the sum of each row is 1, or the sum of each column and the sum of each row are both 1.

[0116] In one exemplary embodiment, after generating the key sequence, it is necessary to determine whether the key sequence needs to be reused:

[0117] If a key sequence is reused, determine the number of 0s and 1s in the key sequence, delete the key value that has more 0s than 1s, and obtain the target key sequence, in which the number of 0s and 1s are equal.

[0118] If the key sequence is not reused, the key sequence is determined as the target key sequence.

[0119] When a key sequence needs to be reused, the number of 0s and 1s in the key sequence must be equal. For example, if the generated key sequence is 101101001, which includes 4 0s and 5 1s, one 1 can be deleted to make the number of 0s and 1s equal. Any 1 can be deleted as needed; for example, deleting the last 1 results in the target key sequence 10110100. When the key is no longer needed, the generated key sequence can be used as the target key sequence.

[0120] In an exemplary embodiment of this disclosure, an N-order target matrix is ​​obtained in which the sum of all elements in each row and / or column is 1. A set corresponding one-to-one with the rows and / or columns of the target matrix is ​​generated. Each set includes N consecutively connected sub-intervals. Each set covers [0,1]. Random probability values ​​corresponding one-to-one with the rows and / or columns of the target matrix are generated. The position identifier of the sub-interval to which the random probability value belongs in the set corresponding to the corresponding row and / or column is determined. A key sequence is generated based on the number of random probability values ​​corresponding to each position identifier. This method does not require additional circuitry and is simple to implement.

[0121] Furthermore, for the same N-order target matrix, the result obtained from each execution of step S203 is considered a sample, i.e., a set S is obtained as described above. Therefore, the number of different sampled samples that can be generated from an N-order target matrix is:

[0122]

[0123] Where N! = 1 * 2 * 3 * ... * N, therefore, the total number of different sampling samples that can be generated increases exponentially with the order N of the target matrix. Figure 4 This is a graph illustrating the relationship between the order of the target matrix and the total number of different sampled samples generated, according to an exemplary embodiment. Figure 4 As shown, the horizontal axis represents the order of the target matrix, and the vertical axis represents the total number of different sampled samples generated. When N is 128, the total number of different sampled samples exceeds 10. 75 If the total number of different samples is large, then the probability of each sample appearing is extremely small, so it can be assumed that no two samples will appear the same.

[0124] In one example, when N=128, the sampling process of step S203 is repeated 160,000,000 times. Each sampling process corresponds to obtaining one sample, and the probability of different sample occurrences is calculated. Figure 5A This is a probability distribution diagram of a sampled sample illustrated according to an exemplary embodiment. Figure 5A This displays the probability distribution of 10,000 different sampled items. The horizontal axis represents the sample number, and the vertical axis represents the probability value. The probability distribution is within a range of 10. -230 Up to 10 -265 Between these values, the probability values ​​are extremely small. Figure 5B This chart displays a probability histogram of 160,000,000 sampling processes. The horizontal axis represents the exponent of the sample probability values, and the vertical axis represents the probability density. Most of the samples cluster around 10. -245 The surrounding area exhibits a normal distribution.

[0125] Based on the above data, the total number of sampling samples generated by the method in this disclosure is astronomical, and the probability of each sampling sample appearing is extremely small, which is impossible within the time range that humans can perceive. Therefore, when the order of the target matrix is ​​large, it is impossible for repeated sampling samples to appear. As a result, the repetition of the generated key sequence is extremely low. Therefore, the generated key sequence is unpredictable and cannot be deciphered based on the generated sequence, thus ensuring the security of the key.

[0126] In an exemplary embodiment of this disclosure, a key generation apparatus is provided. Figure 6 This is a block diagram illustrating a key generation apparatus according to an exemplary embodiment, such as... Figure 6 As shown, it includes:

[0127] The acquisition module 601 is configured to acquire an N-order target matrix, wherein the sum of all elements in each row and / or column of the target matrix is ​​1;

[0128] The first generation module 602 is configured to generate a set that corresponds one-to-one with the rows and / or columns of the target matrix, the set comprising N consecutively connected sub-intervals, the set covering [0,1];

[0129] The sampling module 603 is configured to generate random probability values ​​that correspond one-to-one with the rows and / or columns of the target matrix, and to determine the position identifier of the sub-interval to which the random probability value belongs in the set corresponding to the corresponding row and / or column;

[0130] The second generation module 604 is configured to generate a key sequence based on the number of random probability values ​​corresponding to each of the location identifiers.

[0131] In one exemplary embodiment, the second generation module 604 is further configured to:

[0132] If the number of random probability values ​​corresponding to the location identifier is greater than 0, then the key value corresponding to the location identifier is 1;

[0133] If the number of random probability values ​​corresponding to the location identifier is equal to 0, then the key value corresponding to the location identifier is 0;

[0134] The key sequence is formed by sequentially arranging the key values ​​corresponding to all the location identifiers.

[0135] In one exemplary embodiment, the second generation module 604 is further configured to:

[0136] If the key sequence is reused, determine the number of 0s and 1s in the key sequence, delete the key value where one number is greater than the other, and obtain the target key sequence in which the number of 0s and 1s are equal.

[0137] If the key sequence is not reused, the key sequence is determined to be the target key sequence.

[0138] In one exemplary embodiment, the acquisition module 601 is further configured to:

[0139] Generate an N-order random unitary matrix, and determine the element at the same position in the target matrix by the square of the modulus of the element at each position in the random unitary matrix.

[0140] In one exemplary embodiment, the acquisition module 601 is further configured to:

[0141] Generate an N-order random matrix, and determine the element at the same position in the target matrix as the ratio of each element in the random matrix to the sum of all elements in the row and / or column containing that element.

[0142] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0143] Figure 7 This is a block diagram illustrating a key generation apparatus 700 according to an exemplary embodiment.

[0144] Reference Figure 7 The device 700 may include one or more of the following components: a processing component 702, a memory 704, a power supply component 706, a multimedia component 708, an audio component 710, an input / output (I / O) interface 712, a sensor component 714, and a communication component 716.

[0145] Processing component 702 typically controls the overall operation of device 700, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 702 may include one or more modules to facilitate interaction between processing component 702 and other components. For example, processing component 702 may include a multimedia module to facilitate interaction between multimedia component 708 and processing component 702.

[0146] Memory 704 is configured to store various types of data to support the operation of device 700. Examples of this data include instructions for any application or method operating on device 700, contact data, phonebook data, messages, pictures, videos, etc. Memory 704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0147] Power supply assembly 706 provides power to various components of device 700. Power supply assembly 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 700.

[0148] Multimedia component 708 includes a screen that provides an output interface between the device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 708 includes a front-facing camera and / or a rear-facing camera. When the device 700 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0149] Audio component 710 is configured to output and / or input audio signals. For example, audio component 710 includes a microphone (MIC) configured to receive external audio signals when device 700 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 704 or transmitted via communication component 716. In some embodiments, audio component 710 also includes a speaker for outputting audio signals.

[0150] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0151] Sensor assembly 714 includes one or more sensors for providing state assessments of various aspects of device 700. For example, sensor assembly 714 may detect the on / off state of device 700, the relative positioning of components such as the display and keypad of device 700, changes in the position of device 700 or a component of device 700, the presence or absence of user contact with device 700, the orientation or acceleration / deceleration of device 700, and temperature changes of device 700. Sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 714 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 714 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.

[0152] Communication component 716 is configured to facilitate wired or wireless communication between device 700 and other devices. Device 700 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 716 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 716 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0153] In an exemplary embodiment, the apparatus 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.

[0154] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, which can be executed by a processor 720 of the device 700 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0155] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a device, enables the device to perform a key generation method, the method comprising any of the methods described above.

[0156] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.

[0157] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A key generation method, characterized in that, The key generation method includes: Obtain an N-order target matrix, wherein the sum of all elements in each row and / or column of the target matrix is ​​1; Generate a set that corresponds one-to-one with the rows and / or columns of the target matrix. The set includes N consecutively connected sub-intervals, each sub-interval having a length equal to the value of each element in that row and / or column. The set covers [0,1]. Generate random probability values ​​that correspond one-to-one with the rows and / or columns of the target matrix, and determine the position identifier of the sub-interval to which the random probability value belongs in the set corresponding to the corresponding row and / or column; A key sequence is generated based on the number of random probability values ​​corresponding to each location identifier.

2. The key generation method according to claim 1, characterized in that, The step of generating a key sequence based on the number of random probability values ​​corresponding to each location identifier includes: If the number of random probability values ​​corresponding to the location identifier is greater than 0, then the key value corresponding to the location identifier is 1; If the number of random probability values ​​corresponding to the location identifier is equal to 0, then the key value corresponding to the location identifier is 0; The key sequence is formed by sequentially arranging the key values ​​corresponding to all the location identifiers.

3. The key generation method according to claim 1, characterized in that, The method further includes: If the key sequence is reused, determine the number of 0s and 1s in the key sequence, delete the key value where one number is greater than the other, and obtain the target key sequence in which the number of 0s and 1s are equal. If the key sequence is not reused, the key sequence is determined to be the target key sequence.

4. The key generation method according to claim 1, characterized in that, The process of obtaining the N-order target matrix includes: Generate an N-order random unitary matrix, and determine the element at the same position in the target matrix by the square of the modulus of the element at each position in the random unitary matrix.

5. The key generation method according to claim 1, characterized in that, The process of obtaining the N-order target matrix includes: Generate an N-order random matrix, and determine the element at the same position in the target matrix as the ratio of each element in the random matrix to the sum of all elements in the row and / or column containing that element.

6. A key generation device, characterized in that, The key generation device includes: The acquisition module is configured to acquire an N-order target matrix, wherein the sum of all elements in each row and / or column of the target matrix is ​​1; The first generation module is configured to generate a set that corresponds one-to-one with the rows and / or columns of the target matrix. The set includes N consecutively connected sub-intervals, the length of which is the value of each element in the row and / or column. The set covers [0,1]. The sampling module is configured to generate random probability values ​​that correspond one-to-one with the rows and / or columns of the target matrix, and to determine the position identifier of the sub-interval to which the random probability value belongs in the set corresponding to the corresponding row and / or column; The second generation module is configured to generate a key sequence based on the number of random probability values ​​corresponding to each of the location identifiers.

7. A key generation device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to perform the method as described in any one of claims 1-5.

8. A non-transitory computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the device, the device is able to perform the method as described in any one of claims 1-5.