Random number generator, random number generation method, medium, and product

By using an algorithm core in the random number generator to generate true random numbers and pseudo random numbers in parallel, and performing health checks in parallel, the problems of large hardware circuit area, high power consumption, and insufficient security are solved, thus achieving efficient and secure random number generation.

CN119995856BActive Publication Date: 2026-07-21SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
Filing Date
2025-01-24
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing random number generators have large hardware circuit areas, high power consumption, and insufficient security, and cannot guarantee that the output random numbers meet the standard requirements.

Method used

A single algorithm core is used to generate both true and pseudo-random numbers. The integrity and encryption modules share a key register, and a health detection module performs parallel computation and real-time detection to ensure the quality and security of the output random numbers.

Benefits of technology

It reduces hardware circuit area, lowers power consumption, improves the output performance and security of the random number generator, and ensures that the generated random numbers meet the standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119995856B_ABST
    Figure CN119995856B_ABST
Patent Text Reader

Abstract

The application discloses a random number generator, a random number generation method, a medium and a product, comprising: an entropy source for generating random numbers; an algorithm core connected with the entropy source, the algorithm core comprising a key register for storing a random key, an integrity operation module connected with the key register, and an encryption operation module connected with the key register, the integrity operation module being configured to perform integrity hash operation on the random numbers generated by the entropy source based on the random key to obtain true random numbers, and the encryption operation module being configured to perform encryption operation on the true random numbers based on the random key to obtain pseudo random numbers; and a health detection module connected to the outputs of the integrity operation module and the encryption operation module, and configured to perform health detection on the true random numbers and the pseudo random numbers. The application can reduce the hardware circuit area of the random number generator, reduce power consumption, improve security, and thus improve the output performance of the random number generator.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information security technology, and in particular to random number generators, random number generation methods, media, and products. Background Technology

[0002] Existing random number generators typically employ post-processing systems that first perform a health check on the generated random numbers. After passing the health check, the SHA256 algorithm is used to adjust the random numbers, generating higher-quality, fixed-length true random numbers. These true random numbers can then be encrypted using the AES algorithm to generate more secure pseudo-random numbers. Current random number post-processing uses two algorithm cores, increasing the overall system area and power consumption. Furthermore, health checks on the random numbers output by the entropy source cannot guarantee that the final true random numbers output by the SHA-256 algorithm core and the pseudo-random numbers output by the AES algorithm core will still meet standard requirements, resulting in insufficient security.

[0003] It is evident that reducing the hardware circuit area of ​​random number generators, lowering power consumption, and improving security are problems that need to be solved by those skilled in the art. Summary of the Invention

[0004] The purpose of this invention is to provide a random number generator, a random number generation method, a medium, and a product that can reduce the hardware circuit area of ​​the random number generator, lower power consumption, and improve security, thereby enhancing the output performance of the random number generator. The specific solution is as follows:

[0005] In a first aspect, the present invention provides a random number generator, comprising:

[0006] Entropy source, used to generate random numbers;

[0007] An algorithm core connected to an entropy source includes a key register for storing a random key, an integrity operation module connected to the key register, and an encryption operation module connected to the key register. The integrity operation module performs an integrity hash operation on the random number generated by the entropy source based on the random key to obtain a true random number. The encryption operation module performs an encryption operation on the true random number based on the random key to obtain a pseudo random number.

[0008] A health detection module, connected to the outputs of the integrity calculation module and the encryption calculation module, is used to perform health checks on the true random number and the pseudo random number.

[0009] Optionally, the health detection module includes:

[0010] A true random number health detection module connected to the output of the integrity calculation module is used to perform health detection on the true random number;

[0011] A pseudo-random number health detection module connected to the output of the encryption operation module is used to perform health detection on the pseudo-random number.

[0012] Optionally, it also includes a first path selector connected to the entropy source, used for:

[0013] In response to the key write enable signal going high, the random number generated by the entropy source is written as a random key into the key register;

[0014] In response to the key write enable signal going low, the random number generated by the entropy source is passed to the integrity calculation module, so that the integrity calculation module performs integrity hash operation on the passed random number based on the random key to obtain a true random number.

[0015] Optional, also includes:

[0016] A first cache, which has a first connection path with the integrity calculation module, is used to store the true random number;

[0017] A second cache connected to the encryption operation module is used to store the pseudo-random number.

[0018] Optionally, a second path selector connected to the integrity calculation module is also included, for:

[0019] In response to the pseudo-random number mode enable signal going high, the true random number output by the integrity calculation module is input into the encryption calculation module, so that the encryption calculation module performs encryption calculation on the true random number based on the random key to obtain a pseudo-random number.

[0020] Optionally, it also includes a first control switch for controlling the first connection path, and a second control switch for controlling the second connection path between the output of the integrity calculation module and the encryption calculation module;

[0021] When the first control switch is closed, the first connection path is connected, and the integrity calculation module stores the true random number output by the integrity calculation module into the first buffer through the first connection path. The true random number health detection module connected to the output of the integrity calculation module performs health detection on the true random number output by the integrity calculation module.

[0022] When the second control switch is closed, the second connection path is connected, and the true random number output by the integrity calculation module is transmitted to the encryption calculation module through the second connection path. The encryption calculation module performs encryption calculation on the true random number based on the random key to obtain a pseudo-random number, and stores the pseudo-random number in the second buffer. The pseudo-random number health detection module connected to the output of the encryption calculation module is also input to perform health detection on the pseudo-random number.

[0023] If the health test result corresponding to any of the true random numbers does not meet the health standards, the true random numbers in the first cache and the pseudo random numbers in the second cache are cleared.

[0024] If the health check result corresponding to any of the pseudo-random numbers does not meet the health standards, the pseudo-random numbers in the second cache are cleared.

[0025] Secondly, this invention discloses a method for generating random numbers, comprising:

[0026] Random numbers are generated using an entropy source, and the random numbers output by the entropy source are input into an algorithm core. The algorithm core includes a key register for storing random keys, an integrity operation module connected to the key register, and an encryption operation module connected to the key register.

[0027] Using the integrity calculation module, an integrity hash operation is performed on the random number generated by the entropy source based on the random key to obtain a true random number, and then a health detection module is used to perform a health check on the true random number.

[0028] Using the encryption operation module, the true random number is encrypted based on the random key to obtain a pseudo random number, and the pseudo random number is then subjected to health detection using the health detection module.

[0029] Thirdly, the present invention discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the aforementioned random number generation method.

[0030] Fourthly, the present invention provides a computer program product, including a computer program / instruction that, when executed by a processor, implements the steps of the aforementioned disclosed random number generation method.

[0031] Fifthly, the present invention discloses an electronic device, comprising:

[0032] Memory, used to store computer programs;

[0033] A processor for executing the computer program to implement the steps of the aforementioned random number generation method.

[0034] As can be seen from the above scheme, the present invention provides a random number generator, including: an entropy source for generating random numbers; an algorithm core connected to the entropy source, the algorithm core including a key register for storing a random key, an integrity operation module connected to the key register, and an encryption operation module connected to the key register, the integrity operation module being used to perform an integrity hash operation on the random numbers generated by the entropy source based on the random key to obtain true random numbers, the encryption operation module being used to perform an encryption operation on the true random numbers based on the random key to obtain pseudo random numbers; and a health detection module connected to the outputs of the integrity operation module and the encryption operation module, used to perform health detection on the true random numbers and the pseudo random numbers.

[0035] As can be seen, the beneficial effects of the present invention are as follows: the algorithm core connected to the entropy source includes an integrity operation module that performs integrity hashing on the random numbers generated by the entropy source to obtain true random numbers, and an encryption operation module that performs encryption operation on the true random numbers. The integrity operation module and the encryption operation module share the random key stored in the key register of the algorithm core. In this way, a single algorithm core can be used to output true random numbers and pseudo-random numbers, reducing hardware circuit area and power consumption. Furthermore, by using a health detection module connected to the output of the integrity operation module and the encryption operation module to perform health checks on the output true random numbers and pseudo-random numbers, it is possible to ensure that both true random numbers and pseudo-random numbers meet the standards, thereby improving security and thus improving the output performance of the random number generator.

[0036] Correspondingly, the random number generation method, medium, and product provided by the present invention also have the above-mentioned technical effects. Attached Figure Description

[0037] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0038] Figure 1 This is a schematic diagram of an existing random number generator implementation.

[0039] Figure 2 A schematic diagram of a random number generator provided in an embodiment of the present invention;

[0040] Figure 3 This is a schematic diagram of the hardware structure of a random number generator provided in an embodiment of the present invention;

[0041] Figure 4 This is a schematic diagram of another random number generator hardware structure provided in an embodiment of the present invention;

[0042] Figure 5 This is a flowchart of a random number generation method provided in an embodiment of the present invention;

[0043] Figure 6 A flowchart of another random number generation method provided in an embodiment of the present invention;

[0044] Figure 7 This is a structural diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.

[0046] In the field of information security, especially in cryptography, the quality and efficiency of random number generation are crucial. Random numbers are widely used in various scenarios, such as key generation, initialization vectors, timestamps, authentication challenge codes, key negotiation, and large prime number generation. Random numbers are generally generated by random number generators, and existing random number generators typically support the generation of true random numbers and pseudo-random numbers. True random numbers are generated from unpredictable sources such as physical processes or quantum phenomena, exhibiting high unpredictability and non-repeatability. Pseudo-random numbers, on the other hand, are generated through algorithms, thus possessing a certain degree of repeatability and predictability. However, due to the complexity of physical processes, the generated true random numbers may contain noise and bias, affecting their randomness and quality. Appropriate post-processing of true random numbers is necessary to significantly improve the randomness of the data, resulting in high-quality true and pseudo-random numbers. Therefore, the post-processing system for true random numbers is the core component of the entire random number generator.

[0047] See Figure 1 As shown, Figure 1This diagram illustrates an existing random number generator implementation. The generator utilizes physical processes such as electronic noise and thermal noise within an entropy source to produce truly random numbers. After generation, the truly random numbers enter a post-processing system. First, a health check is performed on the generated truly random numbers to ensure they meet international and domestic standards for true random numbers. Following the health check, the SHA256 algorithm is used to adjust the truly random numbers, reducing bias and noise and generating higher-quality, fixed-length truly random numbers. At this point, the truly random numbers are ready for output. Alternatively, they can be encrypted using the AES algorithm to generate more secure pseudo-random numbers.

[0048] Although existing technologies can generate true and pseudo-random numbers and improve the quality of random numbers to some extent, several problems remain: Existing true random number generators use two algorithm cores in the post-processing of random numbers after generation, increasing the overall system area and power consumption. The SHA-256 and AES algorithms are relatively slow. Therefore, using these two algorithms reduces the random number generation rate and lowers the overall system output performance. Health checks and the SHA-256 algorithm core are performed sequentially. Health checks must be completed before subsequent calculations can proceed, leading to a decrease in the overall system speed. Furthermore, health checks on the random numbers output by the entropy source cannot completely guarantee that the final true random numbers output by the SHA-256 algorithm core and the pseudo-random numbers output by the AES algorithm core will still meet standard requirements. Therefore, security still needs to be strengthened. To address these issues, this invention provides a random number generator with smaller area and lower power consumption, higher performance, and greater security. It can implement true and pseudo-random number generation using a single algorithm core, reducing the overall system area and power consumption. It uses a higher-performance, faster algorithm to improve the overall system output performance. This allows health checks to run in parallel with other modules, and uses health checks to monitor the true and pseudo random numbers output by the system in real time, ensuring the quality of random numbers generated by the entire system and improving the overall system security.

[0049] The terms "comprising" and "having," and any variations thereof, in the specification and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may include steps or units not listed.

[0050] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0051] See Figure 2As shown, the present invention provides a random number generator, comprising:

[0052] Entropy source 11 is used to generate random numbers;

[0053] An algorithm core 12 connected to an entropy source includes a key register for storing a random key, an integrity operation module connected to the key register, and an encryption operation module connected to the key register. The integrity operation module performs an integrity hash operation on the random number generated by the entropy source based on the random key to obtain a true random number. The encryption operation module performs an encryption operation on the true random number based on the random key to obtain a pseudo random number.

[0054] The health detection module 13 is connected to the output of the integrity calculation module and the encryption calculation module, and is used to perform health detection on the true random number and the pseudo random number.

[0055] The entropy source utilizes physical processes such as electronic noise and thermal noise to generate random numbers. The random number generator includes a post-processing system for processing the random numbers generated by the entropy source. The algorithm kernel is used to perform calculations on the random numbers generated by the entropy source to obtain true random numbers and pseudo-random numbers. It may include a key register, an integrity calculation module, and an encryption calculation module. The algorithm kernel can be the Zu Chongzhi algorithm kernel.

[0056] The health detection module 13 may include:

[0057] A true random number health detection module connected to the output of the integrity calculation module is used to perform health detection on the true random number;

[0058] A pseudo-random number health detection module connected to the output of the encryption operation module is used to perform health detection on the pseudo-random number.

[0059] In one alternative implementation, the random number generator further includes a first path selector connected to the entropy source, for:

[0060] In response to the key write enable signal going high, the random number generated by the entropy source is written as a random key into the key register;

[0061] In response to the key write enable signal going low, the random number generated by the entropy source is passed to the integrity calculation module, so that the integrity calculation module performs integrity hash operation on the passed random number based on the random key to obtain a true random number.

[0062] The key write enable signal is pulled high after completing an integrity hash operation or an integrity hash operation and encryption operation to update the random key in the key register, thereby further improving the security of random numbers and pseudo-random numbers.

[0063] In one alternative implementation, the random number generator further includes:

[0064] A first cache, which has a first connection path with the integrity calculation module, is used to store the true random number;

[0065] A second buffer connected to the encryption operation module is used to store the pseudo-random numbers. The pseudo-random numbers output by the encryption operation module are simultaneously output to the pseudo-random number health detection module and the second buffer. Both the first and second buffers can be FIFO (first-in-first-out memory).

[0066] In one alternative implementation, the random number generator further includes a second path selector connected to the integrity calculation module, for:

[0067] In response to the pseudo-random number mode enable signal going high, the true random number output by the integrity calculation module is input into the encryption calculation module, so that the encryption calculation module performs encryption calculation on the true random number based on the random key to obtain a pseudo-random number. The true random number output by the integrity calculation module is simultaneously output to the true random number health check module and output to the encryption calculation module after passing through the second path selector.

[0068] In response to the pseudo-random number mode enable signal being pulled low, the true random number output by the integrity calculation module is simultaneously input to the true random number health check module and the first buffer.

[0069] If the health check result corresponding to any of the true random numbers fails to meet the health standards, the true random numbers in the first cache are cleared; if the health check result corresponding to any of the pseudo-random numbers fails to meet the health standards, the pseudo-random numbers in the second cache are cleared. The true random number health check module can trigger an interrupt to notify the CPU when the health check result corresponding to any of the true random numbers fails to meet the health standards, so that the CPU can perform the clearing operation of the first cache. Similarly, the pseudo-random number health check module can notify the CPU when the health check result corresponding to any of the pseudo-random numbers fails to meet the health standards, so that the CPU can perform the clearing operation of the second cache.

[0070] In one optional implementation, the random number generator further includes a first control switch for controlling the first connection path, and a second control switch for controlling the second connection path between the output of the integrity calculation module and the encryption calculation module.

[0071] When the first control switch is closed, the first connection path is connected, and the integrity calculation module stores the true random number output by the integrity calculation module into the first buffer through the first connection path. The true random number health detection module connected to the output of the integrity calculation module performs health detection on the true random number output by the integrity calculation module.

[0072] When the second control switch is closed, the second connection path is connected, and the true random number output by the integrity calculation module is transmitted to the encryption calculation module through the second connection path. The encryption calculation module performs encryption calculation on the true random number based on the random key to obtain a pseudo-random number, and stores the pseudo-random number in the second buffer. The pseudo-random number health detection module connected to the output of the encryption calculation module is also input to perform health detection on the pseudo-random number.

[0073] If the health test result corresponding to any of the true random numbers does not meet the health standards, the true random numbers in the first cache and the pseudo random numbers in the second cache are cleared.

[0074] If the health check result corresponding to any of the pseudo-random numbers does not meet the health standards, the pseudo-random numbers in the second cache are cleared.

[0075] As can be seen, the algorithm core connected to the entropy source in this embodiment of the invention includes an integrity operation module that performs integrity hashing on the random numbers generated by the entropy source to obtain true random numbers, and an encryption operation module that performs encryption operation on the true random numbers. The integrity operation module and the encryption operation module share the random key stored in the key register of the algorithm core. In this way, a single algorithm core can output both true random numbers and pseudo-random numbers, reducing the system hardware circuit area and power consumption. Furthermore, by using a health detection module connected to the outputs of the integrity operation module and the encryption operation module to perform health checks on the output true random numbers and pseudo-random numbers, it is possible to ensure that both true random numbers and pseudo-random numbers meet the standards, thereby improving security and enhancing the output performance of the random number generator.

[0076] For example, see Figure 3 As shown, Figure 3 This is a schematic diagram of the hardware structure of a random number generator disclosed in an embodiment of the present invention. It includes an entropy source, a first path selector, a second path selector, a Zu Chongzhi algorithm core, a true random number health detection module, a pseudo random number health detection module, a true random number output FIFO (i.e., a first buffer), and a pseudo random number output FIFO (a second buffer).

[0077] For example, see Figure 4 As shown, Figure 4This is a schematic diagram of another random number generator hardware structure disclosed in an embodiment of the present invention. It includes an entropy source, a first path selector, a Zu Chongzhi algorithm core, a true random number health detection module, a pseudo random number health detection module, a true random number output FIFO (i.e., a first buffer), a pseudo random number output FIFO (a second buffer), and a control switch.

[0078] The algorithm core consists of an entropy source for generating random numbers. A path selector is used to send random numbers to different modules based on their enable conditions. The core is divided into a key register module, an integrity operation module, and an encryption operation module. The key register stores the key; the integrity and encryption operation modules extract the same key from it, allowing for the parallel generation of higher-quality true and pseudo-random numbers. Depending on the enable condition, the integrity operation module sends true random numbers to the output FIFO or the encryption operation module, while the encryption operation module sends pseudo-random numbers to the output FIFO. A health check module performs parallel health checks on the quality of random numbers during data transmission. If the random numbers do not meet international and domestic standards, an alarm is issued, interrupting the system and preventing the output of non-compliant random numbers. The output FIFO is divided into a true random number output FIFO and a pseudo-random number output FIFO. It stores and outputs standard-compliant random numbers.

[0079] In one optional implementation, when the key write enable is pulled high, the Zu Chongzhi algorithm core stops working, and the first 128 bits of random numbers input from the entropy source are written to the key register portion of the Zu Chongzhi algorithm core. After the 128 bits of random numbers are written to the key register, the key write enable is pulled low. Random numbers then begin to be input to the computation portion of the Zu Chongzhi algorithm core, and the random numbers need to be input with a data length of not less than 32 bits to ensure the randomness of the output truly random numbers. After each computation is completed, the key write enable can be pulled high again to update the key in the key register, thereby further improving the quality of the generated truly random numbers. Furthermore, each integrity hash operation outputs a 32-bit true random number. Generally, the Zu Chongzhi algorithm core integrity hash operation needs to be run at least 32 times, that is, outputting a 1024-bit true random number, thus ensuring the reliability of the health check results. This depends on the health check method used; ensuring that the health check meets international and domestic standards for random number detection; if the health check finds that the true random number does not meet the requirements, an error alarm will be issued and the entire system will stop running, and the true random number and pseudo-random number output FIFOs will be cleared; if the true random number output FIFO is full and the pseudo-random number mode is not enabled, an interrupt will be issued, the entire system will stop working, and wait for the data in the FIFO to be read out.

[0080] Encryption and integrity hashing operations run in parallel using the same key. Generally, the Zu Chongzhi algorithm core encryption operation requires at least 1024 bits of pseudo-random number output to ensure the reliability of the health check results, depending on the health check method used. The health check must comply with international and domestic standards for random number detection. If the health check finds that the pseudo-random number does not meet the requirements, an error alarm will be issued and the entire system will stop running. The pseudo-random number output FIFO will be cleared, while the true random number output FIFO remains unchanged. If the pseudo-random number output FIFO is full and pseudo-random number mode is enabled, an interrupt will be issued, and the entire system will stop working, waiting for the data in the FIFO to be read out.

[0081] This invention provides a random number generator with better performance, smaller size, and lower power consumption, which can be implemented in resource-constrained systems. This is of great significance for computing devices that require efficient generation of high-quality random numbers, such as mobile devices and embedded systems. In the field of cryptography, the quality of random numbers directly affects the security of encryption algorithms. The high-quality random numbers generated by this invention can also be used for generating encryption keys, and are of great value for application scenarios that require high-quality random numbers, such as simulation experiments and random sampling.

[0082] Further, see Figure 5 As shown in the figure, an embodiment of the present invention discloses a random number generation method, including:

[0083] Step S11: Generate random numbers using an entropy source and input the random numbers output by the entropy source into the algorithm core. The algorithm core includes a key register for storing random keys, an integrity operation module connected to the key register, and an encryption operation module connected to the key register.

[0084] In this embodiment, the CPU can configure the number of bits in the random number output by the entropy source each time, controlling the number of bits, such as 32 bits, in the random number output by the entropy source. The CPU controls the entropy source to generate random numbers, which are then input into the algorithm core.

[0085] Step S12: Using the integrity calculation module, perform integrity hashing on the random number generated by the entropy source based on the random key to obtain a true random number, and use the health detection module to perform health detection on the true random number.

[0086] Step S13: Using the encryption operation module, the true random number is encrypted based on the random key to obtain a pseudo random number, and the pseudo random number is then tested for health using the health detection module.

[0087] The health detection module, connected to the outputs of the integrity calculation module and the encryption calculation module, may include a true random number health detection module connected to the output of the integrity calculation module for performing health detection on the true random number, and a pseudo random number health detection module connected to the output of the encryption calculation module for performing health detection on the pseudo random number.

[0088] For example, see Figure 6 As shown, Figure 6 Another flowchart of a random number generation method provided in this embodiment of the invention may include the following steps:

[0089] Step S1: The entropy source generates random numbers, which are then received by the post-processing system (i.e., the part of the random number generator that processes the random numbers generated by the entropy source to obtain true and false random numbers and perform health checks). In other words, the post-processing system receives random numbers from the entropy source.

[0090] Step S2: The key write enable is pulled high, and a random number is first written to the Zu Chongzhi algorithm key register. When the key register is full, the key write enable is pulled low, and the random number is directly written to the Zu Chongzhi algorithm core for integrity hashing. This step mainly includes the following steps:

[0091] Step 1: When the key writing enable is pulled high, the Zu Chongzhi algorithm core stops working, and the first 128 bits of random number input from the entropy source are first written into the key register part of the Zu Chongzhi algorithm core;

[0092] Step 2: After writing the 128-bit random number to the key register, pull the key write enable low;

[0093] Step 3: Start inputting random numbers into the computational part of Zu Chongzhi's algorithm core. The random numbers need to be input with a data length of not less than 32 bits to ensure the randomness of the output truly random numbers.

[0094] Step 4: After each operation (i.e. integrity hash operation) is completed, you can choose to execute Step 1 again, which can raise the key write enable again and update the key in the key register, thereby further improving the quality of the generated true random numbers.

[0095] The purpose of this step is to configure the key used by the Zu Chongzhi algorithm with random numbers and input the random numbers into the Zu Chongzhi algorithm core.

[0096] Step S3: The Zu Chongzhi algorithm kernel outputs a truly random number obtained through integrity hashing. If pseudo-random number mode is not enabled, the output truly random number will undergo health checks and be stored in the truly random number output FIFO, waiting to be used. This step mainly includes the following steps:

[0097] Step 1: The integrity hash operation outputs a 32-bit true random number. Generally, the integrity hash operation of the Zu Chongzhi algorithm core needs to be run at least 32 times, that is, output a 1024-bit true random number, so as to ensure the reliability of the health detection result. This depends on the health detection method used.

[0098] Step 2: Ensure that the health check meets international and domestic standards for random number detection;

[0099] Step 3: If the health check finds that the true random numbers do not meet the requirements, an error alarm will be issued and the entire system will stop running. The true random number and pseudo random number output FIFOs will be cleared. If pseudo random number mode is not enabled, only the true random number output FIFO will be cleared. If pseudo random number mode is enabled, and true random numbers are also stored in the FIFO, both the true random number and pseudo random number output FIFOs will be cleared. For ease of operation, the clear command can be applied to both the true random number and pseudo random number output FIFOs regardless of whether pseudo random number mode is enabled.

[0100] Step 4: If the true random number output FIFO is full and the pseudo random number mode is not enabled, an interrupt will be issued, the entire system will stop working, and wait for the data in the FIFO to be read out.

[0101] The purpose of this step is to use the integrity hashing function of the Zu Chongzhi algorithm kernel to obtain higher quality true random numbers, while performing health checks and storing the true random numbers without enabling the pseudo-random number mode.

[0102] Step S4 involves, if pseudo-random number mode is enabled, using the Zu Chongzhi algorithm to perform encryption operations on the true random numbers. The output pseudo-random number will undergo health checks and be stored in the pseudo-random number output FIFO, awaiting use. This step also includes the following steps:

[0103] Step 1: Encryption and integrity hash operations are performed in parallel using the same key;

[0104] Step 2: Under normal circumstances, the Zu Chongzhi algorithm kernel encryption operation needs to output at least 1024 bits of pseudo-random number to ensure the reliability of the health check result, which depends on the health check method used;

[0105] Step 3: Ensure that the health check meets international and domestic standards for random number detection;

[0106] Step 4: If the health check finds that the true random number does not meet the requirements, an error alarm will be issued and the entire system will stop running. The pseudo-random number output FIFO will be cleared, while the true random number output FIFO remains unchanged.

[0107] Step 5: If the pseudo-random number output FIFO is full and the pseudo-random number mode is enabled, an interrupt will be issued, the entire system will stop working, and wait for the data in the FIFO to be read out.

[0108] The purpose of this step is to use the Zu Chongzhi algorithm to perform encryption operations on the generated true random numbers to obtain more secure pseudo-random numbers, and then perform health checks and storage on the pseudo-random numbers.

[0109] In other words, the post-processing system receives random numbers from the entropy source; it pulls the key write enable high, and the random numbers are first written to the Zu Chongzhi algorithm key register; when the key register is full, the key write enable is pulled low, and the random numbers are directly written to the Zu Chongzhi algorithm core for integrity hashing; the Zu Chongzhi algorithm core outputs truly random numbers obtained through integrity hashing; if pseudo-random number mode is not enabled, the output truly random numbers will undergo health checks and be stored in the truly random number output FIFO, waiting to be used; if pseudo-random number mode is enabled, the Zu Chongzhi algorithm core is used to encrypt the truly random numbers, and the output pseudo-random numbers will undergo health checks and be stored in the pseudo-random number output FIFO, waiting to be used.

[0110] In this way, after receiving random numbers generated by the entropy source, the random numbers are fed into the Zu Chongzhi algorithm core. After integrity hashing, each operation generates a higher-quality 32-bit true random number, which is stored in a FIFO while undergoing health checks, thus achieving true random number output. Simultaneously, if pseudo-random number mode is enabled, the true random numbers can be output to the Zu Chongzhi algorithm core for encryption operations running in parallel with the integrity hashing, generating more secure pseudo-random numbers. These pseudo-random numbers are also stored in a FIFO while undergoing health checks, achieving pseudo-random number output. This technical solution achieves the parallel output of true and pseudo-random numbers using a single Zu Chongzhi algorithm core in hardware, avoiding the problems of excessive system hardware circuit area, high power consumption, and low output performance caused by using two more complex algorithm cores than the Zu Chongzhi algorithm. This significantly improves the output performance of the random number generator, saves system area, reduces power consumption, and achieves a faster random number generation rate. On the other hand, health checks are run in parallel with other modules, and the health checks are used in real time to monitor the true and pseudo-random numbers output by the system. This ensures that all truly and pseudo-random numbers generated by the system meet the standards, guaranteeing the quality of the generated random numbers and improving the overall system security. The principle of encryption and integrity hashing is achieved through the generation of stream ciphers, resulting in good security, fast operation, and low complexity.

[0111] Furthermore, embodiments of the present invention provide a random number generation apparatus, comprising:

[0112] An entropy source module is used to generate random numbers and input the random numbers output by the entropy source into the algorithm core. The algorithm core includes a key register for storing random keys, an integrity operation module connected to the key register, and an encryption operation module connected to the key register.

[0113] The computation module is used to perform an integrity hash operation on the random number generated by the entropy source based on the random key using the integrity computation module to obtain a true random number; and to perform an encryption operation on the true random number based on the random key using the encryption computation module to obtain a pseudo random number.

[0114] The detection module is used to perform health checks on the true random number using the health detection module, and to perform health checks on the pseudo random number using the health detection module.

[0115] The storage module is used to store true random numbers and pseudo random numbers.

[0116] In one optional implementation, a random number generation apparatus includes:

[0117] The entropy source module is mainly used to generate random numbers and send them to the post-processing system.

[0118] The computation module is primarily responsible for post-processing random numbers using the Zu Chongzhi algorithm. This includes two aspects: firstly, performing integrity-based hashing on the random numbers generated by the entropy source module to produce higher-quality true random numbers; and secondly, encrypting the true random numbers generated by the integrity-based hashing to produce more secure pseudo-random numbers.

[0119] The detection module is mainly used to perform health checks on the quality of random numbers in parallel during the data transmission of true random numbers and pseudo random numbers, in accordance with international and domestic standards. If the random numbers do not meet the requirements of international and domestic standards, an alarm will be issued to interrupt and prevent the system from outputting random numbers that do not meet the requirements.

[0120] The storage module is mainly used to store true random numbers and pseudo random numbers.

[0121] The system comprises two modules: an entropy source module connected to the computation module, primarily responsible for generating random numbers and sending them to the computation module; and a computation module connected to the detection and storage modules, primarily responsible for post-processing the random numbers using the Zu Chongzhi algorithm. This involves two aspects: firstly, performing integrity-based hashing on the random numbers generated by the entropy source module to generate higher-quality true random numbers; and secondly, performing encryption on the true random numbers generated by integrity-based hashing to generate more secure pseudo-random numbers. The detection module, connected to the computation module, is used to perform parallel health checks on the quality of the random numbers during data transmission, ensuring they meet international and domestic standards. If a random number does not meet these standards, an alarm will be issued, interrupting the system and preventing the output of the non-compliant random number. The storage module, which can connect to the computation and entropy source modules, is primarily used to store true random numbers, pseudo-random numbers, and random numbers input from the entropy source.

[0122] In this way, a Zu Chongzhi algorithm kernel is used to generate higher quality true random numbers and pseudo random numbers in parallel, enabling parallel operation of health detection and data transmission, and allowing real-time health detection of both true random numbers and pseudo random numbers simultaneously.

[0123] Figure 7 A structural diagram of an electronic device provided in an embodiment of the present invention, such as... Figure 7 As shown, the electronic device includes: a memory 70 for storing computer programs;

[0124] The processor 71 is used to implement the steps of the random number generation method as described in the above embodiments when executing a computer program.

[0125] The electronic devices provided in this embodiment may include, but are not limited to, smartphones, tablets, laptops or desktop computers, servers, etc.

[0126] The processor 71 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 71 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 71 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 71 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 71 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.

[0127] The memory 70 may include one or more computer-readable storage media, which may be non-transitory. The memory 70 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 70 is used to store at least the following computer program 701, which, after being loaded and executed by the processor 71, is capable of implementing the relevant steps of the random number generation method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 70 may also include an operating system 702 and data 703, and the storage method may be temporary or permanent storage. The operating system 702 may include Windows, Unix, Linux, etc. The data 703 may include, but is not limited to, configuration data.

[0128] In some embodiments, the electronic device may further include a display screen 72, an input / output interface 73, a communication interface 74, a power supply 75, and a communication bus 76.

[0129] Those skilled in the art will understand that Figure 7 The structures shown do not constitute a limitation on electronic devices and may include more or fewer components than those shown.

[0130] It is understood that if the random number generation method in the above embodiments is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the current technology, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of the present invention. The aforementioned storage medium includes: USB flash drive, mobile hard drive, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, magnetic disk, or optical disk, and other media capable of storing program code.

[0131] Based on this, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the random number generation method described above.

[0132] The following describes a computer program product provided by an embodiment of the present invention. The computer program product described below can be referred to in conjunction with other embodiments described herein.

[0133] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the aforementioned disclosed random number generation method.

[0134] The random number generator, random number generation method, medium, and product provided in the embodiments of the present invention have been described in detail above. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0135] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0136] The random number generator, random number generation method, medium, and product provided by this invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this invention.

Claims

1. A random number generator, characterized in that, include: Entropy source, used to generate random numbers; An algorithm core connected to an entropy source includes a key register for storing a random key, an integrity operation module connected to the key register, and an encryption operation module connected to the key register. The integrity operation module performs an integrity hash operation on the random number generated by the entropy source based on the random key to obtain a true random number. The encryption operation module performs an encryption operation on the true random number based on the random key to obtain a pseudo random number. A health detection module, connected to the outputs of the integrity calculation module and the encryption calculation module, is used to perform health detection on the true random number and the pseudo random number. The random number generator further includes a first path selector connected to the entropy source, configured to: in response to a key write enable signal going high, write the random number generated by the entropy source as a random key into the key register; in response to a key write enable signal going low, transmit the random number generated by the entropy source to the integrity calculation module, so that the integrity calculation module performs an integrity hash operation on the transmitted random number based on the random key to obtain a true random number; wherein, the key write enable signal goes high after completing one integrity hash operation to update the random key in the key register.

2. The random number generator according to claim 1, characterized in that, The health detection module includes: A true random number health detection module connected to the output of the integrity calculation module is used to perform health detection on the true random number; A pseudo-random number health detection module connected to the output of the encryption operation module is used to perform health detection on the pseudo-random number.

3. The random number generator according to claim 1, characterized in that, Also includes: A first cache with a first connection path to the integrity calculation module is used to store the true random number.

4. The random number generator according to claim 3, characterized in that, Also includes: A second cache connected to the encryption operation module is used to store the pseudo-random number.

5. The random number generator according to claim 4, characterized in that, It also includes a second path selector connected to the integrity calculation module, used for: In response to the pseudo-random number mode enable signal going high, the true random number output by the integrity calculation module is input into the encryption calculation module, so that the encryption calculation module performs encryption calculation on the true random number based on the random key to obtain a pseudo-random number.

6. The random number generator according to claim 4, characterized in that, It also includes a first control switch for controlling the first connection path, and a second control switch for controlling the second connection path between the output of the integrity calculation module and the encryption calculation module; When the first control switch is closed, the first connection path is connected, and the integrity calculation module stores the true random number output by the integrity calculation module into the first buffer through the first connection path. The true random number health detection module connected to the output of the integrity calculation module performs health detection on the true random number output by the integrity calculation module. When the second control switch is closed, the second connection path is connected, and the true random number output by the integrity calculation module is transmitted to the encryption calculation module through the second connection path. The encryption calculation module performs encryption calculation on the true random number based on the random key to obtain a pseudo-random number, and stores the pseudo-random number in the second buffer. The pseudo-random number health detection module connected to the output of the encryption calculation module is also input to perform health detection on the pseudo-random number. If the health test result corresponding to any of the true random numbers does not meet the health standards, the true random numbers in the first cache and the pseudo random numbers in the second cache are cleared. If the health check result corresponding to any of the pseudo-random numbers does not meet the health standards, the pseudo-random numbers in the second cache are cleared.

7. A method for generating random numbers, characterized in that, include: Random numbers are generated using an entropy source, and the random numbers output by the entropy source are input into an algorithm core. The algorithm core includes a key register for storing random keys, an integrity operation module connected to the key register, and an encryption operation module connected to the key register. Using the integrity calculation module, an integrity hash operation is performed on the random number generated by the entropy source based on the random key to obtain a true random number, and the health detection module is used to perform a health detection on the true random number; Using the encryption operation module, the true random number is encrypted based on the random key to obtain a pseudo random number, and the pseudo random number is then subjected to health detection using the health detection module. Specifically, a first path selector connected to the entropy source writes a random number generated by the entropy source as a random key to the key register in response to the key write enable signal going high; in response to the key write enable signal going low, the random number generated by the entropy source is passed to the integrity calculation module, so that the integrity calculation module performs an integrity hash operation on the passed random number based on the random key to obtain a true random number; the key write enable signal goes high after completing one integrity hash operation to update the random key in the key register.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the random number generation method as described in claim 7.

9. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the random number generation method of claim 7.