WO2020259721A2 - Truly random number generator and truly random number generation method for conversion of bridge voltage at random intervals in mcu - Google Patents

Truly random number generator and truly random number generation method for conversion of bridge voltage at random intervals in mcu Download PDF

Info

Publication number
WO2020259721A2
WO2020259721A2 PCT/CN2020/110774 CN2020110774W WO2020259721A2 WO 2020259721 A2 WO2020259721 A2 WO 2020259721A2 CN 2020110774 W CN2020110774 W CN 2020110774W WO 2020259721 A2 WO2020259721 A2 WO 2020259721A2
Authority
WO
WIPO (PCT)
Prior art keywords
random number
adc
true random
amplifier
module
Prior art date
Application number
PCT/CN2020/110774
Other languages
French (fr)
Chinese (zh)
Other versions
WO2020259721A3 (en
Inventor
李镇兵
李钢
章佑鹏
文光俊
Original Assignee
电子科技大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 电子科技大学 filed Critical 电子科技大学
Publication of WO2020259721A2 publication Critical patent/WO2020259721A2/en
Publication of WO2020259721A3 publication Critical patent/WO2020259721A3/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/588Random number generators, i.e. based on natural stochastic processes
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M1/00Analogue/digital conversion; Digital/analogue conversion
    • H03M1/12Analogue/digital converters
    • H03M1/124Sampling or signal conditioning arrangements specially adapted for A/D converters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds

Definitions

  • the invention relates to a true random number generator and a generation method for MCU to convert bridge voltage at random intervals, as well as a true random number generator based on the chaotic mapping of ADC nonlinear effects and an implementation method for generating true random numbers.
  • the transmitting end of the communication system must encrypt the communication data before transmitting the data, and then the receiving end decrypts the received encrypted data. If the transmitted data is not encrypted during the communication process, the data can easily be monitored by illegal receivers and the secrets of the transmitter can be easily revealed; and this unencrypted data is also easy to be illegally tampered with, illegal users Transmitting the tampered data again, allowing the receiver to receive the wrong information, or allowing the receiver to execute commands that should not be executed, will cause great security risks. If the transmitting end encrypts the data before it is transmitted, and the receiver decrypts it in the same way, it will be difficult for illegal users to identify the encrypted data, and it is even more impossible to tamper with the information. The way of data transmission after encryption is relatively safer than that of directly transmitting the original data without encryption.
  • encryption algorithms can be divided into symmetric encryption and asymmetric encryption.
  • the encryption and decryption keys of symmetric encryption algorithms are the same, and the encryption key and decryption key of asymmetric encryption algorithms are different.
  • many encryption algorithms require hashing algorithms. To generate some important parameters.
  • the encryption algorithm especially in the symmetric encryption algorithm, if the same data is encrypted with the same secret key, the encrypted data must be the same, which is also easy to be cracked by illegal users. Therefore, in the current encryption algorithm, appropriately adding random numbers and the data to be encrypted are encrypted together, so even if the same data is encrypted, the encrypted data is completely different, which can improve the security of communication. If this kind of random number is a pseudo-random number, it is also not secure enough.
  • the pseudo-random number is also regular, so it is easier to crack during communication.
  • sensor circuits are also used to generate true random numbers, but most of them use the steady-state voltage value of the circuit. The voltage will only change when the circuit is noisy. This change is small and requires resolution. A very high ADC will change the output, and the output change will be very small, and this kind of solution requires high ADC resolution, the price will be relatively increased, and it is difficult to integrate this high in processing. Resolution ADC. Therefore, there is an urgent need for a solution dedicated to the processor to generate true random numbers.
  • the randomness of the existing true random number generator mainly comes from the entropy source circuit.
  • the structure of the existing true random number generator can be divided into the following three types:
  • Figure 3 is a schematic diagram of the structure of a true random number generator based on the structure of thermal noise and comparator in the prior art.
  • the dashed box in the figure is the entropy source Circuit.
  • the true random number generator is based on a noise-based structure, which amplifies the thermal noise of the resistor, and then generates a random sequence through a comparator to realize a true random number, which is generally achieved by building an analog circuit.
  • the frequency detection structure based on oscillator clock jitter is a schematic diagram of the structure of a true random number generator based on the frequency detection structure of oscillator clock jitter in the prior art.
  • the dotted box in the figure is Entropy source circuit.
  • the true random number generator is based on the structure of frequency detection. It uses a standard clock sampling oscillator. The frequency of the oscillator is much higher than the sampling clock. The jitter information of the sampling clock and the oscillator is collected through the register to generate a random sequence. True random number, which is widely used in FPGA or custom chips.
  • ADC-based residual recycling structure which is also called chaotic mapping, as shown in Figure 5, which is a schematic diagram of a true random number generator based on the ADC-based residual recycling structure in the prior art ,
  • the entropy source circuit is in the dotted box in the figure.
  • the true random number generator is based on the chaotic mapping structure of the ADC. It uses the ADC to convert the input signal, and uses the DAC to convert the digital signal output by the ADC into an analog signal, and then uses the input signal to subtract the analog signal to obtain the residual signal.
  • This residual signal has the non-linear characteristics of ADC and DAC, so it has randomness.
  • the residual signal is amplified to the same voltage range as the input signal by an amplifier, and then input to the next-stage ADC to realize the residual recycle.
  • this structure can generally only be implemented with a customized chip.
  • a true random number generator based on thermal noise and comparators collects resistance thermal noise through comparators and generates random sequences. If an amplifier is not added to the circuit, the noise voltage can hardly meet the requirements of the comparator for the dynamic range of the input signal. While using an amplifier to amplify noise, a high-gain and high-bandwidth amplifier is required to provide white noise for the comparator, which will increase the cost and power consumption of the system.
  • the true random number generator based on the oscillator frequency detection structure collects clock jitter noise through registers to generate true random numbers. This is a commonly used method to realize true random numbers. Very suitable for use in FPGA, or use custom chip implementation. However, using a dedicated true random number generator chip has high power consumption and high cost, and increases the design complexity and volume of the system. Directly using FPGA internal logic to implement the oscillator will also bring high power consumption and require a large number of inverters to improve the jitter of the oscillator circuit, which will take up a lot of FPGA logic resources.
  • a true random number generator based on the ADC-based residual recurring structure uses the ADC's quantization error as the next input signal. After multiple iterations, the random number output by the ADC presents completely different characteristics, and the ADC output is used to generate True random number.
  • This structure conforms to the nature of chaotic mapping, that is, small changes in the input signal will lead to completely different output results. Therefore, the method of generating true random numbers based on the structure of ADC nonlinear chaotic mapping has been widely recognized.
  • this structure using residuals is only suitable for custom chips or needs to be implemented by adding complex circuits, which increases the design complexity of the system, and its versatility is not strong.
  • the purpose of the present invention is to overcome the shortcomings of the prior art, and provide an MCU that converts the output of the bridge through an amplifier and then converts its output by the ADC.
  • the working mode is flexible and can meet various application scenarios of the communication system.
  • the present invention also provides a device that can be implemented using a customized dedicated chip or a traditional processor with built-in ADC, and can be implemented without adding any other circuits, modules, or devices in devices that need to implement sensor functions.
  • a true random number generator based on ADC non-linear effect chaotic mapping and an implementation method for generating true random numbers can be realized only by software.
  • a true random number generator for MCU to convert bridge voltage at random intervals including MCU, bridge module and amplifier, said MCU including application module, random number generation module and ADC module;
  • the power supply VCC is connected to the bridge module and the amplifier through the switch SW, the output end of the bridge module is connected to the amplifier, the output end of the amplifier is connected to the ADC module, the ADC module is connected to the random number generator, and the random number generator is connected to the application module
  • the application module is used to provide the random number digits and the true random number level to the random number generation module, and enable the random number generation module;
  • the random number generating module is used to control the ADC module to convert the analog voltage into a digital signal under the control of the application module, thereby generating a true random number.
  • the bridge module adopts a Wheatstone bridge, including resistors R1, R2, R3, R4, and resistors R1, R2, R3, R4 are connected end to end to form a square circuit; wherein, a set of vertices opposite to the square circuit are connected to each other.
  • the switch SW is connected to the ground terminal; the other set of opposite vertices are respectively connected to the two input terminals of the amplifier.
  • any one of the resistors is a sliding rheostat, and the remaining three resistors are ordinary resistors.
  • the output terminal of the amplifier is grounded through a capacitor C.
  • the present invention also provides a method for generating true random numbers for MCU to convert bridge voltage at random intervals, which includes the following steps:
  • the application module provides random number digits and true random number level to the random number generation module, and enables the random number generation module;
  • the ADC module starts to convert the output voltage of the amplifier, and generates a random number from the sampling value of the ADC according to the random number level;
  • the present invention also provides a true random number generator based on ADC nonlinear effect chaotic mapping, including a processor and a sensor, the processor includes a true random number controller, an ADC, and a memory; the processor is a built-in ADC The power supply VCC is respectively connected to the sensor and the processor through a linear regulator, the output terminal of the sensor is connected to the ADC, the ADC is connected to the true random number controller, and the true The random number controller is also connected to the memory; wherein the processor internally controls the sampling times and sampling time of the ADC through the true random number controller, and generates a true random number according to the output data of the ADC, The true random number is stored in the memory; the sampling times and sampling time of the ADC are determined according to the sensing information collected by the sensor.
  • the processor and the sensor are connected through an amplifier, and the amplifier is used to improve the signal-to-noise ratio of the output signal of the sensor.
  • the amplifier and the processor are connected through a passive filter, and the passive filter is used to optimize the signal-to-noise ratio of the sensor output signal and buffer the output of the amplifier.
  • the passive filter includes a resistor R, a capacitor C1, a capacitor C2, and an inductor L; one end of the capacitor C1 is connected to the output end of the amplifier, and the other end of the capacitor C1 is connected to the resistor R One end is connected, the other end of the resistor R is respectively connected to one end of the inductor L, one end of the capacitor C2 and the ADC, and the other end of the resistor L and the other end of the capacitor C2 are both grounded.
  • the passive filter is a low-pass, band-pass or high-pass filter.
  • the power supply VCC is respectively connected to the processor through a linear regulator LDO1, and the true random number controller is enabled through the linear regulator LDO2.
  • the present invention also provides an implementation method for generating true random numbers, which is applied to the above-mentioned true random number generator based on ADC nonlinear effect chaotic mapping, and includes the following steps:
  • the true random number controller calculates the number of true random numbers C that need to be continuously generated according to the sampling times, the number of random numbers, and the true random number level, and turns on the power switch of the sensor;
  • S2 Generate an initial delay based on the true random number in the true random number storage area of the memory.
  • the ADC converts the input voltage. After the conversion is completed once, the number of ADC conversions M is reduced by 1, and then according to the random number level, After generating a random number from the output data of the ADC, judge whether the M is 0;
  • S5 Determine whether C is 0. If it is not 0, continue to open the switch to generate M-bit true random numbers; if C is 0, send the generated true random numbers.
  • S1 the external application module generates and sends the required sampling times, the number of random numbers, and the true random number level to the true random number controller, and enables the true random number control Device.
  • the output signal of the ADC is a digital signal.
  • sending the generated true random number includes: sending the generated true random number to an external application module.
  • processor and the sensor are connected through an amplifier
  • the turning on the power supply switch of the sensor includes: turning on the power supply switch of the sensor and the amplifier;
  • Said turning off the power of the sensor includes: turning off the power of the sensor and the amplifier;
  • the ADC converting the input voltage includes converting the voltage output by the amplifier by the ADC, and the voltage output by the amplifier is the input voltage of the ADC.
  • the mechanism of the present invention that uses ADC to convert the dynamic change process of entropy source, the change process can be continuous rise or continuous fall, and the conversion interval is random; the present invention passes the output of the bridge through the amplifier, and then the ADC The output is converted. During the ADC conversion, the conversion interval is random, and the random method can be controlled.
  • the size of the true random number digits can be controlled by the application module, and its working mode is quite flexible, which can meet various application scenarios of the communication system and encryption algorithms that require various random number widths.
  • the true random number generator based on the chaotic mapping of ADC nonlinear effects and the method for generating true random numbers proposed in the present invention include a processor and a sensor, and the processor includes a true random number controller, an ADC and a memory; the processing
  • the power supply VCC is a processor chip with the built-in ADC.
  • the power supply VCC is connected to the sensor and the processor through a linear regulator.
  • the output terminal of the sensor is connected to the ADC.
  • the ADC is controlled by the true random number.
  • the true random number controller is also connected to the memory; wherein the processor internally controls the sampling times and sampling time of the ADC through the true random number controller, and according to the output of the ADC
  • the data generates a true random number, and the true random number is stored in the memory; the sampling times and sampling time of the ADC are determined according to the sensing information collected by the sensor.
  • the true random number generator based on the chaotic mapping of the ADC nonlinear effect and the implementation method for generating true random numbers can be implemented using a customized dedicated chip or a traditional processor (built-in ADC). In a functional device, a true random number generator can be realized only through software without adding any other circuits, modules, or devices.
  • the method has a flexible working mode and can meet the requirements of various application scenarios of the communication system and the encryption algorithm that requires various random number digits.
  • the solution is simple and easy to implement, low cost, low power consumption, and small in size, which is very suitable for use in wireless sensor network nodes.
  • data needs to be encrypted, and fixed encryption algorithms are easily intercepted and cracked. Therefore, adding true random numbers to the encryption algorithms in wireless sensor network nodes will Greatly improve the security of wireless sensor network communication.
  • FIG. 1 is a schematic diagram of the structure of a true random number generator for MCU to convert bridge voltage at random intervals of the present invention
  • FIG. 2 is a flow chart of the method for generating true random numbers for the MCU to convert the bridge voltage at random intervals of the present invention
  • FIG. 3 is a schematic diagram of the structure of a true random number generator based on thermal noise and a comparator structure in the prior art
  • FIG. 4 is a schematic structural diagram of a true random number generator based on a frequency detection structure of oscillator clock jitter in the prior art
  • FIG. 5 is a schematic structural diagram of a true random number generator based on the ADC-based residual recycling structure in the prior art
  • FIG. 6 is a theoretical model diagram of the true random number generated by the ADC of the true random number generator based on the ADC nonlinear effect chaotic mapping of the present invention
  • Fig. 7 is a simulation result diagram of the sensitivity of the system of the true random number generator based on the chaotic mapping of the ADC nonlinear effect to the initial delay of the present invention
  • FIG. 8 is a schematic diagram of the overall structure of the true random number generator based on the chaotic mapping of the ADC nonlinear effect of the present invention.
  • Figure 9 is a flow chart of the method for generating true random numbers according to the present invention.
  • the invention adopts a general circuit (no need to use a special true random number generator chip) to realize a true random number generator with high cost performance.
  • the present invention adopts a component with ADC (it can be a single-chip microcomputer, ARM, DSP, FPGA, etc., all embedded ADC devices, of course, can also be added with a dedicated ADC chip, but it is not recommended to use an external dedicated ADC chip, which will increase the cost.
  • this invention can generate true random numbers through a few peripheral circuits and with the ADC module inside the chip. This kind of random number cannot be copied and can be used in applications such as encryption algorithms and anti-collision algorithms.
  • the random numbers generated by this scheme are close to the characteristics of true random numbers, so it can greatly increase the security of encryption algorithms and prevent encrypted data from being cracked; it can also be used in anti-collision systems, which can effectively reduce the anti-collision generated by pseudo-random numbers.
  • the collision problem caused by the collision parameter Since most terminal nodes of the Internet of Things in the future need to have the function of sensors, these terminal nodes with sensor functions will almost all have ADC modules. Therefore, in this application, no additional ADC is needed. Generating true random numbers can greatly reduce system overhead and product area.
  • a true random number generator for MCU to convert bridge voltage at random intervals of the present invention As shown in Figure 1, a true random number generator for MCU to convert bridge voltage at random intervals of the present invention.
  • the main control part is implemented inside the MCU through an application module and a random number generation module.
  • the external bridge and amplifier circuit Provide a source of entropy.
  • the ADC in the single-chip microcomputer is used to convert the analog voltage output by the amplifier; the random number generation module in the single-chip microcomputer controls the ADC to convert the analog voltage into a digital signal under the control of the application module, thereby generating a true random number.
  • it includes an MCU, a bridge module, and an amplifier.
  • the MCU includes an application module, a random number generation module, and an ADC module; the power supply VCC is connected to the bridge module and the amplifier through the switch SW, and the output end of the bridge module is connected to the amplifier.
  • the output terminal is connected to the ADC module, the ADC module is connected to the random number generator, and the random number generator is connected to the application module;
  • the application module is used to provide the random number digits and the true random number level to the random number generation module, and enable the random number generation module;
  • the random number generating module is used to control the ADC module to convert the analog voltage into a digital signal under the control of the application module, thereby generating a true random number.
  • the bridge module adopts a Wheatstone bridge, including resistors R1, R2, R3, R4, and resistors R1, R2, R3, R4 are connected end to end to form a square circuit; wherein, a set of vertices opposite to the square circuit are connected to each other.
  • the switch SW is connected to the ground terminal; the other set of opposite vertices are respectively connected to the two input terminals of the amplifier.
  • any one of the resistors is a sliding rheostat, and the other three resistors are ordinary resistors. You can choose any one of R1, R2, R3, R4 to replace the ordinary resistor with a sliding rheostat, so that Adjust the bridge to the balanced position.
  • the output of the bridge passes through the amplifier AMP with a large amplification factor.
  • the amplifier can amplify the noise brought by the bridge circuit, resulting in a large change in the output, so that the data collected by the ADC has a large change, but you need to pay attention to not let the amplifier saturate. It is necessary to balance the amplification factor and the bridge output voltage.
  • the bridge output A terminal voltage can be adjusted to be slightly larger than the B terminal voltage, which can be about 10mV, so that the amplifier works normally and the amplifier amplifies The multiple can reach 100 times; if the bridge output voltage at terminal A is much larger than the voltage at terminal B, such as 100mV, then the amplifier can only amplify 10-20 times and it will saturate (the specific multiple depends on the power supply voltage), which makes the amplifier The output always tends to the power supply voltage, which causes the amplifier output to become stable, and the output voltage change is very small.
  • the output terminal of the amplifier is grounded through a capacitor C.
  • the capacitor C is used to buffer the output of the amplifier to ensure that after the MCU turns on the SW, the amplifier output has a rise time, which can ensure that the amplifier output is still rising after the ADC performs multiple conversions, so that the last few bits of the ADC output change very much. Large (these bits can be used to generate true random numbers), which can reduce the number of ADC conversions.
  • the ADC converts the voltage value after a pure resistor divider (not just the voltage rise process), the voltage change is completely dependent on the noise of the circuit, and if the circuit noise is small (large circuit noise may affect the performance of other modules in the system), the voltage changes It is very small, so every time the ADC converts the voltage, only the last 1-2 digits of the output digital data may change, or only the last digit may change occasionally, so the random number generated is not very random. And if the application module needs a 32-bit random number, it needs ADC conversion 32 times (the lowest bit of each time is taken to form a 32-bit true random number), so the efficiency of the random number generation module is very low. If the ADC accuracy is not high enough, the ADC may not be able to distinguish the input voltage change, then the digital data output by the ADC may not change, and the random numbers generated by such a circuit cannot be used.
  • the random number generation module After the random number generation module starts to work, first configure the working mode of the ADC, then turn on the SW, and then start to continuously convert the voltage value output by the amplifier.
  • the number of continuous conversions can be controlled by the application module. Since the switch has just been turned on, the bridge output is extremely unbalanced and the noise is very high, so it will also bring uncertainty to the amplifier output.
  • the ADC After turning on the switch, the ADC starts to convert the amplifier output voltage value. At this time, due to the capacitor C, the amplifier output needs to charge C. Therefore, it takes a process for the amplifier output to stabilize.
  • the size of the capacitor C can be determined by the sampling rate of the ADC and the application module.
  • the choice is based on how long the random number bit stream is required by the application module (the ADC may need to be collected multiple times) to ensure that C will not be filled before the last conversion of the ADC. In this way, when the amplifier output voltage value is converted, the amplifier output is continuously rising. If the amplifier output is not rising, but has stabilized, then the data collected by the ADC may not change, or the change is small, only the last 1- 2 is changing. Therefore, the ADC continuously converts multiple times to obtain multiple random numbers, and the value of these random numbers gradually increases because the output voltage of the amplifier is in a rising mode.
  • the present invention also provides a method for generating true random numbers for MCU to convert bridge voltage at random intervals, including the following steps:
  • the application module provides random number digits and true random number level to the random number generation module, and enables the random number generation module;
  • S2 Random Number Generation Module Calculate the number N of conversions required by the ADC module, and turn on the power switch SW of the bridge and amplifier;
  • the ADC module starts to convert the output voltage of the amplifier, and generates a random number from the sampling value of the ADC according to the random number level;
  • the ADC output is limited, generally 8-16bits, but the application module may require higher bits such as 32bits or 64bits, so the value used by the ADC can only be Part of the random number;
  • the high bits of the ADC output data are not very random (if the ADC is 12 bits, if the input does not change much, the high 4 bits of the ADC sampled value may be almost unchanged), so you need to consider only choosing
  • the lower bits of the ADC are used as part of the random number (the lower bits are determined by the random number level, if the random number level is the highest, only the last digit is taken, and the last digit is the highest random number).
  • the splicing method is also random and can be variable. For example, if the application module requires 32 bits and the random number level is 0 (as long as the lowest bit of the ADC), then the ADC needs to collect 32 times, and each time the last one is taken Bits, put these 32 bits together to form a 32-bit random number.
  • the first collection The received one is placed in the last digit of the 32-bit random number, and the last collected one is placed in the highest digit, or vice versa. As long as the random numbers are randomly collected each time, no matter how to splice, the result is also random.
  • the random number level here can be defined by the user.
  • the random number level can be determined by an arbitrary number. If it is a 4bits number, its Values from 0-15 respectively represent extracting the 0th to 15th bits of the least significant bit of the ADC as part of the random number. For example, if the number of bits in the random number is 32 and the level of random number is 3, then the ADC needs to collect 8 times, and each time the 0th to 3rd bits collected by the ADC (the 4 least significant bits) are taken as part of the random number, then The 8 random numbers are spliced together and sent to the application module.
  • the technical scheme of the present invention is that the bridge output passes through an amplifier with a large amplification factor, and then the ADC converts its output.
  • the conversion interval is random, and the random mode can be controlled.
  • the size of the true random number digits can also be controlled by the application module, and its working mode is quite flexible, which can meet various application scenarios of the communication system and encryption algorithms that require various random number widths.
  • it is necessary to encrypt data, and fixed encryption algorithms are easily intercepted and cracked.
  • the present invention adopts a universal circuit structure to realize a high cost-effective true random number generator. It can be realized by using a dedicated chip or in a general-purpose processor embedded with ADC.
  • the processor can be a single-chip microcomputer, ARM, DSP , FPGA (configuration can realize the function of the processor) and all processors with embedded ADC.
  • This kind of true random number generator can generate non-copyable random numbers, thereby improving the security performance of the encryption algorithm and preventing encrypted data from being cracked.
  • this method based on the traditional embedded ADC processor to achieve true random numbers is universal and can It is perfectly compatible with this type of sensing equipment, and can directly use the sensor circuit as an entropy source without adding additional circuits, which can greatly save system costs, effectively reduce product complexity and product volume, and reduce system power consumption.
  • the amplifier module is used to amplify the input signal and increase the randomness of the input signal; the filter is used to optimize the signal output by the amplifier (mainly used in sensor equipment to improve the signal-to-noise ratio); the initial delay is used to select the first time of the input signal The sampling moment; the random interval delay module delays according to the ADC output signal (unit is the clock cycle of the processor), which can bring the noise of the entropy source circuit and the quantization noise of the ADC into the delay function, and change the sampling position of the next ADC.
  • the save module is used to save the digital signal output by the ADC
  • the sampling frequency module is used to determine the number of sampling (according to the number of bits M to generate a random number to determine the number of acquisitions) and when to end sampling
  • Post-processing module can improve the randomness of the system and provide the robustness of the system.
  • the continuation module is used to determine how many M-bit random numbers need to be generated. For the model shown in Figure 6, according to the following formula, we can get its chaotic mapping function and provide a theoretical basis for its realization of a true random number generator.
  • DADC represents the digital output signal after ADC conversion
  • ADC( ⁇ ) represents the ADC conversion function
  • Vcc is the reference voltage of the ADC
  • Vin represents the input voltage of the ADC.
  • Formula (1) is the working principle of the traditional ADC, and the random interval sampling mechanism proposed by the present invention adds some new parameters, which we use the following mapping to represent.
  • V n+1 M(V n ) (2)
  • M( ⁇ ) represents the chaotic mapping from ADC input to output
  • Vn represents the input signal of the chaotic mapping
  • Vn+1 represents the output signal of the chaotic mapping.
  • the unit time of the initial delay and the random interval delay in Figure 6 is the period of the working clock of the processor (here taking the simplest MCU as an example).
  • the initial delay time is determined by the true random number RNtrue generated last time, and its calculation formula as follows
  • t0 represents the initial delay time
  • f MCU represents the operating frequency of the MCU
  • & represents the bitwise AND
  • const1 represents a constant.
  • const2 represents a constant
  • V in K*t+N in (5)
  • N in represents interference signals such as thermal noise and power supply noise in the circuit
  • K represents the slope of Vin (Vin will increase from 0 after SW is turned off).
  • V amp A*K*t+N noise (6)
  • A represents the amplifier gain (amplification factor)
  • N noise represents the total noise in the output signal of the AMP (amplifier)
  • Vamp is connected to the analog input of the ADC in the MCU.
  • Vsat represents the highest voltage that the amplifier output can reach.
  • mapping relationship between VADC voltage and ADC sampling times is as follows:
  • tsample is the time required for the ADC to perform analog-to-digital conversion, which can be calculated by the sampling frequency f sample of the ADC embedded in the MCU.
  • tproc represents the time required by the MCU to process data after each sampling, and this time is determined by the working frequency f MCU of the MCU . If it is assumed that the MCU processing data consumes 8 clocks, the final representation of the chaotic map can be proposed:
  • the present invention provides a true random number generator based on ADC nonlinear effect chaotic mapping, including a processor and a sensor, the processor includes a true random number controller, an ADC and a memory; the processor is a built-in ADC The processor chip, the power supply VCC is respectively connected to the sensor and the processor through a linear regulator, the output end of the sensor is connected to the ADC, and the ADC is connected to the true random number controller.
  • the number controller is also connected to the memory; wherein the processor internally controls the sampling times and sampling time of the ADC through the true random number controller, and generates true random numbers according to the output data of the ADC, and
  • the true random number is stored in the memory; the sampling times and sampling time of the ADC are determined according to the sensing information collected by the sensor.
  • the processor and the sensor are connected through an amplifier, and the amplifier is used to improve the signal-to-noise ratio of the output signal of the sensor.
  • the amplifier and the processor are connected through a passive filter, and the passive filter is used to optimize the signal-to-noise ratio of the sensor output signal and buffer the output of the amplifier.
  • the passive filter includes a resistor R, a capacitor C1, a capacitor C2, and an inductor L; one end of the capacitor C1 is connected to the output end of the amplifier, and the other end of the capacitor C1 is connected to the resistor R One end is connected, the other end of the resistor R is respectively connected to one end of the inductor L, one end of the capacitor C2 and the ADC, and the other end of the resistor L and the other end of the capacitor C2 are both grounded.
  • the passive filter is a low-pass, band-pass or high-pass filter.
  • the power supply VCC is respectively connected to the processor through a linear regulator LDO1, and the true random number controller is enabled through the linear regulator LDO2.
  • An embodiment of the present invention provides a true random number generator that is fully compatible with sensing equipment. Its overall structure is shown in FIG. 8, which is the overall structure of the true random number generator based on the chaotic mapping of the ADC nonlinear effect. Schematic. This structure directly uses the sensor as the source of entropy without adding any other circuits and devices, and there is no need to add ADC modules specifically, which can greatly save costs and reduce the cost of adding external circuits, devices, ADC modules, etc. Disadvantages of increased equipment volume.
  • the processor can be any MCU, DSP, ARM, FPGA (described as a processor structure) and other processor chips with built-in ADCs.
  • the processor controls the sampling times and sampling time of the ADC through a true random number controller, and generates a true random number according to the ADC output data and saves it in the memory.
  • the sensor is used to collect sensing information.
  • the main function of the amplifier is to improve the signal-to-noise ratio of the sensor output signal.
  • the amplifier is not a necessary circuit for a true random number generator.
  • C1, R, L, C2 form a general passive filter structure.
  • the passive filter can be configured as low-pass, band-pass and high-pass filters to optimize the signal noise of the sensor output signal Ratio to achieve sensor output signal detection.
  • the filter can also be used to buffer the output of the amplifier to ensure that after the MCU controls and switch on the SW, the amplifier output has a rise time (not instantaneously saturated), so as to ensure that the amplifier output remains at the same level after the ADC performs multiple conversions In the rising phase, the last few bits of the ADC output data have great changes (these bits can be used to generate true random numbers), which can reduce the number of ADC conversions and increase the rate at which the true random number generator generates true random numbers.
  • the present invention also proposes a A software implementation method specifically used to generate true random numbers, realizes ADC conversion of continuously changing input analog voltage signals to generate true random numbers, and realizes ADC sampling at random intervals. Since the ADC has a fixed resolution, most of the embedded ADC modules have a resolution less than 16 bits. If the application module requires a true random number far exceeding 16 bits, the ADC needs to perform multiple conversions.
  • the true random number controller in Figure 8 is the control core of the true random number generator, which can be selected to generate different levels of true random numbers according to different application scenarios.
  • FIG. 9 it is a flowchart of the implementation method of generating true random numbers of the present invention.
  • the process performed by the random number generation module is shown in Figure 9, where the dashed box is a true random number controller.
  • the present invention provides an implementation method for generating true random numbers, which is applied to the above-mentioned true random number generator based on ADC nonlinear effect chaotic mapping, and includes the following steps:
  • the true random number controller calculates the number of true random numbers C that need to be continuously generated according to the sampling times, the number of random numbers, and the true random number level, and turns on the power switch of the sensor;
  • S2 Generate an initial delay based on the true random number in the true random number storage area of the memory.
  • the ADC converts the input voltage. After the conversion is completed once, the number of ADC conversions M is reduced by 1, and then according to the random number level, After generating a random number from the output data of the ADC, judge whether the M is 0;
  • S5 Determine whether C is 0. If it is not 0, continue to open the switch to generate M-bit true random numbers; if C is 0, send the generated true random numbers.
  • S1 the external application module generates and sends the required sampling times, the number of random numbers, and the true random number level to the true random number controller, and enables the true random number control Device.
  • the output signal of the ADC is a digital signal.
  • sending the generated true random number includes: sending the generated true random number to an external application module.
  • processor and the sensor are connected through an amplifier
  • the turning on the power supply switch of the sensor includes: turning on the power supply switch of the sensor and the amplifier;
  • Said turning off the power of the sensor includes: turning off the power of the sensor and the amplifier;
  • the ADC converting the input voltage includes converting the voltage output by the amplifier by the ADC, and the voltage output by the amplifier is the input voltage of the ADC.
  • an application module generates the required number of random number digits, sampling times, and true random number level, and then sends them to the true random number controller, and enables true random numbers Controller.
  • the true random number controller calculates how many M-bit true random numbers need to be continuously generated according to the number of random number digits, sampling times, and true random number level, which is represented by C, and then turns on the power supply switch of the sensor and amplifier (entropy source).
  • An initial delay is generated according to the true random number in the true random number storage area, and then the ADC starts to convert the voltage output by the amplifier.
  • the ADC output is a digital signal.
  • the number of ADC conversions M is reduced by 1, and then according to the random number level , Generate a random number from the output data of the ADC, and then determine whether M is 0, if it is 0, save the generated true random number to the true random number storage area, and turn off the sensor and amplifier power; if M is not 0, according to The last ADC output achieves a random delay.
  • the ADC continues to convert the input voltage, and continues to decrease M after the conversion is completed; then continue to determine whether M is 0, and determine whether the ADC performs the next conversion until M is 0. Then judge whether C is 0. If it is not 0, continue to open the switch and generate M-bit true random numbers; if C is 0, send the generated true random numbers to the application module and end.
  • Figure 10 shows the true random number generation process with the random number level divided into 0-3 and the random number M is 16 bits. If the random number level is 0, the ADC needs to collect 16 times, and each time the least significant bit (bit 0) of the ADC output data is used to generate a true random number.
  • FIG. 10(a) The corresponding relationship between the ADC output data and the true random number is shown in Figure 10(a) As shown, it can be seen from the figure that only the 0th bit is used to generate a true random number, and the other 1 to 11 bits are discarded.
  • the random number level is 1, 2 and 3
  • the ADC output data and the true random number generation method are shown in Figure 10(b), Figure 10(c) and Figure 10(d) respectively.
  • RN_level 0 in Fig. 10(a)
  • RN_level 1 in Fig. 10(b)
  • RN_level 2 in Fig. 10(c)
  • RN_level 3 in Fig. 10(d).
  • Using multiple bits of ADC output to generate true random numbers will degrade the quality of true random numbers to a certain extent. However, this can increase the rate of true random number generation, especially when the quality of true random numbers is not very high.
  • the implementation method for generating true random numbers can be implemented using a customized dedicated chip, or can be implemented using a traditional processor (built-in ADC), and can be implemented in devices that need to implement sensor functions Without adding any other circuits, modules, or devices, a true random number generator can be realized only by software.
  • the method has a flexible working mode and can meet the requirements of various application scenarios of the communication system and the encryption algorithm that requires various random number digits.
  • the solution is simple and easy to implement, low cost, low power consumption, and small in size, which is very suitable for use in wireless sensor network nodes.
  • data needs to be encrypted, and fixed encryption algorithms are easily intercepted and cracked. Therefore, adding true random numbers to the encryption algorithms in wireless sensor network nodes will Greatly improve the security of wireless sensor network communication.
  • An implementation method for generating true random numbers proposes a method of using ADC output data to generate random delays; using a random interval delay sampling mechanism to generate true random numbers; using a controllable analog circuit to provide ADCs Dynamic input signals to improve the randomness of ADC output data; and combining the above three methods to achieve true random numbers in traditional processors or custom chips.
  • the realization method of generating true random numbers proposes a set of true random number generation mechanism with dynamically changeable random number digits and random number level provided by the application, which can generate any number of true random numbers and flexible settings according to different applications True random number generation rate.
  • the specific usage plan of the application program can be determined according to the application scenario.
  • the number of true random number and the level of true random number are not limited to the above examples, and can be any expression.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Analogue/Digital Conversion (AREA)
  • Amplifiers (AREA)

Abstract

Disclosed in the present invention are a truly random number generator and a truly random number generation method for conversion of a bridge voltage at random intervals in an MCU, comprising an MCU, a bridge module, and an amplifier, the MCU comprising an application module, a random number generation module, and an ADC module. A power supply VCC is separately connected to the bridge module and the amplifier by means of a switch SW, an output terminal of the bridge module is connected to the amplifier, an output terminal of the amplifier is connected to the ADC module, the ADC module is connected to the random number generator, and the random number generator is connected to the application module. In the present invention, an output of a bridge passes through an amplifier, and then the output thereof is converted by an ADC. The bit length of a truly random number can be controlled by means of an application module, and the working mode thereof is relatively flexible, able to be used in various use scenarios for communications systems, and in encryption algorithms requiring various random number bit lengths. Further disclosed in the present invention are a truly random number generator and an implementation method for generating truly random numbers, based on ADC nonlinear effect chaotic mapping.

Description

MCU随机间隔转换电桥电压的真随机数产生器及产生方法True random number generator and generation method for MCU to convert bridge voltage at random intervals 技术领域Technical field
本发明涉及一种MCU随机间隔转换电桥电压的真随机数产生器及产生方法、以及一种基于ADC非线性效应混沌映射的真随机数产生器和产生真随机数的实现方法。The invention relates to a true random number generator and a generation method for MCU to convert bridge voltage at random intervals, as well as a true random number generator based on the chaotic mapping of ADC nonlinear effects and an implementation method for generating true random numbers.
背景技术Background technique
近年来,随着通信技术的不断发展,特别是如今马上进入5G时代,通信速率越来越高,通信质量越来越好,这些以前人们普遍关注的问题现在已经变得越来越不被人们重视了。现在,人们已经转移了其关注的重点,他们不再着重关注通信系统的通信速度或者通信质量,他们现在关注的重点是通信信息安全与否。别是在如今信息时代,信息的安全与否直接影响到国家、企业以及个人的利益,因为,21世纪是信息的时代,在各个领域的竞争中,谁掌握了信息,谁就掌握了在竞争中的主动权。信息的安全与否直接影响到国家、企业以及每个人的利益,因此,确保通信信息的安全显得尤为重要。In recent years, with the continuous development of communication technology, especially now entering the 5G era, the communication speed is getting higher and higher, and the communication quality is getting better and better. These issues that people were generally concerned about have now become less and less popular. Take it seriously. Now, people have shifted their focus. They no longer focus on the communication speed or communication quality of the communication system. They now focus on the security of communication information. In today's information age, the security of information directly affects the interests of the country, enterprises and individuals, because the 21st century is the age of information. In the competition in various fields, whoever has the information will control the competition. Initiative in. The safety of information directly affects the interests of the country, enterprises and everyone. Therefore, it is particularly important to ensure the safety of communication information.
为了保障通信质量,通信系统的发射端,在发射数据之前必须要将通信数据进行加密,然后接收端对接收到的加密数据进行解密。如果在通信的过程中不先对传输的数据进行加密,那么数据很容易被非法接收者监听,很容易泄露发射端的秘密;并且这种未经加密的数据很也很容易被非法篡改,非法用户将篡改后的数据再发射出去,让接收者接收到错误的信息,或者让接收者执行不应该执行的命令,这会造成很大的安全隐患。如果发射端在数据被发射之前,对数据进行加密,接收者通过相同的方式来进行解密,非法用户就很难识别这种加密后的数据,并且就更加不能篡改信息,这种把要发射的数据加密后再传输的方式比不加密直接发射原始数据相对安全的多。In order to ensure communication quality, the transmitting end of the communication system must encrypt the communication data before transmitting the data, and then the receiving end decrypts the received encrypted data. If the transmitted data is not encrypted during the communication process, the data can easily be monitored by illegal receivers and the secrets of the transmitter can be easily revealed; and this unencrypted data is also easy to be illegally tampered with, illegal users Transmitting the tampered data again, allowing the receiver to receive the wrong information, or allowing the receiver to execute commands that should not be executed, will cause great security risks. If the transmitting end encrypts the data before it is transmitted, and the receiver decrypts it in the same way, it will be difficult for illegal users to identify the encrypted data, and it is even more impossible to tamper with the information. The way of data transmission after encryption is relatively safer than that of directly transmitting the original data without encryption.
目前,加密算法可以分为对称加密和非对称加密,其中对称加密算法的加密与解密密钥相同,非对称加密算法的加密密钥与解密密钥不同,此外,很多加密算法都需要散列算法来产生一些重要的参数。在加密算法中,特别是在对称加密算法中,如果对同样的数据用同一个秘钥加密,那么得到加密后的数据肯定是一样的,这样也容易被非法用户破解。因此,现在加密算法中,适当添加随机数和待加密的数据一起被加密,那么即使加密同样的数据,但加密后的数据也完全不一样,能够提高通信的安全性。如果这种随机数是伪随机数,也一样是不够安全的,伪随机数也是有规律可言的,因此在通信的时候也较易被破解。在数字处理器中,也有使用传感器电路产生真随机数,但大部分是使用电路稳态的电压值,电压只会在电路有噪声的情况才会产生变化,这种变化很小,需要分辨率很高的ADC来转换,输出才会有变化,并且输出变化也很小,而且这种方案对ADC的分辨率要求很高,价格也就相对会增加,并且处理中也很难集成这种高分辨率的ADC。因此,急需一种专门用于处理器 产生真随机数的解决方案。At present, encryption algorithms can be divided into symmetric encryption and asymmetric encryption. The encryption and decryption keys of symmetric encryption algorithms are the same, and the encryption key and decryption key of asymmetric encryption algorithms are different. In addition, many encryption algorithms require hashing algorithms. To generate some important parameters. In the encryption algorithm, especially in the symmetric encryption algorithm, if the same data is encrypted with the same secret key, the encrypted data must be the same, which is also easy to be cracked by illegal users. Therefore, in the current encryption algorithm, appropriately adding random numbers and the data to be encrypted are encrypted together, so even if the same data is encrypted, the encrypted data is completely different, which can improve the security of communication. If this kind of random number is a pseudo-random number, it is also not secure enough. The pseudo-random number is also regular, so it is easier to crack during communication. In digital processors, sensor circuits are also used to generate true random numbers, but most of them use the steady-state voltage value of the circuit. The voltage will only change when the circuit is noisy. This change is small and requires resolution. A very high ADC will change the output, and the output change will be very small, and this kind of solution requires high ADC resolution, the price will be relatively increased, and it is difficult to integrate this high in processing. Resolution ADC. Therefore, there is an urgent need for a solution dedicated to the processor to generate true random numbers.
现有的真随机数产生器,大部分人都致力于研究采用FPGA来实现,并且绝大部分的研究者都采用奇数个反相器构成振荡电路,这个振荡电路能够产生频率很高的时钟,并且不稳定,因此采用一个低频时钟来采集这种不稳定的高频时钟能够得到较随机的真随机数。在这个振荡电路中反相器越多产生的时钟越不稳定,但是反相器越多,产生的时钟频率就越低,这就会影响采集数据的随机性。也有部分研究者研究在单片机、DSP和ARM产生真随机数,但是在这些处理器中却不能使用像FPGA芯片里面使用的这种振荡电路,因为,MCU(微处理器)这种处理器都是专用芯片,只能采用软件编程的方式进行数据处理,这种方式只能产生伪随机数,然而伪随机数是很容易被破解的,因此需要采用外部电路和这些MCU联合产生真随机数。目前也有采用单片机的ADC(模数转换器)采集纯电阻分压电路的电压值来产生真随机数。Most of the existing true random number generators are dedicated to the study of FPGA implementation, and most of the researchers use an odd number of inverters to form an oscillating circuit, which can generate a high-frequency clock. And it is unstable, so using a low-frequency clock to collect this unstable high-frequency clock can get a more random true random number. In this oscillating circuit, the more inverters, the more unstable the clock generated, but the more inverters, the lower the generated clock frequency, which will affect the randomness of the collected data. There are also some researchers who study the generation of true random numbers in single-chip microcomputers, DSPs and ARMs, but these processors cannot use the oscillator circuit used in FPGA chips, because MCU (microprocessor) processors are all Special chips can only use software programming for data processing. This method can only generate pseudo-random numbers. However, pseudo-random numbers are easily cracked. Therefore, external circuits and these MCUs need to be used to jointly generate true random numbers. At present, there are also ADCs (analog-to-digital converters) of the single-chip microcomputer to collect the voltage value of the pure resistance voltage divider circuit to generate true random numbers.
现有技术的缺点是:单独的真随机数产生器芯片,首先需要购买专用的芯片,价格昂贵,并且受制于人。FPGA全数字真随机数价格更贵,并且在不需要FPGA的应用场景,且必须由单片机,DSP,ARM来实现的场景,就需要适合这些MCU的真随机数产生方案;单片机使用编程的方式实现伪随机数发生器的方案很多,但是容易被破解,不适合安全信息要求比较高的场合。目前也有采用单片机ADC转换纯电阻分压电路的电压来实现真随机数的电路结构,但是这种纯电阻结构输出电压变化范围很小,如果电路噪声较小,那么分压后得到的电压值变化就不大,并且如果ADC的精度不够高,采集到的电压值可能变化很小或者不变化,因此得到的随机数的随机性不高。The disadvantage of the prior art is that for a separate true random number generator chip, a dedicated chip needs to be purchased first, which is expensive and constrained by others. FPGA all-digital true random numbers are more expensive, and in application scenarios that do not require FPGAs and must be implemented by single-chip microcomputers, DSPs, and ARMs, a true random number generation scheme suitable for these MCUs is required; the single-chip microcomputer is implemented by programming There are many pseudo-random number generator schemes, but they are easy to crack and are not suitable for occasions with high security information requirements. At present, there is also a circuit structure that uses a single-chip ADC to convert the voltage of a pure resistance voltage divider circuit to realize a true random number, but the output voltage of this pure resistance structure has a small range. If the circuit noise is small, the voltage value obtained after the voltage division changes It is not big, and if the accuracy of the ADC is not high enough, the collected voltage value may change little or not, so the randomness of the random number obtained is not high.
现有真随机数发生器的随机性主要来自熵源电路,根据熵源电路的实现方法,可以将现有的真随机数发生器的结构分为以下三种类型:The randomness of the existing true random number generator mainly comes from the entropy source circuit. According to the realization method of the entropy source circuit, the structure of the existing true random number generator can be divided into the following three types:
1)基于热噪声和比较器的结构,如图3所示,其为现有技术中基于热噪声和比较器的结构的真随机数发生器的结构示意图,图中的虚线框内为熵源电路。该真随机数发生器是基于噪声的结构,将电阻的热噪声放大,然后通过比较器产生随机序列,从而实现真随机数,这一般是通过搭建模拟电路来实现。1) Based on the structure of thermal noise and comparator, as shown in Figure 3, which is a schematic diagram of the structure of a true random number generator based on the structure of thermal noise and comparator in the prior art. The dashed box in the figure is the entropy source Circuit. The true random number generator is based on a noise-based structure, which amplifies the thermal noise of the resistor, and then generates a random sequence through a comparator to realize a true random number, which is generally achieved by building an analog circuit.
2)基于振荡器时钟抖动的频率检测结构,如图4所示,其为现有技术中基于振荡器时钟抖动的频率检测结构的真随机数发生器的结构示意图,图中的虚线框内为熵源电路。该真随机数发生器是基于频率检测的结构,使用一个标准时钟采样振荡器,振荡器的频率比采样时钟高得多,通过寄存器收集采样时钟和振荡器的抖动信息,产生随机序列,从而实现真随机数,这在FPGA或者定制芯片中使用广泛。2) The frequency detection structure based on oscillator clock jitter, as shown in Figure 4, is a schematic diagram of the structure of a true random number generator based on the frequency detection structure of oscillator clock jitter in the prior art. The dotted box in the figure is Entropy source circuit. The true random number generator is based on the structure of frequency detection. It uses a standard clock sampling oscillator. The frequency of the oscillator is much higher than the sampling clock. The jitter information of the sampling clock and the oscillator is collected through the register to generate a random sequence. True random number, which is widely used in FPGA or custom chips.
3)基于ADC的残差循环利用结构,这种结构也被称作混沌映射,如图5所示,其为现有技术中基于ADC的残差循环利用结构的真随机数发生器的结构示意图,图中的虚线框内为熵源电路。该真随机数发生器是基于ADC的混沌映射的结构,使用ADC转换输入信号,并使用DAC将ADC输出的数字信号转换为模拟信号,然后使用输入信号减去这个模拟信号,得到残差信号。这个残差信号带有ADC和DAC的非线性特性,因此具有随 机性,使用放大器将残差信号放大至和输入信号同样的电压大小范围,并输入下一级ADC,实现残差循环利用,从而产生真随机数,这种结构一般只能使用定制的芯片实现。3) ADC-based residual recycling structure, which is also called chaotic mapping, as shown in Figure 5, which is a schematic diagram of a true random number generator based on the ADC-based residual recycling structure in the prior art , The entropy source circuit is in the dotted box in the figure. The true random number generator is based on the chaotic mapping structure of the ADC. It uses the ADC to convert the input signal, and uses the DAC to convert the digital signal output by the ADC into an analog signal, and then uses the input signal to subtract the analog signal to obtain the residual signal. This residual signal has the non-linear characteristics of ADC and DAC, so it has randomness. The residual signal is amplified to the same voltage range as the input signal by an amplifier, and then input to the next-stage ADC to realize the residual recycle. To generate true random numbers, this structure can generally only be implemented with a customized chip.
现有技术的缺点是:The disadvantages of the existing technology are:
基于热噪声和比较器的真随机数发生器,通过比较器收集电阻热噪声,并产生随机序列。如果电路中不添加放大器,噪声电压很难满足比较器对输入信号动态范围的要求。而采用放大器来放大噪声,则需要高增益高带宽的放大器为比较器提供白噪声,这将增加系统的成本和功耗。A true random number generator based on thermal noise and comparators collects resistance thermal noise through comparators and generates random sequences. If an amplifier is not added to the circuit, the noise voltage can hardly meet the requirements of the comparator for the dynamic range of the input signal. While using an amplifier to amplify noise, a high-gain and high-bandwidth amplifier is required to provide white noise for the comparator, which will increase the cost and power consumption of the system.
基于振荡器频率检测结构的真随机数发生器,通过寄存器收集时钟抖动噪声来产生真随机数,这是实现真随机数常用的方法。非常适合用在FPGA中,或者使用定制芯片实现。然而,使用专用的真随机数产生器芯片功耗高、成本高,并且增加系统的设计复杂度和体积。直接使用FPGA内部逻辑实现振荡器,同样会带来很高的功耗,并且需要大量的反相器来提高振荡电路的抖动,这会占用很多FPGA逻辑资源。The true random number generator based on the oscillator frequency detection structure collects clock jitter noise through registers to generate true random numbers. This is a commonly used method to realize true random numbers. Very suitable for use in FPGA, or use custom chip implementation. However, using a dedicated true random number generator chip has high power consumption and high cost, and increases the design complexity and volume of the system. Directly using FPGA internal logic to implement the oscillator will also bring high power consumption and require a large number of inverters to improve the jitter of the oscillator circuit, which will take up a lot of FPGA logic resources.
基于ADC的残差循环利用结构的真随机数发生器,将ADC的量化误差作为下一次的输入信号,经过多次迭代后,ADC输出的随机数呈现完全不同的特性,并使用ADC输出来生成真随机数。这种结构符合混沌映射的性质,即输入信号的微小变化将导致完全不同的输出结果。因此,基于ADC非线性混沌映射的结构产生真随机数的方法已经受到了广泛的认可。然而,这种利用残差的结构,只适合定制芯片,或者需要添加复杂的电路来实现,增加了系统的设计复杂度,其通用性不强。A true random number generator based on the ADC-based residual recurring structure uses the ADC's quantization error as the next input signal. After multiple iterations, the random number output by the ADC presents completely different characteristics, and the ADC output is used to generate True random number. This structure conforms to the nature of chaotic mapping, that is, small changes in the input signal will lead to completely different output results. Therefore, the method of generating true random numbers based on the structure of ADC nonlinear chaotic mapping has been widely recognized. However, this structure using residuals is only suitable for custom chips or needs to be implemented by adding complex circuits, which increases the design complexity of the system, and its versatility is not strong.
因此,更需要一种可使用内嵌ADC的传统处理器产生真随机数的解决方案。Therefore, there is a need for a solution that can generate true random numbers using traditional processors with embedded ADCs.
发明内容Summary of the invention
本发明的目的在于克服现有技术的不足,提供一种将电桥的输出经过放大器,然后由ADC对其输出进行转换,工作模式灵活,能够满足通信系统各种应用场景的MCU随机间隔转换电桥电压的真随机数产生器及产生方法。本发明还提供一种可以使用定制的专用芯片实现,也能够使用传统的内置ADC的处理器来实现,并且在需要实现传感器功能的设备中,能够在不添加任何其他电路、模块、器件的情况下,仅仅通过软件就能实现的基于ADC非线性效应混沌映射的真随机数产生器和产生真随机数的实现方法。The purpose of the present invention is to overcome the shortcomings of the prior art, and provide an MCU that converts the output of the bridge through an amplifier and then converts its output by the ADC. The working mode is flexible and can meet various application scenarios of the communication system. True random number generator and method for bridge voltage. The present invention also provides a device that can be implemented using a customized dedicated chip or a traditional processor with built-in ADC, and can be implemented without adding any other circuits, modules, or devices in devices that need to implement sensor functions. Next, a true random number generator based on ADC non-linear effect chaotic mapping and an implementation method for generating true random numbers can be realized only by software.
本发明的目的是通过以下技术方案来实现的:一种MCU随机间隔转换电桥电压的真随机数产生器,包括MCU、电桥模块和放大器,所述MCU包括应用模块、随机数生成模块和ADC模块;电源VCC通过开关SW分别连接电桥模块和放大器,电桥模块的输出端与放大器相连,放大器的输出端连接ADC模块,ADC模块与随机数生成器相连,随机数生成器连接应用模The purpose of the present invention is achieved through the following technical solutions: a true random number generator for MCU to convert bridge voltage at random intervals, including MCU, bridge module and amplifier, said MCU including application module, random number generation module and ADC module; the power supply VCC is connected to the bridge module and the amplifier through the switch SW, the output end of the bridge module is connected to the amplifier, the output end of the amplifier is connected to the ADC module, the ADC module is connected to the random number generator, and the random number generator is connected to the application module
块;Piece;
所述应用模块,用于提供随机数位数和真随机数级别给随机数生成模块,并且使能随 机数生成模块;The application module is used to provide the random number digits and the true random number level to the random number generation module, and enable the random number generation module;
所述随机数生成模块,用于在应用模块的控制下控制ADC模块将模拟电压转换为数字信号,从而产生真随机数。The random number generating module is used to control the ADC module to convert the analog voltage into a digital signal under the control of the application module, thereby generating a true random number.
进一步地,所述电桥模块采用惠斯通电桥,包括电阻R1、R2、R3、R4,电阻R1、R2、R3、R4首尾相连,组成方形电路;其中,方形电路相对的一组顶点分别与开关SW和接地端相连;另一组相对的顶点分别连接放大器的两个输入端。Further, the bridge module adopts a Wheatstone bridge, including resistors R1, R2, R3, R4, and resistors R1, R2, R3, R4 are connected end to end to form a square circuit; wherein, a set of vertices opposite to the square circuit are connected to each other. The switch SW is connected to the ground terminal; the other set of opposite vertices are respectively connected to the two input terminals of the amplifier.
进一步地,所述电阻R1、R2、R3、R4中,任意一个电阻采用滑动变阻器,其余三个电阻采用普通电阻。Further, among the resistors R1, R2, R3, R4, any one of the resistors is a sliding rheostat, and the remaining three resistors are ordinary resistors.
进一步地,所述放大器的输出端通过电容C接地。Further, the output terminal of the amplifier is grounded through a capacitor C.
本发明还提供一种MCU随机间隔转换电桥电压的真随机数产生方法,包括以下步骤:The present invention also provides a method for generating true random numbers for MCU to convert bridge voltage at random intervals, which includes the following steps:
S1、应用模块提供随机数位数和真随机数级别给随机数生成模块,并且使能随机数生成模块;S1. The application module provides random number digits and true random number level to the random number generation module, and enables the random number generation module;
S2、计算ADC模块需要转换的次数N,开启电桥和放大器的供电开关SW;S2. Calculate the number of conversions required by the ADC module N, and turn on the power switch SW of the bridge and amplifier;
S3、ADC模块开始转换放大器的输出电压,并根据随机数级别由ADC的采样值生成随机数;S3. The ADC module starts to convert the output voltage of the amplifier, and generates a random number from the sampling value of the ADC according to the random number level;
S4、将ADC转换次数N减1,判断N是否为0,如果是则将生成的真随机数发送给应用模块,并且关闭开关SW;否则ADC模块进行随机延迟,然后返回步骤S3,直到N为0为止;S4. Reduce the number of ADC conversion times N by 1, to determine whether N is 0, if it is, send the generated true random number to the application module, and close the switch SW; otherwise, the ADC module performs a random delay, and then returns to step S3 until N is Up to 0;
S5、将所有的真随机数拼接在一起,发给应用模块。S5. Splice all true random numbers together and send them to the application module.
本发明还提供一种基于ADC非线性效应混沌映射的真随机数产生器,包括处理器和传感器,所述处理器包括真随机数控制器、ADC和存储器;所述处理器为内置所述ADC的处理器芯片,电源VCC通过线性稳压器分别连接所述传感器和所述处理器,所述传感器的输出端连接所述ADC,所述ADC与所述真随机数控制器相连,所述真随机数控制器还与所述存储器相连;其中,所述处理器内部通过所述真随机数控制器控制所述ADC的采样次数和采样时间,并根据所述ADC的输出数据生成真随机数,将所述真随机数保存在所述存储器中;所述ADC的采样次数和采样时间根据所述传感器采集的感应信息确定。The present invention also provides a true random number generator based on ADC nonlinear effect chaotic mapping, including a processor and a sensor, the processor includes a true random number controller, an ADC, and a memory; the processor is a built-in ADC The power supply VCC is respectively connected to the sensor and the processor through a linear regulator, the output terminal of the sensor is connected to the ADC, the ADC is connected to the true random number controller, and the true The random number controller is also connected to the memory; wherein the processor internally controls the sampling times and sampling time of the ADC through the true random number controller, and generates a true random number according to the output data of the ADC, The true random number is stored in the memory; the sampling times and sampling time of the ADC are determined according to the sensing information collected by the sensor.
进一步地,所述处理器和所述传感器之间通过放大器连接,所述放大器用于提高所述传感器的输出信号的信噪比。Further, the processor and the sensor are connected through an amplifier, and the amplifier is used to improve the signal-to-noise ratio of the output signal of the sensor.
进一步地,所述放大器和所述处理器之间通过无源滤波器连接,所述无源滤波器用于优化所述传感器输出信号的信噪比和给所述放大器的输出起缓冲作用。Further, the amplifier and the processor are connected through a passive filter, and the passive filter is used to optimize the signal-to-noise ratio of the sensor output signal and buffer the output of the amplifier.
进一步地,所述无源滤波器包括电阻R,电容C1、电容C2和电感L;所述电容C1的一端和所述放大器的输出端连接,所述电容C1的另一端和所述电阻R的一端连接,所述电阻R的另一端分别与所述电感L的一端、所述电容C2的一端和所述ADC连接,所述电阻L的另一端和所述电容C2的另一端均接地。Further, the passive filter includes a resistor R, a capacitor C1, a capacitor C2, and an inductor L; one end of the capacitor C1 is connected to the output end of the amplifier, and the other end of the capacitor C1 is connected to the resistor R One end is connected, the other end of the resistor R is respectively connected to one end of the inductor L, one end of the capacitor C2 and the ADC, and the other end of the resistor L and the other end of the capacitor C2 are both grounded.
进一步地,所述无源滤波器为低通、带通或高通滤波器。Further, the passive filter is a low-pass, band-pass or high-pass filter.
进一步地,所述电源VCC分别通过线性稳压器LDO1连接所述处理器,并通过线性稳压器LDO2使能所述真随机数控制器。Further, the power supply VCC is respectively connected to the processor through a linear regulator LDO1, and the true random number controller is enabled through the linear regulator LDO2.
本发明还提供一种产生真随机数的实现方法,应用于上述基于ADC非线性效应混沌映射的真随机数产生器,包括以下步骤:The present invention also provides an implementation method for generating true random numbers, which is applied to the above-mentioned true random number generator based on ADC nonlinear effect chaotic mapping, and includes the following steps:
S1:所述真随机数控制器根据所述采样次数、随机数位数以及真随机数级别计算需要持续生成的真随机数C的个数,并开启所述传感器的供电开关;S1: The true random number controller calculates the number of true random numbers C that need to be continuously generated according to the sampling times, the number of random numbers, and the true random number level, and turns on the power switch of the sensor;
S2:根据所述存储器的真随机数存储区里的真随机数产生一个初始延迟,所述ADC转换输入电压,转换完成一次以后,将ADC转换次数M减1,然后根据所述随机数级别,由ADC的输出数据生成随机数后判断所述M是否为0;S2: Generate an initial delay based on the true random number in the true random number storage area of the memory. The ADC converts the input voltage. After the conversion is completed once, the number of ADC conversions M is reduced by 1, and then according to the random number level, After generating a random number from the output data of the ADC, judge whether the M is 0;
S3:如果M为0,则将生成的真随机数保存到所述真随机数存储区,并且关闭所述传感器的电源;如果M不为0,则根据上一次ADC输出实现随机延迟;S3: If M is 0, save the generated true random number to the true random number storage area, and turn off the power supply of the sensor; if M is not 0, realize a random delay according to the last ADC output;
S4:延迟完成后,所述ADC继续转换输入电压,转换结束后继续将ADC转换次数M减1;然后继续判断所述M是否为0,以确定所述ADC是否进行下一次转换,直到M为0为止;S4: After the delay is completed, the ADC continues to convert the input voltage, and after the conversion is completed, it continues to subtract 1 from the number of ADC conversions M; then continues to determine whether the M is 0 to determine whether the ADC performs the next conversion until M is Up to 0;
S5:判断C是否为0,如果不为0,则继续打开开关,生成M位的真随机数;如果C为0,则发送产生的真随机数。S5: Determine whether C is 0. If it is not 0, continue to open the switch to generate M-bit true random numbers; if C is 0, send the generated true random numbers.
进一步地,所述S1之前还包括:S11:外部的应用模块生成并发送需要的采样次数、随机数位数和真随机数级别给所述真随机数控制器,并且使能所述真随机数控制器。Further, before the S1, it also includes: S11: the external application module generates and sends the required sampling times, the number of random numbers, and the true random number level to the true random number controller, and enables the true random number control Device.
进一步地,所述ADC的输出信号是数字信号。Further, the output signal of the ADC is a digital signal.
进一步地,所述发送产生的真随机数,包括:发送产生的真随机数到外部的应用模块。Further, the sending the generated true random number includes: sending the generated true random number to an external application module.
进一步地,所述处理器和所述传感器之间通过放大器连接;Further, the processor and the sensor are connected through an amplifier;
所述开启所述传感器的供电开关,包括:开启所述传感器和所述放大器的供电开关;The turning on the power supply switch of the sensor includes: turning on the power supply switch of the sensor and the amplifier;
所述关闭所述传感器的电源,包括:关闭所述传感器和所述放大器的电源;Said turning off the power of the sensor includes: turning off the power of the sensor and the amplifier;
所述ADC转换输入电压,包括,所述ADC转换所述放大器输出的电压,所述放大器输出的电压为所述ADC的输入电压。The ADC converting the input voltage includes converting the voltage output by the amplifier by the ADC, and the voltage output by the amplifier is the input voltage of the ADC.
本发明的有益效果是:The beneficial effects of the present invention are:
1、本发明提出的使用ADC转换熵源动态变化过程的机制,变化过程可以是连续上升,也可以是连续下降,并且转换间隔时随机的;本发明将电桥的输出经过放大器,然后由ADC对其输出进行转换,在ADC转换的过程中,转换间隔是随机的,并且随机方式是可以控制的。真随机数位数的大小能够通过应用模块控制,其工作模式相当灵活,能够满足通信系统的各种应用场景,以及需要各种随机数位宽的加密算法。1. The mechanism of the present invention that uses ADC to convert the dynamic change process of entropy source, the change process can be continuous rise or continuous fall, and the conversion interval is random; the present invention passes the output of the bridge through the amplifier, and then the ADC The output is converted. During the ADC conversion, the conversion interval is random, and the random method can be controlled. The size of the true random number digits can be controlled by the application module, and its working mode is quite flexible, which can meet various application scenarios of the communication system and encryption algorithms that require various random number widths.
2、在当今的通信系统,为了通信数据安全可靠,都需要将数据进行加密,而固定的 加密算法很容易被截获和破解,因此在加密算法中添加随机数是必须的方式,如果加入的随机数是伪随机数,也很容易被破解,因此加入真随机数将大大提高加密算法的破解难度,提高通信系统的安全性。2. In today's communication system, for the safety and reliability of communication data, it is necessary to encrypt the data, and the fixed encryption algorithm is easy to be intercepted and cracked. Therefore, adding a random number to the encryption algorithm is a necessary way. If you add a random number Numbers are pseudo-random numbers and are easy to crack. Therefore, adding true random numbers will greatly increase the difficulty of cracking encryption algorithms and improve the security of the communication system.
本发明提出的基于ADC非线性效应混沌映射的真随机数产生器和产生真随机数的实现方法,包括处理器和传感器,所述处理器包括真随机数控制器、ADC和存储器;所述处理器为内置所述ADC的处理器芯片,电源VCC通过线性稳压器分别连接所述传感器和所述处理器,所述传感器的输出端连接所述ADC,所述ADC与所述真随机数控制器相连,所述真随机数控制器还与所述存储器相连;其中,所述处理器内部通过所述真随机数控制器控制所述ADC的采样次数和采样时间,并根据所述ADC的输出数据生成真随机数,将所述真随机数保存在所述存储器中;所述ADC的采样次数和采样时间根据所述传感器采集的感应信息确定。该基于ADC非线性效应混沌映射的真随机数产生器和产生真随机数的实现方法,可以使用定制的专用芯片实现,也能够使用传统的处理器(内置ADC)来实现,并且在需要实现传感器功能的设备中,能够在不添加任何其他电路、模块、器件的情况下,仅仅通过软件就能实现真随机数发生器。该方法工作模式灵活,能够满足通信系统的各种应用场景需求,以及需要各种随机数位数的加密算法。且该方案简单易行、成本低、功耗低、体积小,十分适合在无线传感网络节点中使用。在当今的无线通信系统中,为了通信数据安全可靠,都需要将数据进行加密,而固定的加密算法很容易被截获和破解,因此在无线传感网络节点中的加密算法中添加真随机数将大大提高无线传感网络通信的安全性。The true random number generator based on the chaotic mapping of ADC nonlinear effects and the method for generating true random numbers proposed in the present invention include a processor and a sensor, and the processor includes a true random number controller, an ADC and a memory; the processing The power supply VCC is a processor chip with the built-in ADC. The power supply VCC is connected to the sensor and the processor through a linear regulator. The output terminal of the sensor is connected to the ADC. The ADC is controlled by the true random number. The true random number controller is also connected to the memory; wherein the processor internally controls the sampling times and sampling time of the ADC through the true random number controller, and according to the output of the ADC The data generates a true random number, and the true random number is stored in the memory; the sampling times and sampling time of the ADC are determined according to the sensing information collected by the sensor. The true random number generator based on the chaotic mapping of the ADC nonlinear effect and the implementation method for generating true random numbers can be implemented using a customized dedicated chip or a traditional processor (built-in ADC). In a functional device, a true random number generator can be realized only through software without adding any other circuits, modules, or devices. The method has a flexible working mode and can meet the requirements of various application scenarios of the communication system and the encryption algorithm that requires various random number digits. In addition, the solution is simple and easy to implement, low cost, low power consumption, and small in size, which is very suitable for use in wireless sensor network nodes. In today’s wireless communication systems, for the safety and reliability of communication data, data needs to be encrypted, and fixed encryption algorithms are easily intercepted and cracked. Therefore, adding true random numbers to the encryption algorithms in wireless sensor network nodes will Greatly improve the security of wireless sensor network communication.
附图说明Description of the drawings
图1为本发明的MCU随机间隔转换电桥电压的真随机数产生器结构示意图;FIG. 1 is a schematic diagram of the structure of a true random number generator for MCU to convert bridge voltage at random intervals of the present invention;
图2为本发明的MCU随机间隔转换电桥电压的真随机数产生方法的流程图;2 is a flow chart of the method for generating true random numbers for the MCU to convert the bridge voltage at random intervals of the present invention;
图3为现有技术中基于热噪声和比较器的结构的真随机数发生器的结构示意图;3 is a schematic diagram of the structure of a true random number generator based on thermal noise and a comparator structure in the prior art;
图4为现有技术中基于振荡器时钟抖动的频率检测结构的真随机数发生器的结构示意图;4 is a schematic structural diagram of a true random number generator based on a frequency detection structure of oscillator clock jitter in the prior art;
图5为现有技术中基于ADC的残差循环利用结构的真随机数发生器的结构示意图;FIG. 5 is a schematic structural diagram of a true random number generator based on the ADC-based residual recycling structure in the prior art;
图6为本发明的基于ADC非线性效应混沌映射的真随机数产生器的ADC产生真随机数的理论模型图;FIG. 6 is a theoretical model diagram of the true random number generated by the ADC of the true random number generator based on the ADC nonlinear effect chaotic mapping of the present invention;
图7为本发明的基于ADC非线性效应混沌映射的真随机数产生器的系统对初始延迟的敏感性仿真结果图;Fig. 7 is a simulation result diagram of the sensitivity of the system of the true random number generator based on the chaotic mapping of the ADC nonlinear effect to the initial delay of the present invention;
图8为本发明的基于ADC非线性效应混沌映射的真随机数产生器的总体结构示意图;FIG. 8 is a schematic diagram of the overall structure of the true random number generator based on the chaotic mapping of the ADC nonlinear effect of the present invention;
图9为本发明的产生真随机数的实现方法的流程图;Figure 9 is a flow chart of the method for generating true random numbers according to the present invention;
图10为本发明的产生真随机数的实现方法的M=16时不同级别产生真随机数的方法的流程图。FIG. 10 is a flowchart of a method for generating a true random number at different levels when M=16 in the implementation method for generating a true random number of the present invention.
具体实施方式Detailed ways
下面结合附图进一步说明本发明的技术方案。The technical scheme of the present invention will be further described below in conjunction with the drawings.
本发明采用一个通用的电路(不需要使用专门的真随机数发生器芯片),实现高性价比的真随机数发生器。本发明通过一种带ADC的元器件(可以是单片机,ARM,DSP,FPGA等所有内嵌ADC的器件,当然也可以外加ADC专门的芯片,只是不推荐使用外部专门ADC芯片,会增加成本,增大设备面积),该发明可以通过很少的外围电路,配合芯片内部ADC模块产生真随机数。这种随机数不可复制,能够用在加密算法和防碰撞算法等应用中。该方案产生的随机数接近真随机数特性,因此能够极大的增加加密算法的安全性,防止加密数据被破解;也能够用于防碰撞系统中,可以有效减小由伪随机数产生的防碰撞参数带来的碰撞问题。由于在将来的物联网终端节点中,大部分都需要有传感器的功能,这些带传感器功能的终端节点,也几乎都会有ADC模块,因此,在这内应用中,不需要额外的ADC,就能够产生真随机数,能够极大的减小系统的开销和减小产品的面积。The invention adopts a general circuit (no need to use a special true random number generator chip) to realize a true random number generator with high cost performance. The present invention adopts a component with ADC (it can be a single-chip microcomputer, ARM, DSP, FPGA, etc., all embedded ADC devices, of course, can also be added with a dedicated ADC chip, but it is not recommended to use an external dedicated ADC chip, which will increase the cost. Increasing the area of the device), this invention can generate true random numbers through a few peripheral circuits and with the ADC module inside the chip. This kind of random number cannot be copied and can be used in applications such as encryption algorithms and anti-collision algorithms. The random numbers generated by this scheme are close to the characteristics of true random numbers, so it can greatly increase the security of encryption algorithms and prevent encrypted data from being cracked; it can also be used in anti-collision systems, which can effectively reduce the anti-collision generated by pseudo-random numbers. The collision problem caused by the collision parameter. Since most terminal nodes of the Internet of Things in the future need to have the function of sensors, these terminal nodes with sensor functions will almost all have ADC modules. Therefore, in this application, no additional ADC is needed. Generating true random numbers can greatly reduce system overhead and product area.
如图1所示,本发明的一种MCU随机间隔转换电桥电压的真随机数产生器,其中主要的控制部分在MCU内部通过应用模块和随机数生成模块实现,外部的电桥和放大器电路提供熵源。单片机中的ADC用来转换放大器输出的模拟电压;单片机中的随机数生成模块,在应用模块的控制下控制ADC转换模拟电压为数字信号,从而产生真随机数。具体包括MCU、电桥模块和放大器,所述MCU包括应用模块、随机数生成模块和ADC模块;电源VCC通过开关SW分别连接电桥模块和放大器,电桥模块的输出端与放大器相连,放大器的输出端连接ADC模块,ADC模块与随机数生成器相连,随机数生成器连接应用模块;As shown in Figure 1, a true random number generator for MCU to convert bridge voltage at random intervals of the present invention. The main control part is implemented inside the MCU through an application module and a random number generation module. The external bridge and amplifier circuit Provide a source of entropy. The ADC in the single-chip microcomputer is used to convert the analog voltage output by the amplifier; the random number generation module in the single-chip microcomputer controls the ADC to convert the analog voltage into a digital signal under the control of the application module, thereby generating a true random number. Specifically, it includes an MCU, a bridge module, and an amplifier. The MCU includes an application module, a random number generation module, and an ADC module; the power supply VCC is connected to the bridge module and the amplifier through the switch SW, and the output end of the bridge module is connected to the amplifier. The output terminal is connected to the ADC module, the ADC module is connected to the random number generator, and the random number generator is connected to the application module;
所述应用模块,用于提供随机数位数和真随机数级别给随机数生成模块,并且使能随机数生成模块;The application module is used to provide the random number digits and the true random number level to the random number generation module, and enable the random number generation module;
所述随机数生成模块,用于在应用模块的控制下控制ADC模块将模拟电压转换为数字信号,从而产生真随机数。The random number generating module is used to control the ADC module to convert the analog voltage into a digital signal under the control of the application module, thereby generating a true random number.
进一步地,所述电桥模块采用惠斯通电桥,包括电阻R1、R2、R3、R4,电阻R1、R2、R3、R4首尾相连,组成方形电路;其中,方形电路相对的一组顶点分别与开关SW和接地端相连;另一组相对的顶点分别连接放大器的两个输入端。所述电阻R1、R2、R3、R4中,任意一个电阻采用滑动变阻器,其余三个电阻采用普通电阻,可以选择R1、R2、R3、R4中的任意一个用滑动变阻器来代替普通电阻,这样可以调整电桥到平衡位置。Further, the bridge module adopts a Wheatstone bridge, including resistors R1, R2, R3, R4, and resistors R1, R2, R3, R4 are connected end to end to form a square circuit; wherein, a set of vertices opposite to the square circuit are connected to each other. The switch SW is connected to the ground terminal; the other set of opposite vertices are respectively connected to the two input terminals of the amplifier. In the resistors R1, R2, R3, R4, any one of the resistors is a sliding rheostat, and the other three resistors are ordinary resistors. You can choose any one of R1, R2, R3, R4 to replace the ordinary resistor with a sliding rheostat, so that Adjust the bridge to the balanced position.
电桥输出经过放大倍数很大的放大器AMP,放大器可以放大电桥电路带来的噪声,导致输出变化很大,这样ADC采集到的数据就变化大,但是需要注意一点,不能让放大器饱和,这就需要平衡放大倍数和电桥输出电压,为了使放大器输出电压随机性增高,可以调整电桥输出A端电压比B端电压稍大一点,可以是10mV左右,这样使得放大器正常工作,并且放大器放大倍数可以达到100倍;如果电桥输出A端电压比B端电压稍大很多,比如100mV,那么放大器只能放大10-20倍就会饱和(具体多少倍由电源电压决定),这就使得放大器输出一直趋于电源电压,这就导致放大器输出趋于稳定,输出电压变化量就很小。The output of the bridge passes through the amplifier AMP with a large amplification factor. The amplifier can amplify the noise brought by the bridge circuit, resulting in a large change in the output, so that the data collected by the ADC has a large change, but you need to pay attention to not let the amplifier saturate. It is necessary to balance the amplification factor and the bridge output voltage. In order to increase the randomness of the amplifier output voltage, the bridge output A terminal voltage can be adjusted to be slightly larger than the B terminal voltage, which can be about 10mV, so that the amplifier works normally and the amplifier amplifies The multiple can reach 100 times; if the bridge output voltage at terminal A is much larger than the voltage at terminal B, such as 100mV, then the amplifier can only amplify 10-20 times and it will saturate (the specific multiple depends on the power supply voltage), which makes the amplifier The output always tends to the power supply voltage, which causes the amplifier output to become stable, and the output voltage change is very small.
进一步地,所述放大器的输出端通过电容C接地。电容C用来给放大器输出起缓冲作用,以确保MCU打开SW后,放大器输出有一个上升时间,能保证ADC进行多次转换后,放大器输出还是在上升,这样ADC输出的后几位变化都很大(这些位都能够用来生成真随机数),可以减少ADC转换次数。如果ADC转换的是纯电阻分压后的电压值(不是才电压上升过程),该电压变化完全依赖电路的噪声,而且如果电路噪声小(电路噪声大可能影响系统其他模块的性能),电压变化就很小,那么ADC每次转换该电压后,其输出的数字数据可能只有最后1-2位有变化,或者可能也只有最后一位偶尔有变化,这样产生的随机数的随机性不高,并且如果应用模块需要32位的随机数,就需要ADC转换32次(取每次的最低位组成一个32位的真随机数),这样随机数产生模块的效率就很低。如果ADC精度不够高,ADC可能分辨不出输入电压有变化,那么ADC输出的数字数据可能不会有变化,这样的电路产生的随机性数就不能够使用。Further, the output terminal of the amplifier is grounded through a capacitor C. The capacitor C is used to buffer the output of the amplifier to ensure that after the MCU turns on the SW, the amplifier output has a rise time, which can ensure that the amplifier output is still rising after the ADC performs multiple conversions, so that the last few bits of the ADC output change very much. Large (these bits can be used to generate true random numbers), which can reduce the number of ADC conversions. If the ADC converts the voltage value after a pure resistor divider (not just the voltage rise process), the voltage change is completely dependent on the noise of the circuit, and if the circuit noise is small (large circuit noise may affect the performance of other modules in the system), the voltage changes It is very small, so every time the ADC converts the voltage, only the last 1-2 digits of the output digital data may change, or only the last digit may change occasionally, so the random number generated is not very random. And if the application module needs a 32-bit random number, it needs ADC conversion 32 times (the lowest bit of each time is taken to form a 32-bit true random number), so the efficiency of the random number generation module is very low. If the ADC accuracy is not high enough, the ADC may not be able to distinguish the input voltage change, then the digital data output by the ADC may not change, and the random numbers generated by such a circuit cannot be used.
随机数生成模块开始工作后,首先配置ADC的工作模式,然后打开SW,随后开始连续转换放大器输出的电压值,连续转换的次数可以使用应用模块控制。由于刚刚打开开关,电桥输出极其不平衡,并且噪声很大,因此也会给放大器输出带来不确定性。打开开关后ADC就开始转换放大器输出电压值,这时候由于电容C的原因,放大器输出要给C充电,因此放大器输出达到稳定需要一个过程,这个电容C的大小可以由ADC的采样率和应用模块一起来选择,选择的依据是应用模块需要多长的随机数位流(ADC可能需要多次采集),保证ADC最后一次转换结束前C不会被充满。这样转换放大器输出电压值的时候,放大器输出是持续上升的状态,如果放大器输出不是上升状态,而是已经稳定了,那么ADC采集到的数据可能不会变化,或者变化很小,只有最后1-2位在变化。因此ADC连续转换多次,可以得到多个随机数,这些随机数的值是逐渐增大的,因为放大器输出电压是一种处于上升模式。After the random number generation module starts to work, first configure the working mode of the ADC, then turn on the SW, and then start to continuously convert the voltage value output by the amplifier. The number of continuous conversions can be controlled by the application module. Since the switch has just been turned on, the bridge output is extremely unbalanced and the noise is very high, so it will also bring uncertainty to the amplifier output. After turning on the switch, the ADC starts to convert the amplifier output voltage value. At this time, due to the capacitor C, the amplifier output needs to charge C. Therefore, it takes a process for the amplifier output to stabilize. The size of the capacitor C can be determined by the sampling rate of the ADC and the application module. The choice is based on how long the random number bit stream is required by the application module (the ADC may need to be collected multiple times) to ensure that C will not be filled before the last conversion of the ADC. In this way, when the amplifier output voltage value is converted, the amplifier output is continuously rising. If the amplifier output is not rising, but has stabilized, then the data collected by the ADC may not change, or the change is small, only the last 1- 2 is changing. Therefore, the ADC continuously converts multiple times to obtain multiple random numbers, and the value of these random numbers gradually increases because the output voltage of the amplifier is in a rising mode.
在数字芯片中,使用ADC来转换模拟输入电压来产生数字输出的方式是一种很成熟的方法,这在传感器应用领域非常普遍,大都是采用ADC转换模拟信号为数字信号,然后给处理器做后续处理,但是采用ADC产生真随机数的方案比较少,因此本发明提出一种全新的方案,采用软硬件结合的方式,使用ADC转换输入连续变化的模拟电压来产生 真随机数,并且ADC转换间隔随机(进一步提高随机数发生器的随机性)。目前大部分处理器都内嵌有ADC模块,因此不需要额外增加ADC芯片,这样可以节省很大一笔开销,也能够减小由于添加外部ADC而带来的设备面积增大的弊端,由于ADC都有一个固定的分辨率,大部分内嵌的ADC模块分辨率都小于16bits,如果应用模块需要大于ADC输出位数的随机数就需要进行多次转换。如果使用一次ADC转换结果的所有位,那么ADC每次转换输出的高几位变化概率很小,因此,为了提高真随机数的随机性,只能采用ADC输出的后几位。最后将转换后的数据拼接在一起,再发给应用模块去使用。In digital chips, using ADC to convert analog input voltage to generate digital output is a very mature method. This is very common in sensor applications. Most of them use ADC to convert analog signals into digital signals, and then do it for the processor. Subsequent processing, but there are relatively few schemes using ADC to generate true random numbers. Therefore, the present invention proposes a brand-new scheme that uses a combination of software and hardware to use ADC to convert input continuously varying analog voltages to generate true random numbers, and ADC conversion Random interval (to further improve the randomness of the random number generator). At present, most processors have built-in ADC modules, so there is no need to add an additional ADC chip, which can save a lot of overhead, and can also reduce the disadvantages of the increase in equipment area caused by the addition of external ADCs. All have a fixed resolution. Most of the embedded ADC modules have a resolution less than 16bits. If the application module requires a random number larger than the number of ADC output bits, multiple conversions are required. If all the bits of the ADC conversion result are used at one time, the high-order bits of the ADC conversion output have a small probability of change. Therefore, in order to improve the randomness of the true random number, only the last bits of the ADC output can be used. Finally, the converted data is spliced together, and then sent to the application module for use.
如图2所示,本发明还提供了一种MCU随机间隔转换电桥电压的真随机数产生方法,包括以下步骤:As shown in Figure 2, the present invention also provides a method for generating true random numbers for MCU to convert bridge voltage at random intervals, including the following steps:
S1、应用模块提供随机数位数和真随机数级别给随机数生成模块,并且使能随机数生成模块;S1. The application module provides random number digits and true random number level to the random number generation module, and enables the random number generation module;
S2、(随机数生成模块)计算ADC模块需要转换的次数N,开启电桥和放大器的供电开关SW;S2 (Random Number Generation Module) Calculate the number N of conversions required by the ADC module, and turn on the power switch SW of the bridge and amplifier;
S3、ADC模块开始转换放大器的输出电压,并根据随机数级别由ADC的采样值生成随机数;S3. The ADC module starts to convert the output voltage of the amplifier, and generates a random number from the sampling value of the ADC according to the random number level;
本步骤中生成随机数主要有两种情况:一是由于ADC的输出是有限的,一般8-16bits,但是应用模块可能需要32bits或者64bits等更高的位数,因此ADC采用的值只能是随机数的一部分;二是由于ADC输出的数据高位随机性不强(如果ADC是12bits的,如果输入变化不大,则ADC采样后的值可能高4位几乎不变),因此需要考虑只选用ADC低几位的bits来作为随机数的一部分(到底是低几位,由随机数级别确定,如果随机数级别最高,则只取最后一位,最后一位随机数最高)。There are two main situations for generating random numbers in this step: First, because the ADC output is limited, generally 8-16bits, but the application module may require higher bits such as 32bits or 64bits, so the value used by the ADC can only be Part of the random number; second, because the high bits of the ADC output data are not very random (if the ADC is 12 bits, if the input does not change much, the high 4 bits of the ADC sampled value may be almost unchanged), so you need to consider only choosing The lower bits of the ADC are used as part of the random number (the lower bits are determined by the random number level, if the random number level is the highest, only the last digit is taken, and the last digit is the highest random number).
S4、将ADC转换次数N减1,判断N是否为0,如果是则将生成的真随机数发送给应用模块,并且关闭开关SW;否则ADC模块进行随机延迟,然后返回步骤S3,直到N为0为止;这个随机延迟可以使用上一次ADC转换的后几位来确定(ADC后几位随机性强,因此可以达到随机间隔的目的),也可以采用一个固定的延迟值,具体由用户自行定义。如果每次的转换由ADC转换的数据来确定,则可以提高转换电压值的随机性。延迟完成后,ADC继续转换输入的电压,转换结束后继续将N减1,并根据随机数级别提取ADC输出的数据和上一次输出的数据拼接在一起;然后继续判断N是否为0,确定ADC是否进行下一次转换,直到N为0为止,最后将拼接在一起的真随机数,发给应用模块。S4. Reduce the number of ADC conversion times N by 1, to determine whether N is 0, if it is, send the generated true random number to the application module, and close the switch SW; otherwise, the ADC module performs a random delay, and then returns to step S3 until N is Until 0; this random delay can be determined by the last few digits of the last ADC conversion (the last few digits of the ADC are very random, so the purpose of random interval can be achieved), or a fixed delay value can be used, which is defined by the user . If each conversion is determined by the data converted by the ADC, the randomness of the conversion voltage value can be improved. After the delay is completed, the ADC continues to convert the input voltage. After the conversion, it continues to subtract 1 from N, and extracts the data output by the ADC and the last output data according to the random number level and splices them together; then continues to determine whether N is 0 and determine the ADC Whether to perform the next conversion until N is 0, and finally send the spliced true random numbers to the application module.
S5、将所有的真随机数拼接在一起,发给应用模块。拼接在一起的真随机数:拼接方法也是随机的,可以不固定,比如应用模块要32bits,随机数级别是0(只要ADC最低的一位),那么ADC需要采集32次,每次取最后一位,把这32位放在一起组成32bits的随机数。假设第一次采集到的最后一位是1,第二次是0,第三次是1,第四次是1,第五次是1,那么可以这样接:….11101,把第一采集到的放在32位随机数的最后一位,最后一次采集到的放到最高位,也可以反。只要每次采集随机数都是随机的,那么无论怎么拼接,结果也是随机的。S5. Splice all true random numbers together and send them to the application module. True random numbers spliced together: the splicing method is also random and can be variable. For example, if the application module requires 32 bits and the random number level is 0 (as long as the lowest bit of the ADC), then the ADC needs to collect 32 times, and each time the last one is taken Bits, put these 32 bits together to form a 32-bit random number. Assuming that the last bit collected for the first time is 1, the second time is 0, the third time is 1, the fourth time is 1, and the fifth time is 1, then you can connect like this: ….11101, the first collection The received one is placed in the last digit of the 32-bit random number, and the last collected one is placed in the highest digit, or vice versa. As long as the random numbers are randomly collected each time, no matter how to splice, the result is also random.
由于应用程序需要的随机数位数可能大于ADC的分辨率,因此需要多次采集,这里的随机数级别可以由用户定义,随机数级别可以通过一个任意的数来确定,如果是4bits的数,其值从0-15分别代表提取ADC最低有效位的第0到第15位为随机数的一部分。例如,如果随机数位数是32,随机数级别是3,那么,需要ADC采集8次,每次取ADC采集的第0到第3位(最低有效位的4位)作为随机数的一部分,然后将8次随机数拼接在一起发送给应用模块。Since the number of random number bits required by the application may be greater than the resolution of the ADC, it needs to be collected multiple times. The random number level here can be defined by the user. The random number level can be determined by an arbitrary number. If it is a 4bits number, its Values from 0-15 respectively represent extracting the 0th to 15th bits of the least significant bit of the ADC as part of the random number. For example, if the number of bits in the random number is 32 and the level of random number is 3, then the ADC needs to collect 8 times, and each time the 0th to 3rd bits collected by the ADC (the 4 least significant bits) are taken as part of the random number, then The 8 random numbers are spliced together and sent to the application module.
本发明技术方案是电桥输出经过放大倍数很大的放大器,然后由ADC对其输出进行转换,在ADC转换的过程中,转换间隔是随机的,并且随机方式是可以控制的。真随机数位数的大小也能通过应用模块控制,其工作模式相当灵活,能够满足通信系统的各种应用场景,以及需要各种随机数位宽的加密算法。在当今的通信系统,为了通信数据安全可靠,都需要将数据进行加密,而固定的加密算法很容易被截获和破解,因此在加密算法中添加随机数是必须的方式,如果加入的随机数是伪随机数,也很容易被破解,因此加入真随机数将大大提高加密算法的破解难度,提高通信系统的安全性。真随机数也能够用在多标签防碰撞的应用中,因为在防碰撞算法中,如果标签接收到读写器发出的盘存命令后,标签延迟响应不是随机的,就会导致某些标签一直被盘存,而也有另外一些标签盘存不到,因此在用数字芯片实现的防碰撞系统中,高效的产生真随机数的方法将非常重要。The technical scheme of the present invention is that the bridge output passes through an amplifier with a large amplification factor, and then the ADC converts its output. During the ADC conversion process, the conversion interval is random, and the random mode can be controlled. The size of the true random number digits can also be controlled by the application module, and its working mode is quite flexible, which can meet various application scenarios of the communication system and encryption algorithms that require various random number widths. In today’s communication system, in order to communicate data safely and reliably, it is necessary to encrypt data, and fixed encryption algorithms are easily intercepted and cracked. Therefore, adding random numbers to the encryption algorithm is a must, if the random number added is Pseudo-random numbers are also easy to be cracked, so adding true random numbers will greatly increase the difficulty of cracking the encryption algorithm and improve the security of the communication system. True random numbers can also be used in multi-tag anti-collision applications, because in the anti-collision algorithm, if the tag receives the inventory command sent by the reader, the delayed response of the tag is not random, which will cause some tags to be Inventory, and there are other tags that cannot be inventoried. Therefore, in the anti-collision system implemented with digital chips, an efficient method of generating true random numbers will be very important.
本发明采用一种通用的电路结构,实现高性价比的真随机数发生器,既可以使用专用芯片实现,又能够在内嵌ADC的通用处理器中实现,其中处理器可以是单片机,ARM,DSP,FPGA(配置可实现处理器的功能)等所有内嵌ADC的处理器。这种真随机数发生器能够产生不可复制的随机数,从而提高加密算法的安全性能,防止加密数据被破解。由于在未来的物联网终端节点中,大部分终端节点都需要具备传感器的功能,需要使用ADC模块,因此,这种基于传统内嵌ADC的处理器来实现真随机数的方法具有通用性,能够完美兼容这类传感设备,并且可以直接使用传感器电路作为熵源,不需要添加额外的电路,能够极大的节约系统成本,有效降低产品复杂度和产品体积,并降低系统功耗。The present invention adopts a universal circuit structure to realize a high cost-effective true random number generator. It can be realized by using a dedicated chip or in a general-purpose processor embedded with ADC. The processor can be a single-chip microcomputer, ARM, DSP , FPGA (configuration can realize the function of the processor) and all processors with embedded ADC. This kind of true random number generator can generate non-copyable random numbers, thereby improving the security performance of the encryption algorithm and preventing encrypted data from being cracked. Since most of the terminal nodes of the Internet of Things in the future need to have the function of sensors and need to use the ADC module, this method based on the traditional embedded ADC processor to achieve true random numbers is universal and can It is perfectly compatible with this type of sensing equipment, and can directly use the sensor circuit as an entropy source without adding additional circuits, which can greatly save system costs, effectively reduce product complexity and product volume, and reduce system power consumption.
以下对ADC实现真随机数的原理进行分析:The following is an analysis of the principle of ADC's realization of true random numbers:
目前已经有多种基于ADC的真随机数发生器被提出,然而,现存的基于ADC实现的真随机数发生器通用性不够强,需要定制芯片。因此我们提出基于ADC随机间隔采样变化的输入信号来实现真随机数发生器的方法,可以用在传统的处理器中,其理论模型如图6所示,其为本发明的基于ADC非线性效应混沌映射的真随机数产生器的ADC产生真随机数的理论模型图。该模型可以产生M位的随机数,也可以持续产生多个M位的随机数。其中,输入信号是可控的,可以实现输入信号由Vin到0的变化(或者从0到Vin的变化)。放大模块用来放大输入信号,增加输入信号的随机性;滤波器用来优化放大器输出的信号(主要用在传感器设备中,旨在提高信噪比);初始延迟用来选择输入信号的第一次采样的时刻;随机间隔延迟模块根据ADC输出信号进行延迟(单位是处理器的时钟周期),其可以将熵源电路的噪声和ADC的量化噪声带入延迟函数,改变下一次ADC的采样位置,从而提高ADC输出数据的随机性;保存模块用来保存ADC输出的数字信号;采样次数模块用来确定采样的次数(根据产生随机数的位数M来确定需要采集的次数)以及何时结束采样;后处理模块可以提高系统的随机性,并提供系统的鲁棒性。继续模块用来确定需要产生多少个M位的随机数。针对图6所示的模型,根据下面的公式,我们可以得到其混沌映射函数,并提供其能实现真随机数发生器的理论依据。At present, a variety of ADC-based true random number generators have been proposed. However, the existing ADC-based true random number generators are not sufficiently versatile and require customized chips. Therefore, we propose a method for realizing a true random number generator based on ADC sampling and changing input signals at random intervals, which can be used in a traditional processor. Its theoretical model is shown in Figure 6, which is based on the ADC nonlinear effect of the present invention. The theoretical model diagram of the true random number generated by the ADC of the chaotically mapped true random number generator. This model can generate M-bit random numbers, and it can also generate multiple M-bit random numbers continuously. Among them, the input signal is controllable, and the input signal can be changed from Vin to 0 (or from 0 to Vin). The amplifier module is used to amplify the input signal and increase the randomness of the input signal; the filter is used to optimize the signal output by the amplifier (mainly used in sensor equipment to improve the signal-to-noise ratio); the initial delay is used to select the first time of the input signal The sampling moment; the random interval delay module delays according to the ADC output signal (unit is the clock cycle of the processor), which can bring the noise of the entropy source circuit and the quantization noise of the ADC into the delay function, and change the sampling position of the next ADC. Thereby improving the randomness of ADC output data; the save module is used to save the digital signal output by the ADC; the sampling frequency module is used to determine the number of sampling (according to the number of bits M to generate a random number to determine the number of acquisitions) and when to end sampling ; Post-processing module can improve the randomness of the system and provide the robustness of the system. The continuation module is used to determine how many M-bit random numbers need to be generated. For the model shown in Figure 6, according to the following formula, we can get its chaotic mapping function and provide a theoretical basis for its realization of a true random number generator.
对于N位向下取整(rounding-down)的单级ADC,当输入信号在理想的转换范围内时,有For N-bit rounding-down single-stage ADCs, when the input signal is within the ideal conversion range, there are
Figure PCTCN2020110774-appb-000001
Figure PCTCN2020110774-appb-000001
其中DADC表示ADC转换后的数字输出信号,ADC(·)代表ADC转换函数,Vcc是ADC的参考电压,Vin表示ADC的输入电压。Among them, DADC represents the digital output signal after ADC conversion, ADC(·) represents the ADC conversion function, Vcc is the reference voltage of the ADC, and Vin represents the input voltage of the ADC.
公式(1)是传统ADC的工作原理,而本发明提出的随机间隔采样机制添加了一些新的参数,我们使用如下映射来表示。Formula (1) is the working principle of the traditional ADC, and the random interval sampling mechanism proposed by the present invention adds some new parameters, which we use the following mapping to represent.
V n+1=M(V n)       (2) V n+1 =M(V n ) (2)
其中M(·)表示ADC输入到输出的混沌映射,Vn表示混沌映射的输入信号,Vn+1表示混沌映射的输出信号。图6中的初始延迟和随机间隔延迟的单位时间是处理器(这里以最简单的MCU为例)工作时钟的周期,初始延迟的时间由上一次产生的真随机数RNtrue确定,并且其计算公式如下Among them, M(·) represents the chaotic mapping from ADC input to output, Vn represents the input signal of the chaotic mapping, and Vn+1 represents the output signal of the chaotic mapping. The unit time of the initial delay and the random interval delay in Figure 6 is the period of the working clock of the processor (here taking the simplest MCU as an example). The initial delay time is determined by the true random number RNtrue generated last time, and its calculation formula as follows
Figure PCTCN2020110774-appb-000002
Figure PCTCN2020110774-appb-000002
其中t0表示初始延迟时间,f MCU表示MCU的工作频率,&表示按位与,const1表示一个常数。同样,我们可以得到随机间隔延迟时间t randomWhere t0 represents the initial delay time, f MCU represents the operating frequency of the MCU, & represents the bitwise AND, and const1 represents a constant. Similarly, we can get the random interval delay time t random as
Figure PCTCN2020110774-appb-000003
Figure PCTCN2020110774-appb-000003
其中,
Figure PCTCN2020110774-appb-000004
表示第k次的随机间隔延迟时间,
Figure PCTCN2020110774-appb-000005
表示ADC第k次采样后的输出信号,const2表示一个常数。
among them,
Figure PCTCN2020110774-appb-000004
Represents the random interval delay time of the kth time,
Figure PCTCN2020110774-appb-000005
Represents the output signal after the kth sampling of the ADC, and const2 represents a constant.
为了简便,我们假设SW关闭后,Vin呈线性变化,如下所示。For simplicity, we assume that Vin changes linearly after SW is closed, as shown below.
V in=K*t+N in      (5) V in =K*t+N in (5)
其中N in代表电路中的热噪声和电源噪声等干扰信号,K代表Vin的斜率(SW关闭后Vin会从0开始增加)。那么,放大器输出可以由下式给出: Among them, N in represents interference signals such as thermal noise and power supply noise in the circuit, and K represents the slope of Vin (Vin will increase from 0 after SW is turned off). Then, the amplifier output can be given by:
V amp=A*K*t+N noise      (6) V amp =A*K*t+N noise (6)
其中A表示放大器增益(放大倍数),N noise代表AMP(放大器)输出信号中的总噪声,Vamp连接MCU中ADC的模拟输入。至此,可得出本发明实施例提出的真随机数发生器的混沌映射的ADC输入信号的电压大小VADC如下: A represents the amplifier gain (amplification factor), N noise represents the total noise in the output signal of the AMP (amplifier), and Vamp is connected to the analog input of the ADC in the MCU. So far, it can be obtained that the voltage magnitude VADC of the ADC input signal of the chaotic mapping of the true random number generator proposed in the embodiment of the present invention is as follows:
Figure PCTCN2020110774-appb-000006
Figure PCTCN2020110774-appb-000006
其中,Vsat表示放大器输出能达到的最高电压。当t=0时,开关SW是断开状态,放大器没有输入信号,因此放大器输出只有噪声。当
Figure PCTCN2020110774-appb-000007
时,假设放大器输出饱和,VADC=Vamp=Vsat。在实际电路中,我们可以通过调节无源滤波器来控制ADC输入信号(放大器输出信号)到达饱和状态的上升时间,或者通过const1、const2和m来设置ADC多次采样消耗的总时间。
Among them, Vsat represents the highest voltage that the amplifier output can reach. When t=0, the switch SW is off, and the amplifier has no input signal, so the amplifier output only has noise. when
Figure PCTCN2020110774-appb-000007
When, assuming that the amplifier output is saturated, VADC=Vamp=Vsat. In the actual circuit, we can control the rise time of the ADC input signal (amplifier output signal) to the saturation state by adjusting the passive filter, or set the total time consumed by the ADC multiple sampling by const1, const2, and m.
因此,在ADC输入信号的上升过程中,VADC的电压随ADC采样次数的映射关系如下:Therefore, during the rising process of ADC input signal, the mapping relationship between VADC voltage and ADC sampling times is as follows:
Figure PCTCN2020110774-appb-000008
Figure PCTCN2020110774-appb-000008
tsample是ADC进行模数转换需要的时间,可以通过MCU内嵌的ADC的采样频率f sample来计算。tproc表示每次采样后MCU处理数据需要的时间,该时间由MCU的工作频率f MCU确定。如果假设MCU处理数据消耗8个时钟,则可提出混沌映射最终的表示方式: tsample is the time required for the ADC to perform analog-to-digital conversion, which can be calculated by the sampling frequency f sample of the ADC embedded in the MCU. tproc represents the time required by the MCU to process data after each sampling, and this time is determined by the working frequency f MCU of the MCU . If it is assumed that the MCU processing data consumes 8 clocks, the final representation of the chaotic map can be proposed:
Figure PCTCN2020110774-appb-000009
Figure PCTCN2020110774-appb-000009
根据公式(7),设置A=K=1,N noise=1mV,分别对初始延迟为RNtrue=2000和RNtrue=2001的情况进行仿真,得到迭代次数n和ADC输入电压VADC的关系,如图7所示,其为本发明的基于ADC非线性效应混沌映射的真随机数产生器的系统对初始延迟的敏感性仿真结果图。从图7中可以看出,当初始延迟相差一个时钟时,从第5次迭代开始出现变化,并且随着迭代次数的增多,差异性变大。该仿真结果表明本系统具有混沌映射的特性,可用来产生真随机数。 According to formula (7), set A=K=1, N noise =1mV, and simulate the initial delay of RNtrue=2000 and RNtrue=2001 respectively, and obtain the relationship between the number of iterations n and the ADC input voltage VADC, as shown in Figure 7 As shown, it is a simulation result diagram of the sensitivity of the system of the true random number generator based on the chaotic mapping of the ADC nonlinear effect to the initial delay of the present invention. It can be seen from Figure 7 that when the initial delay differs by one clock, the change appears from the fifth iteration, and as the number of iterations increases, the difference becomes greater. The simulation results show that the system has the characteristics of chaotic mapping and can be used to generate true random numbers.
本发明提供一种基于ADC非线性效应混沌映射的真随机数产生器,包括处理器和传感器,所述处理器包括真随机数控制器、ADC和存储器;所述处理器为内置所述ADC的处理器芯片,电源VCC通过线性稳压器分别连接所述传感器和所述处理器,所述传感器的输出端连接所述ADC,所述ADC与所述真随机数控制器相连,所述真随机数控制器还与所述存储器相连;其中,所述处理器内部通过所述真随机数控制器控制所述ADC的采样次数和采样时间,并根据所述ADC的输出数据生成真随机数,将所述真随机数保存在所述存储器中;所述ADC的采样次数和采样时间根据所述传感器采集的感应信息确定。The present invention provides a true random number generator based on ADC nonlinear effect chaotic mapping, including a processor and a sensor, the processor includes a true random number controller, an ADC and a memory; the processor is a built-in ADC The processor chip, the power supply VCC is respectively connected to the sensor and the processor through a linear regulator, the output end of the sensor is connected to the ADC, and the ADC is connected to the true random number controller. The number controller is also connected to the memory; wherein the processor internally controls the sampling times and sampling time of the ADC through the true random number controller, and generates true random numbers according to the output data of the ADC, and The true random number is stored in the memory; the sampling times and sampling time of the ADC are determined according to the sensing information collected by the sensor.
进一步地,所述处理器和所述传感器之间通过放大器连接,所述放大器用于提高所述传感器的输出信号的信噪比。Further, the processor and the sensor are connected through an amplifier, and the amplifier is used to improve the signal-to-noise ratio of the output signal of the sensor.
进一步地,所述放大器和所述处理器之间通过无源滤波器连接,所述无源滤波器用于优化所述传感器输出信号的信噪比和给所述放大器的输出起缓冲作用。Further, the amplifier and the processor are connected through a passive filter, and the passive filter is used to optimize the signal-to-noise ratio of the sensor output signal and buffer the output of the amplifier.
进一步地,所述无源滤波器包括电阻R,电容C1、电容C2和电感L;所述电容C1的一端和所述放大器的输出端连接,所述电容C1的另一端和所述电阻R的一端连接,所述电阻R的另一端分别与所述电感L的一端、所述电容C2的一端和所述ADC连接,所述电阻L的另一端和所述电容C2的另一端均接地。Further, the passive filter includes a resistor R, a capacitor C1, a capacitor C2, and an inductor L; one end of the capacitor C1 is connected to the output end of the amplifier, and the other end of the capacitor C1 is connected to the resistor R One end is connected, the other end of the resistor R is respectively connected to one end of the inductor L, one end of the capacitor C2 and the ADC, and the other end of the resistor L and the other end of the capacitor C2 are both grounded.
进一步地,所述无源滤波器为低通、带通或高通滤波器。Further, the passive filter is a low-pass, band-pass or high-pass filter.
进一步地,所述电源VCC分别通过线性稳压器LDO1连接所述处理器,并通过线性稳压器LDO2使能所述真随机数控制器。Further, the power supply VCC is respectively connected to the processor through a linear regulator LDO1, and the true random number controller is enabled through the linear regulator LDO2.
本发明实施例提供的一种能完全兼容传感设备的真随机数发生器,其总体结构如图8 所示,其为本发明的基于ADC非线性效应混沌映射的真随机数产生器的总体结构示意图。该结构直接使用传感器作为熵源,不需要添加任何其他电路与器件,并且也不需要专门添加ADC模块,可大大节省开销,也能够减小由于添加外部电路、器件、ADC模块等而带来的设备体积增大的弊端。其中处理器可以是任意的MCU、DSP、ARM和FPGA(描述为处理器结构)等有内置ADC的处理器芯片。处理器内部通过真随机数控制器控制ADC的采样次数和采样时间,并根据ADC输出数据生成真随机数,并将其保存在存储器中。传感器用来采集感应信息,放大器的主要功能是提高传感器输出信号的信噪比,放大器不是真随机数发生器的必须电路。An embodiment of the present invention provides a true random number generator that is fully compatible with sensing equipment. Its overall structure is shown in FIG. 8, which is the overall structure of the true random number generator based on the chaotic mapping of the ADC nonlinear effect. Schematic. This structure directly uses the sensor as the source of entropy without adding any other circuits and devices, and there is no need to add ADC modules specifically, which can greatly save costs and reduce the cost of adding external circuits, devices, ADC modules, etc. Disadvantages of increased equipment volume. The processor can be any MCU, DSP, ARM, FPGA (described as a processor structure) and other processor chips with built-in ADCs. The processor controls the sampling times and sampling time of the ADC through a true random number controller, and generates a true random number according to the ADC output data and saves it in the memory. The sensor is used to collect sensing information. The main function of the amplifier is to improve the signal-to-noise ratio of the sensor output signal. The amplifier is not a necessary circuit for a true random number generator.
其中,C1,R,L,C2组成通用的无源滤波器结构,可以根据传感器输出信号的类型,将无源滤波器配置为低通、带通和高通滤波器,优化传感器输出信号的信噪比,以实现传感器输出信号检测。滤波器也可以用来给放大器输出起缓冲作用,以确保MCU控制并接通SW后,放大器输出有一个上升时间(不是瞬间达到饱和状态),从而保证ADC进行多次转换后,放大器输出仍然处在上升阶段,这样ADC输出数据的后几位变化都很大(这些位都能够用来生成真随机数),可以减少ADC转换次数,提高真随机数发生器生成真随机数的速率。Among them, C1, R, L, C2 form a general passive filter structure. According to the type of sensor output signal, the passive filter can be configured as low-pass, band-pass and high-pass filters to optimize the signal noise of the sensor output signal Ratio to achieve sensor output signal detection. The filter can also be used to buffer the output of the amplifier to ensure that after the MCU controls and switch on the SW, the amplifier output has a rise time (not instantaneously saturated), so as to ensure that the amplifier output remains at the same level after the ADC performs multiple conversions In the rising phase, the last few bits of the ADC output data have great changes (these bits can be used to generate true random numbers), which can reduce the number of ADC conversions and increase the rate at which the true random number generator generates true random numbers.
在数字芯片中,使用ADC转换模拟输入电压信号来产生数字输出的方式是一种很成熟的方法,但是采用基于处理器内嵌的ADC产生真随机数的方案较为罕见,因此本发明还提出一种专门用来产生真随机数的软件实现方法,实现ADC转换连续变化的输入模拟电压信号来产生真随机数,并且实现ADC随机间隔采样。由于ADC都有一个固定的分辨率,大部分内嵌的ADC模块分辨率都小于16bits,如果应用模块需要远远超过16bits的真随机数,则需要ADC进行多次转换。图8中的真随机数控制器是真随机数产生器的控制核心,可以根据不同的应用场景选择产生不同级别的真随机数。In digital chips, it is a very mature method to use ADC to convert analog input voltage signal to generate digital output. However, it is relatively rare to use an ADC embedded in a processor to generate true random numbers. Therefore, the present invention also proposes a A software implementation method specifically used to generate true random numbers, realizes ADC conversion of continuously changing input analog voltage signals to generate true random numbers, and realizes ADC sampling at random intervals. Since the ADC has a fixed resolution, most of the embedded ADC modules have a resolution less than 16 bits. If the application module requires a true random number far exceeding 16 bits, the ADC needs to perform multiple conversions. The true random number controller in Figure 8 is the control core of the true random number generator, which can be selected to generate different levels of true random numbers according to different application scenarios.
如图9所示,其为本发明的产生真随机数的实现方法的流程图。随机数生成模块执行的流程如图9所示,其中虚线框是真随机数控制器。As shown in FIG. 9, it is a flowchart of the implementation method of generating true random numbers of the present invention. The process performed by the random number generation module is shown in Figure 9, where the dashed box is a true random number controller.
本发明提供一种产生真随机数的实现方法,应用于上述基于ADC非线性效应混沌映射的真随机数产生器,包括以下步骤:The present invention provides an implementation method for generating true random numbers, which is applied to the above-mentioned true random number generator based on ADC nonlinear effect chaotic mapping, and includes the following steps:
S1:所述真随机数控制器根据所述采样次数、随机数位数以及真随机数级别计算需要持续生成的真随机数C的个数,并开启所述传感器的供电开关;S1: The true random number controller calculates the number of true random numbers C that need to be continuously generated according to the sampling times, the number of random numbers, and the true random number level, and turns on the power switch of the sensor;
S2:根据所述存储器的真随机数存储区里的真随机数产生一个初始延迟,所述ADC转换输入电压,转换完成一次以后,将ADC转换次数M减1,然后根据所述随机数级别,由ADC的输出数据生成随机数后判断所述M是否为0;S2: Generate an initial delay based on the true random number in the true random number storage area of the memory. The ADC converts the input voltage. After the conversion is completed once, the number of ADC conversions M is reduced by 1, and then according to the random number level, After generating a random number from the output data of the ADC, judge whether the M is 0;
S3:如果M为0,则将生成的真随机数保存到所述真随机数存储区,并且关闭所述传感器的电源;如果M不为0,则根据上一次ADC输出实现随机延迟;S3: If M is 0, save the generated true random number to the true random number storage area, and turn off the power supply of the sensor; if M is not 0, realize a random delay according to the last ADC output;
S4:延迟完成后,所述ADC继续转换输入电压,转换结束后继续将ADC转换次数M减1;然后继续判断所述M是否为0,以确定所述ADC是否进行下一次转换,直到M为 0为止;S4: After the delay is completed, the ADC continues to convert the input voltage, and after the conversion is completed, it continues to subtract 1 from the number of ADC conversions M; then continues to determine whether the M is 0 to determine whether the ADC performs the next conversion until M is Up to 0;
S5:判断C是否为0,如果不为0,则继续打开开关,生成M位的真随机数;如果C为0,则发送产生的真随机数。S5: Determine whether C is 0. If it is not 0, continue to open the switch to generate M-bit true random numbers; if C is 0, send the generated true random numbers.
进一步地,所述S1之前还包括:S11:外部的应用模块生成并发送需要的采样次数、随机数位数和真随机数级别给所述真随机数控制器,并且使能所述真随机数控制器。Further, before the S1, it also includes: S11: the external application module generates and sends the required sampling times, the number of random numbers, and the true random number level to the true random number controller, and enables the true random number control Device.
进一步地,所述ADC的输出信号是数字信号。Further, the output signal of the ADC is a digital signal.
进一步地,所述发送产生的真随机数,包括:发送产生的真随机数到外部的应用模块。Further, the sending the generated true random number includes: sending the generated true random number to an external application module.
进一步地,所述处理器和所述传感器之间通过放大器连接;Further, the processor and the sensor are connected through an amplifier;
所述开启所述传感器的供电开关,包括:开启所述传感器和所述放大器的供电开关;The turning on the power supply switch of the sensor includes: turning on the power supply switch of the sensor and the amplifier;
所述关闭所述传感器的电源,包括:关闭所述传感器和所述放大器的电源;Said turning off the power of the sensor includes: turning off the power of the sensor and the amplifier;
所述ADC转换输入电压,包括,所述ADC转换所述放大器输出的电压,所述放大器输出的电压为所述ADC的输入电压。The ADC converting the input voltage includes converting the voltage output by the amplifier by the ADC, and the voltage output by the amplifier is the input voltage of the ADC.
本发明实施例提供的一种产生真随机数的实现方法,首先应用模块生成需要的随机数位数、采样次数和真随机数级别然后将它们发送给真随机数控制器,并且使能真随机数控制器。真随机数控制器根据随机数位数、采样次数以及真随机数级别计算需要持续生成多少个M位的真随机数,这里用C来表示,然后开启传感器和放大器(熵源)的供电开关。根据真随机数存储区里的真随机数产生一个初始延迟,然后ADC开始转换放大器输出的电压,ADC输出是数字信号,转换完成一次以后,首先将ADC转换次数M减1,然后根据随机数级别,由ADC的输出数据生成随机数,随后判断M是否为0,如果为0,则将生成的真随机数保存到真随机数存储区,并且关闭传感器和放大器电源;如果M不为0,根据上一次ADC输出实现随机延迟。延迟完成后,ADC继续转换输入的电压,转换结束后继续将M减1;然后继续判断M是否为0,确定ADC是否进行下一次转换,直到M为0为止。然后判断C是否为0,如果不为0,则继续打开开关,生成M位的真随机数;如果C为0,则发送产生的真随机数到应用模块,并结束。An implementation method for generating a true random number provided by an embodiment of the present invention. First, an application module generates the required number of random number digits, sampling times, and true random number level, and then sends them to the true random number controller, and enables true random numbers Controller. The true random number controller calculates how many M-bit true random numbers need to be continuously generated according to the number of random number digits, sampling times, and true random number level, which is represented by C, and then turns on the power supply switch of the sensor and amplifier (entropy source). An initial delay is generated according to the true random number in the true random number storage area, and then the ADC starts to convert the voltage output by the amplifier. The ADC output is a digital signal. After the conversion is completed, the number of ADC conversions M is reduced by 1, and then according to the random number level , Generate a random number from the output data of the ADC, and then determine whether M is 0, if it is 0, save the generated true random number to the true random number storage area, and turn off the sensor and amplifier power; if M is not 0, according to The last ADC output achieves a random delay. After the delay is complete, the ADC continues to convert the input voltage, and continues to decrease M after the conversion is completed; then continue to determine whether M is 0, and determine whether the ADC performs the next conversion until M is 0. Then judge whether C is 0. If it is not 0, continue to open the switch and generate M-bit true random numbers; if C is 0, send the generated true random numbers to the application module and end.
以下通过图10可以进一步说明如何使用ADC输出数据生成真随机数。如图10所示,其为本发明的产生真随机数的实现方法的M=16时不同级别产生真随机数的方法的流程图。图10显示了随机数级别分为0-3和随机数位数M为16bits的真随机数产生过程。如果随机数级别是0,则ADC需要采集16次,取每次ADC输出数据的最低有效位(第0位)来生成真随机数,ADC输出数据和真随机数对应关系如图10(a)所示,从图中可以看出只有第0位用来产生真随机数,其他1到11位丢弃。当随机数级别是1、2和3时,ADC输出数据和真随机数产生方法分别如图10(b)、图10(c)和图10(d)所示。图10(a)中的RN_level=0,图10(b)中的RN_level=1,图10(c)中的RN_level=2和图10(d)中的RN_level=3。使用ADC输出的多位来产生真随机数,虽然会使得真随机数的质量有一定的退化,然而,这可以提高真随机数的产生速率,在对真随机数质量要求不是很高的场合特别有用,比如用来实现RFID多标签防碰撞中的随机数。The following figure 10 can further illustrate how to use ADC output data to generate true random numbers. As shown in FIG. 10, it is a flowchart of a method for generating a true random number at different levels when M=16 in the implementation method for generating a true random number of the present invention. Figure 10 shows the true random number generation process with the random number level divided into 0-3 and the random number M is 16 bits. If the random number level is 0, the ADC needs to collect 16 times, and each time the least significant bit (bit 0) of the ADC output data is used to generate a true random number. The corresponding relationship between the ADC output data and the true random number is shown in Figure 10(a) As shown, it can be seen from the figure that only the 0th bit is used to generate a true random number, and the other 1 to 11 bits are discarded. When the random number level is 1, 2 and 3, the ADC output data and the true random number generation method are shown in Figure 10(b), Figure 10(c) and Figure 10(d) respectively. RN_level=0 in Fig. 10(a), RN_level=1 in Fig. 10(b), RN_level=2 in Fig. 10(c) and RN_level=3 in Fig. 10(d). Using multiple bits of ADC output to generate true random numbers will degrade the quality of true random numbers to a certain extent. However, this can increase the rate of true random number generation, especially when the quality of true random numbers is not very high. Useful, for example, to implement random numbers in RFID multi-tag anti-collision.
本发明实施例提供的一种产生真随机数的实现方法,可以使用定制的专用芯片实现,也能够使用传统的处理器(内置ADC)来实现,并且在需要实现传感器功能的设备中,能够在不添加任何其他电路、模块、器件的情况下,仅仅通过软件就能实现真随机数发生器。该方法工作模式灵活,能够满足通信系统的各种应用场景需求,以及需要各种随机数位数的加密算法。且该方案简单易行、成本低、功耗低、体积小,十分适合在无线传感网络节点中使用。在当今的无线通信系统中,为了通信数据安全可靠,都需要将数据进行加密,而固定的加密算法很容易被截获和破解,因此在无线传感网络节点中的加密算法中添加真随机数将大大提高无线传感网络通信的安全性。The implementation method for generating true random numbers provided by the embodiments of the present invention can be implemented using a customized dedicated chip, or can be implemented using a traditional processor (built-in ADC), and can be implemented in devices that need to implement sensor functions Without adding any other circuits, modules, or devices, a true random number generator can be realized only by software. The method has a flexible working mode and can meet the requirements of various application scenarios of the communication system and the encryption algorithm that requires various random number digits. In addition, the solution is simple and easy to implement, low cost, low power consumption, and small in size, which is very suitable for use in wireless sensor network nodes. In today’s wireless communication systems, for the safety and reliability of communication data, data needs to be encrypted, and fixed encryption algorithms are easily intercepted and cracked. Therefore, adding true random numbers to the encryption algorithms in wireless sensor network nodes will Greatly improve the security of wireless sensor network communication.
本发明实施例提供的一种产生真随机数的实现方法,提出了使用ADC输出数据产生随机延迟的方法;使用随机间隔延迟采样机制产生真随机数的方法;使用可控的模拟电路为ADC提供动态的输入信号来提高ADC输出数据随机性的方法;以及结合以上3种方法,在传统处理器或定制芯片中实现真随机数的方法。该产生真随机数的实现方法,提出的一套由应用程序提供可动态改变的随机数位数和随机数级别的真随机数产生机制,可根据不同的应用产生任意数量的真随机数和灵活设置真随机数产生速率。应用程序具体使用方案可以根据应用场景确定,真随机数位数和真随机数级别不限于以上举例的方式,可以是任意的表示方式。An implementation method for generating true random numbers provided by the embodiment of the present invention proposes a method of using ADC output data to generate random delays; using a random interval delay sampling mechanism to generate true random numbers; using a controllable analog circuit to provide ADCs Dynamic input signals to improve the randomness of ADC output data; and combining the above three methods to achieve true random numbers in traditional processors or custom chips. The realization method of generating true random numbers proposes a set of true random number generation mechanism with dynamically changeable random number digits and random number level provided by the application, which can generate any number of true random numbers and flexible settings according to different applications True random number generation rate. The specific usage plan of the application program can be determined according to the application scenario. The number of true random number and the level of true random number are not limited to the above examples, and can be any expression.
本领域的普通技术人员将会意识到,这里所述的实施例是为了帮助读者理解本发明的原理,应被理解为本发明的保护范围并不局限于这样的特别陈述和实施例。本领域的普通技术人员可以根据本发明公开的这些技术启示做出各种不脱离本发明实质的其它各种具体变形和组合,这些变形和组合仍然在本发明的保护范围内。Those of ordinary skill in the art will realize that the embodiments described here are to help readers understand the principles of the present invention, and it should be understood that the protection scope of the present invention is not limited to such special statements and embodiments. A person of ordinary skill in the art can make various other specific modifications and combinations without departing from the essence of the present invention based on the technical enlightenment disclosed in the present invention, and these modifications and combinations still fall within the protection scope of the present invention.

Claims (16)

  1. 一种MCU随机间隔转换电桥电压的真随机数产生器,其特征在于,包括MCU、电桥模块和放大器,所述MCU包括应用模块、随机数生成模块和ADC模块;电源VCC通过开关SW分别连接电桥模块和放大器,电桥模块的输出端与放大器相连,放大器的输出端连接ADC模块,ADC模块与随机数生成器相连,随机数生成器连接应用模块;A true random number generator for MCU to convert bridge voltage at random intervals, which is characterized in that it comprises an MCU, a bridge module and an amplifier. The MCU includes an application module, a random number generation module, and an ADC module; Connect the bridge module and the amplifier, the output end of the bridge module is connected to the amplifier, the output end of the amplifier is connected to the ADC module, the ADC module is connected to the random number generator, and the random number generator is connected to the application module;
    所述应用模块,用于提供随机数位数和真随机数级别给随机数生成模块,并且使能随机数生成模块;The application module is used to provide the random number digits and the true random number level to the random number generation module, and enable the random number generation module;
    所述随机数生成模块,用于在应用模块的控制下控制ADC模块将模拟电压转换为数字信号,从而产生真随机数。The random number generating module is used to control the ADC module to convert the analog voltage into a digital signal under the control of the application module, thereby generating a true random number.
  2. 根据权利要求1所述的一种MCU随机间隔转换电桥电压的真随机数产生器,其特征在于,所述电桥模块采用惠斯通电桥,包括电阻R1、R2、R3、R4,电阻R1、R2、R3、R4首尾相连,组成方形电路;其中,方形电路相对的一组顶点分别与开关SW和接地端相连;另一组相对的顶点分别连接放大器的两个输入端。The true random number generator for MCU to convert bridge voltage at random intervals according to claim 1, wherein the bridge module adopts a Wheatstone bridge, including resistors R1, R2, R3, R4, and resistor R1 , R2, R3, and R4 are connected end to end to form a square circuit; among them, the opposite set of vertices of the square circuit are respectively connected to the switch SW and the ground terminal; the other set of opposite vertices are respectively connected to the two input terminals of the amplifier.
  3. 根据权利要求2所述的一种MCU随机间隔转换电桥电压的真随机数产生器,其特征在于,所述电阻R1、R2、R3、R4中,任意一个电阻采用滑动变阻器,其余三个电阻采用普通电阻。The true random number generator for MCU to convert bridge voltage at random intervals according to claim 2, wherein any one of the resistors R1, R2, R3, R4 is a sliding rheostat, and the remaining three resistors Use ordinary resistance.
  4. 根据权利要求1所述的一种MCU随机间隔转换电桥电压的真随机数产生器,其特征在于,所述放大器的输出端通过电容C接地。The true random number generator for MCU to convert bridge voltage at random intervals according to claim 1, wherein the output terminal of the amplifier is grounded through a capacitor C.
  5. 一种MCU随机间隔转换电桥电压的真随机数产生方法,其特征在于,包括以下步骤:A method for generating true random numbers for MCU to convert bridge voltage at random intervals is characterized in that it includes the following steps:
    S1、应用模块提供随机数位数和真随机数级别给随机数生成模块,并且使能随机数生成模块;S1. The application module provides random number digits and true random number level to the random number generation module, and enables the random number generation module;
    S2、计算ADC模块需要转换的次数N,开启电桥和放大器的供电开关SW;S2. Calculate the number of conversions required by the ADC module N, and turn on the power switch SW of the bridge and amplifier;
    S3、ADC模块开始转换放大器的输出电压,并根据随机数级别由ADC的采样值生成随机数;S3. The ADC module starts to convert the output voltage of the amplifier, and generates a random number from the sampling value of the ADC according to the random number level;
    S4、将ADC转换次数N减1,判断N是否为0,如果是则将生成的真随机数发送给应用模块,并且关闭开关SW;否则ADC模块进行随机延迟,然后返回步骤S3,直到N为0为止;S4. Reduce the number of ADC conversion times N by 1, to determine whether N is 0, if it is, send the generated true random number to the application module, and close the switch SW; otherwise, the ADC module performs a random delay, and then returns to step S3 until N is Up to 0;
    S5、将所有的真随机数拼接在一起,发给应用模块。S5. Splice all true random numbers together and send them to the application module.
  6. 一种基于ADC非线性效应混沌映射的真随机数产生器,其特征在于,包括处理器和传感器,所述处理器包括真随机数控制器、ADC和存储器;所述处理器为内置所述ADC的处理器芯片,电源VCC通过线性稳压器分别连接所述传感器和所述处理器,所述传感器的输出端连接所述ADC,所述ADC与所述真随机数控制器相连,所述真随机数控制器还与所述存储器相连;其中,所述处理器内部通过所述真随机数控制器控制所述ADC的采样次数和采样时间,并根据所述ADC的输出数据生成真随机数,将所述真随机数保存 在所述存储器中;所述ADC的采样次数和采样时间根据所述传感器采集的感应信息确定。A true random number generator based on ADC nonlinear effect chaotic mapping, which is characterized in that it includes a processor and a sensor, the processor includes a true random number controller, an ADC, and a memory; the processor is a built-in ADC The power supply VCC is respectively connected to the sensor and the processor through a linear regulator, the output terminal of the sensor is connected to the ADC, the ADC is connected to the true random number controller, and the true The random number controller is also connected to the memory; wherein the processor internally controls the sampling times and sampling time of the ADC through the true random number controller, and generates a true random number according to the output data of the ADC, The true random number is stored in the memory; the sampling times and sampling time of the ADC are determined according to the sensing information collected by the sensor.
  7. 根据权利要求6所述的一种基于ADC非线性效应混沌映射的真随机数产生器,其特征在于,所述处理器和所述传感器之间通过放大器连接,所述放大器用于提高所述传感器的输出信号的信噪比。The true random number generator based on chaotic mapping of ADC nonlinear effects according to claim 6, wherein the processor and the sensor are connected through an amplifier, and the amplifier is used to improve the sensor. The signal-to-noise ratio of the output signal.
  8. 根据权利要求7所述的一种基于ADC非线性效应混沌映射的真随机数产生器,其特征在于,所述放大器和所述处理器之间通过无源滤波器连接,所述无源滤波器用于优化所述传感器输出信号的信噪比和给所述放大器的输出起缓冲作用。The true random number generator based on chaotic mapping of ADC nonlinear effects according to claim 7, wherein the amplifier and the processor are connected through a passive filter, and the passive filter is used To optimize the signal-to-noise ratio of the sensor output signal and buffer the output of the amplifier.
  9. 根据权利要求8所述的一种基于ADC非线性效应混沌映射的真随机数产生器,其特征在于,所述无源滤波器包括电阻R,电容C1、电容C2和电感L;所述电容C1的一端和所述放大器的输出端连接,所述电容C1的另一端和所述电阻R的一端连接,所述电阻R的另一端分别与所述电感L的一端、所述电容C2的一端和所述ADC连接,所述电阻L的另一端和所述电容C2的另一端均接地。The true random number generator based on chaotic mapping of ADC nonlinear effects according to claim 8, wherein the passive filter comprises a resistor R, a capacitor C1, a capacitor C2, and an inductance L; the capacitor C1 One end of the capacitor C1 is connected to the output end of the amplifier, the other end of the capacitor C1 is connected to one end of the resistor R, and the other end of the resistor R is connected to one end of the inductor L, one end of the capacitor C2 and The ADC is connected, and the other end of the resistor L and the other end of the capacitor C2 are both grounded.
  10. 根据权利要求8所述的一种基于ADC非线性效应混沌映射的真随机数产生器,其特征在于,所述无源滤波器为低通、带通或高通滤波器。8. The true random number generator based on chaotic mapping of ADC nonlinear effects according to claim 8, wherein the passive filter is a low-pass, band-pass or high-pass filter.
  11. 根据权利要求6所述的一种基于ADC非线性效应混沌映射的真随机数产生器,其特征在于,所述电源VCC分别通过线性稳压器LDO1连接所述处理器,并通过线性稳压器LDO2使能所述真随机数控制器。The true random number generator based on chaotic mapping of ADC nonlinear effects according to claim 6, wherein the power supply VCC is connected to the processor through a linear regulator LDO1, and is connected to the processor through a linear regulator. LDO2 enables the true random number controller.
  12. 一种产生真随机数的实现方法,应用于权利要求6至11任意一项所述基于ADC非线性效应混沌映射的真随机数产生器,其特征在于,包括以下步骤:An implementation method for generating true random numbers, applied to the true random number generator based on ADC non-linear effect chaotic mapping according to any one of claims 6 to 11, characterized in that it comprises the following steps:
    S1:所述真随机数控制器根据所述采样次数、随机数位数以及真随机数级别计算需要持续生成的真随机数C的个数,并开启所述传感器的供电开关;S1: The true random number controller calculates the number of true random numbers C that need to be continuously generated according to the sampling times, the number of random numbers, and the true random number level, and turns on the power switch of the sensor;
    S2:根据所述存储器的真随机数存储区里的真随机数产生一个初始延迟,所述ADC转换输入电压,转换完成一次以后,将ADC转换次数M减1,然后根据所述随机数级别,由ADC的输出数据生成随机数后判断所述M是否为0;S2: Generate an initial delay based on the true random number in the true random number storage area of the memory. The ADC converts the input voltage. After the conversion is completed once, the number of ADC conversions M is reduced by 1, and then according to the random number level, After generating a random number from the output data of the ADC, judge whether the M is 0;
    S3:如果M为0,则将生成的真随机数保存到所述真随机数存储区,并且关闭所述传感器的电源;如果M不为0,则根据上一次ADC输出实现随机延迟;S3: If M is 0, save the generated true random number to the true random number storage area, and turn off the power supply of the sensor; if M is not 0, realize a random delay according to the last ADC output;
    S4:延迟完成后,所述ADC继续转换输入电压,转换结束后继续将ADC转换次数M减1;然后继续判断所述M是否为0,以确定所述ADC是否进行下一次转换,直到M为0为止;S4: After the delay is completed, the ADC continues to convert the input voltage, and after the conversion is completed, it continues to subtract 1 from the number of ADC conversions M; then continues to determine whether the M is 0 to determine whether the ADC performs the next conversion until M is Up to 0;
    S5:判断C是否为0,如果不为0,则继续打开开关,生成M位的真随机数;如果C为0,则发送产生的真随机数。S5: Determine whether C is 0. If it is not 0, continue to open the switch to generate M-bit true random numbers; if C is 0, send the generated true random numbers.
  13. 根据权利要求12所述的一种产生真随机数的实现方法,其特征在于,所述S1之前还包括:S11:外部的应用模块生成并发送需要的采样次数、随机数位数和真随机数级别给所述真随机数控制器,并且使能所述真随机数控制器。The method for generating true random numbers according to claim 12, characterized in that, before S1, it further comprises: S11: the external application module generates and sends the required sampling times, the number of random numbers, and the level of true random numbers Give the true random number controller, and enable the true random number controller.
  14. 根据权利要求12所述的一种产生真随机数的实现方法,其特征在于,所述ADC的输出信号是数字信号。An implementation method for generating a true random number according to claim 12, wherein the output signal of the ADC is a digital signal.
  15. 根据权利要求12所述的一种产生真随机数的实现方法,其特征在于,所述发送产生的真随机数,包括:发送产生的真随机数到外部的应用模块。An implementation method for generating a true random number according to claim 12, wherein said sending the generated true random number comprises: sending the generated true random number to an external application module.
  16. 根据权利要求12所述的一种产生真随机数的实现方法,其特征在于,所述处理器和所述传感器之间通过放大器连接;The method for generating true random numbers according to claim 12, wherein the processor and the sensor are connected through an amplifier;
    所述开启所述传感器的供电开关,包括:开启所述传感器和所述放大器的供电开关;The turning on the power supply switch of the sensor includes: turning on the power supply switch of the sensor and the amplifier;
    所述关闭所述传感器的电源,包括:关闭所述传感器和所述放大器的电源;Said turning off the power of the sensor includes: turning off the power of the sensor and the amplifier;
    所述ADC转换输入电压,包括,所述ADC转换所述放大器输出的电压,所述放大器输出的电压为所述ADC的输入电压。The ADC converting the input voltage includes converting the voltage output by the amplifier by the ADC, and the voltage output by the amplifier is the input voltage of the ADC.
PCT/CN2020/110774 2019-06-25 2020-08-24 Truly random number generator and truly random number generation method for conversion of bridge voltage at random intervals in mcu WO2020259721A2 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910553330.6A CN110286878B (en) 2019-06-25 2019-06-25 True random number generator and generating method for MCU random interval conversion bridge voltage
CN201910553330.6 2019-06-25

Publications (2)

Publication Number Publication Date
WO2020259721A2 true WO2020259721A2 (en) 2020-12-30
WO2020259721A3 WO2020259721A3 (en) 2021-02-18

Family

ID=68005603

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/110774 WO2020259721A2 (en) 2019-06-25 2020-08-24 Truly random number generator and truly random number generation method for conversion of bridge voltage at random intervals in mcu

Country Status (2)

Country Link
CN (1) CN110286878B (en)
WO (1) WO2020259721A2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110286878B (en) * 2019-06-25 2021-06-01 电子科技大学 True random number generator and generating method for MCU random interval conversion bridge voltage
CN110955408A (en) * 2019-12-02 2020-04-03 上海威固信息技术股份有限公司 True random number generation method and system based on Xilinx FPGA
CN111352608B (en) * 2020-02-28 2022-08-02 电子科技大学 Low-overhead FPGA (field programmable Gate array) basic true random number generation system
CN112328207B (en) * 2020-11-30 2022-08-12 中国石油大学(华东) True random number generator based on singlechip random source working parameters and generating method

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4853884A (en) * 1987-09-11 1989-08-01 Motorola, Inc. Random number generator with digital feedback
CN100365564C (en) * 2004-08-18 2008-01-30 浙江大学 High speed true random number generator
JP4836766B2 (en) * 2006-12-13 2011-12-14 株式会社エルイーテック Physical random number generation device and physical random number generation circuit
CN101034378A (en) * 2007-04-27 2007-09-12 吴晓栋 Method for implementing processor and computer system information processing environment high safety and trust
JP4365872B2 (en) * 2007-05-31 2009-11-18 株式会社東芝 Random number generator
US8595274B2 (en) * 2007-12-31 2013-11-26 Intel Corporation Random number generator
JP5090216B2 (en) * 2008-03-10 2012-12-05 株式会社エルイーテック Random number generation apparatus and random number generation method
JP5574846B2 (en) * 2010-06-22 2014-08-20 キヤノン株式会社 Switching power supply
CN102968290B (en) * 2012-11-20 2015-08-26 华中科技大学 A kind of true Random Number Generator of isomery lightweight
CN103049243B (en) * 2012-12-17 2015-11-25 深圳国微技术有限公司 True random-number generating method and device thereof
CN203930796U (en) * 2013-12-25 2014-11-05 深圳国微技术有限公司 A kind of true random number produces circuit
CN104317551A (en) * 2014-10-17 2015-01-28 北京德加才科技有限公司 Ultrahigh-safety true random number generation method and ultrahigh-safety true random number generation system
CN106610814B (en) * 2015-10-23 2021-04-30 国民技术股份有限公司 Shared switch capacitor true random number generator and method for generating true random number
CA2957695A1 (en) * 2016-07-15 2018-01-15 Alexander Sheung Lai Wong System and method for building artificial neural network architectures
CN107562410A (en) * 2017-08-29 2018-01-09 中国科学院苏州纳米技术与纳米仿生研究所 The harvester and acquisition method of true random number
CN208547936U (en) * 2018-06-08 2019-02-26 中国科学技术大学 The real-time quantum random number generator of high speed based on photoelectricity hybrid integrated
CN109783060A (en) * 2019-01-16 2019-05-21 河海大学常州校区 High-speed, true random-number generator based on current-steering ring oscillator
CN110286878B (en) * 2019-06-25 2021-06-01 电子科技大学 True random number generator and generating method for MCU random interval conversion bridge voltage

Also Published As

Publication number Publication date
CN110286878B (en) 2021-06-01
CN110286878A (en) 2019-09-27
WO2020259721A3 (en) 2021-02-18

Similar Documents

Publication Publication Date Title
WO2020259721A2 (en) Truly random number generator and truly random number generation method for conversion of bridge voltage at random intervals in mcu
CN106767745B (en) A kind of signal processing method of photoelectric sensor angle measuring system
CN102637122B (en) The parity of physically based deformation noise generates method and the system thereof of true random number
JPH08274825A (en) Signal-shaping circuit reproducing data stream from digital-modulated channel with increased sensitivity
JP5818027B2 (en) Clock data recovery circuit and wireless module including the same
US20190245528A1 (en) Ring oscillator-based timer
KR102159341B1 (en) Ratio-metric self-capacitance-to-code convertor
CN104980130B (en) The method of the change Rise Time of Square Wave of OSERDES2 based on FPGA
WO2020191585A1 (en) Signal transmission method and system, active stylus, touch screen, and readable storage medium
Zhou et al. Digital-assisted asynchronous compressive sensing front-end
Tao et al. A design of WSN based locking system
CN201965746U (en) Remote control encoding circuit based on FPGA (Field Programmable Gate Array)
CN105866483B (en) A kind of implementation method with dsp controller generation sine wave signal
CN114500201A (en) ASK data decoding device, method, microcontroller and equipment
CN111182489A (en) Meteorological ocean information ultrashort wave transmission system
CN102868404A (en) Analog-to-digital (AD) conversion method based on cosine algorithm and Gray code
CN110955408A (en) True random number generation method and system based on Xilinx FPGA
CN209447149U (en) Real random number generator, the control system including it, electronic device
Behravan et al. A compressed-sensing sensor-on-chip incorporating statistics collection to improve reconstruction performance
TWI533619B (en) Time-to-digital converter and operation method thereof
CN204515404U (en) Digital quantizer
CN208043267U (en) A kind of digital temperature sensors of CMOS
Li et al. Implementation of CRC in 10-gigabit Ethernet based on FPGA
Patel et al. Discrete and Continuous Time Chaos Based on True Random Number Generators
Ya-jun et al. Microcontroller-Based LoRa Scatter Communication

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20832048

Country of ref document: EP

Kind code of ref document: A2

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20832048

Country of ref document: EP

Kind code of ref document: A2