Random number generation method, device, computer equipment and storage medium

Entropy source data is generated through the vehicle controller LAN bus signal differential voltage value, which solves the problem of unreliable random numbers in the existing technology and achieves high-security encryption of vehicle data.

CN118363566BActive Publication Date: 2024-09-03PENG CHENG LAB
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410796936.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-09-03
Estimated Expiration
2044-06-20

AI Technical Summary

Technical Problem

The random number generation method used in vehicle electronic systems in the existing technology is unreliable, and the generated random numbers are easily cracked, leading to vehicle data leakage and tampering, posing security risks.

Method used

By obtaining the high-voltage signal and low-voltage signal output by the vehicle's controller LAN bus, the differential voltage value is calculated, the entropy source data is generated, and the data is used to generate random numbers to ensure the unpredictability of the random numbers.

Benefits of technology

It improves the security of vehicle data encryption, prevents data leakage and tampering, and enhances the vehicle's network security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118363566B
    Figure CN118363566B
Patent Text Reader

Abstract

The embodiment of the present application discloses a random number generation method, device, computer equipment and storage medium. The high voltage signal and low voltage signal output by the controller local area network bus of the vehicle are obtained at different sampling time points, and the differential voltage value between the high voltage signal and the low voltage signal at each sampling time point is obtained; the binary value corresponding to each sampling time point is generated according to the differential voltage value, and the binary values ​​are combined into a binary string according to the time sequence of the sampling time points; a preset number of continuous binary values ​​at the end of the binary string are obtained at different entropy source acquisition time points; the continuous binary values ​​are determined as entropy source data, and the entropy source data is stored in a database; when a random number generation request is received, the target entropy source data is selected in the database, and the corresponding random number is generated according to the target entropy source data. Since the entropy source data is unpredictable, the unpredictability of the generated random number is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of automobile network security technology, and in particular to a random number generation method, device, computer equipment and storage medium. Background Art

[0002] With the development of vehicle technology, vehicles are becoming increasingly intelligent and networked, and the operation of the entire vehicle relies on complex electronic systems. For example, functions such as unmanned driving, smart parking, and emergency braking all rely on electronic systems. However, attackers may exploit vulnerabilities in the electronic system to control related functions of the vehicle, and even endanger the lives of passengers.

[0003] In the related art, in order to ensure that data is not leaked during the use of the electronic system, a software algorithm is often used to generate random numbers, and then the original data is encrypted by the generated random numbers. However, the method of generating random numbers by software algorithms is unreliable, and the generated random numbers are easily cracked, resulting in the original data of the vehicle encrypted by random numbers being leaked and tampered with.

[0004] Therefore, the method of generating random numbers in the related art is unreliable, and the generated random numbers are not unpredictable. Summary of the invention

[0005] The embodiments of the present application provide a random number generation method, device, computer equipment and storage medium. The entropy source data can be determined by obtaining the high voltage signal and low voltage signal output by the controller local area network bus of the vehicle, and then the entropy source data is used to generate random numbers. Since the generation of the entropy source data is unpredictable, the generated random numbers are also unpredictable.

[0006] According to one aspect of an embodiment of the present application, a random number generation method is provided, comprising:

[0007] Acquire a high voltage signal and a low voltage signal output by a controller area network bus of the vehicle at different sampling time points, and acquire a differential voltage value between the high voltage signal and the low voltage signal at each sampling time point;

[0008] Generating a binary value corresponding to each of the sampling time points according to the differential voltage value, and composing the binary values ​​into a binary string according to the time sequence of the sampling time points;

[0009] Acquiring a preset number of consecutive binary values ​​at the end of the binary string at different entropy source acquisition time points;

[0010] Determine the continuous binary values ​​as entropy source data, and store the entropy source data in a database;

[0011] When a random number generation request is received, target entropy source data is selected from the database, and a corresponding random number is generated according to the target entropy source data, and the random number is used to encrypt the vehicle data of the vehicle.

[0012] According to one aspect of an embodiment of the present application, a random number generating device is provided, comprising:

[0013] An acquisition module, used for acquiring a high voltage signal and a low voltage signal output by a controller area network bus of the vehicle at different sampling time points, and acquiring a differential voltage value between the high voltage signal and the low voltage signal at each sampling time point;

[0014] A character string generating module, used for generating a binary value corresponding to each of the sampling time points according to the differential voltage value, and combining the binary values ​​into a binary character string according to the time sequence of the sampling time points;

[0015] An acquisition module, used for acquiring a preset number of continuous binary values ​​at the end of the binary string at different entropy source acquisition time points;

[0016] A determination module, used for determining the continuous binary values ​​as entropy source data, and storing the entropy source data in a database;

[0017] The random number generation module is used to select target entropy source data from the database when a random number generation request is received, and generate a corresponding random number according to the target entropy source data, wherein the random number is used to encrypt the vehicle data of the vehicle.

[0018] In some embodiments, the acquisition module is used to:

[0019] Determine an electrical signal output by a controller area network bus of the vehicle, and determine a rising edge signal or a falling edge signal according to the electrical signal;

[0020] Determine a corresponding signal acquisition period according to the rising edge signal or the falling edge signal;

[0021] In the signal acquisition cycle, the high voltage signal and the low voltage signal output by the controller area network bus are acquired at different sampling time points.

[0022] In some embodiments, the acquisition module is used to:

[0023] Determine the entropy source acquisition time point corresponding to each signal acquisition cycle;

[0024] At each entropy source acquisition time point, acquiring the binary string corresponding to each signal acquisition period;

[0025] In the binary character string corresponding to each signal acquisition cycle, a preset number of continuous binary values ​​at the end of the binary character string are obtained.

[0026] In some embodiments, the random number generating device further includes a monitoring module, which is used to:

[0027] After determining the continuous binary values ​​as entropy source data and storing the entropy source data in a database, determining the data amount and data type of the entropy source data in the database;

[0028] When the data volume is less than the preset data volume or the number of types of the data type is less than the preset number of types, the sampling time points in each acquisition cycle are increased, and the preset number is adjusted according to the data volume or the number of types.

[0029] In some implementations, the string generation module is used to:

[0030] When the differential voltage value is greater than a first preset voltage difference value, determining that the binary value corresponding to the differential voltage value is a first value;

[0031] When the differential voltage value is less than a second preset voltage difference value, the binary value corresponding to the differential voltage value is determined to be a second value, and the first preset voltage difference value is greater than the second preset voltage difference value.

[0032] In some implementations, the string generation module is used to:

[0033] Determine the latest sampling time point, and obtain the binary value corresponding to the latest sampling time point;

[0034] The binary value corresponding to the latest sampling time point is set at the tail of the generated binary string to update the binary string.

[0035] In some embodiments, a determination module is used to:

[0036] After determining the continuous binary values ​​as entropy source data and storing the entropy source data in a database, determining different continuous binary values ​​of character string lengths in the database;

[0037] Randomly mixing the consecutive binary values ​​of different character string lengths to obtain a plurality of updated consecutive binary values;

[0038] The multiple updated continuous binary values ​​are determined as the entropy source data and saved in the database.

[0039] In some embodiments, the random number generation module is used to:

[0040] When a random number generation request is received, selecting at least one set of target entropy source data in the database;

[0041] An encryption algorithm corresponding to the at least one set of target entropy source data is determined, and a random number corresponding to the at least one set of target entropy source data is generated through the encryption algorithm.

[0042] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for a processor to load to execute the random number generation method provided in the embodiment of the present application.

[0043] According to one aspect of an embodiment of the present application, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the random number generation method provided in the embodiment of the present application when executing the computer program.

[0044] In an embodiment of the present application, a high voltage signal and a low voltage signal output by a controller area network bus of a vehicle are obtained at different sampling time points, and the differential voltage value between the high voltage signal and the low voltage signal at each sampling time point is obtained; a binary value corresponding to each sampling time point is generated according to the differential voltage value, and the binary values ​​are combined into a binary string according to the time sequence of the sampling time points; a preset number of continuous binary values ​​at the end of the binary string are obtained at different entropy source acquisition time points; the continuous binary values ​​are determined as entropy source data, and the entropy source data is stored in a database; when a random number generation request is received, the target entropy source data is selected in the database, and a corresponding random number is generated according to the target entropy source data. In an embodiment of the present application, the differential voltage value between the high voltage signal and the low voltage signal output by the controller area network bus of the vehicle is obtained, and the entropy source data is determined by the differential voltage value. Due to the randomness of the high voltage signal and the low voltage signal, the determined entropy source data is unpredictable, thereby ensuring that the random number generated according to the entropy source data has unpredictability. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0046] Figure 1 is a schematic diagram of the structure of an electronic controller of a vehicle provided in an embodiment of the present application;

[0047] Figure 2 It is a schematic diagram of a scenario corresponding to the random number generator provided in an embodiment of the present application;

[0048] Figure 3 It is a schematic diagram of a scenario corresponding to a random number provided in an embodiment of the present application;

[0049] Figure 4 It is a flowchart of a random number generation method provided in an embodiment of the present application;

[0050] Figure 5 is a waveform diagram of an electrical signal output by a controller area network bus provided in an embodiment of the present application;

[0051] Figure 6 is a schematic diagram of a binary string provided in an embodiment of the present application;

[0052] Figure 7 is another schematic diagram of the random number generation method provided in an embodiment of the present application;

[0053] Figure 8 is a schematic diagram of the structure of a random number generating device provided in an embodiment of the present application;

[0054] Fig. 9 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0056] It can be understood that in the specific implementation of the present application, vehicle data and other related data are involved. When the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0057] It should be noted that in some processes described in the specification, claims and the above-mentioned drawings, multiple steps appearing in a specific order are included, but it should be clearly understood that these steps may not be executed in the order in which they appear in this document or may be executed in parallel. The step numbers are only used to distinguish different steps, and the numbers themselves do not represent any execution order. In addition, descriptions such as "first", "second" or "target" in this document are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0058] Before further describing the embodiments of the present disclosure in detail, the nouns and terms involved in the embodiments of the present disclosure are described. The nouns and terms involved in the embodiments of the present disclosure are subject to the following interpretations:

[0059] Controller Area Network (CAN), also known as CAN bus, is a serial communication protocol and hardware bus standard for communication in embedded systems and automotive applications. The CAN bus achieves efficient data transmission through the structured design of data frames. Each ECU can prepare and broadcast information to the CAN bus, and the broadcasted data is received by all other ECUs on the network. Each ECU can then check the data and decide whether to accept it. Physical layer and data link layer of CAN bus Technically, the controller area network is described by the data link layer and the physical layer. CAN bus is widely used in automotive electronics, industrial automation and other fields. In automotive control systems, including engine management, body control, airbags, etc., efficient communication and collaborative work between different modules can be achieved by using CAN bus.

[0060] The CAN bus uses twisted pair cables for data transmission, and the two wires are called CAN-High and CAN-Low. The voltage signal output by the CAN-High wire is a high voltage signal, and the signal output by the CAN-Low wire is a low voltage signal.

[0061] Entropy source data refers to the physical or information process that can generate randomness or unpredictability. It is an important basis for generating keys, encryption algorithm parameters or random numbers in the field of cryptography and information security. The randomness or unpredictability provided by the entropy source is one of the key factors to ensure the security of the cryptographic system. Entropy source data has a wide range of applications in cryptography, information security, data encryption, random number generation and other fields. For example, when generating keys, high-quality entropy source data can ensure the randomness and unpredictability of the keys, thereby improving the security of the encryption system.

[0062] Random numbers refer to a sequence of numbers that are not generated in a specific pattern. Each number has an equal probability of appearing, and it is impossible to predict what the next number will be. In mathematics and statistics, random numbers are used to simulate the results of random events and are an important tool for studying probability theory and conducting various probability experiments. In computer science, random numbers are widely used in encryption, simulation, game development and other fields.

[0063] First, let’s describe the technical problems existing in the relevant technologies:

[0064] With the development of vehicle technology, vehicles are becoming increasingly intelligent and networked, and the operation of the entire vehicle relies on complex electronic systems. For example, functions such as unmanned driving, smart parking, and emergency braking all rely on electronic systems. However, attackers may exploit vulnerabilities in the electronic system to control related functions of the vehicle, and even endanger the lives of passengers.

[0065] In the related art, in order to ensure that data is not leaked during the use of the electronic system, a software algorithm is often used to generate random numbers, and then the original data is encrypted by the generated random numbers. However, the method of generating random numbers by software algorithms is unreliable, and the generated random numbers are easily cracked, resulting in the original data of the vehicle encrypted by random numbers being leaked and tampered with.

[0066] Therefore, the method of generating random numbers in the related art is unreliable, and the generated random numbers are not unpredictable.

[0067] In order to solve the above technical problems, the embodiments of the present application provide a random number generation method, device, computer equipment and storage medium, which obtains the differential voltage value between the high voltage signal and the low voltage signal output by the controller local area network bus of the vehicle, and determines the entropy source data through the differential voltage value. Due to the randomness of the high voltage signal and the low voltage signal, the determined entropy source data is unpredictable, thereby ensuring that the random number generated according to the entropy source data is unpredictable. Subsequently, the vehicle data is encrypted by random numbers to ensure that the vehicle data is not leaked, thereby improving the safety of the vehicle.

[0068] The embodiments of the present application provide a random number generation method, device, computer equipment and storage medium. Specifically, the embodiments of the present application will be described from the perspective of a random number generation device, which can be integrated in a vehicle, and can be integrated in an electronic controller of the vehicle.

[0069] See also Figure 1 , Figure 1 It is a schematic diagram of the structure of the electronic controller of the vehicle provided in the embodiment of the present application.

[0070] The electronic controller of the vehicle may be a physical hardware, for example, including a central processing unit, a CAN controller and other components. The CAN controller may control the electrical signal output by the controller area network bus, such as a voltage signal. The controller area network bus may include a CAN high-voltage line and a CAN low-voltage line, wherein the CAN high-voltage line is used to output a high-voltage signal, and the CAN low-voltage line is used to output a low-voltage signal.

[0071] The electronic controller also includes a random number generator, which can be a virtual device. For example, a random number generator is constructed through a variety of different algorithms. The operation of the random number generator is supported by the computing power of the central processing unit.

[0072] The random number generator includes a data acquisition unit, a data processing unit, an entropy pool unit and a random number generation unit. The data acquisition unit is used to collect the voltage signal of the CAN controller. For example, the voltage signal includes a high voltage signal and a low voltage signal. The data acquisition unit can obtain the high voltage signal and the low voltage signal output by the vehicle's controller local area network bus at different sampling time points.

[0073] The data processing unit is used to process the high voltage signal and the low voltage signal, and specifically, the differential voltage value between the high voltage signal and the low voltage signal at each sampling time point can be obtained, and then the binary value corresponding to each sampling time point is generated according to the differential voltage value, and the binary values ​​are combined into a binary string according to the time sequence of the sampling time points. A preset number of continuous binary values ​​at the end of the binary string are obtained at different entropy source acquisition time points.

[0074] The entropy pool unit is used to store continuous binary values, such as storing continuous binary values ​​in a database. Specifically, the entropy pool unit is used to determine the continuous binary values ​​as entropy source data and save the entropy source data in the database.

[0075] The random number generating unit is used to generate a random number according to the entropy source data. Specifically, when a random number generation request is received, target entropy source data is selected from the database, and a corresponding random number is generated according to the target entropy source data.

[0076] The random number generator can send the generated random number to other processing modules, and other processing modules can encrypt the original data corresponding to the vehicle according to the random number, thereby obtaining encrypted data. It should be noted that when the CAN controller is working, the high voltage signal and low voltage signal output by the corresponding controller local area network bus are changing, so they are random. Therefore, the entropy source data obtained after processing the high voltage signal and the low voltage signal are also unpredictable, so the random number generated based on the entropy source data is also unpredictable. Therefore, after encrypting the original data of the vehicle by random numbers, the encrypted data is obtained. The encrypted data has a higher security. Therefore, during the data transmission process, the original data can be guaranteed not to be leaked or tampered with, thereby ensuring the safety of the vehicle.

[0077] See also Figure 2 , Figure 2 It is a schematic diagram of a scenario corresponding to the random number generator provided in an embodiment of the present application.

[0078] The vehicle may have multiple electronic controllers, and different electronic controllers correspond to different functions. For example, electronic controller 1 is used to control power, electronic controller 2 is used to control lights, and electronic controller n is used to control sensors.

[0079] A random number generator can be set on the vehicle network to obtain high voltage signals and low voltage signals corresponding to different electronic controllers, thereby generating entropy source data based on the high voltage signals and low voltage signals of different electronic control appliances, and storing the entropy source data in a database to increase the richness of the entropy source data and at the same time increase the randomness of the entropy source data to ensure that the entropy source data is unpredictable.

[0080] It should be noted that when the random number generator is set on the vehicle network, it can be specifically set on the entire control center of the vehicle, such as the central processing unit of the entire vehicle, so as to obtain high voltage signals and low voltage signals from different electronic control points.

[0081] The in-vehicle network is a time-sensitive deterministic system, which is usually stable and highly predictable, which limits the source of randomness and makes it difficult to collect entropy source data. Therefore, this case can collect the voltage signal corresponding to the control LAN bus and use the voltage signal to determine the entropy source data, which can ensure that the source of entropy source data is richer and the randomness of entropy source data is guaranteed. In addition, the entropy source data is obtained from the hardware device, which can further increase the randomness of the entropy source data.

[0082] See also Figure 3 , Figure 3 It is a schematic diagram of a scenario corresponding to the random numbers provided in an embodiment of the present application.

[0083] Among them, the CAN controller can output a voltage signal that changes with time, and the random number generator can obtain the high voltage signal and the low voltage signal output by the controller local area network bus of the vehicle at different sampling time points, and obtain the differential voltage value between the high voltage signal and the low voltage signal at each sampling time point; generate a binary value corresponding to each sampling time point according to the differential voltage value, and compose the binary values ​​into a binary string according to the time sequence of the sampling time points; obtain a preset number of continuous binary values ​​at the end of the binary string at different entropy source acquisition time points; determine the continuous binary values ​​as entropy source data, and save the entropy source data in a database; when a random number generation request is received, select the target entropy source data in the database, and generate a corresponding random number according to the target entropy source data.

[0084] When the original data corresponding to the vehicle needs to be transmitted between different hardware modules, the original data can be encrypted by obtaining a random number to generate encrypted data, and then the encrypted data is sent to different hardware modules, thereby ensuring that the original data is safe during the data transmission process, thereby improving the data security of the vehicle.

[0085] After the corresponding hardware modules of the vehicle receive the encrypted data sent to each other, they can decrypt the encrypted data according to the public key between different hardware modules to obtain the original data, and then use the original data to implement the corresponding functions of the vehicle, such as unmanned driving function, smart parking function, emergency braking function, etc.

[0086] The above is an explanation of the scenarios corresponding to the random number generation method in the present application. The random number generation method, apparatus, computer equipment and storage medium provided by the embodiments of the present application will be described in detail below.

[0087] See also Figure 4 , Figure 4 : is a flow chart of a random number generation method provided in an embodiment of the present application. The random number generation method may include the following steps:

[0088] Step 110: obtaining a high voltage signal and a low voltage signal output by a controller area network bus of the vehicle at different sampling time points, and obtaining a differential voltage value between the high voltage signal and the low voltage signal at each sampling time point;

[0089] Step 120, generating a binary value corresponding to each sampling time point according to the differential voltage value, and composing the binary values ​​into a binary string according to the time sequence of the sampling time points;

[0090] Step 130, obtaining a preset number of consecutive binary values ​​at the end of the binary string at different entropy source acquisition time points;

[0091] Step 140: determine the continuous binary values ​​as entropy source data, and store the entropy source data in a database;

[0092] Step 150: When a random number generation request is received, target entropy source data is selected from the database, and a corresponding random number is generated according to the target entropy source data.

[0093] Steps 110 to 150 will be described in detail below.

[0094] In step 110 , a high voltage signal and a low voltage signal output by a controller area network bus of the vehicle are obtained at different sampling time points, and a differential voltage value between the high voltage signal and the low voltage signal at each sampling time point is obtained.

[0095] The vehicle's controller area network bus may include a CAN high-voltage line and a CAN low-voltage line, wherein the CAN high-voltage line is used to output a high-voltage signal, and the CAN low-voltage line is used to output a low-voltage signal. The high-voltage signal and the low-voltage signal output by the controller area network bus may be acquired at different sampling time points. Specifically, a plurality of different sampling time points may be determined according to a preset acquisition frequency, such as determining a sampling time point at intervals of a certain period of time, and then acquiring the high-voltage signal and the low-voltage signal output by the controller area network bus at different sampling time points.

[0096] In some implementations, obtaining a high voltage signal and a low voltage signal output by a controller area network bus of a vehicle at different sampling time points includes:

[0097] (1.1) Determine the electrical signal output by the vehicle's controller area network bus, and determine the rising edge signal or the falling edge signal based on the electrical signal;

[0098] (1.2) Determine the corresponding signal acquisition period according to the rising edge signal or the falling edge signal;

[0099] (1.3) During the signal acquisition cycle, high voltage signals and low voltage signals output by the controller area network bus are obtained at different sampling time points.

[0100] Please combine Figure 5 , Figure 5 It is a schematic diagram of the waveform of the electrical signal output by the controller local area network bus provided in the embodiment of the present application.

[0101] Among them, in the electrical signal output by the controller area network bus, a complete electrical signal includes a rising edge signal, a holding edge signal and a falling edge signal, as shown in the following example: Figure 5As shown. Among them, the rising edge signal refers to the electrical signal value during the period when the CAN bus is pulled from the recessive state to the dominant state; the falling edge signal refers to the electrical signal value during the period when the CAN bus falls from the dominant state to the recessive state; the holding edge signal refers to the electrical signal value during the period after the rising edge signal and before the falling edge signal.

[0102] It is understandable that the high voltage signal and low voltage signal output by the LAN bus of the controller are continuously changing only during the time corresponding to the rising edge signal and the falling edge signal. The high voltage signal and the low voltage signal are random and unpredictable. Therefore, it is necessary to obtain the high voltage signal and the low voltage signal during the rising edge signal and the falling edge signal.

[0103] Specifically, the corresponding signal acquisition period can be determined according to the rising edge signal or the falling edge signal. For example, the electrical signal can be acquired for a period of time, and then the change trend of the high voltage signal and the low voltage signal in the electrical signal can be analyzed to determine which type of signal the electrical signal belongs to, such as a rising edge signal, a falling edge signal and a holding edge signal.

[0104] If the electrical signal is a rising edge signal or a falling edge signal, the collection period corresponding to the rising edge signal or the falling edge signal can be determined, for example, within a preset time period after the current time, such as 10 seconds, which is determined as the collection period.

[0105] During the acquisition cycle, a preset acquisition frequency can be set, such as once per second, so as to determine multiple different sampling time points. During the signal cycle, the high voltage signal and low voltage signal output by the controller LAN bus can be obtained at different sampling time points. The sampling time point can also be set freely, or the acquisition frequency can be set freely, and there is no restriction here.

[0106] From the above content, it can be seen that by collecting the high voltage signal and the low voltage signal output by the controller LAN bus during the rising edge signal and the falling edge signal, the randomness of the high voltage signal and the low voltage signal can be increased. The high voltage signal and the low voltage signal are unpredictable, which can ensure the randomness of the subsequently generated random numbers and ensure that the generated random numbers are unpredictable.

[0107] After the high voltage signal and the low voltage signal corresponding to each sampling time point, the differential voltage value between the high voltage signal and the low voltage signal at each sampling time point can be obtained, for example, the high voltage signal and the low voltage signal are subtracted to obtain the differential voltage value, thereby obtaining the differential voltage value corresponding to each sampling time point.

[0108] In step 120, a binary value corresponding to each sampling time point is generated according to the differential voltage value, and the binary values ​​are combined into a binary string according to the time sequence of the sampling time points.

[0109] Among them, in the controller area network bus, when the high voltage signal corresponding to the CAN high voltage line and the low voltage signal corresponding to the CAN low voltage line have different values, the corresponding signal state can be determined by the high voltage signal and the low voltage signal, so as to determine the binary values ​​corresponding to the high voltage signal and the low voltage signal at each time point through the signal state.

[0110] In some implementations, generating a binary value corresponding to each sampling time point according to the differential voltage value includes:

[0111] (1.1) When the differential voltage value is greater than a first preset voltage difference value, determining that the binary value corresponding to the differential voltage value is a first value;

[0112] (1.2) When the differential voltage value is less than the second preset voltage difference value, the binary value corresponding to the differential voltage value is determined to be the second value, and the first preset voltage difference value is greater than the second preset voltage difference value.

[0113] Among them, when the high voltage signal is at a higher voltage value and the low voltage signal is at a lower voltage value, the differential voltage value between the high voltage signal and the low voltage signal will be larger, and the differential voltage value is greater than the first preset voltage difference. For example, the first preset voltage difference is 2V. At this time, the signal state corresponding to the high voltage signal and the low voltage signal is a dominant state, and the binary value corresponding to the dominant state is set to "0", and "0" is the first value of the binary value.

[0114] When the CAN high-voltage line and the CAN low-voltage line are both in a static state, that is, the voltage between the CAN high-voltage line and the CAN low-voltage line and the ground is respectively in a higher voltage state, close to the power supply voltage, then the differential voltage value between the high-voltage signal and the low-voltage signal will be smaller, and the differential voltage value is lower than the second preset voltage difference. For example, the second preset voltage difference is 0.2V. At this time, the signal state corresponding to the high-voltage signal and the low-voltage signal is a recessive state, and the binary value corresponding to the recessive state is set to "1", and "1" is the second value of the binary value.

[0115] From the above, it can be seen that in the embodiment of the present application, the binary value corresponding to the differential voltage value can be determined by the corresponding signal states of the high voltage signal and the low voltage signal, which can improve the efficiency of converting the differential voltage value into a binary value.

[0116] After obtaining the binary value corresponding to each sampling time point, the binary values ​​can be combined into a binary string according to the time sequence of the sampling time points.

[0117] In some implementations, the binary values ​​are combined into a binary string according to the time order of the sampling time points, including:

[0118] (2.1) Determine the latest sampling time point and obtain the binary value corresponding to the latest sampling time point;

[0119] (2.2) The binary value corresponding to the latest sampling time point is set to the end of the generated binary string to update the binary string.

[0120] For example, taking the current sampling period as an example, within the current sampling period, if the latest sampling time point is the first sampling time point, then the binary value corresponding to the latest sampling time point is set at the head of the binary string.

[0121] In the current sampling cycle, if the latest sampling time point is not the first sampling time point, it means that a binary string has been generated. The binary value corresponding to the latest sampling time point can be obtained and the binary value corresponding to the latest sampling time point can be set to the tail of the generated binary string to update the binary string.

[0122] This ensures that the binary string is continuously updated during the sampling period, thus improving the randomness of the binary string.

[0123] In step 130, a preset number of consecutive binary values ​​at the end of the binary string are obtained at different entropy source acquisition time points.

[0124] Please also read Figure 6 , Figure 6 is a schematic diagram of a binary string provided in an embodiment of the present application. The high voltage signal and the low voltage signal collected in each sampling period can be determined as data samples, for example, sampling period 1 corresponds to data sample 1, sampling period 2 corresponds to data sample 2, and sampling period k corresponds to data sample k.

[0125] After processing, each data sample corresponds to a binary string, such as Figure 6 As shown, at different entropy source acquisition time points, a preset number of continuous binary values ​​at the end of the binary string can be obtained.

[0126] In some implementations, obtaining a preset number of consecutive binary values ​​at the end of a binary string at different entropy source acquisition time points includes:

[0127] (1.1) Determine the entropy source acquisition time point corresponding to each signal acquisition cycle;

[0128] (1.2) At each entropy source acquisition time point, obtain the binary string corresponding to each signal acquisition cycle;

[0129] (1.3) In the binary string corresponding to each signal acquisition cycle, a preset number of consecutive binary values ​​at the end of the binary string are obtained.

[0130] Among them, the entropy source acquisition time point corresponding to each signal acquisition cycle can be determined. For example, within a sampling cycle, multiple entropy source acquisition time points can be set as the binary string is updated. Each entropy source acquisition time point corresponds to a latest binary string, and then a preset number of continuous binary values ​​at the end of the latest binary string are obtained at the entropy source acquisition time point.

[0131] In this way, multiple consecutive binary values ​​can be acquired within one sampling period to increase the richness of data acquisition.

[0132] In step 140, the continuous binary values ​​are determined as entropy source data, and the entropy source data is stored in a database.

[0133] Among them, multiple groups of continuous binary values ​​can be obtained, and then each group of continuous binary values ​​can be determined as entropy source data, and the entropy source data can be saved in a database. The database can save entropy source data corresponding to multiple electronic controllers, and can also save entropy source data corresponding to an electronic controller in different sampling periods.

[0134] In some implementations, after determining the continuous binary values ​​as entropy source data and storing the entropy source data in a database, the method further includes:

[0135] (1.1) Determine the amount and data type of the entropy source data in the database;

[0136] (1.2) When the data volume is less than the preset data volume or the number of data types is less than the preset number of types, increase the sampling time points in each acquisition cycle and adjust the preset number according to the data volume or the number of types.

[0137] It is understandable that the richer the entropy source data in the database, the greater the unpredictability of the random numbers subsequently generated by the entropy source data, and the greater the randomness. The amount of data and the data type of the entropy source data in the database can be determined. For example, if the entropy source data corresponds to multiple groups of continuous binary values, the number of groups of continuous binary values ​​is determined as the data amount. For example, each group of continuous binary values ​​corresponds to a certain string length, and the data type can be determined based on the string length.

[0138] When the data volume is less than the preset data volume or the number of data types is less than the preset number of types, increase the sampling time points in each acquisition cycle and adjust the preset number according to the data volume or number of types. For example, if there are 5,000 groups of continuous binary values ​​in the current database and the preset data volume is 10,000 groups, then it is determined that the data volume is less than the preset data volume. If there are 500 data types in the current database and the preset data type is 1,000, then it is determined that the number of data types is less than the preset number of types.

[0139] At this time, the sampling time point in each acquisition cycle can be adjusted to increase the sampled data and the richness of the sampled data. The preset number of the last binary values ​​obtained in each binary string can also be adjusted according to the amount of data or the number of types. For example, if the amount of data is small, the preset number can be appropriately reduced, and the entropy source acquisition time point can be increased. For example, if the number of types is small, the preset number can be dynamically adjusted to change the string length of the continuous binary values ​​obtained, thereby increasing the data type.

[0140] In some implementations, after determining the continuous binary values ​​as entropy source data and storing the entropy source data in a database, the method further includes:

[0141] (2.1) Determine different consecutive binary values ​​of the string length in the database;

[0142] (2.2) Randomly mix consecutive binary values ​​of different string lengths to obtain multiple updated consecutive binary values;

[0143] (2.3) Determine the multiple updated continuous binary values ​​as entropy source data and save them in the database.

[0144] Among them, in order to further increase the richness of the entropy source data in the database, different continuous binary values ​​of the string length can be determined in the database, and then the different continuous binary values ​​of the string length are randomly mixed to generate multiple updated continuous binary values. The multiple updated continuous binary values ​​can be understood as newly generated entropy source data. The multiple updated continuous binary values ​​are determined as entropy source data and saved in the database, thereby increasing the richness of the database.

[0145] From the above, it can be seen that the randomness of the entropy source data can be guaranteed by increasing the richness of the entropy source data in the database, so as to ensure that the entropy source data is unpredictable.

[0146] In step 150, when a random number generation request is received, target entropy source data is selected from the database, and a corresponding random number is generated according to the target entropy source data.

[0147] The random number generation request may be a request issued by a vehicle system or application when it needs to perform a corresponding task, and the original data needs to be encrypted using a random number. Specifically, the corresponding key may be generated using some encryption algorithm combined with a random number, and then the original data is encrypted using the key.

[0148] For example, one-way hash functions and other encryption algorithms may be used, specifically SHA-256, SHA-512, SHA-3, RIPEMD160, symmetric encryption algorithm AES, etc. These encryption algorithms may use entropy source data to generate corresponding random numbers, and then use the random number to generate a key to encrypt the original data to obtain encrypted data.

[0149] In this way, the security of encrypted data can be guaranteed when it is transmitted between different hardware modules of the vehicle, preventing the leakage of original data.

[0150] As can be seen from the above, in the embodiment of the present application, the high voltage signal and the low voltage signal output by the controller area network bus of the vehicle are obtained at different sampling time points, and the differential voltage value between the high voltage signal and the low voltage signal at each sampling time point is obtained; the binary value corresponding to each sampling time point is generated according to the differential voltage value, and the binary value is combined into a binary string according to the time order of the sampling time points; the preset number of continuous binary values ​​at the end of the binary string is obtained at different entropy source acquisition time points; the continuous binary values ​​are determined as entropy source data, and the entropy source data is stored in a database; when a random number generation request is received, the target entropy source data is selected in the database, and the corresponding random number is generated according to the target entropy source data. In the embodiment of the present application, the differential voltage value between the high voltage signal and the low voltage signal output by the controller area network bus of the vehicle is obtained, and the entropy source data is determined by the differential voltage value. Due to the randomness of the high voltage signal and the low voltage signal, the determined entropy source data is unpredictable, thereby ensuring that the random number generated according to the entropy source data has unpredictability.

[0151] See also Figure 7 , Figure 7 1 is another flow chart of the random number generation method provided in the embodiment of the present application. The random number generation method may include the following steps:

[0152] In step 201, an electrical signal output by a controller area network bus of a vehicle is determined, and a rising edge signal or a falling edge signal is determined according to the electrical signal;

[0153] In step 202, a corresponding signal acquisition period is determined according to the rising edge signal or the falling edge signal;

[0154] In step 203, a high voltage signal and a low voltage signal output by the controller area network bus are obtained at different sampling time points within a signal acquisition cycle;

[0155] In step 204, a differential voltage value between the high voltage signal and the low voltage signal at each sampling time point is obtained;

[0156] In step 205, when the differential voltage value is greater than the first preset voltage difference value, the binary value corresponding to the differential voltage value is determined to be the first value;

[0157] In step 206, when the differential voltage value is less than the second preset voltage difference value, it is determined that the binary value corresponding to the differential voltage value is the second value, and the first preset voltage difference value is greater than the second preset voltage difference value;

[0158] In step 207, the binary values ​​are combined into a binary string according to the time sequence of the sampling time points;

[0159] In step 208, the entropy source acquisition time point corresponding to each signal acquisition period is determined, and at each entropy source acquisition time point, a binary string corresponding to each signal acquisition period is acquired;

[0160] In step 209, in the binary string corresponding to each signal acquisition cycle, a preset number of consecutive binary values ​​at the end of the binary string are obtained;

[0161] In step 210, the continuous binary values ​​are determined as entropy source data, and the entropy source data is stored in a database;

[0162] In step 211, when a random number generation request is received, at least one set of target entropy source data is selected from the database;

[0163] In step 212, an encryption algorithm corresponding to at least one set of target entropy source data is determined, and a random number corresponding to at least one set of target entropy source data is generated through the encryption algorithm.

[0164] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the random number generation method above, and will not be repeated here.

[0165] See also Figure 8 , Figure 8 It is a structural schematic diagram corresponding to the random number generation device provided in the embodiment of the present application.

[0166] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0167] like Figure 8 As shown, the random number generating device 300 may include:

[0168] The acquisition module 310 is used to acquire the high voltage signal and the low voltage signal output by the controller area network bus of the vehicle at different sampling time points, and acquire the differential voltage value between the high voltage signal and the low voltage signal at each sampling time point;

[0169] The character string generation module 320 is used to generate a binary value corresponding to each sampling time point according to the differential voltage value, and to combine the binary values ​​into a binary character string according to the time sequence of the sampling time points;

[0170] An acquisition module 330 is used to acquire a preset number of consecutive binary values ​​at the end of a binary string at different entropy source acquisition time points;

[0171] A determination module 340, configured to determine the continuous binary values ​​as entropy source data, and store the entropy source data in a database;

[0172] The random number generation module 350 is used to select target entropy source data from the database when receiving a random number generation request, and generate a corresponding random number based on the target entropy source data, and the random number is used to encrypt the vehicle data of the vehicle.

[0173] In some embodiments, the acquisition module 310 is used to:

[0174] Determine an electrical signal output by a controller area network bus of the vehicle, and determine a rising edge signal or a falling edge signal according to the electrical signal;

[0175] Determine the corresponding signal acquisition period according to the rising edge signal or the falling edge signal;

[0176] During the signal acquisition cycle, high voltage signals and low voltage signals output by the controller area network bus are acquired at different sampling time points.

[0177] In some implementations, the acquisition module 330 is configured to:

[0178] Determine the entropy source acquisition time point corresponding to each signal acquisition cycle;

[0179] At each entropy source acquisition time point, a binary string corresponding to each signal acquisition cycle is obtained;

[0180] In the binary string corresponding to each signal acquisition cycle, a preset number of continuous binary values ​​at the end of the binary string are obtained.

[0181] In some embodiments, the random number generating device further includes a monitoring module, which is used to:

[0182] After determining the continuous binary values ​​as entropy source data and storing the entropy source data in a database, determining the data amount and data type of the entropy source data in the database;

[0183] When the data volume is less than the preset data volume or the number of types of data types is less than the preset number of types, the sampling time points in each acquisition cycle are increased, and the preset number is adjusted according to the data volume or the number of types.

[0184] In some implementations, the string generation module 320 is used to:

[0185] When the differential voltage value is greater than the first preset voltage difference value, determining that the binary value corresponding to the differential voltage value is a first value;

[0186] When the differential voltage value is less than the second preset voltage difference value, the binary value corresponding to the differential voltage value is determined to be the second value, and the first preset voltage difference value is greater than the second preset voltage difference value.

[0187] In some implementations, the string generation module 320 is used to:

[0188] Determine the latest sampling time point and obtain the binary value corresponding to the latest sampling time point;

[0189] The binary value corresponding to the latest sampling time point is set to the tail of the generated binary string to update the binary string.

[0190] In some implementations, the determination module 340 is configured to:

[0191] After determining the continuous binary values ​​as entropy source data and storing the entropy source data in a database, different continuous binary values ​​of the character string length are determined in the database;

[0192] Randomly mix consecutive binary values ​​of different string lengths to obtain multiple updated consecutive binary values;

[0193] A plurality of updated continuous binary values ​​are determined as entropy source data and saved in a database.

[0194] In some implementations, the random number generation module 350 is used to:

[0195] When a random number generation request is received, at least one set of target entropy source data is selected from the database;

[0196] An encryption algorithm corresponding to at least one set of target entropy source data is determined, and a random number corresponding to at least one set of target entropy source data is generated through the encryption algorithm.

[0197] In the above embodiments, the description of each embodiment has its own focus. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the queue processing method above, and will not be repeated here.

[0198] As can be seen from the above, in the embodiment of the present application, the acquisition module 310 obtains the high voltage signal and the low voltage signal output by the controller LAN bus of the vehicle at different sampling time points, and obtains the differential voltage value between the high voltage signal and the low voltage signal at each sampling time point; the string generation module 320 generates a binary value corresponding to each sampling time point according to the differential voltage value, and composes the binary values ​​into a binary string according to the time sequence of the sampling time points; the acquisition module 330 obtains a preset number of continuous binary values ​​at the end of the binary string at different entropy source acquisition time points; the determination module 340 determines the continuous binary values ​​as entropy source data, and saves the entropy source data in a database; when the random number generation module 350 receives a random number generation request, it selects the target entropy source data in the database, and generates a corresponding random number according to the target entropy source data. In an embodiment of the present application, the differential voltage value between the high voltage signal and the low voltage signal output by the vehicle's controller local area network bus is obtained, and the entropy source data is determined by the differential voltage value. Due to the randomness of the high voltage signal and the low voltage signal, the determined entropy source data is unpredictable, thereby ensuring that the random numbers generated based on the entropy source data are unpredictable.

[0199] See also Fig. 9 , Fig. 9 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application.

[0200] The present application also provides a computer device, which may be a vehicle, such as Fig. 9 As shown, it shows a schematic diagram of the structure of a vehicle involved in an embodiment of the present application, specifically:

[0201] The computer device may include a radio frequency (RF) circuit 401, a memory 402 including one or more computer-readable storage media, an input unit 403, a display unit 404, a sensor 405, an audio circuit 406, a wireless fidelity (WiFi) module 407, a processor 408 including one or more processing cores, and a power supply 409. Those skilled in the art will appreciate that Fig. 9 The vehicle structure shown in the figure does not constitute a limitation on the vehicle, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:

[0202] The RF circuit 401 can be used for receiving and sending signals during the process of sending and receiving information or making calls. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 408 for processing; in addition, the data related to the uplink is sent to the base station. Generally, the RF circuit 401 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 401 can also communicate with the network and other devices through wireless communication. Wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.

[0203] The memory 402 can be used to store software programs and modules. The processor 408 executes various functional applications and information retrieval by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the vehicle (such as audio data, a phone book, etc.), etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 408 and the input unit 403 with access to the memory 402.

[0204] The input unit 403 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to object setting and function control. Specifically, in a specific embodiment, the input unit 403 may include a touch-sensitive surface and other input devices. The touch-sensitive surface, also known as a touch display screen or a touch pad, can collect touch operations of an object on or near it (such as operations of an object using a finger, a stylus or any other suitable object or accessory on or near the touch-sensitive surface), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface may include a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the object, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 408, and can receive and execute commands sent by the processor 408. In addition, the touch-sensitive surface can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch-sensitive surface, the input unit 403 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0205] The display unit 404 can be used to display information input by an object or information provided to an object and various graphic object interfaces of the vehicle, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 404 may include a display panel, and optionally, the display panel may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch-sensitive surface may cover the display panel, and when the touch-sensitive surface detects a touch operation on or near it, it is transmitted to the processor 408 to determine the type of touch event, and then the processor 408 provides a corresponding visual output on the display panel according to the type of touch event.

[0206] The vehicle may also include at least one sensor 405, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor may turn off the display panel and / or the backlight when the vehicle moves to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; As for other sensors that can be configured in the vehicle, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.

[0207] The audio circuit 406, the speaker, and the microphone can provide an audio interface between the object and the vehicle. The audio circuit 406 can convert the received audio data into an electrical signal and transmit it to the speaker, which converts it into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 406 and converted into audio data, and then the audio data is output to the processor 408 for processing, and then sent to another vehicle through the RF circuit 401, or the audio data is output to the memory 402 for further processing. The audio circuit 406 may also include an earphone jack to provide communication between an external headset and the vehicle.

[0208] WiFi is a short-range wireless transmission technology. The vehicle can help the object to send and receive emails, browse the web and access streaming media through the WiFi module 407, which provides the object with wireless broadband Internet access. Fig. 9 A WiFi module 407 is shown, but it is understandable that it is not an essential component of the vehicle and can be omitted as needed without changing the essence of the invention.

[0209] Processor 408 is the control center of the vehicle, and uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and / or modules stored in memory 402, and calling data stored in memory 402, it performs various functions of the vehicle and processes data, thereby monitoring the mobile phone as a whole. Optionally, processor 408 may include one or more processing cores; preferably, processor 408 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, object interface and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into processor 408.

[0210] The vehicle also includes a power source 409 (such as a battery) for supplying power to various components. Preferably, the power source can be logically connected to the processor 408 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power source 409 can also include one or more DC or AC power sources, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0211] Although not shown, the vehicle may also include a camera, a Bluetooth module, etc., which will not be described in detail here. Specifically in this embodiment, the processor 408 in the vehicle will load the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 408 will run the applications stored in the memory 402 to achieve various functions:

[0212] Acquire a high voltage signal and a low voltage signal output by a controller area network bus of the vehicle at different sampling time points, and acquire a differential voltage value between the high voltage signal and the low voltage signal at each sampling time point;

[0213] Generate a binary value corresponding to each sampling time point according to the differential voltage value, and combine the binary values ​​into a binary string according to the time sequence of the sampling time points;

[0214] Acquire a preset number of consecutive binary values ​​at the end of the binary string at different entropy source acquisition time points;

[0215] Determine the continuous binary values ​​as entropy source data, and store the entropy source data in a database;

[0216] When a random number generation request is received, target entropy source data is selected from the database, and a corresponding random number is generated according to the target entropy source data.

[0217] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the random number generation method above, and will not be repeated here.

[0218] As can be seen from the above, in the embodiment of the present application, the high voltage signal and the low voltage signal output by the controller area network bus of the vehicle are obtained at different sampling time points, and the differential voltage value between the high voltage signal and the low voltage signal at each sampling time point is obtained; the binary value corresponding to each sampling time point is generated according to the differential voltage value, and the binary value is combined into a binary string according to the time order of the sampling time points; the preset number of continuous binary values ​​at the end of the binary string is obtained at different entropy source acquisition time points; the continuous binary values ​​are determined as entropy source data, and the entropy source data is stored in a database; when a random number generation request is received, the target entropy source data is selected in the database, and the corresponding random number is generated according to the target entropy source data. In the embodiment of the present application, the differential voltage value between the high voltage signal and the low voltage signal output by the controller area network bus of the vehicle is obtained, and the entropy source data is determined by the differential voltage value. Due to the randomness of the high voltage signal and the low voltage signal, the determined entropy source data is unpredictable, thereby ensuring that the random number generated according to the entropy source data has unpredictability.

[0219] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0220] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any random number generation method provided in the embodiment of the present application. For example, the instructions can execute the following steps:

[0221] Acquire a high voltage signal and a low voltage signal output by a controller area network bus of the vehicle at different sampling time points, and acquire a differential voltage value between the high voltage signal and the low voltage signal at each sampling time point;

[0222] Generate a binary value corresponding to each sampling time point according to the differential voltage value, and combine the binary values ​​into a binary string according to the time sequence of the sampling time points;

[0223] Acquire a preset number of consecutive binary values ​​at the end of the binary string at different entropy source acquisition time points;

[0224] Determine the continuous binary values ​​as entropy source data, and store the entropy source data in a database;

[0225] When a random number generation request is received, target entropy source data is selected from the database, and a corresponding random number is generated according to the target entropy source data.

[0226] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the random number generation method provided in the various optional implementations provided in the above embodiments.

[0227] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0228] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0229] Since the instructions stored in the computer-readable storage medium can execute the steps in any random number generation method provided in the embodiments of the present application, the beneficial effects that can be achieved by any random number generation method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0230] The above is a detailed introduction to a random number generation method, device, computer equipment and storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for technicians in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A random number generation method, It is characterized in that include: Determine an electrical signal output by a controller area network bus of the vehicle, and determine a rising edge signal or a falling edge signal according to the electrical signal; Determine a corresponding signal acquisition period according to the rising edge signal or the falling edge signal, during which the high voltage signal and the low voltage signal output by the controller area network bus continuously change; Acquiring a high voltage signal and a low voltage signal output by the controller area network bus at different sampling time points during the signal acquisition cycle; Acquire a differential voltage value between the high voltage signal and the low voltage signal at each sampling time point; Generating a binary value corresponding to each of the sampling time points according to the differential voltage value, and composing the binary values ​​into a binary string according to the time sequence of the sampling time points; Determine the entropy source acquisition time point corresponding to each signal acquisition cycle; At each entropy source acquisition time point, acquiring the binary string corresponding to each signal acquisition period; In the binary string corresponding to each signal acquisition cycle, obtaining a preset number of consecutive binary values ​​at the end of the binary string; Determine the continuous binary values ​​as entropy source data, and store the entropy source data in a database; When a random number generation request is received, target entropy source data is selected from the database, and a corresponding random number is generated according to the target entropy source data, and the random number is used to encrypt the vehicle data of the vehicle.

2. The random number generation method according to claim 1, It is characterized in that After determining the continuous binary values ​​as entropy source data and storing the entropy source data in a database, the method further includes: Determine the amount and data type of the entropy source data in the database; When the data volume is less than the preset data volume or the number of types of the data type is less than the preset number of types, the sampling time points in each acquisition cycle are increased, and the preset number is adjusted according to the data volume or the number of types.

3. The random number generation method according to claim 1, It is characterized in that Generating a binary value corresponding to each sampling time point according to the differential voltage value includes: When the differential voltage value is greater than a first preset voltage difference value, determining that the binary value corresponding to the differential voltage value is a first value; When the differential voltage value is less than a second preset voltage difference value, the binary value corresponding to the differential voltage value is determined to be a second value, and the first preset voltage difference value is greater than the second preset voltage difference value.

4. The random number generation method according to claim 1, It is characterized in that The step of forming a binary string from the binary values ​​according to the time sequence of the sampling time points comprises: Determine the latest sampling time point, and obtain the binary value corresponding to the latest sampling time point; The binary value corresponding to the latest sampling time point is set at the tail of the generated binary string to update the binary string.

5. The random number generation method according to claim 1, It is characterized in that After determining the continuous binary values ​​as entropy source data and storing the entropy source data in a database, the method further includes: Determining different consecutive binary values ​​of the string length in the database; Randomly mixing the consecutive binary values ​​of different character string lengths to obtain a plurality of updated consecutive binary values; The multiple updated continuous binary values ​​are determined as the entropy source data and saved in the database.

6. The random number generation method according to any one of claims 1 to 4, It is characterized in that When a random number generation request is received, target entropy source data is selected from the database, and a corresponding random number is generated according to the target entropy source data, including: When a random number generation request is received, selecting at least one set of target entropy source data in the database; An encryption algorithm corresponding to the at least one set of target entropy source data is determined, and a random number corresponding to the at least one set of target entropy source data is generated through the encryption algorithm.

7. A random number generating device, It is characterized in that include: An acquisition module, used to determine an electrical signal output by a controller area network bus of the vehicle, and determine a rising edge signal or a falling edge signal according to the electrical signal; Determine a corresponding signal acquisition period according to the rising edge signal or the falling edge signal, during which the high voltage signal and the low voltage signal output by the controller area network bus continuously change; Acquiring a high voltage signal and a low voltage signal output by the controller area network bus at different sampling time points during the signal acquisition cycle; Acquire a differential voltage value between the high voltage signal and the low voltage signal at each sampling time point; A character string generation module, used to generate a binary value corresponding to each of the sampling time points according to the differential voltage value, and to combine the binary values ​​into a binary character string according to the time sequence of the sampling time points; An acquisition module, used to determine the entropy source acquisition time point corresponding to each signal acquisition cycle; At each entropy source acquisition time point, acquiring the binary string corresponding to each signal acquisition period; In the binary string corresponding to each signal acquisition cycle, obtaining a preset number of consecutive binary values ​​at the end of the binary string; A determination module, used for determining the continuous binary values ​​as entropy source data, and storing the entropy source data in a database; The random number generation module is used to select target entropy source data from the database when a random number generation request is received, and generate a corresponding random number according to the target entropy source data, wherein the random number is used to encrypt the vehicle data of the vehicle.

8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the random number generation method according to any one of claims 1 to 6.

9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the random number generation method according to any one of claims 1 to 6 is implemented.