Commercial password random number security detection method and system
By generating commercial cryptographic random numbers, grouping bit data, and performing XOR calculations and Z-tests, the problem of the inability of existing technologies to fully verify the security of random numbers is solved, and efficient security testing of commercial cryptographic random numbers is achieved.
Patent Information
- Application Number
- CN202510751260.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2045-06-06
AI Technical Summary
Existing random number security detection technologies fail to fully verify the security of random numbers, especially since they do not consider the impact of time factors on random number generation and the correlation between different random numbers, making it impossible to accurately verify the security of random numbers.
Test random numbers are generated by connecting to a commercial cryptographic random number generator, bit data is grouped, a bit calculation model is constructed, XOR data is calculated, and Z-test is performed to determine whether the XOR data conforms to the expected random probability.
It improves the accuracy and comprehensiveness of random number security detection, ensures the true randomness of commercial cryptographic random numbers, and prevents threats caused by the generation of the same random number and the correlation between different random numbers.
Smart Images

Figure CN120378100B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of random number security detection, and particularly relates to a commercial cryptographic random number security detection method and system. BACKGROUND
[0002] Random number security detection technology refers to a technical system for evaluating whether a sequence generated by a random number generator meets the cryptographic security requirements through systematic methods and tools, ensuring the unpredictability, statistical randomness and attack resistance of the sequence, and the core goal is to verify the reliability of the random number in security scenarios such as key generation and authentication protocols, and to prevent security vulnerabilities caused by insufficient randomness.
[0003] Existing random number security detection technology usually performs security detection on random numbers according to random number detection specification parameter restrictions, which includes frequency detection, that is, verifying whether the number of 0 and 1 in the random number is close, but the specific ratio of the number of 0 and 1 that can be considered close is not explicitly specified, and in existing computer random number generation, most of the random numbers are pseudo-random, and the generated data actually has a certain relationship with time. At a fixed time, the computer will always output the same random number. However, the existing random number security detection technology does not consider the influence of time on the generated random number. At the same time, the existing random number security detection technology is only for security detection of the random number itself, and different random numbers may have certain correlation, which needs to be further verified that different random numbers are also random. For example, in the patent application with the publication number CN110531957A, an online detection method for a random number generator is disclosed. This scheme is only for online detection of the random number itself and cannot verify whether different random numbers are associated. Moreover, the influence of time on the generated random number is not considered. The existing random number security detection technology still has the problem that the security detection of the random number is not comprehensive enough, which leads to the problem that the safety of the random number cannot be accurately verified. SUMMARY
[0004] The application aims to at least solve one of the technical problems in the prior art. A commercial cryptographic random number generator is connected, the commercial cryptographic random number generator generates a first test number of random numbers according to time, which is named test random number. Then, the bit data in the same test random number is grouped to obtain a bit group, a bit calculation model is constructed, the bit group is calculated through the bit calculation model to obtain first exclusive or data, different test random numbers are calculated through the bit calculation model to obtain second exclusive or data, and then the exclusive or data is subjected to Z test to determine whether the exclusive or data meets the random probability expectation, so as to solve the problem that the existing random number security detection technology still has the problem that the security detection of the random number is not comprehensive enough, which leads to the problem that the safety of the random number cannot be accurately verified.
[0005] To achieve the above object, in a first aspect, the application provides a commercial cryptographic random number security detection method, comprising the following steps:
[0006] Connecting a commercial cryptographic random number generator, the commercial cryptographic random number generator randomly generates a first test number of random numbers according to time, named test random numbers;
[0007] Grouping the bit data in the same test random number to obtain bit groups;
[0008] Building a bit calculation model, calculating the bit groups and different test random numbers to obtain XOR data;
[0009] Performing Z test on the XOR data to determine whether the XOR data meets the expected random probability.
[0010] Further, connecting a commercial cryptographic random number generator, the commercial cryptographic random number generator randomly generates a first test number of random numbers according to time, named test random numbers, comprising the following sub-steps:
[0011] Connecting a commercial cryptographic random number generator;
[0012] Setting a first test time, a first test period and a first test number;
[0013] Starting the commercial cryptographic random number generator at the first test time every day, and randomly generating a first test number of test random numbers through the commercial cryptographic random number generator, the number of bits of the test random numbers being fixed as a first bit number, the first bit number being a multiple of 4;
[0014] After the generation is completed, the commercial cryptographic random number generator is closed, the commercial cryptographic random number generator is started again at the first test time of the next day to generate test random numbers, and the first test period is repeatedly executed;
[0015] Adding a start instruction and a generation instruction to the commercial cryptographic random number generator to ensure that the time of starting and starting to generate test random numbers of the commercial cryptographic random number generator is exactly the same each time.
[0016] Further, grouping the bit data in the same test random number to obtain bit groups comprises the following sub-steps:
[0017] In the same test random number, every 4-bit bit data is a bit group;
[0018] The bit groups are numbered in the order from left to right, and the bit groups are represented by the symbol B n , wherein n is a positive integer and n is the serial number of B.
[0019] Furthermore, a bit computation model is constructed to calculate the XOR data for bit groups and different test random numbers, including the following sub-steps:
[0020] Construct a bit computation model;
[0021] The first XOR data is obtained by calculating the bit group using the bit calculation model;
[0022] The second XOR data is obtained by calculating different test random numbers using a bit computation model.
[0023] Furthermore, constructing the bit computation model includes the following sub-steps:
[0024] Name the two data points in the input bit calculation model as the first data point and the second data point, respectively.
[0025] The bits in the first data are numbered and labeled A1 from left to right. m The bits in the second data are numbered and labeled A2 from left to right. m m is a positive integer and m is the index of A1 and A2;
[0026] Starting with m=1, for A1 m and A2 m Perform an XOR operation and label the result as H. m Add one to m and perform XOR calculation again until the maximum value of m is reached;
[0027] H is arranged in ascending order of m. m Combine them to obtain the XOR data.
[0028] Furthermore, the first XOR data is obtained by calculating the bit group using the bit calculation model, including the following sub-steps:
[0029] Starting with n=1, B n and B n+1 The input bit computation model labels the output XOR data as C. n The process involves incrementing n by one and repeating the process until max(n) - 1 is reached. max() is the maximum value operator.
[0030] Finally, we get C. n To C max(n)-1 Arrange C in ascending order of n n Combine them to obtain the first XOR data;
[0031] The first test period and the first test quantity are labeled as P1 and P2 respectively. Each test random number is analyzed to obtain a total of P1×P2 first XOR data.
[0032] Further, the second exclusive-OR data is obtained by calculating different test random numbers through the bit calculation model, including the following sub-steps:
[0033] Any two test random numbers are input into the bit calculation model for calculation, and the output exclusive-OR data is named as the second exclusive-OR data;
[0034] Each test random number needs to be calculated P1XP2-1 times, and a total of (P1XP2)X(P1XP2-1) second exclusive-OR data is obtained.
[0035] Further, the exclusive-OR data is subjected to Z test to determine whether the exclusive-OR data conforms to the random probability expectation, including the following sub-steps:
[0036] The first exclusive-OR data and the second exclusive-OR data both belong to the exclusive-OR data. For any exclusive-OR data, the number of digital 1 and the number of digital 0 in the exclusive-OR data are counted and marked as K1 and K2 respectively, K1 / (K1+K2) is calculated, and the calculation result is named as the exclusive-OR one-zero ratio. The exclusive-OR one-zero ratio of each exclusive-OR data is numbered, and the symbol X j is used, wherein j is a positive integer and j is the serial number of X;
[0037] The overall standard deviation of the exclusive-OR one-zero ratio is calculated by the formula , wherein S is the overall standard deviation of the exclusive-OR one-zero ratio, max(j) is the maximum value of j, is the average value of X j ;
[0038] The Z test is used to determine whether the exclusive-OR data conforms to the random probability expectation.
[0039] Further, the Z test is used to determine whether the exclusive-OR data conforms to the random probability expectation, including the following sub-steps:
[0040] The random probability expectation includes the exclusive-OR probability expectation, which is represented by the symbol μ;
[0041] The Z value of the exclusive-OR data is calculated by the formula , wherein Z is the Z value of the exclusive-OR data;
[0042] The significance level α is set, the rejection region of the significance level α is found, and whether Z is in the rejection region is compared. If Z is in the rejection region, it is marked that the test random number does not conform to the random probability expectation, and if Z is not in the rejection region, it is marked that the test random number conforms to the random probability expectation.
[0043] In a second aspect, the application provides a commercial cryptographic random number security detection system, comprising a test random number generation module, a bit grouping module, a bit calculation module and a random number security inspection module; the test random number generation module, the bit grouping module and the random number security inspection module are respectively connected with the bit calculation module in data;
[0044] The test random number generation module is used for connecting a commercial cryptographic random number generator, and a first test number of random numbers is randomly generated by the commercial cryptographic random number generator according to time, and is named as test random numbers.
[0045] The bit grouping module is used for grouping bit data in the same test random number to obtain a bit group.
[0046] The bit calculation module is used for constructing a bit calculation model, and calculating the bit group and different test random numbers to obtain exclusive or data.
[0047] The random number security inspection module is used for performing Z inspection on the exclusive or data to determine whether the exclusive or data conforms to a random probability expectation.
[0048] The application has the advantages that the time factor is considered when the test random numbers are generated, the same random number is prevented from being output by the random number generator at the same time, the security of the commercial cryptographic is threatened, and the effectiveness and rationality of the random number sample in the random number security detection are improved.
[0049] The application has the advantages that the time factor is considered when the test random numbers are generated, the same random number is prevented from being output by the random number generator at the same time, the security of the commercial cryptographic is threatened, and the effectiveness and rationality of the random number sample in the random number security detection are improved. BRIEF DESCRIPTION OF DRAWINGS
[0050] Figure 1 It is a principle block diagram of the system of the application;
[0051] Figure 2 It is a step flow chart of the random number security inspection of the application;
[0052] Figure 3The flow chart of the steps of the method of the present application.
[0053] Figure 4 The structural schematic diagram of the electronic device of the present application. DETAILED DESCRIPTION
[0054] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0055] Embodiment 1, please refer to Figure 1 As shown in the figure, the present application provides a commercial cipher random number safety detection system, which comprises a test random number generation module, a bit grouping module, a bit calculation module and a random number safety inspection module; the test random number generation module, the bit grouping module and the random number safety inspection module are respectively connected with the bit calculation module in data;
[0056] Please refer to Figure 2 As shown in the figure, the test random number generation module is used for connecting a commercial cipher random number generator, and the commercial cipher random number generator is used to randomly generate a first test number of random numbers according to time, which are named as test random numbers;
[0057] The test random number generation module is configured with a test random number generation strategy, and the test random number generation strategy comprises:
[0058] Connecting the commercial cipher random number generator;
[0059] Setting a first test time, a first test period and a first test number;
[0060] Starting the commercial cipher random number generator at the first test time every day, randomly generating a first test number of test random numbers through the commercial cipher random number generator, and fixing the bit number of the test random numbers as a first bit number, the first bit number being a multiple of 4;
[0061] After the generation is completed, the commercial cipher random number generator is closed, the commercial cipher random number generator is started again at the first test time of the next day to generate test random numbers, and the first test period is repeatedly executed;
[0062] Adding a starting instruction and a generation instruction to the commercial cipher random number generator, so as to ensure that the time of starting and starting to generate test random numbers of the commercial cipher random number generator is completely the same each time;
[0063] In practical applications, the first test time, the first test period, the first test quantity and the first bit quantity are set by the tester, the first test time and the first test period are for obtaining test random numbers at the same time, the first test quantity is for obtaining a sufficient quantity of test random numbers as samples, and the first bit quantity is for ensuring that the test random numbers have sufficient length and eliminating the influence of contingency; in this embodiment, the first test time is set to 14:00, the first test period is set to 3 days, the first test quantity is set to 10, and the first bit quantity is set to 256 bits, i.e., computer codes composed of 256-bit binary numbers; a start instruction and a generation instruction are added to the commercial cryptographic random number generator to ensure that the commercial cryptographic random number generator starts and begins to generate test random numbers at the same time each time, and the mechanical control of the start time can eliminate the error caused by manual start. Since the computer can generate random numbers based on the computer time or generate random numbers based on the start time of the device, both need to be considered. A total of 30 test random numbers are generated.
[0064] The bit grouping module is configured to group the bit data in the same test random number to obtain a bit group.
[0065] The bit grouping module is configured with a bit grouping strategy, and the bit grouping strategy includes:
[0066] In the same test random number, every 4-bit bit data is a bit group.
[0067] The bit groups are numbered in the order from left to right, and are represented by the symbol B n , where n is a positive integer and n is the serial number of B.
[0068] In practical applications, since there are 256-bit bit data in the test random number, every 4-bit is a bit group, and the numbering obtains B n , 1≤n≤256, and the bit data is 0 or 1.
[0069] The bit calculation module is configured to construct a bit calculation model, calculate the bit groups and different test random numbers, and obtain exclusive or data; the bit calculation module includes a calculation model construction unit, a bit group calculation unit and a random number calculation unit.
[0070] The calculation model construction unit is configured to construct a bit calculation model.
[0071] The calculation model construction unit is configured with a calculation model construction strategy, and the calculation model construction strategy includes:
[0072] The two data input into the bit calculation model are named as the first data and the second data.
[0073] The bit data in the first data is numbered and marked as A1 in sequence from left to right m The bit data in the second data is numbered and marked as A2 in sequence from left to right m m is a positive integer and m is the sequence number of A1 and A2
[0074] Starting from m = 1, XOR calculation is performed on A1 m and A2 m , and the calculation result is marked as H m , m is incremented by one and the XOR calculation is performed again until the maximum value of m is reached
[0075] H m is combined in sequence from small to large m to obtain XOR data
[0076] In actual application, since the number of test random numbers is too large, it is not convenient to specifically show in the embodiment, and part of the test random number is used for example in the embodiment, which aims to specifically calculate the process of XOR data and homomorphic data; Assuming that the first data is 0101001011010010, and the second data is 1001101101001011, A1 m and A2 m are obtained by numbering, 1≤m≤16, starting from m = 1, A11 and A21 are 0 and 1 respectively, XOR calculation is performed on A11 and A21 to obtain H1 as 0, then m+1, m = 2 at this time, A12 and A22 are 1 and 0 respectively, XOR calculation is performed on A12 and A22 to obtain H2 as 0, and the like is sequentially performed until H 16 is obtained, and finally the XOR data is 1100100110011001
[0077] The bit group calculation unit is configured to calculate the bit group by a bit calculation model to obtain first XOR data
[0078] The bit group calculation unit is configured with a bit group calculation strategy, and the bit group calculation strategy includes:
[0079] Starting from n = 1, B n and B n+1 are input into the bit calculation model, and the output XOR data is marked as C n , n is incremented by one and executed again until max(n)-1 is reached, max() is the maximum value operator
[0080] Finally, C n to C max(n)-1 are obtained, C n is combined in sequence from small to large n to obtain first XOR data
[0081] The first test period and the first test number are marked as P1 and P2 respectively, and each test random number is analyzed, and a total of P1xP2 first XOR data is obtained;
[0082] In actual application, assuming that the test random number is 0101001011010010 on a certain day, a total of 16-bit data is obtained, and 4 groups of bit groups B1 to B4 are obtained, which are 0101, 0010, 1101 and 0010 respectively. B1 and B2 are input into the bit calculation model to obtain C1 as 0111. B2 and B3 are input into the bit calculation model to calculate C2 and C3 as 1111 and 1111 respectively. Finally, the first XOR data is obtained as 011111111111, and P1xP2 is 30, a total of 30 first XOR data is obtained;
[0083] The random number calculation unit is configured to calculate different test random numbers through the bit calculation model to obtain second XOR data;
[0084] The random number calculation unit is configured with a random number calculation strategy, and the random number calculation strategy includes:
[0085] Any two test random numbers are input into the bit calculation model for calculation, and the output XOR data is named as second XOR data;
[0086] Each test random number needs to be calculated P1xP2-1 times, and a total of (P1xP2)x(P1xP2-1) second XOR data is obtained;
[0087] In actual application, a total of 30 test random numbers are obtained, each test random number needs to be calculated 29 times, that is, each test data needs to be calculated with all other test random numbers except itself, and a total of 29x30=870 first XOR data is obtained.
[0088] The random number safety inspection module is configured to perform Z test on the XOR data to determine whether the XOR data meets the random probability expectation; the random number safety inspection module includes a standard deviation calculation unit and a safety detection unit;
[0089] The standard deviation calculation unit is configured with a standard deviation calculation strategy, and the standard deviation calculation strategy includes:
[0090] The first XOR data and the second XOR data both belong to XOR data. For any XOR data, the number of digits 1 and the number of digits 0 in the XOR data are counted and marked as K1 and K2 respectively, K1 / (K1+K2) is calculated, and the calculation result is named as XOR one zero ratio. The XOR one zero ratio of each XOR data is numbered, and the symbol X j is represented, wherein j is a positive integer and j is the serial number of X;
[0091] The overall standard deviation of the XOR one zero ratio is calculated by the formula , wherein S is the overall standard deviation of the XOR one zero ratio, max(j) is the maximum value of j, is the average value of X j .
[0092] In actual application, the first XOR data and the second XOR data together constitute 900 XOR data. Taking the first XOR data 011111111111 as an example, it is calculated that K1 and K2 are 1 and 11 respectively, the XOR one zero ratio is 1 / 12, the XOR one zero ratio of each XOR data is calculated, and X j , 1≤j≤900, is obtained. It is calculated that is 7 / 16. Since the data volume is too large, the specific value of X j is not displayed in this embodiment, and only the final calculation result is given. It is calculated that the overall standard deviation S is 1 / 6.
[0093] The security detection unit is configured to determine whether the XOR data conforms to the random probability expectation through Z test.
[0094] The security detection unit is configured with a security detection strategy, and the security detection strategy includes:
[0095] The random probability expectation includes an XOR probability expectation, which is represented by the symbol μ.
[0096] The Z value of the XOR data is calculated by the formula , wherein Z is the Z value of the XOR data.
[0097] A significance level α is set, and a rejection region of the significance level α is searched. Whether Z is in the rejection region is compared. If Z is in the rejection region, it is marked that the test random number does not conform to the random probability expectation. If Z is not in the rejection region, it is marked that the test random number conforms to the random probability expectation.
[0098] In actual application, when the XOR calculation is performed, A1 m and A2 m have four combinations, including 00, 01, 10 and 11. Among them, 0 and 0 XORed is 0, 1 and 1 XORed was 0, 0 and 1 or 1 and 0 XORed was 1, that is, the probability of XORing 0 is 0.5, and the probability of 1 is also 0.5. Therefore, the XOR probability expectation μ is set to 0.5, the formula is originally After simplification, it is obtained After final simplification, it is , wherein For 7 / 16, mu is 0.5, S is 1 / 6, P1xP2=30, finally calculate Z is -11.25, in Z test, the significance level alpha is usually set to 0.05, and 0.05 corresponds to the rejection region {Z≤-1.96} U {Z≥1.96}, by comparison, Z is in the rejection region, so the test random number does not meet the random probability expectation, and the rejection region is a fixed value; Therefore, although the number of 0 and 1 in the test random number itself is close, there is a certain correlation between the bit groups or different test random numbers, and it is not truly random.
[0099] Embodiment 2, please refer to Figure 3 As shown in the figure, the application provides a commercial cryptographic random number security detection method, comprising the following steps:
[0100] Step S1, connect the commercial cryptographic random number generator, generate a first test number of random numbers according to time by the commercial cryptographic random number generator, named test random number; Step S1 includes the following substeps:
[0101] Step S101, connect the commercial cryptographic random number generator;
[0102] Step S102, set the first test time, the first test period and the first test number;
[0103] Step S103, start the commercial cryptographic random number generator at the first test time every day, and generate a first test number of test random numbers by the commercial cryptographic random number generator, the bit number of the test random number is fixed as the first bit number, and the first bit number is a multiple of 4;
[0104] Step S104, after generation, close the commercial cryptographic random number generator, start the commercial cryptographic random number generator again at the first test time of the next day and generate test random numbers, and repeat the first test period;
[0105] Step S105, add start instruction and generation instruction to the commercial cryptographic random number generator, to ensure that the commercial cryptographic random number generator starts and begins to generate test random numbers at the same time each time;
[0106] Step S2, group the bit data in the same test random number to obtain a bit group; Step S2 includes the following substeps:
[0107] Step S201, in the same test random number, every 4 bits of bit data is a bit group;
[0108] Step S202, number the bit groups in order from left to right, and the bit group is represented by symbol B n , wherein n is a positive integer and n is the serial number of B;
[0109] Step S3, constructing a bit calculation model, calculating the bit group and different test random numbers to obtain XOR data; Step S3 includes the following sub-steps:
[0110] Step S301, constructing a bit calculation model;
[0111] Step S301 includes the following sub-steps:
[0112] Step S301.1, naming the two data input into the bit calculation model as first data and second data respectively;
[0113] Step S301.2, numbering the bit data in the first data and marking it as A1 m in the order from left to right; m , m is a positive integer and m is the serial number of A1 and A2;
[0114] Step S301.3, starting with m = 1, XOR calculating A1 m and A2 m , marking the calculation result as H m , adding one to m and performing XOR calculation again until the maximum value of m is reached;
[0115] Step S301.4, combining H m in the order from small to large m to obtain XOR data;
[0116] Step S302, calculating the bit group through the bit calculation model to obtain first XOR data;
[0117] Step S302 includes the following sub-steps:
[0118] Step S302.1, starting with n = 1, inputting B n and B n+1 into the bit calculation model, marking the output XOR data as C n , adding one to n and performing again until max(n)-1 is reached, max() being the maximum value operator;
[0119] Step S302.2, finally obtaining C n to C max(n)-1 , combining C n in the order from small to large n to obtain first XOR data;
[0120] Step S302.3, marking the first test period and the first test number as P1 and P2 respectively, analyzing each test random number to obtain P1xP2 first XOR data in total;
[0121] Step S303, calculating different test random numbers through a bit calculation model to obtain second XOR data;
[0122] Step S303 includes the following sub-steps:
[0123] Step S303.1, inputting any two test random numbers into the bit calculation model for calculation, and naming the output XOR data as second XOR data;
[0124] Step S303.2, each test random number needs to be calculated P1XP2-1 times, and a total of (P1XP2)XP2-1 pieces of second XOR data are obtained;
[0125] Step S4, performing Z test on the XOR data to determine whether the XOR data conforms to the random probability expectation; Step S4 includes the following sub-steps:
[0126] Step S401, the first XOR data and the second XOR data both belong to XOR data, for any XOR data, the number of digital 1 and the number of digital 0 in the XOR data are counted and marked as K1 and K2 respectively, K1 / (K1+K2) is calculated, and the calculation result is named as XOR one zero ratio, the XOR one zero ratio of each XOR data is counted, and the XOR one zero ratio is numbered by symbol X j , wherein j is a positive integer and j is the serial number of X;
[0127] Step S402, calculating the overall standard deviation of the XOR one zero ratio by the formula , wherein S is the overall standard deviation of the XOR one zero ratio, max(j) is the maximum value of j, is the average value of X j ;
[0128] Step S403, determining whether the XOR data conforms to the random probability expectation by Z test;
[0129] Step S403 includes the following sub-steps:
[0130] Step S403.1, the random probability expectation includes XOR probability expectation, which is represented by symbol μ;
[0131] Step S403.2, calculating the Z value of the XOR data by the formula , wherein Z is the Z value of the XOR data;
[0132] Step S403.3, setting a significance level α, finding a rejection region of the significance level α, comparing whether Z is in the rejection region, if Z is in the rejection region, marking that the test random number does not conform to the random probability expectation, if Z is not in the rejection region, marking that the test random number conforms to the random probability expectation.
[0133] Embodiment 3, please refer to Figure 4 as shown, Figure 4 An electronic device is exemplified, which can include a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus. The memory stores computer readable instructions, and the processor can call the instructions in the memory, and when the computer readable instructions are executed by the processor, the steps in a commercial cryptographic random number security detection method are run to realize the following functions: connecting a commercial cryptographic random number generator, randomly generating a first test number of random numbers by the commercial cryptographic random number generator according to time, named test random numbers; grouping bit data in the same test random number to obtain a bit group; constructing a bit calculation model to calculate the bit group and different test random numbers to obtain exclusive or data; and performing Z test on the exclusive or data to determine whether the exclusive or data conforms to random probability expectation.
[0134] In addition, the logical instructions in the memory described above can be implemented in the form of a software functional unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0135] Embodiment 4, the present application also provides a computer readable storage medium, and the present application provides a storage medium, which stores a computer program, and the computer program is executed by a processor to run the steps in the above-mentioned commercial cryptographic random number security detection method to realize the following functions: connecting a commercial cryptographic random number generator, randomly generating a first test number of random numbers by the commercial cryptographic random number generator according to time, named test random numbers; grouping bit data in the same test random number to obtain a bit group; constructing a bit calculation model to calculate the bit group and different test random numbers to obtain exclusive or data; and performing Z test on the exclusive or data to determine whether the exclusive or data conforms to random probability expectation.
[0136] Through the description of the above embodiments, the embodiments of the present application can be provided as a method, a system or a computer program product. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in various embodiments or some parts of the embodiments.
[0137] In the embodiments provided by the present application, it should be understood that the disclosed system or method can be implemented in other manners. The embodiments described above are merely schematic, and should not be construed as limiting the present application. For example, the division of the modules or the units is merely logical function division, and there can be other division manners in actual implementation. For example, a plurality of modules or units can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different modules can be indirect couplings or communication connections through some interfaces, and there can be electric, mechanical or other forms.
[0138] Finally, it should be noted that the above-mentioned embodiments are merely used to illustrate the technical solutions of the present application, rather than limit them; even if the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some technical features; and these modifications or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A commercial cryptorandom number security detection method, characterized by, The method comprises the following steps: connecting a commercial cryptographic random number generator, randomly generating a first test number of random numbers by the commercial cryptographic random number generator according to time, and naming the random numbers as test random numbers; grouping bit data in the same test random number to obtain a bit group; constructing a bit calculation model to calculate the bit group and different test random numbers to obtain exclusive or data; performing Z test on the exclusive or data to determine whether the exclusive or data conforms to a random probability expectation; connecting a commercial cryptographic random number generator, randomly generating a first test number of random numbers by the commercial cryptographic random number generator according to time, and naming the random numbers as test random numbers comprises the following sub-steps: connecting a commercial cryptographic random number generator; setting a first test time, a first test period and a first test number; starting the commercial cryptographic random number generator at the first test time every day, randomly generating the first test number of test random numbers by the commercial cryptographic random number generator, the test random numbers having a fixed bit number of a first bit number, the first bit number being a multiple of 4; after the generation is completed, closing the commercial cryptographic random number generator, starting the commercial cryptographic random number generator again at the first test time of the next day to generate test random numbers, and repeatedly performing the first test period; adding a starting instruction and a generation instruction to the commercial cryptographic random number generator to ensure that the commercial cryptographic random number generator is started and begins to generate test random numbers at the same time every time; grouping bit data in the same test random number to obtain a bit group comprises the following sub-steps: every 4 bits of bit data in the same test random number is a bit group; The bit groups are numbered in left-to-right order by the symbol B n denotes, where n is a positive integer and n is the order number of B. constructing a bit calculation model to calculate the bit group and different test random numbers to obtain exclusive or data comprises the following sub-steps: constructing a bit calculation model; calculating the bit group by the bit calculation model to obtain first exclusive or data; calculating different test random numbers by the bit calculation model to obtain second exclusive or data; constructing a bit calculation model comprises the following sub-steps: naming two pieces of data input into the bit calculation model as first data and second data; The bit data in the first data is numbered and marked as A1 in sequence from left to right m The bit data in the second data is numbered and marked as A2 in sequence from left to right m m is a positive integer and m is the sequence number of A1 and A2; Starting with m=1, for A1 m and A2 m Perform an XOR operation and label the result as H. m Add one to m and perform XOR calculation again until the maximum value of m is reached; H is arranged in ascending order of m. m Combine them to obtain the XOR data; calculating the bit group by the bit calculation model to obtain first exclusive or data comprises the following sub-steps: Start with n = 1, let B n and B n+1 Input bit calculation model, mark the output of the exclusive or data as C n Add one to n and execute again until max(n)-1 is reached, max() is the maximum operator; Finally, C n to C max(n)-1 , C n is combined in ascending order of n to obtain first XOR data; marking the first test period and the first test number as P1 and P2 respectively, analyzing each test random number, and obtaining P1×P2 pieces of first exclusive or data in total; calculating different test random numbers by the bit calculation model to obtain second exclusive or data comprises the following sub-steps: inputting any two test random numbers into the bit calculation model for calculation, and naming the output exclusive or data as second exclusive or data; each test random number needs to be calculated P1×P2-1 times, and (P1×P2)×(P1×P2-1) pieces of second exclusive or data are obtained in total; performing Z test on the exclusive or data to determine whether the exclusive or data conforms to a random probability expectation comprises the following sub-steps: The first exclusive or data and the second exclusive or data both belong to exclusive or data. For any exclusive or data, the number of digital 1 and the number of digital 0 in the exclusive or data are counted and marked as K1 and K2 respectively, K1 / (K1+K2) is calculated, and the calculation result is named as exclusive or one zero ratio. The exclusive or one zero ratio of each exclusive or data is counted, and the exclusive or one zero ratio is numbered by symbol X j , wherein j is a positive integer and j is the serial number of X. The overall standard deviation of the XOR-one-zero ratio is calculated by the formula where S is the overall standard deviation of the XOR-one-zero ratio, max(j) is the maximum value of j, is the average value of X j . determining whether the exclusive or data conforms to a random probability expectation by Z test; determining whether the exclusive or data conforms to a random probability expectation by Z test comprises the following sub-steps: the random probability expectation comprises an exclusive or probability expectation, which is represented by a symbol μ; The Z value of the XOR data is calculated by the formula Z = 0.5 * (1 - (1 - 2 * P) / (1 + 2 * P)) wherein Z is the Z value of the A significance level α is set, a rejection region of the significance level α is searched, whether Z is in the rejection region is compared, if Z is in the rejection region, the test random number is marked as not meeting the random probability expectation, and if Z is not in the rejection region, the test random number is marked as meeting the random probability expectation.
2. A commercial cryptogram random number security detection system for implementing the commercial cryptogram random number security detection method of claim 1, characterized by, The test random number generation module, the bit grouping module, the bit calculation module and the random number security inspection module are included. The test random number generation module, the bit grouping module and the random number security inspection module are respectively in data connection with the bit calculation module. The test random number generation module is used for connecting a commercial cryptographic random number generator, and a first test quantity of random numbers is randomly generated by the commercial cryptographic random number generator according to time, and is named as test random numbers. The bit grouping module is used for grouping bit data in the same test random number to obtain bit groups. The bit calculation module is used for constructing a bit calculation model, and calculating the bit groups and different test random numbers to obtain exclusive or data. The random number security inspection module is used for performing Z inspection on the exclusive or data to judge whether the exclusive or data meets the random probability expectation.
Citation Information
Patent Citations
Online detection method of random number generator
CN110531957A
Randomness quantitative test method of random function and terminal
CN118519891A
Method and device for protecting quantum random number and quantum security module
CN119011134A