Equipment identifier generation method and vehicle
By generating a random number-based device identifier on the vehicle communication terminal and adjusting characters according to the hardware and message attribute information, the problem that the vehicle communication terminal cannot generate a unique device identifier is solved, and the generation of highly unique device identifiers is realized, ensuring the accuracy of device management and data tracking.
Patent Information
- Application Number
- CN202510488013.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-04-18
AI Technical Summary
Due to resource and cost limitations, the vehicle communication terminal cannot call the standard equipment identifier library to generate unique equipment identifiers, resulting in difficulty in device management and data tracking.
By generating a random number-based device identifier and adjusting characters based on hardware attribute information and/or message attribute information of hardware elements, a target device identifier with high uniqueness is generated.
Without relying on a third-party device identifier library, a device identifier with high uniqueness is generated to ensure that the second device can accurately identify the source device.
Smart Images

Figure CN120012174A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of identity recognition of embedded devices, and in particular to a method for generating a device identifier and a vehicle. Background Art
[0002] In the field of embedded devices, especially in vehicle-mounted communication terminals (Telematics Box, TBox), the generation of device identifiers (such as Universally Unique Identifier (UUID)) is a key technical issue.
[0003] However, due to resource and cost constraints, vehicle communication terminals often cannot call the standard device identifier library to generate a unique identifier. If the device identifier is not unique, it will be impossible to accurately identify the vehicle communication terminal that is the source of the data, which brings difficulties to the device management and data tracking of the vehicle communication terminal. Summary of the invention
[0004] The present application provides a method and a vehicle for generating a device identifier, aiming to generate a device identifier with high uniqueness without relying on a third-party device identifier library.
[0005] A first aspect of the present application provides a method for generating a device identifier, which is applied to a first device, and the method includes: For a message to be sent to a second device, generating a first device identifier based on a random number; According to the hardware attribute information of the hardware elements deployed in the first device and / or the message attribute information of the message to be sent, the characters in the first device identifier are adjusted to obtain a target device identifier, and the target device identifier is used to indicate to the second device that the message to be sent comes from the first device.
[0006] In an optional implementation, the first device identifier includes at least N characters, each character occupies one character position; for a message to be sent to a second device, generating a first device identifier based on a random number includes: Initializing an original device identifier including at least N character positions, wherein the characters at each character position of the original device identifier are initial characters; Obtaining a timestamp corresponding to the message to be sent, where the timestamp represents a time when the message content of the message to be sent is generated or a time when the message to be sent is sent; Generate N random numbers based on the timestamp; Based on the nth random number, for the nth character position of the original device identifier, extract a character from a character set, the character set including a plurality of different characters, and the value of n ranges from 1 to N; The extracted characters are filled into the nth character position of the original device identifier to obtain a first device identifier based on a random number.
[0007] In an optional implementation, based on the nth random number, for the nth character position of the original device identifier, extracting a character from a character set includes: Determine an index value of an nth character position of the original device identifier based on the nth random number and the total number of characters in the character set; A character corresponding to the index value of the nth character position of the original device identifier is extracted from the character set, and different characters in the character set correspond to different index values.
[0008] In an optional implementation, the first device identifier further includes M target characters, the original device identifier further includes M target character positions, each target character occupies a target character position, and the target character is different from each character in the character set; before extracting a character from the character set for the nth character position of the original device identifier based on the nth random number, the method further includes: Fill the target character in each target character position of the M target character positions of the original device identifier; Filling the extracted character at the nth character position of the original device identifier to obtain a first device identifier based on a random number, comprising: The extracted characters are filled in the nth character position in the original device identifier except the M target character positions to obtain a first device identifier based on a random number.
[0009] In an optional implementation, the first device identifier further includes M target characters, and the characters in the first device identifier are adjusted according to the hardware attribute information of the hardware element deployed in the first device and / or the message attribute information of the message to be sent to obtain the target device identifier, including: According to the hardware attribute information of the hardware elements deployed in the first device and / or the message attribute information of the message to be sent, a plurality of characters other than the M target characters in the first device identifier are adjusted to obtain a target device identifier.
[0010] In an optional implementation, adjusting characters in the first device identifier according to hardware attribute information of a hardware element deployed in the first device and / or message attribute information of the message to be sent to obtain a target device identifier includes: Determine a first character string representing the hardware attribute information; and / or obtain a message number corresponding to the message to be sent, and determine a second character string representing the message number; the message number increases as the total number of messages sent by the first device to the second device increases; The first character string is used to adjust multiple first characters in the first device identifier, and / or the second character string is used to adjust multiple second characters in the first device identifier to obtain a target device identifier, wherein the character positions of the multiple first characters do not overlap with the character positions of the multiple second characters.
[0011] In an optional implementation, after obtaining the target device identifier, the method further includes: Obtaining a hardware usage rate of the first device, where the hardware usage rate includes at least one of the following: a CPU usage rate and a memory usage rate; When the hardware usage rate is less than a first threshold, encrypting the target device identifier using a first encryption method; When the hardware usage rate is greater than or equal to the first threshold and less than a second threshold, encrypt the target device identifier using a second encryption method, the hardware resource consumption of the second encryption method is lower than the hardware resource consumption of the first encryption method, and the second threshold is greater than the first threshold; When the hardware usage rate is greater than or equal to the second threshold, it is determined not to use any encryption method to encrypt the target device identifier.
[0012] In an optional embodiment, the method further includes: generating encryption prompt information according to whether the target device identifier is encrypted and the encryption method used when encrypting the target device identifier; Generate a target message according to the encryption prompt information, the target device identifier and the message content of the message to be sent; The target message is sent to the second device.
[0013] In an optional embodiment, the method further includes: Determine the message type of the message to be sent; For a message to be sent to a second device, generating a first device identifier based on a random number includes: When the message type belongs to the target message type, a first device identifier based on a random number is generated for the message to be sent, and the target message type includes any one of the following: login message type, logout message type, sleep message type, wake-up message type, remote control response message type, appointment control vehicle message type, and OTA upgrade message type.
[0014] A second aspect of the present application provides a vehicle, comprising: A memory storing the vehicle frame number of the vehicle; The vehicle-mounted terminal is used to use the vehicle frame number as the hardware attribute information of the hardware elements deployed in the first device, and execute the steps of the device identifier generation method of the first aspect of the present application.
[0015] According to a third aspect of the present application, there is provided a device for generating a device identifier, which is applied to a first device. The device includes: A first processing module, configured to generate a first device identifier based on a random number for a message to be sent to a second device; The second processing module is used to adjust the characters in the first device identifier according to the hardware attribute information of the hardware elements deployed in the first device and / or the message attribute information of the message to be sent, so as to obtain a target device identifier, and the target device identifier is used to indicate to the second device that the message to be sent comes from the first device.
[0016] The fourth aspect of the present application provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the device identifier generation method of the first aspect of the present application when executing the computer program.
[0017] The fifth aspect of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the device identifier generation method of the first aspect of the present application is implemented.
[0018] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the device identifier generation method of the first aspect of the present application.
[0019] In the device identifier generation method provided in the present application, a first device identifier based on a random number is generated for a message to be sent to a second device; the characters in the first device identifier are adjusted according to the hardware attribute information of the hardware components deployed in the first device and / or the message attribute information of the message to be sent, to obtain a target device identifier, which is used to indicate to the second device that the message to be sent comes from the first device. By adjusting the characters in the first device identifier based on a random number in combination with the hardware attribute information and / or the message attribute information, a target device identifier with high uniqueness can be generated to avoid relying on a device identifier library; the generated target device identifier helps the second device to accurately identify the source device of the message. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0021] Figure 1 is a flowchart of the steps of a method for generating a device identifier proposed in an embodiment of the present application; Figure 2 is a flowchart of the steps of generating a first device identifier based on a random number in a device identifier generation method proposed in an embodiment of the present application; Figure 3 It is a schematic diagram of the comprehensive CPU usage and encryption algorithm of the device identifier generation method proposed in one embodiment of the present application; Figure 4 It is a structural diagram of a device identifier generation apparatus proposed in an embodiment of the present application; Figure 5 It is a schematic diagram of an electronic device proposed in an embodiment of the present application. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are 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 ordinary technicians in this field without creative work are within the scope of protection of this application.
[0023] In the drawings, the size of the constituent elements, the thickness of the layer or the area may be exaggerated for the sake of clarity. Therefore, any implementation of the present disclosure is not necessarily limited to the size shown in the drawings, and the shapes and sizes of the components in the drawings do not reflect the true proportions. In addition, the drawings schematically show ideal examples, and any implementation of the present disclosure is not limited to the shapes or values shown in the drawings.
[0024] When the vehicle communication terminal TBox sends a message to the server (such as a login or logout message), a 36-character device identifier string, such as a UUID string, needs to be included in the content so that both parties can jointly verify the problem. Due to limited resources and costs, TBox cannot call the device identifier library to generate a unique device identifier.
[0025] In view of the above problems, the embodiments of the present application propose a device identifier generation method and a vehicle to generate a highly unique device identifier without relying on a third-party device identifier library. The following is a detailed description of a device identifier generation method and a vehicle provided by the embodiments of the present application through some embodiments and their application scenarios in conjunction with the accompanying drawings.
[0026] Reference Figure 1 , Figure 1 1 is a flowchart of the steps of the device identifier generation method proposed in one embodiment of the present application. Figure 1 As shown, the method is applied to the first device, comprising the following steps S11-S12: Step S11: Generate a first device identifier based on a random number for a message to be sent to a second device.
[0027] In this embodiment, the first device is an embedded device, such as a vehicle-mounted communication terminal; the second device is a device that interacts with the first device, such as a server. In the process of information interaction between the first device and the second device, for the message to be sent by the first device to the second device, a first device identifier based on a random number corresponding to the first device can be generated through a random number algorithm. Among them, the message to be sent in this embodiment is a message that the first device has prepared but has not yet been actually transmitted to the second device. For example, the message to be sent can be a login, logout message, OTA upgrade message, etc. In this embodiment, the first device identifier based on a random number refers to a device identifier generated by a random number algorithm. In an optional embodiment, the device identifier is a UUID.
[0028] Step S12: According to the hardware attribute information of the hardware elements deployed in the first device and / or the message attribute information of the message to be sent, the characters in the first device identifier are adjusted to obtain a target device identifier, and the target device identifier is used to indicate to the second device that the message to be sent comes from the first device.
[0029] In this embodiment, for hardware attribute information, attribute information (such as serial number, model, manufacturer information, etc.) can be read from the hardware components of the first device (such as CPU, motherboard, network interface card, etc.). This information can usually be obtained through the API (Application Programming Interface) provided by the operating system of the first device. For message attribute information, attribute information can be extracted based on the content or metadata of the message to be sent. The attribute information refers to the key elements that describe the message characteristics, message transmission behavior, and implement the business logic, such as: message type, message identifier, transmission protocol, etc.
[0030] According to a preset rule or algorithm, as well as the hardware attribute information of the hardware element deployed in the first device and / or the message attribute information of the message to be sent, the characters in the first device identifier are adjusted to obtain a target device identifier, and the target device identifier is used to indicate to the second device that the message to be sent comes from the first device. In this embodiment, the adjustment may include, but is not limited to, replacement, mapping, padding, deletion, encoding, and other methods.
[0031] For example, when the adjustment operation is mapping, in an optional implementation, a specific position in the first device identifier can be selected based on hardware attribute information and / or message attribute information, and based on the mapping relationship corresponding to the hardware attribute information and / or message attribute information, the characters in the specific position are mapped into corresponding characters to obtain the target device identifier.
[0032] When the adjustment operation is deletion, in an optional implementation, one or more character positions to be deleted in the first device identifier can be determined based on hardware attribute information and / or message attribute information, and the characters in the character positions to be deleted in the first device identifier can be deleted to obtain the target device identifier.
[0033] When the adjustment operation is replacement, in an optional implementation, the preset replacement rule can be formulated based on the hardware attribute information and / or the message attribute information. For example, characters at a specific position (such as the beginning, the end, or a certain section in the middle) in the device identifier can be selected for bitwise replacement. During the replacement process, the basic format and length of the device identifier can be kept unchanged to ensure that the replaced device identifier is still readable and recognizable.
[0034] In the device identifier generation method provided in the present application, a first device identifier based on a random number is generated for a message to be sent to a second device; the characters in the first device identifier are adjusted according to the hardware attribute information of the hardware components deployed in the first device and / or the message attribute information of the message to be sent, to obtain a target device identifier, which is used to indicate to the second device that the message to be sent comes from the first device. By adjusting the characters in the first device identifier based on a random number in combination with the hardware attribute information and / or the message attribute information, a target device identifier with high uniqueness can be generated to avoid relying on a device identifier library; the generated target device identifier helps the second device to accurately identify the source device of the message.
[0035] In the device identifier generation method of the related technology, in addition to the limitation of resources and cost, the vehicle communication terminal often cannot call the standard device identifier library to generate a unique device identifier. In addition, the generated device identifier may not be unique because different vehicle communication terminals are started at the same timestamp.
[0036] For example, the current random number-based method for generating device identifiers may face the following problems: Example 1: Under normal circumstances, different vehicle communication terminals correspond to different device identifiers. However, if different vehicle communication terminals are powered on at the same second, different vehicle communication terminals will most likely generate the same device identifier (if the two timestamps are exactly the same, the results generated by the random number algorithm based on the timestamp are likely to be the same).
[0037] Example 2: Under normal circumstances, different processes in the same vehicle communication terminal correspond to different device identifiers. However, if two different processes in the same vehicle communication terminal are started at the same second, the same device identifier will be generated with a high probability (the timestamps used by the two processes are exactly the same, so the results generated by the random number algorithm based on the timestamp are likely to be the same).
[0038] Based on this, the present application proposes a method for generating a device identifier, generating a first device identifier based on a random number for a message to be sent to a second device; adjusting the characters in the first device identifier according to the hardware attribute information of the hardware components deployed in the first device and / or the message attribute information of the message to be sent, to obtain a target device identifier. In this way, the present application generates a first device identifier based on a random number for a message to be sent to a second device on the basis of avoiding reliance on a device identifier library, and can generate different first device identifiers for different messages to be sent as much as possible, and then adjusts the characters in the first device identifier based on a random number by combining the hardware attribute information and / or the message attribute information, and the target device identifier obtained after adjustment carries a mapping relationship with the hardware attribute information and / or the message attribute information.
[0039] On the one hand, the second device has built-in different hardware attribute information corresponding to different devices. After receiving the target device identifier, the second device identifies the target device identifier according to the mapping relationship carried by the target device identifier, identifies the hardware attribute information of the device, and thus accurately identifies the message source device corresponding to the target device identifier (such as device A or device B).
[0040] Taking the above-mentioned Example 1 as an example, the vehicle communication terminal A and the vehicle communication terminal B are turned on at the same second. The first target device identifier adjusted based on the hardware attribute information of the vehicle communication terminal A carries a mapping relationship with the hardware attribute information of the vehicle communication terminal A. The second device identifies the first target device identifier according to the mapping relationship carried by the first target device identifier, identifies the hardware attribute information of the vehicle communication terminal A, and further determines that the message source device corresponding to the first target device identifier is the vehicle communication terminal A based on the different hardware attribute information corresponding to different devices built into the second device; the second target device identifier adjusted based on the hardware attribute information of the vehicle communication terminal B carries a mapping relationship with the hardware attribute information of the vehicle communication terminal B. The second device identifies the second target device identifier according to the mapping relationship carried by the second target device identifier, identifies the hardware attribute information of the vehicle communication terminal B, and further determines that the message source device corresponding to the second target device identifier is the vehicle communication terminal B based on the different hardware attribute information corresponding to different devices built into the second device.
[0041] Even if the first device identifier based on the random number is the same, the target device identifiers adjusted based on different hardware attribute information corresponding to different devices are different using the technical solution of the present application. Continuing with the above example 1, since the hardware attribute information of the vehicle-mounted communication terminal A is unique and cannot be the same as the hardware attribute information of other vehicle-mounted communication terminals (for example: vehicle-mounted communication terminal B), the first target device identifier adjusted based on the hardware attribute information of the vehicle-mounted communication terminal A is different from the second target device identifier adjusted based on the hardware attribute information of the vehicle-mounted communication terminal B. The target device identifier generated using the technical solution of the present application has high uniqueness.
[0042] On the other hand, the second device has built-in different message attribute information corresponding to different message source processes. After receiving the target device identifier, the second device identifies the target device identifier according to the mapping relationship carried by the target device identifier, and identifies the message attribute information of the message source process, thereby accurately identifying the message source process corresponding to the target device identifier (such as the OTA remote control process or the logout process in the vehicle communication terminal).
[0043] Taking Example 2 above as an example, the OTA remote control process and the logout process in the vehicle communication terminal are started at the same second. The third target device identifier adjusted based on the message attribute information of the OTA remote control process carries a mapping relationship with the message attribute information of the OTA remote control process. The second device identifies the third target device identifier according to the mapping relationship carried by the third target device identifier, identifies the message attribute information of the OTA remote control process, and further determines that the message source process corresponding to the third target device identifier is the OTA remote control process based on the different message attribute information corresponding to different message source processes built into the second device; the fourth target device identifier adjusted based on the message attribute information of the logout process carries a mapping relationship with the message attribute information of the logout process. The second device identifies the fourth target device identifier according to the mapping relationship carried by the fourth target device identifier, identifies the message attribute information of the logout process, and further determines that the message source process corresponding to the fourth target device identifier is the logout process based on the different message attribute information corresponding to different message source processes built into the second device.
[0044] Even if the first device identifier based on the random number is the same, the target device identifiers adjusted based on different message attribute information corresponding to different message source processes are different using the technical solution of the present application. Continuing with the above example 2, because the message attribute information of the OTA remote control process is unique, it is impossible to be the same as the message attribute information of other message source processes (for example, the logout process). Therefore, the third target device identifier adjusted based on the message attribute information of the OTA remote control process is different from the fourth target device identifier adjusted based on the message attribute information of the logout process. The target device identifier generated using the technical solution of the present application has high uniqueness.
[0045] In this way, through the device identifier generation method proposed in this application, a target device identifier with high uniqueness can be generated, avoiding dependence on a device identifier library.
[0046] In one embodiment, the present application further provides a method for generating a device identifier, wherein the first device identifier includes at least N characters, and each character occupies one character position; in the method, the above step S11 "generating a first device identifier based on a random number for a message to be sent to a second device" may specifically include the following steps S21 to S25: Step S21: Initializing an original device identifier including at least N character positions, wherein the characters at each character position of the original device identifier are initial characters.
[0047] In this embodiment, the original device identifier is first initialized, and the initialized original device identifier includes at least N character positions, and the characters at each character position of the original device identifier are initial characters. The initial characters can be randomly set to any character, or the initial characters are all null values, which is not limited in this embodiment.
[0048] In this embodiment, at least N character positions included in the initialized original device identifier correspond to at least N characters included in the first device identifier to be generated, where N is an integer greater than 1, and the specific value of N can be determined based on the device type of the first device, and different device types can correspond to different specific values of N. For example, in the case where the first device is a vehicle-mounted communication terminal, its corresponding device identifier is usually a 128-bit value, which is represented as 32 hexadecimal characters in a standard format. In this case, N in this embodiment can be 32, that is, the first device identifier includes at least 32 characters, each character occupies one character position, and then it is necessary to initialize the original device identifier including at least 32 character positions.
[0049] Step S22: Obtain a timestamp corresponding to the message to be sent, where the timestamp represents the time when the message content of the message to be sent is generated or the time when the message to be sent is sent.
[0050] In this embodiment, on the first device, the timestamp corresponding to the message to be sent can be obtained through the system clock, and the timestamp represents the generation time of the message content of the message to be sent or the sending time of the message to be sent. For example, the message to be sent is a login message, and when the first device process is started or the device is started, the generation and sending of the login message will be triggered. At this time, the generation time or sending time of the login message can be used as the timestamp. For another example, in some other scenarios (such as logout, OTA upgrade scenarios, etc.), the first device will trigger the generation and sending of the message to be sent, and at this time, the generation time or sending time of the message to be sent will also be used as the timestamp.
[0051] Step S23: Generate N random numbers based on the timestamp.
[0052] In this embodiment, the timestamp is used as the seed of the random number generator, and N random numbers can be generated based on the timestamp through multiple random number algorithms (including but not limited to: random number generation seeded by time function (srand(time) function), standard library pseudo-random number generation (Pseudo-Random Number Generators, PRNGs), cryptographically secure random number generation (Cryptographically Secure Pseudo-Random Number Generators, CSPRNGs), etc.). Among them, the srand(time) function is called once at the beginning of the program to set the seed of the random number generator, and subsequent random number generation is achieved by calling the srand(time) function.
[0053] Step S24: Based on the nth random number, for the nth character position of the original device identifier, extract a character from a character set, wherein the character set includes a plurality of different characters, and the value of n ranges from 1 to N.
[0054] In this embodiment, a character set including multiple different characters is predefined, such as numbers, letters, etc. According to the nth random number based on the timestamp, a character is extracted from the character set for the nth character position of the original device identifier, where n is a value from 1 to N. N is the number of characters of the first device identifier, N=32.
[0055] Step S25: Fill the extracted characters into the nth character position of the original device identifier to obtain a first device identifier based on a random number.
[0056] In this embodiment, for the nth character position of the original device identifier, the character extracted in step S24 is filled in the corresponding nth character position of the original device identifier until all character positions in the original device identifier are filled, thereby obtaining a first device identifier based on a random number.
[0057] In an optional implementation, when generating N random numbers, not only can N random numbers be generated based on the timestamp through multiple random number algorithms, but N random numbers can also be generated based on the message content of the message to be sent through multiple random number algorithms. N random numbers can also be generated based on the message sequence identifier of the message to be sent (that is, the sequential number of the message to be sent in the communication) through multiple random number algorithms, and so on. This embodiment does not limit the method of generating random numbers.
[0058] In one implementation, the present application further provides a method for generating a device identifier. In this embodiment, the above step S24 "based on the nth random number, for the nth character position of the original device identifier, extracting a character from the character set" may specifically include step S31 and step S32: Step S31: Determine the index value of the nth character position of the original device identifier based on the nth random number and the total number of characters in the character set.
[0059] In this embodiment, the index value of the nth character position of the original device identifier can be determined based on the nth random number and the total number of characters in the predefined character set. In an optional implementation, the index value of the nth character position of the original device identifier can be obtained by taking the remainder of the nth random number and the total number of characters in the predefined character set.
[0060] For example, when the first device is a vehicle-mounted communication terminal, the standard format of the device identifier corresponding to the vehicle-mounted communication terminal requires the use of hexadecimal numbers. Therefore, a character set (character filling candidate pool) including 16 characters can be predefined, such as the character set chars can be expressed as: chars = "0123456789abcdef". Correspondingly, the remainder of the generated nth random number with respect to 16 is obtained to obtain an integer ranging from 0 to 15 as the index value, that is, the index value of the nth character position of the original device identifier is determined.
[0061] Step S32: extracting a character corresponding to the index value of the nth character position of the original device identifier from the character set, wherein different characters in the character set correspond to different index values.
[0062] In this embodiment, for the nth character position of the original device identifier, the index value obtained in step S31 is used to extract the character corresponding to the index value from the character set (such as the chars string), and different characters in the character set correspond to different index values. Afterwards, the corresponding extracted character is filled into the corresponding nth character position in the original device identifier. For example, if the index value calculated at the 9th character position of the original device identifier is 2, then the value of the character set chars[2] taken out based on the index value 2 is 1, and the 9th character position of the original device identifier is set to "2"; if the index value calculated at the 14th character position of the original device identifier is 15, then the value of the character set chars
[15] taken out based on the index value 15 is f, and the 14th character position of the original device identifier is set to "f".
[0063] In one implementation, the present application further provides a method for generating a device identifier. In this embodiment, the above step S24 "based on the nth random number, for the nth character position of the original device identifier, extracting a character from the character set" may specifically include the following steps: After determining the index value of the nth character position of the original device identifier based on the nth random number and the total number of characters in the character set, the index values corresponding to the characters in the character set are randomly shuffled, and then a character corresponding to the index value of the nth character position is extracted from the character set. In this way, the present embodiment randomly shuffles the index values corresponding to the characters in the character set each time a character is extracted from the character set based on a random number, thereby improving the randomness of the first device identifier, so as to further ensure the high uniqueness of the target device identifier.
[0064] In one embodiment, the present application also provides a method for generating a device identifier, wherein the first device identifier further includes M target characters, the original device identifier further includes M target character positions, each target character occupies a target character position, and the target character is different from each character in the character set. Before the above step S24 "based on the nth random number, for the nth character position of the original device identifier, extract a character from the character set", the method further includes step S41. The above step S25 "filling the extracted character into the nth character position of the original device identifier to obtain the first device identifier based on the random number" specifically includes step S42: Step S41: Fill the target character in each of the M target character positions of the original device identifier.
[0065] In this embodiment, the target character is different from each character in the character set, for example, the target character may be "-", " / ", "$", or other characters different from those in the character set. The position and number of target characters in the first device identifier may be set by the manufacturer, for example, there are 3 target character positions, namely the 1st, 3rd, and 5th positions; there are 4 target character positions, namely the 8th, 13th, 18th, and 23rd positions. Assuming that the target character is "-", and the target character positions are 4, namely the 8th, 13th, 18th, and 23rd positions, then in the standard format of the device identifier corresponding to the vehicle-mounted communication terminal, the 8th / 13th / 18th / 23rd string positions of the device identifier need to be filled with "-". Assuming that the target character is " / ", and the target character positions are 3, namely the 1st, 3rd, and 5th positions, then in the standard format of the device identifier corresponding to the vehicle-mounted communication terminal, the 1st, 3rd, and 5th string positions of the device identifier need to be filled with " / ".
[0066] Step S42: Fill the extracted characters into the nth character position in the original device identifier except the M target character positions to obtain a first device identifier based on a random number.
[0067] In this embodiment, the first device identifier includes M+N characters. In the process of generating the first device identifier based on a random number, after filling M target characters in each target character position of the M target character positions of the original device identifier, the extracted nth character is filled in the nth character position of the original device identifier except the M target character positions to obtain the first device identifier.
[0068] In one example, M is 4, N is 32, then the first device identifier includes 32 characters and 4 target characters, the original device identifier includes 32 character positions and 4 target character positions, wherein the 4 target character positions are the 8th, 13th, 18th, and 23rd character positions of the original device identifier. When the target character is "-", "-" can be filled in the 8th, 13th, 18th, and 23rd character positions of the original device identifier, and then the character extracted for the nth time can be filled in the nth character position of the other 32 character positions in the original device identifier except the 8th, 13th, 18th, and 23rd character positions, thereby obtaining the first device identifier.
[0069] In one embodiment, if Figure 2 As shown, Figure 2 1 is a flowchart of the steps of generating a first device identifier based on a random number in a device identifier generation method proposed in an embodiment of the present application. Figure 2In the example, for the message to be sent to the second device, the specific process of generating the first device identifier based on the random number is as follows: create a character set (such as a chars array) and create a device identifier array with a length of 36. Through loop processing, fill each character position of the device identifier, that is, determine whether it reaches the end of the device identifier. If it reaches the end of the device identifier, it ends; if it does not reach the end of the device identifier, move to the next position of the device identifier and fill the character position moved to. In the filling process, perform a "-" assignment operation on special positions; obtain a time-based random number; randomly extract a value from 0 to 15 as the subscript of the character set (such as chars) (take the remainder of 16 of the time-based random number, and obtain an integer between 0 and 15 as the index value, and extract the corresponding character from chars according to the index value, such as index value index=15→chars
[15] ="f'"); assign the obtained value to the device identifier. When the loop processing ends, it means that all positions of the device identifier have been processed, and the first device identifier based on the random number is obtained.
[0070] In one embodiment, the present application further provides a method for generating a device identifier, in which the first device identifier further includes M target characters, and the above step S12 "adjusting the characters in the first device identifier according to the hardware attribute information of the hardware element deployed in the first device and / or the message attribute information of the message to be sent to obtain a target device identifier" may specifically include the following steps S51: Step S51: According to the hardware attribute information of the hardware elements deployed in the first device and / or the message attribute information of the message to be sent, a plurality of characters other than the M target characters in the first device identifier are adjusted to obtain a target device identifier.
[0071] In this embodiment, the M target characters in the first device identifier can be kept unchanged, and multiple characters other than the M target characters in the first device identifier can be adjusted according to the hardware attribute information of the hardware components deployed in the first device and / or the message attribute information of the message to be sent to obtain the target device identifier.
[0072] In an optional example, when the first device is a vehicle-mounted communication terminal and is adjusted to replacement, the first device identifier generated for the first device is generally represented as a string of 36 characters, wherein there are M target characters at special character positions, such as target characters "-" at 4 target character positions. Therefore, when replacing the characters in the first device identifier according to the hardware attribute information and / or message attribute information corresponding to the first device, multiple characters other than the 4 target characters "-" in the first device identifier are replaced to obtain the target device identifier. For example, the corresponding character string and the number of characters a of the character string are determined according to the hardware attribute information corresponding to the first device, and the first a characters (excluding the target character "-") in the first device identifier are replaced with the character string corresponding to the hardware attribute information; and / or, the corresponding character string and the number of characters b of the character string are determined according to the message attribute information corresponding to the first device, and the last b characters (excluding the target character "-") in the first device identifier are replaced with the character string corresponding to the message attribute information, and finally the target device identifier is obtained.
[0073] In one embodiment, the present application further provides a method for generating a device identifier, in which the above step S12 "adjusting the characters in the first device identifier according to the hardware attribute information of the hardware element deployed in the first device and / or the message attribute information of the message to be sent to obtain a target device identifier" may specifically include the following steps S61~S62: Step S61: determine a first string representing the hardware attribute information; and / or obtain a message number corresponding to the message to be sent, and determine a second string representing the message number; the message number increases as the total number of messages sent by the first device to the second device increases.
[0074] In this embodiment, the vehicle identification number (VIN) of the stored vehicle is read from the vehicle communication terminal. The VIN is a 17-bit character sequence that includes the manufacturing information, year, model, etc. of the vehicle. The VIN is converted into a format suitable for replacing device identifier characters, such as a hexadecimal string, to obtain a first string representing the hardware attribute information of the vehicle communication terminal. Also, the msgID corresponding to the message to be sent to the server is obtained from the vehicle communication terminal, and a second string representing the message number (msgID) is determined. The msgID is used to identify each message sent, and is incremented each time a message is sent, that is, it is incremented as the total number of messages sent by the vehicle communication terminal to the server increases, thereby ensuring that the messages sent by each device are different.
[0075] Step S62: Using the first character string, adjust multiple first characters in the first device identifier, and / or using the second character string, adjust multiple second characters in the first device identifier to obtain a target device identifier, wherein the character positions of the multiple first characters do not overlap with the character positions of the multiple second characters.
[0076] In this embodiment, the first character string obtained in step S61 is used to adjust the multiple first characters in the first device identifier. For example, the VIN number of a certain vehicle model is a random combination of 17 letters and numbers, and the 17 characters of the VIN number are replaced with the first 17 characters of the first device identifier (excluding the target character "-"). And / or the second character string obtained in step S61 is used to adjust the multiple second characters in the first device identifier. For example, the last 8 positions of the first device identifier are filled byte by byte with a variable msgID of type uint64. Among them, the character positions of the multiple first characters do not overlap with the character positions of the multiple second characters. After the character replacement, the target device identifier is obtained.
[0077] In one embodiment, the present application further provides a method for generating a device identifier, in which the above step S12 "adjusting the characters in the first device identifier according to the hardware attribute information of the hardware element deployed in the first device and / or the message attribute information of the message to be sent to obtain a target device identifier" may specifically include the following steps: A third character string is determined according to the hardware attribute information of the hardware element deployed in the first device and the message attribute information of the message to be sent, and the third character string is used to adjust multiple characters in the first device identifier to obtain the target device identifier.
[0078] For example, when the hardware attribute information is the vehicle terminal identifier and the message attribute information is the message type identifier, if the vehicle terminal identifier is a 14-bit string and the message type identifier is a 6-bit string, the vehicle terminal identifier and the message type identifier can be arbitrarily combined (such as directly concatenating while keeping the order of the original strings, or randomly combining the characters in the two strings by disrupting the order of the characters) to obtain a 20-bit third string, and then use this 20-bit third string to replace the first / middle / last 20 characters (except the target characters) in the first device identifier to obtain the target device identifier.
[0079] In one embodiment, the present application further provides a method for generating a device identifier. After obtaining the target device identifier in the above step S12, the method may further include the following steps S71 to S74: Step S71: Obtaining the hardware usage of the first device, where the hardware usage includes at least one of the following: CPU usage and memory usage; Step S72: When the hardware usage rate is less than a first threshold, encrypt the target device identifier using a first encryption method; Step S73: when the hardware usage rate is greater than or equal to the first threshold and less than a second threshold, encrypt the target device identifier using a second encryption method, the hardware resource consumption of the second encryption method is lower than the hardware resource consumption of the first encryption method, and the second threshold is greater than the first threshold; Step S74: when the hardware usage rate is greater than or equal to the second threshold, determine not to use any encryption method to encrypt the target device identifier.
[0080] In this embodiment, the encryption algorithms include RC4 (Rivest Cipher 4), ChaCha20 (ChaCha with 20 rounds), Blowfish, AES-128 (Advanced Encryption Standard with 128-bit key), 3DES (Triple Data Encryption Standard), Serpent, etc. The above algorithms are sorted from low to high according to the hardware resource consumption. Considering that the first device is a vehicle-mounted communication terminal, a large amount of system resources will be occupied during the remote control, intensive data packaging and reporting stage, or OTA stage. Based on these resource-specific scenarios, according to the real-time acquisition of the hardware usage of the first device (such as obtaining the CPU usage alone, obtaining the memory usage alone, and obtaining the CPU usage and memory usage at the same time), the appropriate encryption algorithm is selected according to the defined priority to ensure data security while reducing the impact on system resources. Specifically, two thresholds are pre-set to determine the logic of switching different encryption algorithms: When the hardware usage is less than the first threshold, the target device identifier is encrypted using the first encryption method. For example, when the CPU usage is obtained separately as the hardware usage, the current CPU usage is read through the API provided by the operating system. When the CPU usage is <40%, the target device identifier is encrypted using AES-128 to balance security and performance.
[0081] When the hardware usage rate is greater than or equal to the first threshold and less than the second threshold, the target device identifier is encrypted using the second encryption method, and the hardware resource consumption of the second encryption method is lower than the hardware resource consumption of the first encryption method. The first threshold represents the usage rate when the hardware resources are relatively abundant, and the second threshold represents the usage rate when the hardware resources begin to be tight, and the second threshold is greater than the first threshold. For example, when 40%≤CPU usage rate<60%, the target device identifier is encrypted using a relatively lightweight algorithm such as RC4 to ensure the normal operation of the system. Specifically, the hardware resource consumption of the second encryption method is lower than the hardware resource consumption of the first encryption method. For example, when the first encryption method uses AES-128, the second encryption method can use RC4, ChaCha2 or Blowfish whose hardware resource consumption is lower than AES-128. When the first encryption method uses Serpent, the second encryption method can use RC4, ChaCha20, Blowfish, AES-128 or 3DES whose hardware resource consumption is lower than Serpent.
[0082] When the hardware usage is greater than or equal to the second threshold, it is determined not to use any encryption method to encrypt the target device identifier. For example, when the CPU usage is ≥60%, restrictions are implemented and the target device identifier is not encrypted. Only critical data (important messages) are encrypted.
[0083] In one embodiment, if Figure 3 As shown, Figure 3 Schematic diagram of the comprehensive CPU usage and encryption algorithm of the device identifier generation method proposed in one embodiment of the present application. Figure 3 In the message payload, a field is opened to indicate whether an encryption algorithm is currently used. If an encryption algorithm is used, the encryption method is described. Specifically, when the CPU usage rate is <40%, the Advanced Encryption Standard (128-bit key) (i.e. AES-128) is used to encrypt the target device identifier; when 40%≤CPU usage rate<60%, the Rivest Fourth Cipher (RC4) is used to encrypt the target device identifier. When the CPU usage rate is ≥60%, the restriction is enforced and the target device identifier is not encrypted. Finally, the message payload is obtained: encryption method + device identifier content.
[0084] This application takes into account the low power consumption characteristics of embedded devices and the stability requirements of automotive components for products, as well as security considerations, and proposes an optimized superposition algorithm based on the above target device identifier algorithm. According to the real-time CPU usage, the target device identifier is encrypted by selecting a suitable encryption algorithm according to the defined priority. Through the dynamic encryption algorithm selection mechanism based on CPU usage, while ensuring data security, it can optimize power consumption and system performance, prevent performance bottlenecks when the device is overloaded, and can be used in embedded devices or resource-constrained environments.
[0085] In one implementation, the present application further provides a method for generating a device identifier, which may further include the following steps S81-S83: Step S81: Generate encryption prompt information according to whether the target device identifier is encrypted and the encryption method used when encrypting the target device identifier; Step S82: Generate a target message according to the encryption prompt information, the target device identifier and the message content of the message to be sent; Step S83: Send the target message to the second device.
[0086] In this embodiment, an encryption prompt message is generated according to whether the target device identifier is encrypted and the encryption method used. For example, a flag bit can be used to indicate whether encryption is used, and another field can be used to indicate the encryption method. The target device identifier, the encryption prompt message, and the message content are combined into a complete target message and sent to the second device. The encryption prompt message can let the recipient know whether the message is encrypted and the encryption method used, so as to ensure that both parties can correctly parse and process the message.
[0087] In one embodiment, the present application further provides a method for generating a device identifier, which further includes step S91. The above step S11 "generating a first device identifier based on a random number for a message to be sent to a second device" specifically further includes step S92: Step S91: Determine the message type of the message to be sent; Step S92: When the message type belongs to the target message type, a first device identifier based on a random number is generated for the message to be sent, and the target message type includes any one of the following: login message type, logout message type, sleep message type, wake-up message type, remote control response message type, appointment control vehicle message type, and OTA upgrade message type.
[0088] In this embodiment, the message type of the message to be sent can be determined by parsing the message content or checking the type field in the message header. The target message type includes any of the following: login message type, logout message type, sleep message type, wake-up message type, remote control response message type, appointment control message type, OTA upgrade message type. If the message type belongs to the target message type, a first device identifier based on a random number is generated for the message to be sent. This facilitates targeted processing of messages of specific types.
[0089] Based on the same inventive concept, an embodiment of the present disclosure also provides a vehicle, comprising: a memory storing the frame number of the vehicle; and an on-board terminal, used to use the frame number of the vehicle as hardware attribute information of a hardware element deployed in a first device, and execute the steps in the device identifier generation method described in any of the above embodiments of the present application.
[0090] Based on the same inventive concept, an embodiment of the present application provides a device for generating a device identifier, which is applied to a first device. Figure 4 is a schematic diagram of the structure of a device identifier generation apparatus proposed in an embodiment of the present application, such as Figure 4 As shown, the device identifier generating device includes: A first processing module, configured to generate a first device identifier based on a random number for a message to be sent to a second device; The second processing module is used to adjust the characters in the first device identifier according to the hardware attribute information of the hardware elements deployed in the first device and / or the message attribute information of the message to be sent, so as to obtain a target device identifier, and the target device identifier is used to indicate to the second device that the message to be sent comes from the first device.
[0091] In an optional implementation, the first device identifier includes at least N characters, each character occupies one character position; and the first processing module includes: An initialization module, used for initializing an original device identifier including at least N character positions, wherein the characters at each character position of the original device identifier are initial characters; A first acquisition module, used to acquire a timestamp corresponding to the message to be sent, wherein the timestamp represents a time when the message content of the message to be sent is generated or a time when the message to be sent is sent; A random number generation module, used to generate N random numbers based on the timestamp; An extraction module, configured to extract a character from a character set based on an nth random number and at an nth character position of the original device identifier, wherein the character set includes a plurality of different characters, and a value of n ranges from 1 to N; The first filling module is used to fill the extracted characters into the nth character position of the original device identifier to obtain a first device identifier based on a random number.
[0092] In an optional implementation, the extraction module includes: A first determination module, configured to determine an index value of an nth character position of the original device identifier based on the nth random number and the total number of characters in the character set; The index module is used to extract a character corresponding to the index value of the nth character position of the original device identifier from the character set, and different characters in the character set correspond to different index values.
[0093] In an optional implementation, the first device identifier further includes M target characters, the original device identifier further includes M target character positions, each target character occupies a target character position, and the target character is different from each character in the character set; the apparatus further includes: A second filling module is used to fill the target character in each of the M target character positions of the original device identifier before extracting a character from the character set for the nth character position of the original device identifier based on the nth random number; The first filling module comprises: The first filling submodule is used to fill the extracted characters in the nth character position in the original device identifier except the M target character positions to obtain a first device identifier based on a random number.
[0094] In an optional implementation, the first device identifier further includes M target characters, and the second processing module includes: The first replacement module is used to adjust multiple characters in the first device identifier except the M target characters according to the hardware attribute information of the hardware components deployed in the first device and / or the message attribute information of the message to be sent, so as to obtain a target device identifier.
[0095] In an optional implementation, the second processing module includes: A second determination module is used to determine a first character string representing the hardware attribute information; and / or obtain a message number corresponding to the message to be sent, and determine a second character string representing the message number; the message number increases as the total number of messages sent by the first device to the second device increases; The second replacement module is used to use the first character string to adjust multiple first characters in the first device identifier, and / or use the second character string to adjust multiple second characters in the first device identifier to obtain a target device identifier, wherein the character positions of the multiple first characters do not overlap with the character positions of the multiple second characters.
[0096] In an optional embodiment, the device further comprises: A second acquisition module is used to acquire a hardware usage rate of the first device, where the hardware usage rate includes at least one of the following: a CPU usage rate and a memory usage rate; A first encryption module, configured to encrypt the target device identifier using a first encryption method when the hardware usage rate is less than a first threshold; a second encryption module, configured to encrypt the target device identifier using a second encryption method when the hardware usage rate is greater than or equal to the first threshold and less than a second threshold, the hardware resource consumption of the second encryption method being lower than the hardware resource consumption of the first encryption method, and the second threshold being greater than the first threshold; The third encryption module is used to determine not to use any encryption method to encrypt the target device identifier when the hardware usage rate is greater than or equal to the second threshold.
[0097] In an optional embodiment, the device further comprises: A prompt information generating module, used for generating encrypted prompt information according to whether the target device identifier is encrypted and the encryption method used when encrypting the target device identifier; A target information generating module, used for generating a target message according to the encrypted prompt information, the target device identifier and the message content of the message to be sent; A sending module is used to send the target message to the second device.
[0098] In an optional embodiment, the device further comprises: A third determining module, used to determine the message type of the message to be sent; The first processing module comprises: The first identification generation module is used to generate a first device identifier based on a random number for the message to be sent when the message type belongs to a target message type. The target message type includes any one of the following: login message type, logout message type, sleep message type, wake-up message type, remote control response message type, appointment control vehicle message type, and OTA upgrade message type.
[0099] Based on the same inventive concept, an embodiment of the present application provides an electronic device, referring to Figure 5 , Figure 5 is a schematic diagram of an electronic device proposed in one embodiment of the present application. Figure 5 As shown, the electronic device 100 includes: a memory 110 and a processor 120. The memory 110 and the processor 120 are connected via a bus communication. A computer program is stored in the memory 110. The computer program can be run on the processor 120 to implement the steps in the device identifier generation method described in any of the above embodiments of the present application.
[0100] Based on the same inventive concept, an embodiment of the present disclosure also provides a computer-readable storage medium. When the instructions in the computer-readable storage medium are executed by a processor of a computer device, the computer device is enabled to execute the steps in the device identifier generation method described in any of the above embodiments of the present application.
[0101] Based on the same inventive concept, an embodiment of the present disclosure further provides a computer program product, including a computer program, which, when executed by a processor of a computer device, can execute the steps in the device identifier generation method described in any of the above embodiments of the present application.
[0102] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0103] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0104] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0105] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0106] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0107] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0108] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0109] The above is a detailed introduction to a device identifier generation method and a vehicle provided by 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 a person skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for generating a device identifier, characterized in that: Applied to a first device, the method includes: For a message to be sent to a second device, generating a first device identifier based on a random number; According to the hardware attribute information of the hardware elements deployed in the first device and / or the message attribute information of the message to be sent, the characters in the first device identifier are adjusted to obtain a target device identifier, and the target device identifier is used to indicate to the second device that the message to be sent comes from the first device.
2. The method for generating a device identifier according to claim 1, characterized in that: The first device identifier includes at least N characters, each character occupies one character position; For a message to be sent to a second device, generating a first device identifier based on a random number includes: Initializing an original device identifier including at least N character positions, wherein the characters at each character position of the original device identifier are initial characters; Obtaining a timestamp corresponding to the message to be sent, where the timestamp represents a time when the message content of the message to be sent is generated or a time when the message to be sent is sent; Generate N random numbers based on the timestamp; Based on the nth random number, for the nth character position of the original device identifier, extract a character from a character set, the character set including a plurality of different characters, and the value of n ranges from 1 to N; The extracted characters are filled into the nth character position of the original device identifier to obtain a first device identifier based on a random number.
3. The method for generating a device identifier according to claim 2, characterized in that: Based on the nth random number, for the nth character position of the original device identifier, extract a character from the character set, including: Determine an index value of an nth character position of the original device identifier based on the nth random number and the total number of characters in the character set; A character corresponding to the index value of the nth character position of the original device identifier is extracted from the character set, and different characters in the character set correspond to different index values.
4. The method for generating a device identifier according to claim 2, wherein: The first device identifier further includes M target characters, the original device identifier further includes M target character positions, each target character occupies a target character position, and the target character is different from each character in the character set; Before extracting a character from a character set for the nth character position of the original device identifier based on the nth random number, the method further comprises: Fill the target character in each target character position of the M target character positions of the original device identifier; Filling the extracted character at the nth character position of the original device identifier to obtain a first device identifier based on a random number, comprising: The extracted characters are filled in the nth character position in the original device identifier except the M target character positions to obtain a first device identifier based on a random number.
5. The method for generating a device identifier according to claim 2, characterized in that: The first device identifier also includes M target characters. According to the hardware attribute information of the hardware element deployed in the first device and / or the message attribute information of the message to be sent, the characters in the first device identifier are adjusted to obtain the target device identifier, including: According to the hardware attribute information of the hardware elements deployed in the first device and / or the message attribute information of the message to be sent, a plurality of characters other than the M target characters in the first device identifier are adjusted to obtain a target device identifier.
6. The method for generating a device identifier according to claim 1, characterized in that: According to the hardware attribute information of the hardware element deployed in the first device and / or the message attribute information of the message to be sent, the characters in the first device identifier are adjusted to obtain the target device identifier, including: Determine a first character string representing the hardware attribute information; and / or obtain a message number corresponding to the message to be sent, and determine a second character string representing the message number; the message number increases as the total number of messages sent by the first device to the second device increases; The first character string is used to adjust multiple first characters in the first device identifier, and / or the second character string is used to adjust multiple second characters in the first device identifier to obtain a target device identifier, wherein the character positions of the multiple first characters do not overlap with the character positions of the multiple second characters.
7. The method for generating a device identifier according to any one of claims 1 to 6, characterized in that: After obtaining the target device identifier, the method further includes: Obtaining a hardware usage rate of the first device, where the hardware usage rate includes at least one of the following: a CPU usage rate and a memory usage rate; When the hardware usage rate is less than a first threshold, encrypting the target device identifier using a first encryption method; When the hardware usage rate is greater than or equal to the first threshold and less than a second threshold, encrypt the target device identifier using a second encryption method, the hardware resource consumption of the second encryption method is lower than the hardware resource consumption of the first encryption method, and the second threshold is greater than the first threshold; When the hardware usage rate is greater than or equal to the second threshold, it is determined not to use any encryption method to encrypt the target device identifier.
8. The method for generating a device identifier according to claim 7, characterized in that: The method further comprises: generating encryption prompt information according to whether the target device identifier is encrypted and the encryption method used when encrypting the target device identifier; Generate a target message according to the encryption prompt information, the target device identifier and the message content of the message to be sent; The target message is sent to the second device.
9. The method for generating a device identifier according to claim 8, characterized in that: The method further comprises: Determine the message type of the message to be sent; For a message to be sent to a second device, generating a first device identifier based on a random number includes: When the message type belongs to the target message type, a first device identifier based on a random number is generated for the message to be sent, and the target message type includes any one of the following: login message type, logout message type, sleep message type, wake-up message type, remote control response message type, appointment control vehicle message type, and OTA upgrade message type.
10. A vehicle, characterized in that: include: A memory storing the vehicle frame number of the vehicle; The vehicle-mounted terminal is used to use the vehicle frame number as the hardware attribute information of the hardware element deployed in the first device, and execute the steps of the device identifier generation method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Unique identifier of distributed system and generation method thereof
CN111353275A
Message identifier generation method and device, electronic equipment and storage medium
CN116032869A
Vehicle identification number VIN coding and verification method, device, equipment and medium
CN117494170A
Identification generation method and device, computer equipment, storage medium and program product
CN118036045A
Vehicle component identification method and device, storage medium and vehicle
CN118585970A