True random number generator and random number generation method
By sampling potential signals in the idle state using MEMS/NEMS sensor structures and comparing them with a reference value, a true random number sequence is generated, which solves the problem of high cost in existing technologies and realizes low-cost true random number generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- YONGJIANG LAB
- Filing Date
- 2025-11-21
- Publication Date
- 2026-04-17
AI Technical Summary
Most commercially available random number generators in the current technology are pseudo-random number generators, which are costly and difficult to generate random number sequences that meet the requirements of true randomness at low cost.
A MEMS/NEMS sensor structure is adopted, and a Wheatstone bridge and a switching module are used to sample the potential signal in the sensor idle state to generate a true random number sequence. The hardware PUF feature value of the MEMS/NEMS sensor is used as the data source, and random numbers are generated by comparing with a reference value.
The random number generator reduces the cost of generating random number sequences that meet the requirements of true randomness by utilizing existing sensors in electronic devices.
Smart Images

Figure CN121879718A_ABST
Abstract
Description
Technical Field
[0001] This application claims priority to the earlier application, application number 202511022942.4, entitled "True Random Number Generator and Random Number Generation Method".
[0002] This application belongs to the field of information security technology, and in particular relates to a true random number generator and a random number generation method. Background Technology
[0003] Random number generators (RNGs) are widely used in many fields, such as generating keys in encryption technology to ensure data security.
[0004] Most random number generators in commercial products are pseudo-random number generators (PRNGs). Currently, true random number generators (TRNGs) with high randomness are usually expensive and are only used in some products with high security requirements. Summary of the Invention
[0005] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application proposes a true random number generator and a random number generation method, which can generate random number sequences that meet the requirements of true randomness at low cost.
[0006] In a first aspect, this application provides a true random number generator, including: a power supply module, a processing module, a MEMS / NEMS sensor structure, a signal output terminal, and a first switch module; The MEMS / NEMS sensor structure includes a Wheatstone bridge, and the two ends of the signal output terminal are electrically connected to the Wheatstone bridge respectively. The first end of the signal output terminal is electrically connected to the first end of the power module through the first switch module. The processing module is used to control the first switch module to open when the MEMS / NEMS sensor structure is in normal working state. The processing module is also used to control the first switch module to close when the MEMS / NEMS sensor structure is in random number generation state, and to sample the potential signal output from the second terminal of the signal output terminal multiple times to obtain multiple first potential sample values. The multiple first potential sample values are compared with the reference value respectively, and a random number sequence is obtained based on the comparison result.
[0007] According to the true random number generator of this application, when the MEMS / NEMS sensor structure is in an idle state where it is not being detected, the first switch module between the first terminal of the control signal output terminal and the first terminal of the power module is closed, so that the first terminal of the signal output terminal is equivalently grounded, and the potential signal output by the second terminal of the signal output terminal is sampled multiple times to obtain multiple first potential sampling values. The potential signal affected by external interference has good randomness.
[0008] This application uses the hardware PUF (Physically Unclonable Function) feature value of MEMS / NEMS sensors as the data source for true random numbers. Based on multiple first potential sampling values under external random interference, a true random number sequence is generated. Since electronic devices often have various sensors installed, and the cost of sensors is low, this application can generate random number sequences that meet the requirements of true randomness at low cost.
[0009] According to one embodiment of this application, the first potential sampling value is the sum of the potential calculation value of the second terminal of the signal output terminal and the potential value of the current external interference signal.
[0010] According to one embodiment of this application, the MEMS / NEMS sensor structure is a piezoresistive sensor or a capacitive sensor.
[0011] According to one embodiment of this application, the processing module includes: A switch control module is used to control the opening and closing of the first switch module according to the working state of the MEMS / NEMS sensor structure. The sampling module is used to sample the potential signal output from the second terminal of the signal output terminal multiple times when the first switch module is closed, to obtain multiple first potential sampling values, and to send the first potential sampling values to the random number generation module in real time. The random number generation module is used to compare the first potential sample value obtained in real time with the reference value. When the first potential sample value is greater than or equal to the reference value, a first number of bits is generated. When the first potential sample value is less than or equal to the reference value, a second number of bits is generated. The first number of bits and the second number of bits are arranged in the order of the first potential sample value obtained by sampling to obtain a random number sequence.
[0012] According to one embodiment of this application, the processing module further includes a clock signal generation module for generating a sampling clock signal; the sampling module is used to sample the potential signal output from the second terminal of the signal output terminal multiple times according to the frequency of the sampling clock signal when the first switch module is closed.
[0013] According to one embodiment of this application, the random number generation module includes: A comparator is provided, wherein the positive input terminal of the comparator is used to input the reference value, the negative input terminal is used to input the first potential sample value, the comparator is used to compare the first potential sample value with the reference value, and the output terminal of the comparator is used to output a first level when the first potential sample value is greater than or equal to the reference value, and output a second level when the first potential sample value is less than or equal to the reference value. The random number generation unit is used to generate a first number of bits when the comparator outputs a first level, and to generate a second number of bits when the comparator outputs a second level.
[0014] According to one embodiment of this application, the random number generation module includes a storage medium and / or a computer program product, the storage medium and the computer program product being configured to perform the following steps: The first potential sample value obtained in real time is compared with the reference value. When the first potential sample value is greater than or equal to the reference value, a first number of bits is generated. When the first potential sample value is less than or equal to the reference value, a second number of bits is generated.
[0015] According to one embodiment of this application, the switch control module is further configured to control the first switch module to close when the true random number generator is in the factory test state; The sampling module is also used to sample the potential signal output from the second terminal of the signal output terminal multiple times when the true random number generator is in the factory test state, to obtain multiple second potential sampling values, and to average the multiple second potential sampling values to obtain the potential average value. In the random number generation state, the reference value is the potential average value.
[0016] According to one embodiment of this application, the processing module further includes a storage module. In the random number generation state, the storage module is used to store the first potential sample value obtained by the sampling module in real time. The random number generation module is used to compare the first potential sample value obtained in real time with the first potential sample value stored in the storage module in the previous moment as a reference value to obtain the random number sequence.
[0017] Secondly, this application provides a random number generation method, the method being applied to the true random number generator as described in any one of claims 1-9, the method comprising: When the MEMS / NEMS sensor structure is in normal operating condition, the first switch module is controlled to disconnect. When the MEMS / NEMS sensor structure is in random number generation state, the first switch module is controlled to close, and the potential signal output from the second terminal of the signal output terminal is sampled multiple times to obtain multiple first potential sample values. The multiple first potential sample values are compared with the reference value respectively, and a random number sequence is obtained based on the comparison results.
[0018] According to the random number generation method of this application, when the MEMS / NEMS sensor structure is in an idle state without detection, the first switch module between the first terminal of the control signal output terminal and the first terminal of the power module is closed, so that the first terminal of the signal output terminal is equivalently grounded. The potential signal output by the second terminal of the signal output terminal is sampled multiple times to obtain multiple first potential sampling values. The potential signal affected by external interference has good randomness. Based on multiple first potential sampling values, a random number sequence that meets the requirements of true randomness can be generated at low cost.
[0019] Thirdly, this application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the random number generation method as described in the first aspect above.
[0020] Fourthly, this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the random number generation method as described in the first aspect above.
[0021] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the random number generation method as described in the first aspect above.
[0022] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0023] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is one of the structural schematic diagrams of the true random number generator provided in the embodiments of this application; Figure 2 This is a second schematic diagram of the structure of the true random number generator provided in the embodiments of this application; Figure 3 This is the third schematic diagram of the structure of the true random number generator provided in the embodiments of this application; Figure 4 This is one of the schematic diagrams of the comparator provided in the embodiments of this application; Figure 5 This is one of the schematic diagrams of the comparator output level provided in the embodiments of this application; Figure 6 This is a second schematic diagram of the comparator provided in the embodiments of this application; Figure 7 This is a second schematic diagram of the comparator output level provided in the embodiments of this application; Figure 8 This is a flowchart illustrating the random number generation method provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application.
[0024] Figure label: True random number generator 100, power supply module 110, processing module 120, MEMS / NEMS sensor structure 130, Signal output terminal 140, first switch module 150. Detailed Implementation
[0025] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0026] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0027] The true random number generator 100, random number generation method, random number generation device, electronic device and readable storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0028] This application provides a true random number generator 100.
[0029] like Figure 1As shown, the true random number generator 100 includes a power supply module 110, a processing module 120, a MEMS / NEMS sensor structure 130, a signal output terminal 140, and a first switch module 150.
[0030] Among them, the power supply module 110 is a module that can provide a stable power supply to the entire true random number generator 100.
[0031] The processing module 120 is a module that can control and coordinate the operation of each module in the true random number generator 100. It can be used to process and convert the output data from the MEMS / NEMS sensor structure 130 and convert the output data into usable random numbers.
[0032] MEMS / NEMS sensor structure 130 includes micro-electro-mechanical systems (MEMS) or nano-electro-mechanical systems (NEMS). Micro-electro-mechanical systems are micro-systems that integrate mechanical structures, sensors, actuators and electronic circuits on a tiny chip. Nano-electro-mechanical systems are micro-electro-mechanical systems with a scale at the nanometer level, integrating nanometer-scale mechanical structures and electronic components.
[0033] The signal output terminal 140 is a structure that can output the signal generated by the MEMS / NEMS sensor structure 130.
[0034] The first switch module 150 is a module that can connect the first terminal of the signal output terminal 140 to the first terminal of the power module 110, or disconnect the connection between the first terminal of the signal output terminal 140 and the first terminal of the power module 110. The first switch module 150 may include a mechanical switch, or it may be an analog or digital switch circuit or switch element. This embodiment does not limit the implementation method of the first switch module.
[0035] In this embodiment, the MEMS / NEMS sensor structure 130 includes a Wheatstone bridge, the two ends of the signal output terminal 140 are electrically connected to the Wheatstone bridge respectively, and the first end of the signal output terminal 140 is electrically connected to the first end of the power module 110 through the first switch module 150.
[0036] Among them, the Wheatstone bridge is the core unit of the MEMS / NEMS sensor structure 130 signal conversion. The Wheatstone bridge can be a bridge circuit composed of four resistors. The two bridge arm resistors can be connected to the sensitive element. When external physical quantities such as pressure are applied to the sensitive element, the resistance value of the bridge arm changes slightly, causing the bridge to become unbalanced, thereby outputting a voltage difference proportional to the measured signal.
[0037] The two ends of the signal output terminal 140 are electrically connected to the Wheatstone bridge, and the signal generated by the Wheatstone bridge can be output through the signal output terminal 140.
[0038] The first terminal of the signal output terminal 140 is electrically connected to the first terminal of the power module 110 through the first switch module 150. The first terminal of the signal output terminal 140 can be the negative output terminal, and the first terminal of the power module 110 can be the negative terminal of the power supply. The first terminal of the power module 110 can be set to ground potential. When the first switch module 150 is closed, the first terminal of the signal output terminal 140 is electrically connected to the first terminal of the power module 110, and the potential of the first terminal of the signal output terminal 140 is the same as the ground potential. The first terminal of the signal output terminal 140 is equivalently grounded.
[0039] In this embodiment, the processing module 120 is used to control the first switch module 150 to open when the MEMS / NEMS sensor structure 130 is in normal working state. The processing module 120 is also used to control the first switch module 150 to close when the MEMS / NEMS sensor structure 130 is in random number generation state, and to sample the potential signal output from the second terminal of the signal output terminal 140 multiple times to obtain multiple first potential sample values. The multiple first potential sample values are compared with the reference value respectively, and a random number sequence is obtained based on the comparison result.
[0040] The MEMS / NEMS sensor structure 130 is in a normal working state, which means that the MEMS / NEMS sensor structure 130 is operating normally under its main functions. In the normal working state, the MEMS / NEMS sensor structure 130 is mainly used to perform sensing tasks to measure physical quantities. According to the functional characteristics of the MEMS / NEMS sensor structure 130, the measured physical quantities may include pressure, acceleration, and temperature, etc.
[0041] The MEMS / NEMS sensor structure 130 being in the random number generation state corresponds to the idle state when the MEMS / NEMS sensor structure 130 is not performing a test task.
[0042] In this embodiment, when the MEMS / NEMS sensor structure 130 is in normal working condition, the processing module 120 controls the first switch module 150 to be disconnected, the ground wire is in a cut-off state, the two ends of the signal output terminal 140 connected by the Wheatstone bridge maintain differential output, and the signal output terminal 140 outputs the sensor test results.
[0043] When the MEMS / NEMS sensor structure 130 is in the random number generation state, the processing module 120 controls the first switch module 150 to close, the first terminal of the signal output terminal 140 is equivalently grounded, and the potential signal output from the second terminal of the signal output terminal 140 is sampled multiple times to obtain multiple first potential sample values.
[0044] The first potential sampling value is the voltage value of the second terminal of the signal output terminal 140 relative to ground when the MEMS / NEMS sensor structure 130 is in a random number generation state.
[0045] The processing module 120 samples the potential signal output from the second terminal of the signal output terminal 140 multiple times to obtain multiple first potential sampling values. These multiple first potential sampling values can reflect unpredictable noise or fluctuation characteristics in the circuit of the MEMS / NEMS sensor structure 130.
[0046] In this embodiment, after obtaining the first potential sample value, the first potential sample value is compared with the reference value, and a random number sequence is obtained based on the comparison results corresponding to each first potential sample value.
[0047] The reference value is a standard value used to compare with the first potential sample value to determine the comparison result and generate a random number sequence. The reference value can be a pre-set value.
[0048] The first potential sample value can be compared with the reference value to determine whether the first potential sample value is greater than, less than or equal to the reference value, and different label values can be generated according to the different comparison results.
[0049] Alternatively, the first potential sample value can be compared with the reference value to determine the degree of deviation, and different marker values can be generated based on the degree of deviation.
[0050] Arrange the various marker values in chronological order to obtain a random number sequence.
[0051] According to the true random number generator 100 provided in the embodiments of this application, by closing the first switch module 150 between the first terminal of the control signal output terminal 140 and the first terminal of the power module 110 when the MEMS / NEMS sensor structure 130 is in an idle state without detection, the first terminal of the signal output terminal 140 is effectively grounded, and the potential signal output from the second terminal of the signal output terminal 140 is sampled multiple times to obtain multiple first potential sampling values. The potential signal, which is subject to various external noise interferences, has good randomness. Based on multiple first potential sampling values, a random number sequence that meets the requirements of true randomness can be generated at low cost.
[0052] In some embodiments, the first potential sampling value is the sum of the potential calculation value of the second terminal of the signal output terminal 140 and the potential value of the current external interference signal.
[0053] Among them, the potential calculation value of the second terminal of the signal output terminal 140 is the inherent potential information of the second terminal of the signal output terminal 140.
[0054] The current external interference signal is a signal mixed in from the external environment that can cause random potential changes at the signal output terminal 140, such as thermal noise and contact noise in the circuit, as well as electrostatic interference in the environment. The potential value of the current external interference signal is the potential change value caused by the current external interference signal.
[0055] In this embodiment, the potential calculation value of the second terminal of the signal output terminal 140 is a fixed value, the potential value of the current external interference signal is a random value, and the potential calculation value of the second terminal of the signal output terminal 140 is added to the potential value of the current external interference signal to obtain a random first potential sampling value.
[0056] In some embodiments, the MEMS / NEMS sensor structure 130 is a piezoresistive sensor or a capacitive sensor. The MEMS / NEMS piezoresistive sensor can be a pressure sensor, force sensor, acceleration sensor, displacement sensor, strain sensor, flow sensor, or torque sensor, etc. The MEMS / NEMS capacitive sensor can be a capacitive pressure sensor, capacitive acceleration sensor, capacitive displacement sensor, capacitive humidity sensor, capacitive liquid level sensor, capacitive gyroscope, capacitive gas sensor, capacitive temperature sensor, or capacitive biosensor, etc.
[0057] Taking a piezoresistive sensor as an example, a piezoresistive sensor in an electronic device is a sensor whose resistivity changes when subjected to pressure. The magnitude of the pressure can be indirectly deduced by measuring the change in resistance. In this embodiment, when the piezoresistive sensor is in a random number generation state, no pressure test is performed. That is, random number generation is performed when the piezoresistive sensor is not subjected to external pressure, or when pressure is applied to the piezoresistive sensor but the electronic device does not need to know the magnitude of the pressure to be measured.
[0058] In some embodiments, the processing module 120 includes: A switch control module is used to control the opening and closing of the first switch module 150 according to the working state of the MEMS / NEMS sensor structure 130; The sampling module is used to sample the potential signal output from the second terminal of the signal output terminal 140 multiple times when the first switch module 150 is closed, to obtain multiple first potential sample values, and to send the first potential sample values to the random number generation module in real time. The random number generation module compares the first potential sample value obtained in real time with the reference value. When the first potential sample value is greater than or equal to the reference value, a first number of bits is generated. When the first potential sample value is less than or equal to the reference value, a second number of bits is generated. The first number of bits and the second number of bits are arranged in the order of the first potential sample value obtained in real time to obtain a random number sequence.
[0059] In this embodiment, the switch control module controls the first switch module 150 to open when the MEMS / NEMS sensor structure 130 is in normal working state, and controls the first switch module 150 to close when the MEMS / NEMS sensor structure 130 is in random number generation state.
[0060] The sampling module is connected to the second terminal of the signal output terminal 140. When the first switch module 150 is closed, it samples the potential signal output from the second terminal of the signal output terminal 140 multiple times. Each sampling yields a first potential sampling value. The sampling module is also connected to the random number generation module and sends the first potential sampling value to the random number generation module in real time.
[0061] The random number generation module receives real-time first potential sample values from the sampling module. Each time a new first potential sample value is received, it compares the first potential sample value with a reference value. If the first potential sample value is greater than or equal to the reference value, a first bit number is generated, which can be logic 1. If the first potential sample value is less than the reference value, a second bit number is generated, which can be logic 0.
[0062] The first and second bits generated are arranged in chronological order. For example, if four samples are taken and the resulting bits are 1, 0, 1, and 0, then the generated random number sequence is 1010.
[0063] In some embodiments, the processing module 120 further includes a clock signal generation module for generating a sampling clock signal; and a sampling module for sampling the potential signal output from the second terminal of the signal output terminal 140 multiple times according to the frequency of the sampling clock signal when the first switch module 150 is closed.
[0064] The sampling clock signal is an electrical signal used to control and synchronize the data sampling process.
[0065] In this embodiment, the clock signal generation module generates a stable sampling clock signal. The frequency of the sampling clock signal determines the sampling rate at which the sampling module samples the potential signal at the second terminal of the signal output terminal 140. The frequency of the sampling clock signal can be set according to specific application requirements.
[0066] The sampling module can trigger a potential signal sampling operation once at the rising or falling edge of each sampling clock signal, so that each sampling is performed within the same time interval.
[0067] In some embodiments, the random number generation module includes a comparator.
[0068] The positive input of the comparator is used to input the reference value, and the negative input is used to input the first potential sample value. The comparator is used to compare the first potential sample value with the reference value. The output of the comparator is used to output a first level when the first potential sample value is greater than or equal to the reference value, and to output a second level when the first potential sample value is less than or equal to the reference value. The random number generation unit is used to generate a first number of bits when the comparator outputs a first level and a second number of bits when the comparator outputs a second level.
[0069] A comparator is a device that can compare the magnitudes of two input signals and output a corresponding level signal based on the comparison result.
[0070] In this embodiment, a reference value is input to the positive input terminal of the comparator, and a first potential sample value is input to the negative input terminal. When the first potential sample value is greater than or equal to the reference value, the comparator outputs a first level, which can be a logic high level. When the first potential sample value is less than the reference value, the comparator outputs a second level, which can be a logic low level.
[0071] The random number generation unit is connected to the output of the comparator. It generates a first bit or a second bit based on the high or low output level of the comparator. For example, it can generate a logic 1 when the level is high and a logic 0 when the level is low.
[0072] In this embodiment, a hardware comparator compares the first potential sample value with a reference value, and a random number generation unit generates the corresponding number of bits.
[0073] In some embodiments, the random number generation module includes a storage medium and / or a computer program product, which are configured to perform the following steps: The first potential sample value obtained in real time is compared with the reference value. When the first potential sample value is greater than or equal to the reference value, the first number of bits is generated. When the first potential sample value is less than or equal to the reference value, the second number of bits is generated.
[0074] Storage media are used to store computer program code and necessary data, and may include hard disks, solid-state drives, flash memory, and optical discs.
[0075] Computer program products may include software code that performs random number generation tasks. This code may be a compiled binary file or an interpreted script that runs on a processor.
[0076] In this embodiment, the first potential sample value is compared with a reference value using computer software to generate the corresponding number of bits.
[0077] In some embodiments, the switch control module is also used to control the first switch module 150 to close when the true random number generator 100 is in the factory test state; The sampling module is also used to sample the potential signal output from the second terminal of the signal output terminal 140 multiple times when the true random number generator 100 is in the factory test state, to obtain multiple second potential sampling values, and to average the multiple second potential sampling values to obtain the potential average value. In the random number generation state, the reference value is the potential average value.
[0078] The second potential sampling value is the voltage of the second terminal of the signal output terminal 140 relative to ground when the true random number generator 100 is in the factory test state.
[0079] In this embodiment, the switch control module controls the first switch module 150 to close when the true random number generator 100 is in the factory test state, so that the first end of the signal output terminal 140 is equivalently grounded.
[0080] When the true random number generator 100 is in the factory test state, the sampling module samples the potential signal output from the second terminal of the signal output terminal 140 multiple times. Each sampling yields a second potential sampling value. The average potential value is obtained by averaging the multiple second potential sampling values. The average potential value represents the average level of the potential signal output from the second terminal of the signal output terminal 140 and is used as the reference value.
[0081] In some embodiments, the processing module 120 further includes a storage module. In the random number generation state, the storage module is used to store the first potential sample value obtained by the sampling module in real time. The random number generation module is used to use the first potential sample value stored in the storage module at the previous moment as a reference value, and compare the first potential sample value obtained by real-time sampling with the first potential sample value stored in the storage module at the previous moment to obtain a random number sequence.
[0082] In this embodiment, when the sampling module obtains the first potential sampling value, it saves the first potential sampling value in the storage module. The new first potential sampling value in the storage module can be appended to the previous first potential sampling value according to the timing sequence.
[0083] The random number generation module uses the first potential sample value stored in the storage module at the previous moment as the reference value, and compares the first potential sample value obtained in real time at the current moment with the first potential sample value stored at the previous moment to obtain a random number sequence.
[0084] The true random number generator of this application can be constructed from various electronic components that are already installed in the electronic device, and by adding relevant control modules or switch modules to the original device control chip / circuit.
[0085] These electronic devices can be industrial internet devices using various types of sensors mentioned above, such as industrial pressure transmitters, altimeters for weather stations, various weighing devices in warehousing systems, and checkweighers on production lines. The MEMS / NEMS sensor structure using true random number generators in industrial internet devices can be various sensors in these industrial internet devices. The power module can be the power supply for the electronic device or the power module built into the sensor. The processing module can be the control chip of the electronic device. The first switch module can be set in the control chip of the sensor or integrated on the control chip of the electronic device.
[0086] It can also be used in consumer electronic devices, such as mobile phones. The MEMS / NEMS sensor structure can be a barometer, altimeter, gyroscope, touch recognition sensor, distance / proximity sensor, etc. in the mobile phone. The power module of the true random number generator can be the power supply of the mobile phone or the power module built into the sensor. The processing module can be the CPU, MPU, etc. of the mobile phone. The first switch module can be set in the control chip of the sensor or integrated into the motherboard of the mobile phone. The clock signal, etc., is generated by the clock signal generation module built into the mobile phone, etc.
[0087] In other embodiments, the true random number generator may also be a separately packaged sensor product, that is, the capability of a true random number generator is integrated into the sensor product.
[0088] The following describes a specific embodiment of a true random number generator 100.
[0089] Using the port output voltage of the signal output terminal 140 of the MEMS / NEMS sensor structure 130 when it is idle (i.e., not in the test state) as the source data, these source data are sampled and extracted, and a highly random number sequence is generated by processing the sampled data.
[0090] Taking a piezoresistive pressure sensor as an example, such as Figure 2 The figure shows the equivalent circuit diagram for pressure testing using a piezoresistive pressure sensor.
[0091] The pressure change of the contact sensor will cause the resistors R1 and R2 to change in opposite directions, thereby causing changes in the port output voltages Vout+ and Vout-, and generating the corresponding pressure test value output.
[0092] In this embodiment, such as Figure 3As shown, a connection between the negative terminal of the signal output terminal 140 and the ground is added, and the first switch module 150 is set to determine whether to use this ground wire. When the MEMS / NEMS sensor structure 130 is in a normal working state such as testing, the first switch module 150 disconnects the ground wire and is in a cut-off state. The MEMS / NEMS sensor structure 130 outputs normal pressure test results through the two ports of the signal output terminal 140.
[0093] When a random number sequence needs to be generated, the first switch module 150 closes the ground wire and is in a connected state. The MEMS / NEMS sensor structure 130 switches to the random number generation state. The MEMS / NEMS sensor structure 130 outputs a single-ended voltage to the ground. The voltage output by the MEMS / NEMS sensor structure 130, that is, the first potential sampling value, is Vout += V0 × + Vnoise where V0 is the voltage output by the power supply module 110, V0 × is the calculated value of the potential at the second terminal of the signal output terminal 140, that is, the positive terminal, and Vnoise is the potential value of the current external interference signal.
[0094] Vout + is sampled multiple times to obtain a sampling sequence {V1, V2,....Vn}. A random number sequence is obtained by processing the first potential sampling value. For example, a comparator is used for voltage comparison. There are the following two ways to generate a random number sequence.
[0095] One way is to compare the sampled voltage value, that is, the first potential sampling value Vi, with the average value of the single-pole voltage output tested at the factory, that is, the potential average value Vavg. If Vi >= Vavg, the comparator outputs a low level, and the corresponding output sequence bit takes 1. If Vi < Vavg, the comparator outputs a high level, and the corresponding output sequence bit takes 0.
[0096] Another way is to compare the sampled voltage value Vi with the previous sampled data Vi-1. If Vi >= Vi-1, the comparator outputs a low level, and the corresponding output sequence bit takes 1. If Vi < Vi-1, the comparator outputs a high level, and the corresponding output sequence bit takes 0.
[0097] The voltage value comparison can be achieved through the following two methods.
[0098] One way is that the MEMS / NEMS sensor structure 130 is connected to a hardware comparator and directly outputs the comparison result, such as Figure 4As shown, to use the average potential of the single-pole voltage output tested at the factory as a reference value for voltage comparison, a first potential sampling value Vi is input to the negative input terminal of the comparator, and the average potential value Vavg is input to the positive input terminal. The comparator outputs Vout, which includes a high level V. OH and low level V OL .like Figure 5 As shown, the first potential sample value Vi is compared with the potential average value Vavg to generate a high level or a low level.
[0099] like Figure 6 As shown, the current first potential sample value Vi is input to the negative input terminal of the comparator, and the previous first potential sample value Vi-1 is input to the positive input terminal of the comparator. The output terminal of the comparator outputs Vout, which includes a high level V. OH and low level V OL .like Figure 7 As shown, the current first potential sample value Vi is compared with the previous first potential sample value Vi-1 to generate a high level or a low level.
[0100] Another approach involves processing the data via the microcontroller unit software (MCU) connected to the MEMS / NEMS sensor structure 130. The MEMS / NEMS sensor structure 130 outputs the first potential sample value to the MCU through the signal output terminal 140. The MCU compares the current first potential sample value with the factory average value or the previous first potential sample value and outputs a bit sequence based on the comparison result.
[0101] When the MEMS / NEMS sensor structure 130 is subjected to stress testing, or when mobile applications require the support of the MEMS / NEMS sensor structure 130, a random number sequence is generated and used as a key to ensure the security of data on the device.
[0102] The MCU or central processing unit (CPU) on the device sends instructions to the MEMS / NEMS sensor structure 130 to obtain the first potential sampling value sequence. The first potential sampling value is processed to generate a real random number sequence. In actual product applications, the random number sequence can be implemented in the following two ways.
[0103] One approach is to sample the potential signal output from the second terminal of the signal output terminal 140 multiple times when the true random number generator 100 is in factory testing state, obtain multiple second potential sample values, average the multiple second potential sample values to obtain the potential average value, and give the potential average value to the customer so that the customer can set and use it in the corresponding software of the sensor. Alternatively, the manufacturer can configure the random number generator software to use the potential average value as a parameter. After sampling the first potential sample value sequence, the random number sequence is output by comparing it with the potential average value through hardware or software.
[0104] Another approach is to sample the output voltage when using a true random number generator 100, and then compare adjacent first potential sample values with hardware or a processor to output a random bit stream sequence of 0s and 1s.
[0105] The true random number generator 100 provided in this application embodiment can generate random number sequences, such as those required for key generation, by collecting different random physical characteristic values generated inside the MEMS / NEMS sensor structure 130 due to interference in scenarios where hardware and its supporting software and applications require random numbers.
[0106] The selection of source physical feature values for an RNG depends on the randomness of the feature values themselves, as well as the difficulty and cost of extraction. Processing the output voltage value sequence when the sensor is idle to generate a random sequence is simple and effective, can improve randomness, and can replace existing RNG modules in integrated products with micro-electro-mechanical systems (MEMS), thereby reducing costs.
[0107] By discovering suitable source data, reducing the sampling cost of source data, and using existing MEMS circuits and digital processing units in a simple and effective way, we can generate real random sequences that meet the standards.
[0108] This application also provides a method for generating random numbers.
[0109] The random number generation method can be applied to the aforementioned true random number generator 100.
[0110] The random number generation method provided in this application embodiment can be executed by an electronic device or a functional module or entity in an electronic device that can implement the random number generation method. The electronic devices mentioned in this application embodiment include, but are not limited to, mobile phones, tablets, computers, cameras, and wearable devices. The random number generation method provided in this application embodiment is described below using an electronic device as the execution subject.
[0111] like Figure 8 As shown, the random number generation method includes steps 810 and 820.
[0112] Step 810: When the MEMS / NEMS sensor structure 130 is in normal working condition, control the first switch module 150 to disconnect.
[0113] Step 820: When the MEMS / NEMS sensor structure 130 is in the random number generation state, control the first switch module 150 to close, and sample the potential signal output from the second terminal of the signal output terminal 140 multiple times to obtain multiple first potential sample values. Then, compare the multiple first potential sample values with the reference value respectively, and obtain a random number sequence based on the comparison results.
[0114] According to the random number generation method provided in the embodiments of this application, when the MEMS / NEMS sensor structure 130 is in an idle state without detection, the first switch module 150 between the first terminal of the control signal output terminal 140 and the first terminal of the power module 110 is closed, so that the first terminal of the signal output terminal 140 is equivalently grounded. The potential signal output from the second terminal of the signal output terminal 140 is sampled multiple times to obtain multiple first potential sampling values. The potential signal affected by external interference has good randomness. Based on multiple first potential sampling values, a random number sequence that meets the requirements of true randomness can be generated at low cost.
[0115] The random number generation method provided in this application can be executed by a random number generation device. This application uses a random number generation device executing the random number generation method as an example to illustrate the random number generation device provided in this application.
[0116] In some embodiments, such as Figure 9 As shown, this application embodiment also provides an electronic device 900, including a processor 901, a memory 902, and a computer program stored in the memory 902 and executable on the processor 901. When the program is executed by the processor 901, it implements the various processes of the above-described random number generation method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0117] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0118] This application also provides a non-transitory computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described random number generation method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0119] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0120] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described random number generation method.
[0121] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0122] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described random number generation method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0123] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0124] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0125] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0126] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
[0127] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0128] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.
Claims
1. A true random number generator, characterized in that, include: The power module, processing module, MEMS / NEMS sensor structure, signal output terminal, and first switch module; The MEMS / NEMS sensor structure includes a Wheatstone bridge, and the two ends of the signal output terminal are electrically connected to the Wheatstone bridge respectively. The first end of the signal output terminal is electrically connected to the first end of the power module through the first switch module. The processing module is used to control the first switch module to open when the MEMS / NEMS sensor structure is in normal working state. The processing module is also used to control the first switch module to close when the MEMS / NEMS sensor structure is in random number generation state, and to sample the potential signal output from the second terminal of the signal output terminal multiple times to obtain multiple first potential sample values. The multiple first potential sample values are compared with the reference value respectively, and a random number sequence is obtained based on the comparison result.
2. The true random number generator according to claim 1, characterized in that, The first potential sampling value is the sum of the potential calculation value of the second terminal of the signal output terminal and the potential value of the current external interference signal.
3. The true random number generator according to claim 1, characterized in that, The MEMS / NEMS sensor structure is either a piezoresistive sensor or a capacitive sensor.
4. The true random number generator according to any one of claims 1-3, characterized in that, The processing module includes: A switch control module is used to control the opening and closing of the first switch module according to the working state of the MEMS / NEMS sensor structure. The sampling module is used to sample the potential signal output from the second terminal of the signal output terminal multiple times when the first switch module is closed, to obtain multiple first potential sampling values, and to send the first potential sampling values to the random number generation module in real time. The random number generation module is used to compare the first potential sample value obtained in real time with the reference value. When the first potential sample value is greater than or equal to the reference value, a first number of bits is generated. When the first potential sample value is less than or equal to the reference value, a second number of bits is generated. The first number of bits and the second number of bits are arranged in the order of the first potential sample value obtained by sampling to obtain a random number sequence.
5. The true random number generator according to claim 4, characterized in that, The processing module further includes a clock signal generation module for generating a sampling clock signal; the sampling module is used to sample the potential signal output from the second terminal of the signal output terminal multiple times according to the frequency of the sampling clock signal when the first switch module is closed.
6. The true random number generator according to claim 4, characterized in that, The random number generation module includes: A comparator is provided, wherein the positive input terminal of the comparator is used to input the reference value, the negative input terminal is used to input the first potential sample value, the comparator is used to compare the first potential sample value with the reference value, and the output terminal of the comparator is used to output a first level when the first potential sample value is greater than or equal to the reference value, and output a second level when the first potential sample value is less than or equal to the reference value. The random number generation unit is used to generate a first number of bits when the comparator outputs a first level, and to generate a second number of bits when the comparator outputs a second level.
7. The true random number generator according to claim 4, characterized in that, The random number generation module includes a storage medium and / or a computer program product, the storage medium and the computer program product being configured to perform the following steps: The first potential sample value obtained in real time is compared with the reference value. When the first potential sample value is greater than or equal to the reference value, a first number of bits is generated. When the first potential sample value is less than or equal to the reference value, a second number of bits is generated.
8. The true random number generator according to claim 4, characterized in that, The switch control module is also used to control the first switch module to close when the true random number generator is in the factory test state; The sampling module is also used to sample the potential signal output from the second terminal of the signal output terminal multiple times when the true random number generator is in the factory test state, to obtain multiple second potential sampling values, and to average the multiple second potential sampling values to obtain the potential average value. In the random number generation state, the reference value is the potential average value.
9. The true random number generator according to claim 4, characterized in that, The processing module further includes a storage module. In the random number generation state, the storage module is used to store the first potential sample value obtained by the sampling module in real time. The random number generation module is used to use the first potential sample value stored in the storage module at the previous moment as a reference value, and compare the first potential sample value obtained in real time with the first potential sample value stored in the storage module at the previous moment to obtain the random number sequence.
10. A method for generating random numbers, characterized in that, The method is applied to the true random number generator as described in any one of claims 1-9, and the method includes: When the MEMS / NEMS sensor structure is in normal operating condition, the first switch module is controlled to disconnect. When the MEMS / NEMS sensor structure is in random number generation state, the first switch module is controlled to close, and the potential signal output from the second terminal of the signal output terminal is sampled multiple times to obtain multiple first potential sample values. The multiple first potential sample values are compared with the reference value respectively, and a random number sequence is obtained based on the comparison results.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the random number generation method as described in claim 10.
12. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the random number generation method as described in claim 10.
13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the random number generation method as described in claim 10.