CN118153703A - Quantum random number post-processing method and device based on word processing - Google Patents

Quantum random number post-processing method and device based on word processing Download PDF

Info

Publication number
CN118153703A
CN118153703A CN202410257400.4A CN202410257400A CN118153703A CN 118153703 A CN118153703 A CN 118153703A CN 202410257400 A CN202410257400 A CN 202410257400A CN 118153703 A CN118153703 A CN 118153703A
Authority
CN
China
Prior art keywords
random number
matrix
quantum random
number sequence
word
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202410257400.4A
Other languages
Chinese (zh)
Other versions
CN118153703B (en
Inventor
黄蕾蕾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Regular Quantum Beijing Technology Co ltd
Original Assignee
Regular Quantum Beijing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Regular Quantum Beijing Technology Co ltd filed Critical Regular Quantum Beijing Technology Co ltd
Priority to CN202410257400.4A priority Critical patent/CN118153703B/en
Publication of CN118153703A publication Critical patent/CN118153703A/en
Application granted granted Critical
Publication of CN118153703B publication Critical patent/CN118153703B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena
    • G06N10/60Quantum algorithms, e.g. based on quantum optimisation, quantum Fourier or Hadamard transforms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/588Random number generators, i.e. based on natural stochastic processes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Artificial Intelligence (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Complex Calculations (AREA)

Abstract

The application provides a quantum random number post-processing method and a device based on word processing, wherein one specific implementation mode of the method comprises the following steps: receiving an initial quantum random number sequence and a corresponding hash matrix thereof; storing row elements included in a first row vector formed by the initial quantum random number sequence and row elements included in each row vector included in the hash matrix to a plurality of word storage units in a continuous and sectional mode by taking a word of a microcontroller as a unit; and performing matrix operation by utilizing contents stored in the plurality of word storage units to extract a target quantum random number sequence from the initial quantum random number sequence. By storing the first row vector and the row elements of the row vector in the hash matrix respectively in units of words, the memory consumption in the quantum random number post-processing process can be saved, so that the quantum random number post-processing process can be realized on the microcontroller, and the operation resource waste and the system cost are reduced.

Description

Quantum random number post-processing method and device based on word processing
Technical Field
The application relates to the technical field of quantum communication, in particular to a quantum random number post-processing method and device based on word processing.
Background
Random numbers have important applications in the fields of modern cryptography, simulation experiments, information processing, and the like. Conventional computer systems employ pseudo-random number generators to generate random numbers, but the result is actually generated by deterministic algorithms, which do not provide true randomness. This pseudo-randomness may present a safety hazard in certain scenarios. To solve this problem, quantum random number generation schemes have been developed. The uncertainty principle of quantum mechanics provides a basis for achieving true randomness. Quantum random number generation exploits the random properties of quantum physical systems, such as the unpredictability of single photons, the randomness of quantum measurements, the randomness of quantum tunneling effects, etc., to produce truly random arrays of numbers.
Generally, the generation of the quantum random number is divided into two stages, wherein the first stage is to obtain an original random number sequence from a physical system, that is, convert an electrical signal, an optical signal, etc. into a binary sequence, and the second stage is to perform post-processing on the original random number sequence to extract a truly random binary sequence. Because of imperfections in the actual physical system, the original random number sequence obtained in the first stage has imperfections such as correlation, uneven distribution of values, etc., and thus requires post-processing in the second stage to process it into perfectly random numbers.
Currently, the second stage of random number post-processing method is typically to multiply a hash matrix (HASHI NG MATR ix) with the original random number sequence using matrix multiplication. To guarantee the speed of the processing, such post-processing often requires the use of field programmable gate array (fiel d-programmabl E GATE AR RAY, FPGA) devices, which would otherwise greatly affect the processing speed and the speed of the final output random number sequence. However, the cost of the FPGA is relatively high, which is not beneficial to miniaturization and commercialization of the quantum random number generator, and a large amount of memory and operation resources are wasted in the processing process.
Disclosure of Invention
In order to solve the above problems, the application provides a method, a device, a quantum random number generator and a microcontroller for post-processing a quantum random number based on word processing, which can realize the post-processing process of the quantum random number on the microcontroller by saving the memory consumption in the post-processing process of the quantum random number.
In a first aspect, the present application provides a method for post-processing a quantum random number based on word processing, the method comprising:
receiving an initial quantum random number sequence and a corresponding hash matrix thereof; the initial quantum random number sequence is obtained by measuring an entropy source with quantum effect, and the scale of the hash matrix is determined by the minimum entropy of the initial quantum random number sequence;
Storing the row elements of a first row vector formed by the initial quantum random number sequence to a plurality of first word storage units in a continuous and sectional mode by taking a word of a microcontroller as a unit, and storing the row elements of each row vector in the hash matrix to a plurality of second word storage units in a continuous and sectional mode by taking the word as a unit;
and performing matrix operation by utilizing the contents stored in the plurality of first word storage units corresponding to the first row vectors and the plurality of second word storage units corresponding to all row vectors in the hash matrix respectively so as to extract a target quantum random number sequence from the initial quantum random number sequence.
Therefore, by changing the existing storage mode taking the bits as the object, the first row vector formed by the initial quantum random number sequence and the row element of each row vector in the corresponding hash matrix are stored in the word storage unit of the micro control unit in a continuous and sectionalized mode respectively, so that the memory consumption in the quantum random number post-processing process can be saved, the quantum random number post-processing process can be realized on the micro control unit, and the operation resource waste and the system cost are reduced.
In a second aspect, the present application provides a word processing based quantum random number post-processing apparatus, the apparatus comprising:
The receiving module is used for receiving the initial quantum random number sequence and the corresponding hash matrix; the initial quantum random number sequence is obtained by measuring an entropy source with quantum effect, and the scale of the hash matrix is determined by the minimum entropy of the initial quantum random number sequence;
The storage module is used for continuously and sectionally storing the row elements of a first row vector formed by the initial quantum random number sequence to a plurality of first word storage units by taking the word of the microcontroller as a unit, and continuously and sectionally storing the row elements of each row vector in the hash matrix to a plurality of second word storage units by taking the word as a unit;
And the processing module is used for performing matrix operation by utilizing the contents stored in the plurality of first word storage units corresponding to the first row vectors and the plurality of second word storage units respectively corresponding to all the row vectors in the hash matrix so as to extract a target quantum random number sequence from the initial quantum random number sequence.
In a third aspect, the present application provides a word processing based quantum random number generator comprising:
The entropy source with quantum effect is used for preparing quantum state according to quantum effect;
the measuring unit is used for measuring the quantum state to obtain an initial quantum random number sequence;
A post-processing unit, configured to receive a hash matrix corresponding to the initial quantum random number sequence, where a scale of the hash matrix is determined by a minimum entropy of the initial quantum random number sequence;
The post-processing unit is further configured to store row elements of a first row vector formed by the initial quantum random number sequence in a continuous segment manner in a plurality of first word storage units by using words of a microcontroller as units, and store row elements of each row vector in the hash matrix in a continuous segment manner in a plurality of second word storage units by using the words as units;
The post-processing unit is further configured to perform matrix operation by using contents stored in the plurality of first word storage units corresponding to the first row vectors and the plurality of second word storage units corresponding to all row vectors in the hash matrix, so as to extract a target quantum random number sequence from the initial quantum random number sequence.
In a fourth aspect, the present application provides a microcontroller comprising: at least one memory for storing a program; at least one processor for executing the programs stored in the memory; wherein the processor is adapted to perform the method described in the first aspect or any one of the possible implementations of the first aspect, when the program stored in the memory is executed.
It will be appreciated that the advantages of the second to fourth aspects may be found in the relevant description of the first aspect and are not repeated here.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a quantum random number generator according to an embodiment of the present application;
FIG. 2 is a flow chart of a method for post-processing a quantum random number based on word processing according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a storage method used by a processor according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a grouping method for matrix operations according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a grouping result for matrix operations according to an embodiment of the present application;
Fig. 6 is a diagram of a quantum random number post-processing device based on word processing according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be described below with reference to the accompanying drawings.
In describing embodiments of the present application, words such as "exemplary," "such as" or "for example" are used to mean serving as examples, illustrations or explanations. Any embodiment or design described herein as "exemplary," "such as" or "for example" is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary," "such as" or "for example," etc., is intended to present related concepts in a concrete fashion.
In the description of the embodiments of the present application, the term "and/or" is merely an association relationship describing an association object, and indicates that three relationships may exist, for example, a and/or B may indicate: a alone, B alone, and both A and B. In addition, unless otherwise indicated, the term "plurality" means two or more. For example, a plurality of systems means two or more systems, and a plurality of screen terminals means two or more screen terminals.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating an indicated technical feature. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The quantum random number generator (quantum random number generator, QRNG) is a scheme based on quantum mechanics principles to generate a true random number sequence. The quantum random number generator utilizes the random properties of a quantum physical system, such as uncertainty of quantum measurement and unpredictability of light quanta, to generate a truly random sequence, wherein the randomness is ensured by quantum mechanics and is a truly random number with theoretical support. The quantum random number has important and wide application in the fields of practical cryptography, information security, national defense, scientific research and the like. The current mainstream scheme of QRNG is to collect the signal output by the quantum physical system, convert it into binary number sequence, and then extract the final quantum random number string by multiplying the post-processing mode of hash matrix.
The specific post-treatment process can be described as follows: the signal output by the quantum physical system is converted into a binary number sequence with M bits to be used as an initial quantum random number sequence (forming a row vector M), and the length of a final quantum random number sequence (forming a row vector R) which needs to be extracted is R. Wherein the ratio of m to r is determined by a specific system and can be calculated by theory. After m and r are determined, a hash matrix T of size mxr is generated from the existing binary random number, which needs to satisfy the properties of an unimersal-2 hash, such as the Toeplitz matrix. Subsequently, a matrix multiplication of r=m×t is calculated, resulting in a final output result. In the matrix multiplication process, a row vector M formed by a hash matrix and an initial quantum random number sequence is stored in a word storage unit of a memory by taking bits (bits) as units, and multiplication operation is carried out one by one. Algorithms are also known that use a Fast Fourier Transform (FFT) method to perform matrix multiplication to obtain the result. This calculation is typically performed by an FPGA.
Specifically, the design rules of the processor determine the length of a word, and common word sizes include 8 bits, 16 bits, 32 bits, and higher 64 bits. Each word consists of several bytes (bytes), which are the basic unit of 8 bits. Thus, the size of the word determines the number of memory bytes that the processor can access and operate on at once. A word memory unit may be used to store one or more binary numbers, the maximum number of bits that can be stored being the word size of the processor.
The hash matrix and the initial quantum random number sequence M are binary number strings, and the current post-processing method is to store the hash matrix to be operated and the initial quantum random number sequence in a word storage unit of a memory by taking bits as objects, so that a large amount of memory loss is caused by processing. For example, for a byte memory unit with a length of 8 bits, a binary number may correspond to a value of 1 or 0, and the stored content in the byte memory unit is 0000 0001 or 0000 0000, i.e. the actual valid memory content has only the lowest 1bit, which may cause waste of other 7bit memory space.
In addition, in order to ensure the processing speed, the FPGA is adopted on hardware for processing and operation no matter the matrix multiplication or the FFT is directly calculated, and the cost of the FPGA is higher, so that the method is not beneficial to the miniaturization and commercialization of the quantum random number generator.
Sometimes, in the post-processing process, a microcontroller (such as a singlechip) with lower cost can be adopted to perform operation, but the microcontroller cannot perform complex algorithms such as FFT, so that matrix multiplication can only be directly performed, the operation efficiency is relatively low, and the operation capability of the microcontroller is inferior to that of the FPGA, so that the processing speed is relatively low.
In view of this, the embodiment of the present application changes the existing storage mode using bits as objects, and stores the first row vector formed by the initial quantum random number sequence and the row element of each row vector in the corresponding hash matrix in word units and continuous segments to the word storage unit of the micro control unit, so as to save the memory consumption in the quantum random number post-processing process, and realize the quantum random number post-processing process on the micro control unit, thereby reducing the operation resource waste and the system cost.
Exemplary, fig. 1 shows a schematic diagram of a quantum random number generator according to an embodiment of the present application. As shown in fig. 1, the structure of the quantum random number generator includes three parts of an entropy source, a measuring unit and a post-processing unit, wherein,
The entropy source of the quantum random number generator is a physical system with quantum effect, such as an optical system, an electron tunneling system and the like, is used for preparing and outputting quantum states according to the quantum effect, and is a generation source of quantum randomness.
The measurement unit is used for measuring the quantum state output by the entropy source to generate an initial quantum random number sequence. The initial quantum random number sequence is affected by environmental noise, non-ideal entropy source, measurement noise and other factors, so that the initial quantum random number sequence has certain bias and correlation, the initial data output by the measurement unit is firstly subjected to entropy estimation, then the randomness is extracted through a post-processing algorithm, and finally the complete quantum random number sequence is obtained.
And the post-processing unit is used for receiving a hash matrix corresponding to the initial quantum random number sequence generated according to the entropy estimation result. The method comprises the steps of storing row elements of a first row vector formed by an initial quantum random number sequence in a continuous and piecewise mode into a plurality of first word storage units by taking words of a microcontroller as units, and storing row elements of each row vector in a hash matrix in a continuous and piecewise mode into a plurality of second word storage units by taking the words as units.
And performing matrix operation by utilizing the contents stored in the plurality of first word storage units corresponding to the first row vectors and the plurality of second word storage units corresponding to all the row vectors in the hash matrix respectively so as to extract a target quantum random number sequence from the initial quantum random number sequence. The target quantum random number sequence is the quantum random number sequence with perfect randomness.
Therefore, by changing the storage mode of the initial quantum random number sequence and the hash matrix in the existing post-processing process, the first row vector formed by the initial quantum random number sequence and the row element of each row vector in the corresponding hash matrix are respectively changed from taking bits as objects to taking words as units, and are continuously segmented and stored in a word storage unit of the microcontroller. And then based on the content stored in the word storage unit, performing matrix operation of a first row vector formed by the initial quantum random number sequence and the hash matrix to extract the target quantum random number sequence from the initial quantum random number sequence, thereby saving the memory consumption in the quantum random number post-processing process.
In addition, since the first row vector and the corresponding element of the hash matrix are usually 0 or 1, the calculation efficiency of matrix operation between the first row vector formed by the initial quantum random number sequence and the hash matrix can be further optimized according to the characteristics of matrix operation. For example, assuming that matrix multiplication is to be performed, the multiplication operation involving the row element 1 in the first row vector is replaced by the original content of the corresponding hash matrix element in the storage space, so that the processing speed of the microcontroller for executing the post-processing process is improved.
Next, a quantum random number post-processing method based on word processing provided by the embodiment of the present application is described based on the above.
Illustratively, a flow chart of a method for quantum random number post-processing based on word processing is shown in fig. 2. As shown in fig. 2, the quantum random number post-processing method mainly includes the following steps:
Step 201, an initial quantum random number sequence and a corresponding hash matrix are received. The initial quantum random number sequence is obtained by measuring an entropy source with quantum effect, and the scale of the hash matrix is determined by the minimum entropy of the initial quantum random number sequence.
In this embodiment, the initial quantum random number sequence is a binary number sequence converted from a signal output by a quantum physical system, and the quantum physical system is an entropy source with quantum effect, such as an optical system, an electron tunneling system, etc., shown in fig. 1, for generating a quantum state according to the quantum effect. The initial quantum random number sequence can be obtained by measuring the quantum state output by the quantum physical system. The hash matrix is a linear transformation matrix for mapping high-dimensional input to low-dimensional output, and can be used for tasks such as dimension reduction, compression, feature extraction and the like.
The initial quantum random number sequence has certain bias and correlation due to the influence of environmental noise, non-ideal entropy source, measurement noise and other factors. Entropy estimation is needed to be carried out on the initial quantum random number sequence, then randomness is extracted through post-processing, and finally the quantum random number with perfect randomness is obtained.
Illustratively, the randomness of the initial quantum random number sequence is evaluated using the concept of minimum entropy. The minimum entropy gives the upper limit that a quantum random number with perfect randomness can be extracted from the initial sequence of quantum random numbers. For an initial quantum random number sequence with a length of m bits, if the minimum entropy is k, only k bits of quantum random numbers with perfect randomness can be extracted from m bits of data at most. For example, for a string of binary sequences X, the definition of minimum entropy may be:
As shown in equation (1), where H min (X) is the minimum entropy and P X(xi is the probability that bit X i occurs in binary sequence X.
The hash matrix corresponding to the initial quantum random number sequence is determined by the minimum entropy of the initial quantum random number sequence. For example, the number of columns r of the hash matrix may be set to be not greater than the minimum entropy k, and the number of rows of the hash matrix may be set to be the same as the random number included in the initial quantum random number sequence.
By performing matrix multiplication operation m×t of a first row vector M (vector size is 1*m) composed of an initial quantum random number sequence and a hash matrix T (matrix size is m×r), a target quantum random number sequence with length r can be extracted, and r is less than or equal to k, so that the target quantum random number sequence is a quantum random number sequence with perfect randomness.
For example, after the minimum entropy k of the initial quantum random number sequence is evaluated, a hash matrix corresponding to the initial quantum random number sequence may be generated based on the preset binary number sequence, and a matrix element of the hash matrix generated in this manner is 0 or 1. For example, a Toeplitz matrix may be generated that satisfies the universal-2 hash property, the Toeplitz matrix being the same matrix for each element on the diagonal from top left to bottom right.
Specifically, a Toeplitz matrix with m+r-1 length can be constructed by using a preset binary number sequence, and each row of the Toeplitz matrix is obtained by right shifting one bit for the previous row and adding a new random number. The random numbers in the preset binary number sequence can be existing quantum random numbers or classical random numbers, are usually unbiased quantum random numbers, and have high randomness, such as at least need to be capable of going through tests such as national security/NIST and the like.
Step 202, storing row elements of a first row vector formed by the initial quantum random number sequence in a plurality of first word storage units in a continuous and piecewise mode by taking words of the microcontroller as units. And storing the row elements of each row vector in the hash matrix to a plurality of second word storage units in a continuous segmentation mode by taking words as units.
In this embodiment, the size of the word determines the number of memory bytes that the processor can access and operate on at once. Each word consists of several bytes (bytes), which are the basic unit of 8 bits. A word memory unit may be used to store one or more binary numbers, the maximum number of bits that can be stored being the word size of the processor. Common processor word sizes include 8 bits, 16 bits, 32 bits, 64 bits at a higher level, and the like.
For example, since the initial quantum random number sequence is a binary number sequence converted by a signal output by the quantum physical system, and the matrix element of the hash matrix is 0 or 1, the initial quantum random number sequence can be stored in a plurality of first word storage units in a continuous segmented manner by taking a word as a unit, and the row element of each row vector in the hash matrix can be stored in a plurality of second word storage units in a continuous segmented manner by taking a word as a unit, so that subsequent matrix operation can be performed.
Fig. 3 is a schematic diagram of a storage method used by a processor according to an embodiment of the present application.
As shown in fig. 3, assuming that the length m=1024 of the initial quantum random number sequence, the size of the first row vector M that is composed is 1×1024, the row elements of the first row vector M may be expressed as M j, j=1, 2. Based on the foregoing size of the hash matrix T corresponding to the initial quantum random number sequence received in step 201 being 1024×512, the matrix elements of the hash matrix T may be represented as T s,t, s=1, 2. Each dot in fig. 3 represents an element of M or T.
For example, if the word length of the adopted processor is 32 bits, the row elements of the first row vector M are continuously stored in a segmented mode by taking words as units, the M 1~M32 th bit is stored in one first word storage unit in the memory space, the M 33~M64 th bit is stored in the other first word storage unit in the memory space, and the like. Similarly, the same processing is performed on each row vector included in the hash matrix T, and the row elements of each row vector are subjected to continuous segmentation processing and stored in a plurality of second word storage units in the memory space.
It will be appreciated that the number of word storage units that each row vector of the first row vector and hash matrix needs to occupy is the quotient of the length of the row vector to the length of the processor word is rounded up.
Because the initial quantum random number sequence and the corresponding hash matrix are stored by taking the bit as the object instead of taking the word as the unit, the memory consumption in the quantum random number post-processing process is saved.
In step 203, matrix operation is performed by using the contents stored in the plurality of first word storage units corresponding to the first row vectors and the plurality of second word storage units corresponding to all the row vectors in the hash matrix, so as to extract the target quantum random number sequence from the initial quantum random number sequence.
In this embodiment, a matrix operation of a first row vector composed of the initial quantum random number sequence and a hash matrix is performed to extract a target quantum random number sequence from the initial quantum random number sequence. The target quantum random number sequence is the quantum random number sequence with perfect randomness.
In one implementation, the matrix operation may be that after performing a conventional matrix multiplication operation on the first row vector and the hash matrix, each vector element in the row vector obtained by the operation is subjected to a modulo-2 operation to obtain the target quantum random number sequence.
In another implementation manner, the matrix operation may also be that a matrix multiplication operation based on modulo-2 addition is performed on the first row vector and the hash matrix, and a target quantum random number sequence is obtained based on a result of the matrix multiplication operation. Wherein a matrix multiplication operation based on modulo-2 addition means that the addition operation involved in the matrix multiplication operation is replaced by a modulo-2 addition operation.
Modulo-2 addition is a binary-based operation, equivalent to an exclusive-or operation, commonly used in the computer and electronics fields. The logic rules of both sides of the operation are as follows: 1+1=0+0=0, 1+0=0+1=1, consistent with the exclusive or algorithm of the computer bit operators.
For the first row vector M and the hash matrix T shown in fig. 3, when performing matrix multiplication operation based on modulo-2 addition, the target to be calculated can be expressed as a first set of calculation formulas:
M1*T1,1 XOR M2*T2,1 XOR …XOR M1024*T1024,1
M1*T1,2 XOR M2*T2,2 XOR …XOR M1024*T1024,2
………,
M1*T1,512 XOR M2*T2,512 XOR …XOR M1024*T1024,512
It can be understood that the number of the first set of calculation formulas is the number r of columns of the hash matrix T (r=512 in fig. 3), and the calculation result of each calculation formula in the first set of calculation formulas corresponds to a one-bit quantum random number included in the target quantum random number sequence.
Specifically, taking the first element M 1 of the first row vector M as an example, from the first set of calculation formulas, it can be seen that the matrix multiplication based on modulo-2 addition includes multiplication calculation by M 1 for each element T 1,t, t=1, 2, 512, respectively, in the first row of the hash matrix T. Similarly, there is such a rule for each element M j, j=1, 2, 1024 in the first row vector M.
As can also be seen from each of the first set of formulas, the modular 2 addition based matrix multiplication further comprises a multiplication calculation of the elements M j, j=1, 2 of the first row vector M, 1024 with the elements T j,1 in the j-th column of the hash matrix T. And performing exclusive OR operation on the binary digits obtained by calculation of each M j*Tj,1 in sequence to obtain a target binary digit, wherein the target binary digit corresponds to a one-bit quantum random number included in the target quantum random number sequence.
For example, in the first calculation formula in the first set of calculation formulas, the binary bit calculated by M 1*T1,1 and the binary bit calculated by M 2*T2,1 are xored, the result (one binary bit) obtained by the calculation is further xored with the binary bit calculated by M 2*T2,1, and so on, so as to finally obtain a target binary bit. Similarly, there are similar rules of calculation for the other formulas in the set of formulas. And combining the target binary digits corresponding to the calculation formulas in the first group of calculation formulas to obtain a binary sequence, namely the target quantum random number sequence.
For example, the matrix W with the block as an element may be obtained based on contents stored in the plurality of second word storage units corresponding to all the row vectors in the hash matrix T. Wherein each block includes content stored in a word storage unit. Matrix multiplication based on modulo-2 addition can be performed on the first row vector and the blocks in matrix W to simplify the matrix operation process.
Fig. 4 is a schematic diagram of a grouping method for matrix operation according to an embodiment of the present application.
As shown in fig. 4, for a hash matrix T with a size of 1024×512, row elements of each row vector in the hash matrix T may be continuously segmented in units of words to obtain a plurality of word blocks. For example, the row element T 1,1~T1,32 of the first row vector in the hash matrix T is segmented to obtain a block. Since the row elements of each row vector in the hash matrix T have been stored in the second word storage units of the microcontroller in successive segments in units of words in step 202, each word block includes the contents stored in one word storage unit.
As described above, the block matrix W with the blocks as elements can be obtained based on all the blocks, and a schematic diagram of grouping results for matrix operation provided by the embodiment of the present application is shown in fig. 5. As shown in fig. 5, a block matrix W with a size of 1024×16 can be obtained based on the above method. It can be understood that the number of columns of W is obtained by rounding up the quotient of the number of columns of the hash matrix T to the word length of the microprocessor.
For the first row vector M and the block matrix W shown in fig. 5, when performing matrix multiplication operation based on modulo-2 addition, the target to be calculated can be expressed as follows:
M1*W1,1 XOR M2*W2,1 XOR …XOR M1a24*W1024,1
M1*W1,2 XOR M2*W2,2 XOR …XOR M1024*W1024,2
………,
M1*W1,16 XOR M2*W2,512 XOR …XOR M1024*W1024,16
It will be appreciated that the number of the second set of calculations is the number W of columns of the matrix W of blocks, and is obtained by rounding up the quotient of the number of columns of the hash matrix T to the word length of the microprocessor (w=512++32=16 in fig. 5). The calculation result of each calculation formula in the second group of calculation formulas is a word block, and the binary sequence obtained by splicing the contents included in the word blocks in sequence is the target quantum random number sequence.
Specifically, taking the first element M 1 of the first row vector M as an example, from the second set of calculations, it can be seen that the matrix multiplication based on modulo-2 addition includes M 1 multiplication calculations for each element W 1,k, k=1, 2, 16 in the first row of the block matrix W, respectively. Similarly, there is such a rule for each element M j, j=1, 2, 1024 in the first row vector M. As can also be seen from each of the second set of formulas, the modular 2 addition based matrix multiplication also includes a multiplication calculation of the elements M j, j=1, 2 of the first row vector M, 1024 with the elements W j,1 in the j-th column of the block matrix W. For each of the second set of formulas, a target block may be obtained by aligning the contents included in the blocks calculated by each M j*Wj,1 by bit and performing an exclusive-or operation bit by bit.
For example, in the first calculation formula in the second set of calculation formulas, the first block calculated by M 1*W1,1 and the second block calculated by M 2*W2,1 are subjected to exclusive-or operation, that is, the contents included in the two blocks are aligned according to bits, and are subjected to exclusive-or operation bit by bit, the result (one block) obtained by the operation is continuously subjected to exclusive-or operation with the block calculated by M 3*W3,1, and so on, and finally a target block is obtained. Similarly, there are similar rules of calculation for the other formulas in the set of formulas. And (3) splicing the contents included in the target blocks corresponding to the calculation formulas in the second group of calculation formulas in sequence to obtain a binary sequence which is the target quantum random number sequence.
For example, since the result of multiplying the data 1 by any number is also any number, the multiplication operation involving the row element 1 in the first row vector may be replaced by the original content included in the corresponding block of the multiplication operation.
And because the result of the multiplication of the data 0 and any number is 0, the multiplication operation participated by the row element 0 in the first row vector can be replaced by zero clearing the content included in the corresponding word block of the multiplication operation, so that the matrix operation process is further simplified.
And because the result of the addition operation of the data 0 and the arbitrary number is also the arbitrary number, the addition operation of the data 0 in the matrix multiplication operation of the module 2 can be omitted, and the result is directly set as the content included in the addition operation of the module 2 corresponding to the other bit, so as to further simplify the matrix operation process. In this case, about 50% of the modulo-2 addition steps can be saved.
As shown in fig. 5, in the second set of the above-described expressions, assuming that the row element M 1 =1 in the first row vector, M 1 may be replaced with the original content included in the holding block W 1,1、W1,2 for the multiplication operation M 1*W1,1、M1*W1,2 and the like.
Assuming that row element M 1 = 0 in the first row vector, it may be replaced by zeroing out the contents included in block W 1,1、W1,2 for M 1 -involved multiplication operations M 1*W1,1、M1*W1,2, etc.
Further, the modulo-2 addition operation involving data 0 in the second set of formulas may also be omitted. For example, when performing the exclusive-or operation of the first block calculated by M 1*W1,1 and the second block calculated by M 2*W2,1, assuming that the content included in the first block is 01111111 11111111 11111111 11111111, the modulo-2 addition operation involving the most significant data 0 in the first block may be omitted, i.e., the most significant position of the block obtained by performing the exclusive-or operation on the two blocks is directly the most significant content in the second block.
As shown in fig. 3, in the first set of calculation formulas, when assuming that the row element M 1 =1 or M 1 =0 in the first row vector, or the modulo-2 addition operation involving the data 0 may also be performed, a simplified operation similar to the second set of calculation formulas in fig. 5 is not repeated.
Therefore, by changing the storage mode of the initial quantum random number sequence and the hash matrix in the existing post-processing process, the first row vector formed by the initial quantum random number sequence and the row element of each row vector of the corresponding hash matrix are respectively changed from taking bits as objects to taking words as units, and are continuously segmented and stored in a word storage unit of the microcontroller. And then based on the content stored in the word storage unit, performing matrix operation of a first row vector formed by the initial quantum random number sequence and the hash matrix to extract the target quantum random number sequence from the initial quantum random number sequence, thereby saving the memory consumption in the quantum random number post-processing process.
In addition, according to the characteristics of matrix operation, the calculation efficiency of matrix operation between the first row vector formed by the initial quantum random number sequence and the hash matrix can be further optimized, so that the processing speed of the microcontroller in executing the post-processing process is improved.
Compared with the prior art, the quantum random number post-processing method based on word processing provided by the embodiment of the application has the main advantages that:
1. Low cost: the method can be directly executed on a microprocessor, such as a singlechip, and compared with an FPGA, the hardware cost of the QRNG can be reduced.
2. High efficiency: by utilizing the word processing grouping technology, the computing capability of the microprocessor is fully utilized, and the computing efficiency is improved. Meanwhile, the property of 0 bit and 1 bit can be utilized, so that the operation amount of matrix operation is further reduced, and the calculation efficiency is further improved.
It should be noted that while in the above embodiments, the operations of the methods of the embodiments of the present disclosure are described in a particular order, this does not require or imply that the operations must be performed in that particular order or that all of the illustrated operations be performed in order to achieve desirable results. Rather, the steps depicted in the flowcharts may change the order of execution. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform.
Fig. 6 shows a diagram of a quantum random number post-processing device based on word processing according to an embodiment of the present application. As shown in fig. 6, the quantum random number post-processing apparatus 600 includes:
A receiving module 610, configured to receive an initial quantum random number sequence and a hash matrix corresponding to the initial quantum random number sequence; the initial quantum random number sequence is obtained by measuring an entropy source with quantum effect, and the scale of the hash matrix is determined by the minimum entropy of the initial quantum random number sequence.
The storage module 620 is configured to store the row elements of the first row vector formed by the initial quantum random number sequence in the first word storage units in continuous segments by using the word of the microcontroller as a unit, and store the row elements of each row vector in the hash matrix in the second word storage units in continuous segments by using the word as a unit.
The processing module 630 is configured to perform matrix operation by using the contents stored in the plurality of first word storage units corresponding to the first row vectors and the plurality of second word storage units corresponding to all the row vectors in the hash matrix, so as to extract the target quantum random number sequence from the initial quantum random number sequence.
Based on the method in the above embodiments, the embodiments of the present application provide a microcontroller. The microcontroller may include: at least one memory for storing a program; at least one processor for executing programs stored in the memory; wherein the processor is adapted to perform the methods of the above embodiments when the program stored in the memory is executed.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions in accordance with embodiments of the present invention are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.) means from one website, computer, server, or data center. Computer readable storage media can be any available media that can be accessed by a computer or data storage devices, such as servers, data centers, etc., that contain an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)) or the like.
It will be appreciated that the various numerical numbers referred to in the embodiments of the present application are merely for ease of description and are not intended to limit the scope of the embodiments of the present application. It should be understood that, in the embodiment of the present application, the sequence number of each process does not mean the sequence of execution, and the execution sequence of each process should be determined by the function and the internal logic of each process, and should not limit the implementation process of the embodiment of the present application.
The foregoing detailed description of the application has been presented for purposes of illustration and description, and it should be understood that the foregoing is by way of illustration and description only, and is not intended to limit the scope of the application.

Claims (10)

1. A method for post-processing a quantum random number based on word processing, the method comprising:
receiving an initial quantum random number sequence and a corresponding hash matrix thereof; the initial quantum random number sequence is obtained by measuring an entropy source with quantum effect, and the scale of the hash matrix is determined by the minimum entropy of the initial quantum random number sequence;
Storing the row elements of a first row vector formed by the initial quantum random number sequence to a plurality of first word storage units in a continuous and sectional mode by taking a word of a microcontroller as a unit, and storing the row elements of each row vector in the hash matrix to a plurality of second word storage units in a continuous and sectional mode by taking the word as a unit;
and performing matrix operation by utilizing the contents stored in the plurality of first word storage units corresponding to the first row vectors and the plurality of second word storage units corresponding to all row vectors in the hash matrix respectively so as to extract a target quantum random number sequence from the initial quantum random number sequence.
2. The method of claim 1, wherein the size of the hash matrix is determined by a minimum entropy of the initial sequence of quantum random numbers comprises a number of columns of the hash matrix not greater than the minimum entropy.
3. The method of claim 1, wherein the hash matrix is generated based on a predetermined binary number sequence, and wherein an element of the hash matrix is 0 or 1.
4. The method of claim 1, wherein the number of rows of the hash matrix is the same as the random number bits included in the initial sequence of quantum random numbers, the matrix operation comprising:
performing matrix multiplication operation based on modulo-2 addition on the first row vector and the hash matrix;
Wherein the matrix multiplication operation based on modulo-2 addition represents that the addition operation involved in the matrix multiplication operation process is replaced by a modulo-2 addition operation.
5. The method of claim 1, wherein the number of rows of the hash matrix is the same as the random number bits included in the initial sequence of quantum random numbers, the matrix operation comprising:
Obtaining a word block matrix taking a word block as an element based on contents stored in a plurality of second word storage units respectively corresponding to all row vectors in the hash matrix; the word block comprises contents stored in a word storage unit;
performing matrix multiplication operation based on modulo-2 addition on the first row vector and the block matrix;
Wherein the matrix multiplication operation based on modulo-2 addition represents that the addition operation involved in the matrix multiplication operation process is replaced by modulo-2 addition operation.
6. The method of claim 5, wherein the matrix multiplication operation comprises:
Replacing multiplication operation participated by line element 1 in the first line vector with original content included in a corresponding word block of the multiplication operation; and
And replacing multiplication operation participated by the line element 0 in the first line vector by clearing the content included in the corresponding word block of the multiplication operation.
7. The method of claim 4 or 5, wherein the modulo-2 addition based matrix multiplication operation comprises:
And omitting the modulo-2 addition operation participated by the data 0 in the matrix multiplication operation, and directly setting the result of the modulo-2 addition operation as the content included in the modulo-2 addition operation corresponding to another bit.
8. A quantum random number post-processing device based on word processing, the device comprising:
The receiving module is used for receiving the initial quantum random number sequence and the corresponding hash matrix; the initial quantum random number sequence is obtained by measuring an entropy source with quantum effect, and the scale of the hash matrix is determined by the minimum entropy of the initial quantum random number sequence;
The storage module is used for continuously and sectionally storing the row elements of a first row vector formed by the initial quantum random number sequence to a plurality of first word storage units by taking the word of the microcontroller as a unit, and continuously and sectionally storing the row elements of each row vector in the hash matrix to a plurality of second word storage units by taking the word as a unit;
And the processing module is used for performing matrix operation by utilizing the contents stored in the plurality of first word storage units corresponding to the first row vectors and the plurality of second word storage units respectively corresponding to all the row vectors in the hash matrix so as to extract a target quantum random number sequence from the initial quantum random number sequence.
9. A quantum random number generator based on word processing, the quantum random number generator comprising:
The entropy source with quantum effect is used for preparing quantum state according to quantum effect;
the measuring unit is used for measuring the quantum state to obtain an initial quantum random number sequence;
A post-processing unit, configured to receive a hash matrix corresponding to the initial quantum random number sequence, where a scale of the hash matrix is determined by a minimum entropy of the initial quantum random number sequence;
The post-processing unit is further configured to store row elements of a first row vector formed by the initial quantum random number sequence in a continuous segment manner in a plurality of first word storage units by using words of a microcontroller as units, and store row elements of each row vector in the hash matrix in a continuous segment manner in a plurality of second word storage units by using the words as units;
The post-processing unit is further configured to perform matrix operation by using contents stored in the plurality of first word storage units corresponding to the first row vectors and the plurality of second word storage units corresponding to all row vectors in the hash matrix, so as to extract a target quantum random number sequence from the initial quantum random number sequence.
10. A microcontroller, comprising: at least one memory for storing a program; at least one processor for executing the programs stored in the memory; wherein the processor is adapted to perform the method of any of claims 1-7 when the program stored in the memory is executed.
CN202410257400.4A 2024-03-06 2024-03-06 Quantum random number post-processing method and device based on word processing Active CN118153703B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410257400.4A CN118153703B (en) 2024-03-06 2024-03-06 Quantum random number post-processing method and device based on word processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410257400.4A CN118153703B (en) 2024-03-06 2024-03-06 Quantum random number post-processing method and device based on word processing

Publications (2)

Publication Number Publication Date
CN118153703A true CN118153703A (en) 2024-06-07
CN118153703B CN118153703B (en) 2024-09-13

Family

ID=91286208

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410257400.4A Active CN118153703B (en) 2024-03-06 2024-03-06 Quantum random number post-processing method and device based on word processing

Country Status (1)

Country Link
CN (1) CN118153703B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140270162A1 (en) * 2013-03-14 2014-09-18 International Business Machines Corporation Instruction for performing a pseudorandom number generate operation
CN108776582A (en) * 2018-05-08 2018-11-09 清华大学 A kind of true random number sequence production method based on quantum tunneling effect
US20200387563A1 (en) * 2019-06-07 2020-12-10 International Business Machines Corporation Electronic system for computing items of an outer product matrix
CN112130810A (en) * 2020-09-27 2020-12-25 山西大学 Safe high-speed random number generator and structure optimization method thereof
CN115378575A (en) * 2022-07-04 2022-11-22 广西伯汉科技有限公司 Universal lightweight hash processing method, system and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140270162A1 (en) * 2013-03-14 2014-09-18 International Business Machines Corporation Instruction for performing a pseudorandom number generate operation
CN108776582A (en) * 2018-05-08 2018-11-09 清华大学 A kind of true random number sequence production method based on quantum tunneling effect
US20200387563A1 (en) * 2019-06-07 2020-12-10 International Business Machines Corporation Electronic system for computing items of an outer product matrix
CN112130810A (en) * 2020-09-27 2020-12-25 山西大学 Safe high-speed random number generator and structure optimization method thereof
CN115378575A (en) * 2022-07-04 2022-11-22 广西伯汉科技有限公司 Universal lightweight hash processing method, system and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吴明川;成琛;张江江;郭晓敏;郭龑强;: "高速量子随机数产生中的实时并行后处理", 光通信研究, no. 05, 22 September 2020 (2020-09-22), pages 5 - 10 *

Also Published As

Publication number Publication date
CN118153703B (en) 2024-09-13

Similar Documents

Publication Publication Date Title
WO2023040365A1 (en) Image encryption method based on multi-scale compressed sensing and markov model
Zhao et al. A self-perturbed pseudo-random sequence generator based on hyperchaos
Anashin et al. T-functions revisited: new criteria for bijectivity/transitivity
CN111832050B (en) Paillier encryption scheme based on FPGA chip implementation for federal learning
Liu et al. Hyperchaotic system‐based pseudorandom number generator
US20240097883A1 (en) Systems and computer-implemented methods for generating pseudo random numbers
Jiang et al. Image encryption algorithm for crowd data based on a new hyperchaotic system and Bernstein polynomial
CN102684871A (en) Quick parallel generating method for multidimensional pseudo-random sequence with uniform distribution characteristics
Yao et al. Research of incoherence rotated chaotic measurement matrix in compressed sensing
CN115622685A (en) Method, device and system for homomorphic encryption of private data
US20230291541A1 (en) Methods of operating on data in a fully homomorphic encryption system using in-situ processing-in-memory and related circuits
Wei et al. A selective image encryption scheme using LICC hyperchaotic system
CN116527235A (en) Data encryption method and device based on key rotation and electronic equipment
Wu et al. Normalized stability: A cross-level design metric for early termination in stochastic computing
Song et al. Multi-image reorganization encryption based on SLF cascade chaos and bit scrambling
CN117155572A (en) Method for realizing large integer multiplication in cryptographic technology based on GPU (graphics processing Unit) parallel
CN114185860B (en) Collusion attack resistant data sharing method and device and electronic equipment
Yan et al. High-speed privacy amplification scheme using GMP in quantum key distribution
Li Image encryption algorithm based on hyperchaos and DNA coding
Tang et al. Secure and Efficient Image Compression‐Encryption Scheme Using New Chaotic Structure and Compressive Sensing
CN112543092B (en) Chaotic binary sequence family matrix construction method based on image compressed sensing encryption
WO2024139196A1 (en) Matrix computation apparatus and method for marlin zero-knowledge proof protocol, and device
CN118153703B (en) Quantum random number post-processing method and device based on word processing
Peng et al. Stochastic circuit synthesis by cube assignment
CN108319448B (en) Method for realizing high-speed random extraction in random number generator

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant