Background
Random numbers are an important basic resource and play a significant role in many areas of science and technology as well as daily life. The quantum random number generator which appears under the promotion of quantum information research generates true random numbers by measuring the random characteristics which are inherited in a quantum physical system, has unpredictability, non-repeatability and unbiased property, the randomness of the quantum random number generator is ensured by the basic principle of quantum mechanics, and the quantum random number generator has more advantages compared with other random number generation technologies and is rapidly developed in recent years. Random numbers output by a common quantum random number generator are all binary sequences, decimal random numbers are needed in many application scenes, and a gap exists between a quantum random number generator system and an actual use scene.
Disclosure of Invention
Technical problem to be solved
Aiming at the problems, the invention provides an application management system and method of quantum random numbers, which are used for at least partially solving the technical problems that the traditional quantum random number generator system is difficult to apply to practical use scenes and the like.
(II) technical scheme
One aspect of the present invention provides an application management system for quantum random numbers, including: the binary quantum random number sequence 1 is composed of at least one quantum random number generator 11 and is respectively connected with the server 2; the server 2 is used for dynamically selecting and reading a binary random number sequence generated by at least one quantum random number generator according to the real-time monitoring of the state of the quantum random number generator and the practical application requirements; converting the binary quantum random number sequence into random data meeting the requirements of an application program; the states of the random data and quantum random number generator are provided to the application for use.
Further, the server 2 specifically includes: and the state monitoring SDK21 is used for reading the monitoring data of the quantum random number generator 11 in real time and providing the monitoring data to the monitoring service 22.
Further, the monitoring service 22 is operable to provide monitoring data to applications for use via the application interface specific SDK 24.
Further, the server 2 specifically includes: the special SDK23 for the quantum random number generator is used for reading the binary quantum random number sequence from at least one quantum random number generator connected and converting the binary quantum random number sequence into random data meeting the requirements of an application program through a specific algorithm.
Further, the specific algorithm is a binary-to-other binary algorithm, including a repeatable algorithm and a non-repeatable algorithm.
Further, the server 2 specifically includes: the SDK24 is used for acquiring the requirements of the application program, providing the requirements to the monitoring service 22 and the SDK23 special for the quantum random number generator, and providing the monitoring data and the random data to the application program for use.
Further, the quantum random number generator 11 is connected with the server 2 through a digital interface, and the digital interface comprises a USB and a network port.
Further, the random data includes octal, decimal, hexadecimal quantum random data.
In another aspect, the present invention provides a method for applying a quantum random number in an application management system of the quantum random number, including: s1, dynamically selecting and reading the binary random number sequence generated by at least one quantum random number generator according to the real-time monitoring of the state of the quantum random number generator and the practical application requirements; s2, converting the binary quantum random number sequence into random data meeting the requirement of an application program; s3, providing the state of the random data and quantum random number generator to the application for use.
Further, the random data includes octal, decimal, hexadecimal quantum random data.
(III) advantageous effects
The application management system and method for the quantum random numbers provided by the embodiment of the invention generate various quantum random numbers meeting the requirements based on the quantum random number generator, provide the quantum random numbers for application programs to use, have the functions of monitoring, managing and the like of the quantum random number generator, and can ensure the randomness, stability and safety of the output quantum random numbers.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to specific embodiments and the accompanying drawings.
A first embodiment of the present invention provides an application management system of quantum random numbers, please refer to fig. 1, which includes: the binary quantum random number sequence 1 is composed of at least one quantum random number generator 11 and is respectively connected with the server 2; the server 2 is used for dynamically selecting and reading a binary random number sequence generated by at least one quantum random number generator according to the real-time monitoring of the state of the quantum random number generator and the practical application requirements; converting the binary quantum random number sequence into random data meeting the requirements of an application program; the states of the random data and quantum random number generator are provided to the application for use.
The binary quantum random number sequence part comprises a plurality of independent quantum random number generators which are respectively connected with the server part; the server part is composed of a state monitoring Software Development Kit (SDK), a monitoring service, a quantum random number generator special SDK and an application program interface special SDK. The randomness of the quantum random number generated by the quantum random number generator is ensured by the fundamental principle of quantum mechanics, and can be strictly proved by adopting the minimum entropy theory, so that the quantum random number has higher safety. The quantum random number generator can be implemented in various schemes such as a photon routing scheme, a photon arrival time scheme, a laser phase fluctuation scheme, a vacuum fluctuation scheme, and the like. The server can dynamically select and read the binary random number sequence generated by one or more quantum random number generators through real-time monitoring of the states of the connected quantum random number generators and actual application requirements, so that load balance can be achieved, data of hardware can be timely found and avoided when part of the quantum random number generator hardware fails, various general quantum random number outputs including decimal systems meeting application program requirements can be continuously and stably provided, and stability and safety of the system are guaranteed.
On the basis of the above embodiment, the server 2 specifically includes: and the state monitoring SDK21 is used for reading the monitoring data of the quantum random number generator 11 in real time and providing the monitoring data to the monitoring service 22.
The server is connected with a plurality of quantum random number generator hardware, on one hand, the running state of the equipment is monitored in real time through the state monitoring SDK21 and the monitoring service 22 and is provided for an application program; on the other hand, according to the running state of the device and the requirement of the application program, the reading process of the binary quantum random number sequence is controlled by the special SDK of the quantum random number generator.
Based on the above embodiments, the monitoring service 22 is configured to provide monitoring data to the application for use via the application interface specific SDK 24.
The monitoring service 22 obtains the requirements of the application via the application interface specific SDK24 and provides corresponding monitoring data to the application for use in invoking the application.
On the basis of the above embodiment, the server 2 specifically includes: the special SDK23 for the quantum random number generator is used for reading the binary quantum random number sequence from at least one quantum random number generator connected with the special SDK and converting the binary quantum random number sequence into random data meeting the requirements of an application program through a specific algorithm.
The quantum random number generator special SDK23 selects one or more quantum random number generators 11, 12 … to read binary quantum random number sequence according to the monitoring result provided by the monitoring service 22 and the requirement of the application program, and converts the binary quantum random number sequence into the required random data through a specific algorithm to output, which can be used in various general random number applications including decimal system.
On the basis of the above embodiment, the specific algorithm is a binary to other binary algorithm, including a repeatable algorithm and a non-repeatable algorithm.
The specific conversion algorithm is determined by the requirements of the application program, including but not limited to various binary to other binary algorithms, repeatable algorithms and non-repeatable algorithms.
On the basis of the above embodiment, the server 2 specifically includes: the SDK24 is used for acquiring the requirements of the application program, providing the requirements to the monitoring service 22 and the SDK23 special for the quantum random number generator, and providing the monitoring data and other binary quantum random number sequences to the application program for use.
The application interface-specific SDK24 is connected to the application, acquires the requirements of the application, provides the requirements to the monitoring service 22 and the quantum random number generator-specific SDK23, and provides corresponding monitoring data and random data to the application.
On the basis of the above embodiment, the quantum random number generator 11 is connected with the server 2 through a digital interface, and the digital interface includes USB and a network port.
The plurality of independent quantum random number generators are respectively connected with the server through high-speed interfaces such as USB or internet access, the generated binary quantum random number sequence and the equipment running state are uploaded to the server according to the requirements of the server, and the whole server is used as a reliable binary quantum random number sequence source of the server.
On the basis of the above-described embodiment, the random data includes octal, decimal, hexadecimal quantum random data.
The random data is various general quantum random numbers including decimal, and is not limited to the octal, decimal and hexadecimal quantum random data exemplified herein, but other binary data may be used.
A second embodiment of the present invention provides a method for applying quantum random numbers, please refer to fig. 2, which includes: s1, dynamically selecting and reading the binary random number sequence generated by at least one quantum random number generator according to the real-time monitoring of the state of the quantum random number generator and the practical application requirements; s2, converting the binary quantum random number sequence into random data meeting the requirement of an application program; s3, providing the state of the random data and quantum random number generator to the application for use.
The server can dynamically select and read the binary random number sequence generated by one or more quantum random number generators through real-time monitoring of the states of the connected quantum random number generators and actual application requirements, so that load balance can be achieved, data of hardware can be timely found and avoided when part of the quantum random number generator hardware fails, various general quantum random number outputs including decimal systems meeting application program requirements can be continuously and stably provided, and stability and safety of the system are guaranteed. The server converts the read binary quantum random number into random data meeting the requirements of the application program through a specific algorithm, and then provides the random data for the application program to use. The specific algorithm is determined by the requirements of the practical application program, and includes but is not limited to the following algorithms: one range for repeatable random number algorithm, one range for non-repeatable random number algorithm (deduplication implementation), and one range for non-repeatable random number algorithm (shuffling algorithm).
The specific algorithm in the SDK specific to the quantum random number generator is determined by the requirements of the practical application, including but not limited to the following algorithms.
(one) a range algorithm to obtain repeatable random numbers:
1. calculating an interval as a set of numbers corresponding to all possible situations in practical application, wherein each number corresponds to one possible result and corresponds to a binary quantum random number sequence according to corresponding weight, the interval is marked as [ h, l ], the size of the interval is n, n is h-l +1, the interval is the set of numbers corresponding to all possible situations in practical application, each number corresponds to one possible result and corresponds to the binary quantum random number sequence according to corresponding weight;
2. calculating t bit data required by each random number according to the interval size, wherein n is less than or equal to 2t(first 2 starting from 1)tT is n or more);
3. calculating byte data z required by each number according to the bit data required by each random number, wherein the z is t/8 (the minimum is 1, and the integer is taken up);
4. calculating byte data c which needs to be obtained by M samples together, and adding 1-time redundancy c to M multiplied by z multiplied by 2;
5. acquiring c byte data from the quantum random number;
6. b, taking z byte data from c each time, and converting the z byte into binary data e;
7. binary data e is intercepted for t lengths from the 0 th bit and converted into data x in a required format, generally decimal;
8. and (3) interval mapping: mapping the read data x to an interval with the size of n to obtain a random number r;
9. calculating final data as N ═ l + r, and putting N into the sequence;
10. and circulating for M times to obtain a sequence of M samples at the upper and lower boundaries of the interval finally.
(II) a random number algorithm (duplicate removal implementation) for obtaining unrepeatable random numbers in a range:
similar to the repeatable algorithm of the N-to-M interface, repeated data are removed each time, and the following specific algorithm is implemented:
1. calculating an interval as a set of numbers corresponding to all possible situations in practical application, wherein each number corresponds to one possible result and corresponds to a binary quantum random number sequence according to corresponding weight, the interval is marked as [ h, l ], the size of the interval is n, n is h-l +1, the interval is the set of numbers corresponding to all possible situations in practical application, each number corresponds to one possible result and corresponds to the binary quantum random number sequence according to corresponding weight;
2. calculating t bit data required by each random number according to the interval size, wherein n is less than or equal to 2t(first 2 starting from 1)tT is n or more);
3. calculating byte data z required by each number according to the bit data required by each random number, wherein the z is t/8 (the minimum is 1, and the integer is taken up);
4. calculating byte data c which needs to be obtained by M samples together, and adding 1-time redundancy c to M multiplied by z multiplied by 2;
5. acquiring c byte data from the quantum random number;
6. b, taking z byte data from c each time, and converting the z byte into binary data e;
7. binary data e is intercepted for t lengths from the 0 th bit and converted into data x in a required format, generally decimal;
8. and (3) interval mapping: mapping the read data x to an interval with the size of n to obtain a random number r;
9. calculating final data as N ═ l + r, and if the N does not appear in the sequence, putting the N into the sequence;
10. and circulating for M times to obtain a sequence of M samples at the upper and lower boundaries of the interval finally.
(iii) one range to obtain non-repeatable random number algorithm (shuffling algorithm):
the shuffling algorithm is used for randomly drawing one card from N cards, and then drawing one card from the rest N-1 until M cards are drawn.
The following is a specific algorithm implementation, let initial sample be a0…aN-1And the sample size is N.
1. Initializing m-0 and N-N. (N is the initial sample size, N is the current sample size, m is the number of samples for which the operation has been completed)
2. Single random sampling: generating a random number r in the range of 0 to n-1, i.e. the r-th data a in the selected sampler。
3. The selected data is moved to the end of the sample and the sample size is reduced by one. I.e. exchange data arAnd an-1And calculating m-m +1 and N-m.
4. Repeat 2 to 3 until M ═ M.
5. Reading a from the tail of the sample to the front in sequenceN-1To aN-MThe data of (2) is the result.
On the basis of the above-described embodiment, the random data includes octal, decimal, hexadecimal quantum random data.
The random data is various general quantum random numbers including decimal, and is not limited to the octal, decimal and hexadecimal quantum random data exemplified herein, but other binary data may be used.
In the test data of the 10-out-of-5 algorithm (the above table is the unrepeatable case, and the below table is the repeatable case), the sample size of each group is 10 ten thousand, and the statistics result is shown by the number of times of occurrence of each case from left to right.
In the application method and the management system of the quantum random number, the random number application program uses the binary quantum random number sequence to generate random data which meets the application requirements, can better meet the application requirements of various industries, particularly the requirements of fairness, justness and disclosure in the lottery industry, and the binary quantum random number sequence part consists of a plurality of independent quantum random number generators and is monitored and read and controlled by the server in real time, thereby obtaining stable and reliable binary quantum random number sequence input.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the present invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the protection scope of the present invention.