Quantum random number extraction method and device based on post-processing
By updating the seeds of the Toeplitz matrix using high-speed ADC and minimum entropy calculations, the problem of poor security of random number generators in the prior art is solved, and high-security quantum random number extraction is achieved.
Patent Information
- Application Number
- CN202411551824.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, the Toeplitz matrix is usually generated using a pseudo-random number generator or a loop call to store seeds, which increases the risk that the random number generation system is controlled by the attacker, resulting in poor security of the extracted random numbers.
The analog signal output from the quantum entropy source is converted into a digital signal by preset high-speed ADC, the minimum entropy is calculated, and the original random number is updated as seed to obtain the updated sequence of random numbers and the extraction ratio, thereby extracting the quantum random number.
It realizes the real-time update of the random number seeds of the Toeplitz matrix with post-processed random numbers, avoiding the possibility that the random number generator is controlled and cracked by the attacking party, and ensuring the security of the random number.
Smart Images

Figure CN119597242A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of quantum communication technology, and in particular to a post-processing-based quantum random number extraction method, device, equipment and computer-readable storage medium. Background Art
[0002] Random numbers are widely used in many industries, commerce and science. In the field of information communication, cryptography is the field that relies most on random numbers. If the key used for encryption is completely unpredictable random bits, the encrypted ciphertext can be considered undecipherable, that is, absolutely safe. True random numbers (TRNG) play a vital role in secure encryption systems. It is generally believed that the numbers it produces are unpredictable. Among them, schemes based on classical noise (thermal) systems appear random, and hardware methods are inherently more secure than software methods. However, as long as they are purely classical systems, they are deterministic in principle. Compared with these classical systems, quantum mechanical systems provide the ultimate randomness. Optical quantum random number generators (QRNGs) based on the inherent randomness of basic quantum processes guarantee the generation of uncertain and unpredictable random numbers.
[0003] Even though the laws of quantum physics guarantee the entropy of quantum random numbers, the measurements of quantum systems are often contaminated by classical noise. For actual QRNG systems, the electrical noise in the system will affect the security of the original data, so the corresponding random number extraction operation is very important to eliminate the influence of classical noise. Minimum entropy estimation should exclude the influence of classical noise, which helps to characterize the extractable randomness. Then the random extraction operation is performed on the basis of the minimum entropy estimation, and the real random numbers will be generated after random extraction.
[0004] The original samples generated by ADC follow Gaussian distribution and contain classical side information. The method of using Toeplitz matrix to implement post-processing is to segment the original sequence and then multiply it with the matrix separately. The seed for generating Toeplitz matrix is S 1 ,S 2 ...,S m+n-1 , the random number seed usually used to generate the matrix comes from a pseudo-random number generator or a loop calling memory data, d 1 ,d 2 ...,d n is a random sequence to be processed, and the processed random sequence is r 1 ,r 2 ...,r n However, currently the Toeplitz matrix is usually generated by a pseudo-random number generator or a stored seed by cyclically calling, which increases the risk of the random number generation system being controlled by an attacker, resulting in poor security of the extracted random numbers. Summary of the invention
[0005] The present application provides a post-processing-based quantum random number extraction method, apparatus, device and computer-readable storage medium, which can solve the technical problem in the prior art that the Toeplitz matrix is usually generated by a pseudo-random number generator or a stored seed that is called cyclically, which increases the risk of the random number generation system being controlled by an attacker, resulting in poor security of the extracted random numbers.
[0006] In a first aspect, an embodiment of the present application provides a quantum random number extraction method based on post-processing, and the quantum random number extraction method based on post-processing includes:
[0007] The analog signal output by the quantum entropy source is converted into a digital signal by presetting a high-speed ADC to obtain the original random number;
[0008] Calculating the minimum entropy according to the obtained original random number;
[0009] Using the original random number as a seed to update a preset Toeplitz large matrix, so as to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix;
[0010] Extracting quantum random numbers from the first random number sequence according to the minimum entropy and the first extraction ratio.
[0011] In combination with the first aspect, in one implementation, the method of updating a preset Toeplitz large matrix using the original random number as a seed to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix includes:
[0012] Divide the original random number into multiple sample data according to a preset segmentation rule;
[0013] Extracting corresponding bits from each of the sample data in sequence according to a preset extraction rule;
[0014] Inputting a plurality of the bits into a preset random number seed shift register as a seed;
[0015] updating a preset Toeplitz large matrix according to the seed in the current preset random number seed shift register to obtain a second random number sequence output by the updated preset Toeplitz large matrix;
[0016] updating the seed in the preset random number seed shift register according to the second random number sequence;
[0017] The updated preset Toeplitz large matrix is started with the seed in the updated preset random number seed shift register to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix.
[0018] In combination with the first aspect, in one implementation, updating the preset Toeplitz large matrix according to the seed in the current preset random number seed shift register to obtain a second random number sequence output by the updated preset Toeplitz large matrix includes:
[0019] Using the seed in the preset random number seed shift register to update the first row of submatrices in the preset Toeplitz large matrix, and obtaining the updated shift data of the first row of submatrices, wherein the preset Toeplitz large matrix includes multiple rows of submatrices;
[0020] The first row submatrix is updated with the obtained shift data until all submatrices are updated, and then a second random number sequence output by the updated preset Toeplitz large matrix is obtained, wherein the preset Toeplitz large matrix is updated when all submatrices are updated.
[0021] In combination with the first aspect, in one implementation, extracting a quantum random number from the first random number sequence according to the minimum entropy and the first extraction ratio includes:
[0022] Comparing the minimum entropy with the first extraction ratio to determine whether the first random number sequence is qualified;
[0023] If the minimum entropy is greater than the first extraction ratio, it is determined that the first random number sequence is qualified;
[0024] A quantum random number is extracted from the first random number sequence based on the first extraction ratio.
[0025] In combination with the first aspect, in one implementation, after comparing the minimum entropy with the first extraction ratio to determine whether the first random number sequence is qualified, the method further includes:
[0026] If the minimum entropy is less than or equal to the first extraction ratio, determining that the first random number sequence is unqualified;
[0027] Reduce the first extraction ratio by performing an XOR operation to obtain a second extraction ratio;
[0028] Compare the minimum entropy with the second extraction ratio to determine again whether the first random number sequence is qualified;
[0029] If the minimum entropy is greater than the second extraction ratio, it is determined that the first random number sequence is qualified;
[0030] Extracting quantum random numbers from the first random number sequence based on the second extraction ratio.
[0031] In combination with the first aspect, in one implementation, after extracting the quantum random number from the first random number sequence according to the minimum entropy and the first extraction ratio, the method further includes:
[0032] Performing power-on detection or periodic detection on the acquired quantum random number;
[0033] If it is determined that the quantum random number passes the power-on detection or the periodic detection, it is determined that the quantum random number is normal;
[0034] If it is determined that the quantum random number has not passed the power-on detection or has not passed the periodic detection, it is determined that the quantum random number is abnormal.
[0035] In combination with the first aspect, in one implementation, after extracting the quantum random number from the first random number sequence according to the minimum entropy and the first extraction ratio, the method further includes:
[0036] Updating the seed in the preset random number seed shift register according to the quantum random number, and using the quantum random number as the target seed in the preset random number seed shift register;
[0037] Determining whether the minimum entropy is updated;
[0038] If the minimum entropy update is determined, the updated preset Toeplitz large matrix is started according to the target seed in the preset random number seed shift register, and a third random number sequence and a third extraction ratio output by the updated preset Toeplitz large matrix are obtained;
[0039] Extracting quantum random numbers from the third random number sequence according to the updated minimum entropy and the third extraction ratio.
[0040] In a second aspect, an embodiment of the present application provides a quantum random number extraction device based on post-processing, and the quantum random number extraction device based on post-processing includes:
[0041] The first acquisition module is used to convert the analog signal output by the quantum entropy source into a digital signal through a preset high-speed ADC to obtain an original random number;
[0042] A calculation module, used for calculating the minimum entropy according to the obtained original random number;
[0043] A second acquisition module is used to update a preset Toeplitz large matrix using the original random number as a seed to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix;
[0044] An extraction module is used to extract quantum random numbers from the first random number sequence according to the minimum entropy and the first extraction ratio.
[0045] In a third aspect, an embodiment of the present application provides a post-processing-based quantum random number extraction device, characterized in that the post-processing-based quantum random number extraction device includes a processor, a memory, and a post-processing-based quantum random number extraction program stored on the memory and executable by the processor, wherein when the post-processing-based quantum random number extraction program is executed by the processor, the steps of the post-processing-based quantum random number extraction method as described above are implemented.
[0046] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, characterized in that a post-processing-based quantum random number extraction program is stored on the computer-readable storage medium, wherein when the post-processing-based quantum random number extraction program is executed by a processor, the steps of the post-processing-based quantum random number extraction method described above are implemented.
[0047] The beneficial effects brought by the technical solution provided in the embodiments of the present application include:
[0048] The analog signal output by the quantum entropy source is converted into a digital signal by presetting a high-speed ADC to obtain an original random number; the minimum entropy is calculated according to the obtained original random number; the original random number is used as a seed to update a preset Toeplitz large matrix to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix; according to the minimum entropy and the first extraction ratio, quantum random numbers are extracted from the first random number sequence, which solves the technical problem that the Toeplitz matrix in the related art is usually generated by a pseudo-random number generator or a stored seed that is called cyclically, which increases the risk of the random number generation system being controlled by an attacker, resulting in poor security of the extracted random number, and realizes real-time updating of the random number seed of the Toeplitz matrix with a post-processed random number, avoiding the possibility of the random number generator being controlled or cracked by the attacker, and ensuring the security of the random number. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 This is a flow chart of the first embodiment of the quantum random number extraction method based on post-processing of the present application;
[0050] Figure 2This is a schematic diagram of the composition of the preset Toeplitz matrix in this application;
[0051] Figure 3 A schematic diagram of a random number seed shift register in this application;
[0052] Figure 4 This is a schematic diagram of updating the preset Toeplitz matrix in this application;
[0053] Figure 5 A schematic diagram of the calculation of the preset Toeplitz matrix in this application;
[0054] Figure 6 This is a flow chart of the second embodiment of the post-processing quantum random number extraction method of the present application;
[0055] Figure 7 This is a flow chart of the third embodiment of the quantum random number extraction method based on post-processing of the present application;
[0056] Figure 8 This is a functional module diagram of an embodiment of a quantum random number extraction device based on post-processing of the present application;
[0057] Fig. 9 This is a schematic diagram of the hardware structure of a post-processing-based quantum random number extraction device involved in the embodiment of the present application. DETAILED DESCRIPTION
[0058] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0059] First, some technical terms in the present application are explained to facilitate those skilled in the art to understand the present application.
[0060] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0061] In a first aspect, an embodiment of the present application provides a quantum random number extraction method based on post-processing.
[0062] In one embodiment, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the quantum random number extraction method based on post-processing of this application. Figure 1As shown, the quantum random number extraction method based on post-processing includes:
[0063] Step S10: converting the analog signal output by the quantum entropy source into a digital signal by presetting a high-speed ADC to obtain an original random number;
[0064] Exemplarily, an analog signal output by a quantum entropy source is detected, the analog signal output by the quantum entropy source is collected by a preset high-speed ADC, and the analog signal is converted into a digital signal to obtain an original random number.
[0065] Step S20: Calculate the minimum entropy according to the obtained original random number;
[0066] Demonstratively, obtain the preset period for calculating the minimum entropy, turn off the preset laser, and only the classical noise entropy remains in the original random number. Collect 1-Gbit pure classical noise data, and calculate the variance of the classical noise based on the original random number. Turn on the laser, and the original random number contains both classical noise data and quantum entropy data. Collect 1-Gbit data containing both classical noise data and quantum entropy data, and then calculate the classical variance and quantum entropy variance. For example, the quantum entropy variance is obtained by subtracting the classical entropy variance from the preset mixed entropy variance. Calculate the minimum entropy excluding classical noise through the preset formula.
[0067] Step S30: updating a preset Toeplitz large matrix by using the original random number as a seed through post-processing to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix;
[0068] For example, the original random number is used as a seed to update the preset Toeplitz matrix through post-processing. The preset Toeplitz matrix is as follows: Figure 2 As shown, it is composed of seed shifts in the original random number. The actual generation method is to divide the large matrix with a dimension of m*n into multiple sub-matrices with a dimension of w*l. w is determined by the calculation parallelism set by the FPGA, and l is determined by the sequence length of each calculation. The random number seed in the sub-matrix is updated once each large matrix calculation is completed. The first random number sequence and the first extraction ratio of the updated Toeplitz large matrix output are obtained.
[0069] Specifically, the post-processing uses the original random number as a seed to update the preset Toeplitz large matrix to obtain the first random number sequence and the first extraction ratio output by the updated preset Toeplitz large matrix, including: dividing the original random number into multiple sample data according to a preset segmentation rule; extracting corresponding bits from each of the sample data in turn according to a preset extraction rule; inputting multiple bits into a preset random number seed shift register as seeds; updating the preset Toeplitz large matrix according to the seed currently in the preset random number seed shift register to obtain the second random number sequence output by the updated preset Toeplitz large matrix; updating the seed in the preset random number seed shift register according to the second random number sequence; and starting the updated preset Toeplitz large matrix with the seed in the updated preset random number seed shift register to obtain the first random number sequence and the first extraction ratio output by the updated preset Toeplitz large matrix.
[0070] Exemplarily, a preset segmentation rule is obtained to segment the original random number, thereby obtaining multiple sample data. One bit is taken from each original data sample, the first bit is taken from the first sample, the second bit is taken from the second sample, and so on, thereby obtaining multiple bits. The obtained multiple bits are sequentially input into the preset random number seed shift register as seeds, wherein the preset random number seed shift register is as follows: Figure 3 As shown. Determine whether the seed length in the preset random number seed shift register meets the preset requirements. If it is determined that the seed length in the preset random number seed shift register meets the preset requirements, update the seed in the current preset random number seed shift register to the preset Toeplitz large matrix. For example, obtain whether the seed length in the current preset random number seed shift register is m+n-1, where m is the number of rows of the submatrix in the preset Toeplitz large matrix, and n is the number of columns of the submatrix in the preset Toeplitz large matrix. Figure 4 As shown, the dimension of the preset Toeplitz large matrix is m*n, and the dimension of the sub-matrix is l*w. The seed in the random number register is represented by the symbol S, and its length is m+n-1. The sub-matrices are connected end to end, receiving the random number seed shift from the previous sub-matrix. After each large matrix calculation is completed, all sub-matrices must be updated before starting the next calculation.
[0071] After updating the preset Toeplitz large matrix, the updated preset Toeplitz large matrix is used to perform calculations to obtain the output first random number sequence and the first extraction ratio. Figure 5As shown, taking the 1024*512 dimensional Toeplitz matrix as an example, each matrix calculation processes the original data of length 1024 bits, and the calculation parallelism is set to 32. The large matrix is divided into 128 128*32 dimensional sub-matrices. The FPGA completes the matrix calculation of the sub-matrix and the original data of length 128 once per beat. After 8 beats, the calculation results are added in sequence to obtain a calculation result of length 32 bits. The entire large matrix calculation needs to be completed 16 rounds of calculation to obtain 16 calculation results of length 32 bits. They are spliced in sequence to obtain a large matrix calculation result of length 512 bits, and the calculation result includes the second random number sequence. The seed in the preset random number seed shift register is updated by the second random number sequence. For example, turn on channel 1 of MUX2, directly output the output sequence of the preset Toeplitz large matrix, and the extraction ratio of the post-processing is the extraction ratio of the preset Toeplitz large matrix. Turn on channel 2 of MUX1, split the output sequence after each matrix calculation, take the last 16 bits, and update the random number seed register. The updated preset Toeplitz large matrix is started with the seed in the updated preset random number seed shift register to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix.
[0072] Step S40: extracting quantum random numbers from the first random number sequence according to the minimum entropy and the first extraction ratio.
[0073] Exemplarily, the minimum entropy is compared with the first extraction ratio to determine whether the first random number sequence is qualified; if the minimum entropy is greater than the first extraction ratio, the first random number sequence is determined to be qualified; quantum random numbers are extracted from the first random number sequence based on the first extraction ratio. If the minimum entropy is less than or equal to the first extraction ratio, the first random number sequence is determined to be unqualified; the first extraction ratio is reduced by performing an XOR operation to obtain a second extraction ratio; the minimum entropy is compared with the second extraction ratio to determine again whether the first random number sequence is qualified; if the minimum entropy is greater than the second extraction ratio, the first random number sequence is determined to be qualified; quantum random numbers are extracted from the first random number sequence based on the second extraction ratio. For example, by performing sequential XOR operations, the extraction ratio is reduced, that is, half of the first extraction ratio.
[0074] In this embodiment, an analog signal output by a quantum entropy source is converted into a digital signal by presetting a high-speed ADC to obtain an original random number; a minimum entropy is calculated based on the obtained original random number; the original random number is used as a seed to update a preset Toeplitz large matrix to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix; according to the minimum entropy and the first extraction ratio, a quantum random number is extracted from the first random number sequence, which solves the technical problem that in the related art, the Toeplitz matrix is usually generated by a pseudo-random number generator or a stored seed is called cyclically, which increases the risk of the random number generation system being controlled by an attacker, resulting in poor security of the extracted random number. The random number seed of the Toeplitz matrix is updated in real time with a post-processed random number, which avoids the possibility of the random number generator being controlled or cracked by the attacker, thereby ensuring the security of the random number.
[0075] In one embodiment, referring to Figure 6 , Figure 6 This is a flow chart of the second embodiment of the post-processing quantum random number extraction method of this application. Figure 6 As shown, the quantum random number extraction method based on post-processing includes:
[0076] Step S11: converting the analog signal output by the quantum entropy source into a digital signal by presetting a high-speed ADC to obtain an original random number;
[0077] Exemplarily, an analog signal output by a quantum entropy source is detected, the analog signal output by the quantum entropy source is collected by a preset high-speed ADC, and the analog signal is converted into a digital signal to obtain an original random number.
[0078] Step S12: Calculate the minimum entropy according to the obtained original random number;
[0079] Demonstratively, obtain the preset period for calculating the minimum entropy, turn off the preset laser, and only the classical noise entropy remains in the original random number. Collect 1-Gbit pure classical noise data, and calculate the variance of the classical noise based on the original random number. Turn on the laser, and the original random number contains both classical noise data and quantum entropy data. Collect 1-Gbit data containing both classical noise data and quantum entropy data, and then calculate the classical variance and quantum entropy variance. For example, the quantum entropy variance is obtained by subtracting the classical entropy variance from the preset mixed entropy variance. Calculate the minimum entropy excluding classical noise through the preset formula.
[0080] Step S13: updating a preset Toeplitz large matrix by using the original random number as a seed through post-processing to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix;
[0081] For example, the original random number is used as a seed to update the preset Toeplitz matrix through post-processing. The preset Toeplitz matrix is as follows: Figure 2 As shown, it is composed of seed shifts in the original random number. The actual generation method is to divide the large matrix with a dimension of m*n into multiple sub-matrices with a dimension of w*l. w is determined by the calculation parallelism set by the FPGA, and l is determined by the sequence length of each calculation. The random number seed in the sub-matrix is updated once each large matrix calculation is completed. The first random number sequence and the first extraction ratio of the updated Toeplitz large matrix output are obtained.
[0082] Specifically, the post-processing uses the original random number as a seed to update the preset Toeplitz large matrix to obtain the first random number sequence and the first extraction ratio output by the updated preset Toeplitz large matrix, including: dividing the original random number into multiple sample data according to a preset segmentation rule; extracting corresponding bits from each of the sample data in turn according to a preset extraction rule; inputting multiple bits into a preset random number seed shift register as seeds; updating the preset Toeplitz large matrix according to the seed currently in the preset random number seed shift register to obtain the second random number sequence output by the updated preset Toeplitz large matrix; updating the seed in the preset random number seed shift register according to the second random number sequence; and starting the updated preset Toeplitz large matrix with the seed in the updated preset random number seed shift register to obtain the first random number sequence and the first extraction ratio output by the updated preset Toeplitz large matrix.
[0083] Exemplarily, a preset segmentation rule is obtained to segment the original random number, thereby obtaining multiple sample data. One bit is taken from each original data sample, the first bit is taken from the first sample, the second bit is taken from the second sample, and so on, thereby obtaining multiple bits. The obtained multiple bits are sequentially input into the preset random number seed shift register as seeds, wherein the preset random number seed shift register is as follows: Figure 3 As shown. Determine whether the seed length in the preset random number seed shift register meets the preset requirements. If it is determined that the seed length in the preset random number seed shift register meets the preset requirements, update the seed in the current preset random number seed shift register to the preset Toeplitz large matrix. For example, obtain whether the seed length in the current preset random number seed shift register is m+n-1, where m is the number of rows of the submatrix in the preset Toeplitz large matrix, and n is the number of columns of the submatrix in the preset Toeplitz large matrix. Figure 4As shown, the dimension of the preset Toeplitz large matrix is m*n, and the dimension of the sub-matrix is l*w. The seed in the random number register is represented by the symbol S, and its length is m+n-1. The sub-matrices are connected end to end, receiving the random number seed shift from the previous sub-matrix. After each large matrix calculation is completed, all sub-matrices must be updated before starting the next calculation.
[0084] After updating the preset Toeplitz large matrix, the updated preset Toeplitz large matrix is used to perform calculations to obtain the output first random number sequence and the first extraction ratio. Figure 5 As shown, taking the 1024*512 dimensional Toeplitz matrix as an example, each matrix calculation processes the original data of length 1024 bits, and the calculation parallelism is set to 32. The large matrix is divided into 128 128*32 dimensional sub-matrices. The FPGA completes the matrix calculation of the sub-matrix and the original data of length 128 once per beat. After 8 beats, the calculation results are added in sequence to obtain a calculation result of length 32 bits. The entire large matrix calculation needs to be completed 16 rounds of calculation to obtain 16 calculation results of length 32 bits. They are spliced in sequence to obtain a large matrix calculation result of length 512 bits, and the calculation result includes the second random number sequence. The seed in the preset random number seed shift register is updated by the second random number sequence. For example, turn on channel 1 of MUX2, directly output the output sequence of the preset Toeplitz large matrix, and the extraction ratio of the post-processing is the extraction ratio of the preset Toeplitz large matrix. Turn on channel 2 of MUX1, split the output sequence after each matrix calculation, take the last 16 bits, and update the random number seed register. The updated preset Toeplitz large matrix is started with the seed in the updated preset random number seed shift register to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix.
[0085] Step S14: extracting quantum random numbers from the first random number sequence according to the minimum entropy and the first extraction ratio;
[0086] Exemplarily, the minimum entropy is compared with the first extraction ratio to determine whether the first random number sequence is qualified; if the minimum entropy is greater than the first extraction ratio, the first random number sequence is determined to be qualified; quantum random numbers are extracted from the first random number sequence based on the first extraction ratio. If the minimum entropy is less than or equal to the first extraction ratio, the first random number sequence is determined to be unqualified; the first extraction ratio is reduced by performing an XOR operation to obtain a second extraction ratio; the minimum entropy is compared with the second extraction ratio to determine again whether the first random number sequence is qualified; if the minimum entropy is greater than the second extraction ratio, the first random number sequence is determined to be qualified; quantum random numbers are extracted from the first random number sequence based on the second extraction ratio. For example, by performing sequential XOR operations, the extraction ratio is reduced, that is, half of the first extraction ratio.
[0087] Step S15: performing power-on detection or periodic detection on the acquired quantum random number;
[0088] Step S16: If it is determined that the quantum random number passes the power-on detection or the periodic detection, it is determined that the quantum random number is normal;
[0089] Step S17: If it is determined that the quantum random number has not passed the power-on detection or the periodic detection, it is determined that the quantum random number is abnormal.
[0090] Exemplary: Turn on the output switch of the post-processed random number to accept the quantum random number. Power-on detection collects 20×104 bits of random numbers, divides them into 20 groups, each group has 104 bits, and performs poker detection (m=2). If 2 or more groups of the tested sequence do not pass the detection standard, the alarm detection fails. It is allowed to repeat the random number collection and detection once. If the repeated detection still fails, the random number generator is judged to be abnormal, enters the abnormal state, and outputs the abnormal state alarm. Periodic detection collects 5×104 bits of random numbers, divides them into 5 groups, each group has 104 bits, and performs poker detection (m=2). If 1 or more groups of the tested sequence do not pass the detection standard, the alarm detection fails. It is allowed to repeat the random number collection and detection once. If the repeated detection still fails, the random number generator is judged to be abnormal, enters the abnormal state, and outputs the abnormal state alarm.
[0091] In this embodiment, the security of the quantum random numbers is ensured by performing power-on detection and periodic detection on the extracted quantum random numbers.
[0092] In one embodiment, referring to Figure 7 , Figure 7 This is a flow chart of the third embodiment of the post-processing quantum random number extraction method of this application. Figure 7 As shown, the quantum random number extraction method based on post-processing includes:
[0093] Step S21: converting the analog signal output by the quantum entropy source into a digital signal by presetting a high-speed ADC to obtain an original random number;
[0094] Exemplarily, an analog signal output by a quantum entropy source is detected, the analog signal output by the quantum entropy source is collected by a preset high-speed ADC, and the analog signal is converted into a digital signal to obtain an original random number.
[0095] Step S22: Calculate the minimum entropy according to the obtained original random number;
[0096] Demonstratively, obtain the preset period for calculating the minimum entropy, turn off the preset laser, and only the classical noise entropy remains in the original random number. Collect 1-Gbit pure classical noise data, and calculate the variance of the classical noise based on the original random number. Turn on the laser, and the original random number contains both classical noise data and quantum entropy data. Collect 1-Gbit data containing both classical noise data and quantum entropy data, and then calculate the classical variance and quantum entropy variance. For example, the quantum entropy variance is obtained by subtracting the classical entropy variance from the preset mixed entropy variance. Calculate the minimum entropy excluding classical noise through the preset formula.
[0097] Step S23: updating a preset Toeplitz large matrix by using the original random number as a seed through post-processing to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix;
[0098] For example, the original random number is used as a seed to update the preset Toeplitz matrix through post-processing. The preset Toeplitz matrix is as follows: Figure 2 As shown, it is composed of seed shifts in the original random number. The actual generation method is to divide the large matrix with a dimension of m*n into multiple sub-matrices with a dimension of w*l. w is determined by the calculation parallelism set by the FPGA, and l is determined by the sequence length of each calculation. The random number seed in the sub-matrix is updated once each large matrix calculation is completed. The first random number sequence and the first extraction ratio of the updated Toeplitz large matrix output are obtained.
[0099] Specifically, the post-processing uses the original random number as a seed to update the preset Toeplitz large matrix to obtain the first random number sequence and the first extraction ratio output by the updated preset Toeplitz large matrix, including: dividing the original random number into multiple sample data according to a preset segmentation rule; extracting corresponding bits from each of the sample data in turn according to a preset extraction rule; inputting multiple bits into a preset random number seed shift register as seeds; updating the preset Toeplitz large matrix according to the seed currently in the preset random number seed shift register to obtain the second random number sequence output by the updated preset Toeplitz large matrix; updating the seed in the preset random number seed shift register according to the second random number sequence; and starting the updated preset Toeplitz large matrix with the seed in the updated preset random number seed shift register to obtain the first random number sequence and the first extraction ratio output by the updated preset Toeplitz large matrix.
[0100] Exemplarily, a preset segmentation rule is obtained to segment the original random number, thereby obtaining multiple sample data. One bit is taken from each original data sample, the first bit is taken from the first sample, the second bit is taken from the second sample, and so on, thereby obtaining multiple bits. The obtained multiple bits are sequentially input into the preset random number seed shift register as seeds, wherein the preset random number seed shift register is as follows: Figure 3 As shown. Determine whether the seed length in the preset random number seed shift register meets the preset requirements. If it is determined that the seed length in the preset random number seed shift register meets the preset requirements, update the seed in the current preset random number seed shift register to the preset Toeplitz large matrix. For example, obtain whether the seed length in the current preset random number seed shift register is m+n-1, where m is the number of rows of the submatrix in the preset Toeplitz large matrix, and n is the number of columns of the submatrix in the preset Toeplitz large matrix. Figure 4 As shown, the dimension of the preset Toeplitz large matrix is m*n, and the dimension of the sub-matrix is l*w. The seed in the random number register is represented by the symbol S, and its length is m+n-1. The sub-matrices are connected end to end, receiving the random number seed shift from the previous sub-matrix. After each large matrix calculation is completed, all sub-matrices must be updated before starting the next calculation.
[0101] After updating the preset Toeplitz large matrix, the updated preset Toeplitz large matrix is used to perform calculations to obtain the output first random number sequence and the first extraction ratio. Figure 5As shown, taking the 1024*512 dimensional Toeplitz matrix as an example, each matrix calculation processes the original data of length 1024 bits, and the calculation parallelism is set to 32. The large matrix is divided into 128 128*32 dimensional sub-matrices. The FPGA completes the matrix calculation of the sub-matrix and the original data of length 128 once per beat. After 8 beats, the calculation results are added in sequence to obtain a calculation result of length 32 bits. The entire large matrix calculation needs to be completed 16 rounds of calculation to obtain 16 calculation results of length 32 bits. They are spliced in sequence to obtain a large matrix calculation result of length 512 bits, and the calculation result includes the second random number sequence. The seed in the preset random number seed shift register is updated by the second random number sequence. For example, turn on channel 1 of MUX2, directly output the output sequence of the preset Toeplitz large matrix, and the extraction ratio of the post-processing is the extraction ratio of the preset Toeplitz large matrix. Turn on channel 2 of MUX1, split the output sequence after each matrix calculation, take the last 16 bits, and update the random number seed register. The updated preset Toeplitz large matrix is started with the seed in the updated preset random number seed shift register to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix.
[0102] Step S24: extracting quantum random numbers from the first random number sequence according to the minimum entropy and the first extraction ratio.
[0103] Exemplarily, the minimum entropy is compared with the first extraction ratio to determine whether the first random number sequence is qualified; if the minimum entropy is greater than the first extraction ratio, the first random number sequence is determined to be qualified; quantum random numbers are extracted from the first random number sequence based on the first extraction ratio. If the minimum entropy is less than or equal to the first extraction ratio, the first random number sequence is determined to be unqualified; the first extraction ratio is reduced by performing an XOR operation to obtain a second extraction ratio; the minimum entropy is compared with the second extraction ratio to determine again whether the first random number sequence is qualified; if the minimum entropy is greater than the second extraction ratio, the first random number sequence is determined to be qualified; quantum random numbers are extracted from the first random number sequence based on the second extraction ratio. For example, by performing sequential XOR operations, the extraction ratio is reduced, that is, half of the first extraction ratio.
[0104] Step S25: updating the seed in the preset random number seed shift register according to the quantum random number, and using the quantum random number as the target seed in the preset random number seed shift register;
[0105] Step S26: Determine whether the minimum entropy is updated;
[0106] Step S27: if the minimum entropy update is determined, the updated preset Toeplitz large matrix is started according to the target seed in the preset random number seed shift register, and a third random number sequence and a third extraction ratio output by the updated preset Toeplitz large matrix are obtained;
[0107] Step S28: extracting quantum random numbers from the third random number sequence according to the updated minimum entropy and the third extraction ratio.
[0108] Exemplarily, a seed in a preset random number seed shift register is calculated and updated using a quantum random number, and the quantum random number is used as a target seed in the preset random number seed shift register; it is determined whether the minimum entropy is updated; if it is determined that the minimum entropy is updated, the updated preset Toeplitz large matrix is started according to the target seed in the preset random number seed shift register, and a third random number sequence and a third extraction ratio output by the updated preset Toeplitz large matrix are obtained; and the quantum random number is extracted from the third random number sequence according to the updated minimum entropy and the third extraction ratio.
[0109] In this embodiment, by recalculating the minimum entropy, after determining the minimum entropy update, the updated preset Toeplitz large matrix is no longer repeatedly updated, so that quantum random numbers can be directly extracted, thereby improving the extraction efficiency of quantum random numbers.
[0110] In a second aspect, an embodiment of the present application also provides a quantum random number extraction device based on post-processing.
[0111] In one embodiment, referring to Figure 8 , Figure 8 This is a functional module diagram of an embodiment of a quantum random number extraction device based on post-processing in this application. Figure 8 As shown, the quantum random number extraction device based on post-processing includes:
[0112] A first acquisition module 10 is used to convert the analog signal output by the quantum entropy source into a digital signal through a preset high-speed ADC to obtain an original random number;
[0113] A calculation module 20, configured to calculate the minimum entropy according to the obtained original random number;
[0114] A second acquisition module 30 is used to update a preset Toeplitz large matrix by using the original random number as a seed through post-processing to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix;
[0115] The extraction module 40 is used to extract quantum random numbers from the first random number sequence according to the minimum entropy and the first extraction ratio.
[0116] Furthermore, in one embodiment, the second acquisition module 30 is used to:
[0117] Divide the original random number into multiple sample data according to a preset segmentation rule;
[0118] Extracting corresponding bits from each of the sample data in sequence according to a preset extraction rule;
[0119] Inputting a plurality of the bits into a preset random number seed shift register as a seed;
[0120] updating a preset Toeplitz large matrix according to the seed in the current preset random number seed shift register to obtain a second random number sequence output by the updated preset Toeplitz large matrix;
[0121] updating the seed in the preset random number seed shift register according to the second random number sequence;
[0122] The updated preset Toeplitz large matrix is started with the seed in the updated preset random number seed shift register to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix.
[0123] Furthermore, in one embodiment, the post-processing-based quantum random number extraction device also includes a new module for:
[0124] Using the seed in the preset random number seed shift register to update the first row of submatrices in the preset Toeplitz large matrix, and obtaining the updated shift data of the first row of submatrices, wherein the preset Toeplitz large matrix includes multiple rows of submatrices;
[0125] The second row submatrix is updated with the obtained shift data until all submatrices are updated, and then a second random number sequence output by the updated preset Toeplitz large matrix is obtained, wherein the preset Toeplitz large matrix is updated when all submatrices are updated.
[0126] Furthermore, in one embodiment, the extraction module 40 is used to:
[0127] Comparing the minimum entropy with the first extraction ratio to determine whether the first random number sequence is qualified;
[0128] If the minimum entropy is greater than the first extraction ratio, it is determined that the first random number sequence is qualified;
[0129] A quantum random number is extracted from the first random number sequence based on the first extraction ratio.
[0130] Furthermore, in one embodiment, the post-processing-based quantum random number extraction device also includes a new module for:
[0131] If the minimum entropy is less than or equal to the first extraction ratio, determining that the first random number sequence is unqualified;
[0132] Reduce the first extraction ratio by performing an XOR operation to obtain a second extraction ratio;
[0133] Compare the minimum entropy with the second extraction ratio to determine again whether the first random number sequence is qualified;
[0134] If the minimum entropy is greater than the second extraction ratio, it is determined that the first random number sequence is qualified;
[0135] Extracting quantum random numbers from the first random number sequence based on the second extraction ratio.
[0136] Furthermore, in one embodiment, the post-processing-based quantum random number extraction device also includes a new module for:
[0137] Performing power-on detection or periodic detection on the acquired quantum random number;
[0138] If it is determined that the quantum random number passes the power-on detection or the periodic detection, it is determined that the quantum random number is normal;
[0139] If it is determined that the quantum random number has not passed the power-on detection or has not passed the periodic detection, it is determined that the quantum random number is abnormal.
[0140] Furthermore, in one embodiment, the post-processing-based quantum random number extraction device also includes a new module for:
[0141] Updating the seed in the preset random number seed shift register according to the quantum random number, and using the quantum random number as the target seed in the preset random number seed shift register;
[0142] Determining whether the minimum entropy is updated;
[0143] If the minimum entropy update is determined, the updated preset Toeplitz large matrix is started according to the target seed in the preset random number seed shift register, and a third random number sequence and a third extraction ratio output by the updated preset Toeplitz large matrix are obtained;
[0144] Extracting quantum random numbers from the third random number sequence according to the updated minimum entropy and the third extraction ratio.
[0145] Among them, the functional implementation of each module in the above-mentioned post-processing-based quantum random number extraction device corresponds to the steps in the above-mentioned post-processing-based quantum random number extraction method embodiment, and its functions and implementation processes are no longer repeated here one by one.
[0146] In a third aspect, an embodiment of the present application provides a quantum random number extraction device based on post-processing. The quantum random number extraction device based on post-processing can be a personal computer (PC), a laptop computer, a server, or other device with data processing functions.
[0147] Reference Fig. 9 , Fig. 9 Schematic diagram of the hardware structure of the post-processing quantum random number extraction device involved in the embodiment of the present application. In the embodiment of the present application, the post-processing quantum random number extraction device may include a processor, a memory, a communication interface and a communication bus.
[0148] The communication bus may be of any type and is used to interconnect the processor, the memory, and the communication interface.
[0149] The communication interface includes an input / output (I / O) interface, a physical interface, and a logical interface, etc., which are used to realize the interconnection of devices inside the post-processing quantum random number extraction device, and an interface for realizing the interconnection between the post-processing quantum random number extraction device and other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, an optical fiber interface, an ATM interface, etc.; the user device can be a display, a keyboard, etc.
[0150] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.
[0151] The processor may be a general-purpose processor, and the general-purpose processor may call the post-processing-based quantum random number extraction program stored in the memory, and execute the post-processing-based quantum random number extraction method provided in the embodiment of the present application. For example, the general-purpose processor may be a central processing unit (CPU). Among them, the method executed when the post-processing-based quantum random number extraction program is called can refer to the various embodiments of the post-processing-based quantum random number extraction method of the present application, which will not be repeated here.
[0152] Those skilled in the art will understand that Fig. 9 The hardware structure shown in the figure does not constitute a limitation on the present application, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0153] In a fourth aspect, an embodiment of the present application also provides a computer-readable storage medium.
[0154] The computer-readable storage medium of the present application stores a post-processing-based quantum random number extraction program, wherein when the post-processing-based quantum random number extraction program is executed by a processor, the steps of the post-processing-based quantum random number extraction method as described above are implemented.
[0155] Among them, the method implemented when the post-processing-based quantum random number extraction program is executed can refer to the various embodiments of the post-processing-based quantum random number extraction method of this application, and will not be repeated here.
[0156] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.
[0157] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit "first", "second" and "third" to different types.
[0158] In the description of the embodiments of the present application, "exemplary", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a specific way.
[0159] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; the “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.
[0160] In some processes described in the embodiments of the present application, multiple operations or steps that appear in a specific order are included, but it should be understood that these operations or steps may not be executed in the order in which they appear in the embodiments of the present application or in parallel, and the sequence number of the operation is only used to distinguish the different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed in sequence or in parallel, and these operations or steps may be combined.
[0161] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD) as described above, and includes a number of instructions for a terminal device to execute the methods described in each embodiment of the present application.
[0162] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A quantum random number extraction method based on post-processing, characterized in that: The post-processing-based quantum random number extraction method comprises: The analog signal output by the quantum entropy source is converted into a digital signal by presetting a high-speed ADC to obtain the original random number; Calculating the minimum entropy according to the obtained original random number; By post-processing, the original random number is used as a seed to update a preset Toeplitz large matrix, so as to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix; Extracting quantum random numbers from the first random number sequence according to the minimum entropy and the first extraction ratio.
2. The post-processing-based quantum random number extraction method according to claim 1, characterized in that: The post-processing uses the original random number as a seed to update the preset Toeplitz large matrix to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix, including: Divide the original random number into multiple sample data according to a preset segmentation rule; Extracting corresponding bits from each of the sample data in sequence according to a preset extraction rule; Inputting a plurality of the bits into a preset random number seed shift register as a seed; updating a preset Toeplitz large matrix according to the seed in the current preset random number seed shift register to obtain a second random number sequence output by the updated preset Toeplitz large matrix; updating the seed in the preset random number seed shift register according to the second random number sequence; The updated preset Toeplitz large matrix is started with the seed in the updated preset random number seed shift register to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix.
3. The post-processing-based quantum random number extraction method according to claim 2, characterized in that: The step of updating the preset Toeplitz large matrix according to the seed in the current preset random number seed shift register to obtain a second random number sequence output by the updated preset Toeplitz large matrix comprises: Using the seed in the preset random number seed shift register to update the first row of submatrices in the preset Toeplitz large matrix, and obtaining the updated shift data of the first row of submatrices, wherein the preset Toeplitz large matrix includes multiple rows of submatrices; The second row submatrix is updated with the obtained shift data until all submatrices are updated, and then a second random number sequence output by the updated preset Toeplitz large matrix is obtained, wherein the preset Toeplitz large matrix is updated when all submatrices are updated.
4. The post-processing-based quantum random number extraction method according to claim 1, characterized in that: The step of extracting a quantum random number from the first random number sequence according to the minimum entropy and the first extraction ratio includes: Comparing the minimum entropy with the first extraction ratio to determine whether the first random number sequence is qualified; If the minimum entropy is greater than the first extraction ratio, it is determined that the first random number sequence is qualified; A quantum random number is extracted from the first random number sequence based on the first extraction ratio.
5. The post-processing-based quantum random number extraction method according to claim 4, characterized in that: After comparing the minimum entropy with the first extraction ratio to determine whether the first random number sequence is qualified, the method further includes: If the minimum entropy is less than or equal to the first extraction ratio, determining that the first random number sequence is unqualified; Reduce the first extraction ratio by performing an XOR operation to obtain a second extraction ratio; Compare the minimum entropy with the second extraction ratio to determine again whether the first random number sequence is qualified; If the minimum entropy is greater than the second extraction ratio, it is determined that the first random number sequence is qualified; Extracting quantum random numbers from the first random number sequence based on the second extraction ratio.
6. The post-processing-based quantum random number extraction method according to claim 1, characterized in that: After extracting the quantum random number from the first random number sequence according to the minimum entropy and the first extraction ratio, the method further includes: Performing power-on detection or periodic detection on the acquired quantum random number; If it is determined that the quantum random number passes the power-on detection or the periodic detection, it is determined that the quantum random number is normal; If it is determined that the quantum random number has not passed the power-on detection or has not passed the periodic detection, it is determined that the quantum random number is abnormal.
7. The post-processing-based quantum random number extraction method according to claim 1, characterized in that: After extracting the quantum random number from the first random number sequence according to the minimum entropy and the first extraction ratio, the method further includes: Updating the seed in the preset random number seed shift register according to the quantum random number, and using the quantum random number as the target seed in the preset random number seed shift register; Determining whether the minimum entropy is updated; If the minimum entropy update is determined, the updated preset Toeplitz large matrix is started according to the target seed in the preset random number seed shift register, and a third random number sequence and a third extraction ratio output by the updated preset Toeplitz large matrix are obtained; Extracting quantum random numbers from the third random number sequence according to the updated minimum entropy and the third extraction ratio.
8. A quantum random number extraction device based on post-processing, characterized in that: The post-processing-based quantum random number extraction device comprises: The first acquisition module is used to convert the analog signal output by the quantum entropy source into a digital signal through a preset high-speed ADC to obtain an original random number; A calculation module, used for calculating the minimum entropy according to the obtained original random number; A second acquisition module is used for updating a preset Toeplitz large matrix by post-processing the original random number as a seed to obtain a first random number sequence and a first extraction ratio output by the updated preset Toeplitz large matrix; An extraction module is used to extract quantum random numbers from the first random number sequence according to the minimum entropy and the first extraction ratio.
9. A quantum random number extraction device based on post-processing, characterized in that: The post-processing-based quantum random number extraction device includes a processor, a memory, and a post-processing-based quantum random number extraction program stored on the memory and executable by the processor, wherein when the post-processing-based quantum random number extraction program is executed by the processor, the steps of the post-processing-based quantum random number extraction method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a post-processing-based quantum random number extraction program, wherein when the post-processing-based quantum random number extraction program is executed by a processor, the steps of the post-processing-based quantum random number extraction method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Streaming quantum random number generation method, apparatus and device, medium and program product
CN120909552A
General hash function class randomness extraction method and device
CN120915432A
A general hash function class randomness extraction method and device
CN120915432B
Random number testing method and device for quantum random source chip and terminal equipment
CN121684090A
Quantum random source chip random number test method, device and terminal equipment
CN121684090B