Data security encryption method and smart wearable device
By using hash operations and Lee distance calculations with timestamps and preset ring modulo numbers in smart wearable devices to generate dynamic key seeds and symbol sequences, the problem of static keys being easily cracked is solved, achieving high security and anti-cracking capabilities for data transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN XINCORE TECH CO LTD
- Filing Date
- 2026-03-10
- Publication Date
- 2026-06-05
AI Technical Summary
Among the existing data encryption methods for smart wearable devices, encryption algorithms based on static shared keys are easily cracked by attackers through side-channel analysis or physical extraction, leading to the leakage of user privacy information and lacking key dynamism and anti-cracking capabilities.
A dynamic key seed is generated by hashing based on the current timestamp and the pre-configured shared key. The key symbol sequence is mapped and Lee distance is calculated by combining the preset ring modulus. The encrypted ciphertext symbol sequence is generated bit by bit and the timestamp is carried in the transmission data packet to realize the generation and transmission of the dynamic key.
It enhances the dynamism and anti-cracking capabilities of the key, preventing attackers from obtaining a fixed key throughout the entire communication cycle and ensuring the security and integrity of data transmission.
Smart Images

Figure CN122160126A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a data security encryption method and a smart wearable device. Background Technology
[0002] In the field of secure data transmission for smart wearable devices, existing technologies often employ encryption methods based on symmetric encryption algorithms combined with fixed keys to achieve data protection. For example, a typical method involves pre-setting the same static shared key between the device and the receiver, and then using this key to encrypt the sensor data using AES (Advanced Encryption Standard) before transmission.
[0003] However, because the shared key remains unchanged throughout the entire communication cycle, once an attacker obtains this static key through side-channel analysis, physical extraction, or long-term eavesdropping, they can decrypt all historical and future transmitted data, leading to large-scale leaks of user privacy information. Therefore, how to improve key dynamism and anti-cracking capabilities without relying on complex key negotiation protocols has become an urgent technical problem to be solved. Summary of the Invention
[0004] This invention provides a data security encryption method and a smart wearable device, aiming to improve key dynamism and anti-cracking capabilities, and enhance data transmission security without relying on complex key negotiation protocols.
[0005] In a first aspect, the present invention provides a data security encryption method, comprising: A hash operation is performed based on the current timestamp and the pre-configured shared key to obtain the first key seed. A hash operation is then performed based on the first key seed and the data sequence to be transmitted to determine the second key seed. Based on the second key seed and the preset ring modulus, the mapped key symbol sequence is determined, and the data sequence to be transmitted is mapped in the preset ring modulus to obtain the data symbol sequence; Lee distance is calculated bit by bit based on the mapped key symbol sequence and the data symbol sequence to obtain a Lee distance sequence. Then, based on the Lee distance sequence and the mapped key symbol sequence, encryption is performed on the preset ring modulus to obtain an encrypted ciphertext symbol sequence. Based on the encrypted ciphertext symbol sequence and the current timestamp, a transmission data packet is generated and sent to the receiving end.
[0006] Optionally, the encryption based on the Lee distance sequence and the mapped key symbol sequence on the preset ring modulus to obtain the encrypted ciphertext symbol sequence includes: Each corresponding element at the same index position in the Lee distance sequence and the mapped key symbol sequence is combined into a tuple to obtain a paired symbol tuple sequence; each tuple in the paired symbol tuple sequence contains a Lee distance symbol and a mapped key symbol. For each pair of paired symbol tuples in the sequence of paired symbol tuples, perform an integer addition operation between the Lee distance symbol contained in it and the mapped key symbol to obtain a preliminary ciphertext symbol sequence; For each preliminary ciphertext symbol in the preliminary ciphertext symbol sequence, perform a minimum non-negative residue operation on the preliminary ciphertext symbol with respect to the preset ring modulus to obtain a modulus-reduced ciphertext symbol sequence; Perform a bitwise XOR operation between each item in the modulo-reduced ciphertext symbol sequence and the corresponding position of the mapped key symbol in the mapped key symbol sequence to obtain the target ciphertext symbol sequence. Then, perform a second modulo reduction based on the target ciphertext symbol sequence and the preset ring modulus to obtain the encrypted ciphertext symbol sequence.
[0007] Optionally, the step of performing a second-order modulo reduction based on the target ciphertext symbol sequence and the preset ring modulus to obtain the encrypted ciphertext symbol sequence includes: For each perturbed ciphertext symbol in the target ciphertext symbol sequence, perform a modulo operation on the preset ring modulus to obtain a quadratic reduced ciphertext symbol sequence; Using each item in the Lee distance sequence as an offset, a cyclic right shift operation is performed on the index position of the quadratic reduced ciphertext symbol sequence to generate a permutation index sequence; the number of shifts in the cyclic right shift operation is equal to the result of taking the Lee distance symbol modulo the length of the quadratic reduced ciphertext symbol sequence; Based on the new index indicated by each position in the permutation index sequence, the symbols in the quadratic reduction ciphertext symbol sequence are rearranged to their corresponding positions to obtain the rearranged ciphertext symbol sequence; Based on the rearranged ciphertext symbol sequence, sequence integrity encapsulation is performed to obtain an encrypted ciphertext symbol sequence.
[0008] Optionally, the step of calculating the Lee distance bit by bit based on the mapped key symbol sequence and the data symbol sequence to obtain the Lee distance sequence includes: Based on the mapped key symbol sequence and the data symbol sequence, a length alignment check is performed to obtain an aligned key symbol subsequence and an aligned data symbol subsequence. Based on the aligned key symbol subsequence and the aligned data symbol subsequence, bit-by-bit difference calculation is performed to obtain the original difference symbol sequence; Modular reduction is performed based on the original difference symbol sequence and the preset ring modulus to obtain a modulo-reduced difference symbol sequence. Then, symmetric distance candidate generation is performed based on the modulo-reduced difference symbol sequence and the preset ring modulus to obtain a symmetric distance candidate symbol sequence. Based on the symmetric distance candidate symbol sequence, the minimum value is selected bit by bit to obtain the Lee distance sequence.
[0009] Optionally, the step of selecting the minimum value bit by bit based on the symmetric distance candidate symbol sequence to obtain the Lee distance sequence includes: For each pair of symmetric distance candidate values in the symmetric distance candidate symbol sequence, the position corresponding to the smallest value is taken as the preliminary Lee distance result, thus obtaining the preliminary Lee distance symbol sequence; Iterate through each item in the initial Lee distance symbol sequence. If there is a negative item, replace it with the absolute value of the negative item to obtain the corrected Lee distance symbol sequence. For each item in the corrected Lee distance symbol sequence, if its value is greater than the floor value of the preset ring modulus divided by two, it is replaced with the floor value of the preset ring modulus divided by two to obtain the constrained Lee distance symbol sequence. The Lee distance sequence is obtained by encapsulating the Lee distance symbol sequence based on the constraints.
[0010] Optionally, determining the mapped key symbol sequence based on the second key seed and the preset ring modulus includes: Based on the second key seed, a cyclic shift operation is performed to obtain a key symbol block, and based on the key symbol block and the preset ring modulus, a modular arithmetic is performed to divide the block into multiple key sub-block sequences. Each key sub-block sequence is converted to an integer to obtain a key integer sequence. Then, based on the key integer sequence and the preset ring modulus, an element-wise modulo operation is performed to obtain a preliminary key symbol sequence. If the first length of the preliminary key symbol sequence is less than the second length of the data sequence to be transmitted, the preliminary key symbol sequence is periodically and repeatedly spliced until the first length equals the second length; otherwise, the target sequence exceeding the second length is truncated to obtain the extended key symbol sequence. The mapped key symbol sequence is obtained by performing a centralized mapping based on the extended key symbol sequence and the preset ring modulus.
[0011] Optionally, the step of performing a centralized mapping based on the extended key symbol sequence and the preset ring modulus to obtain the mapped key symbol sequence includes: For each target element in the extended key symbol sequence, if the target element value is greater than or equal to the floor value of the preset ring modulus divided by two, then the target element value is replaced with the target element value minus the preset ring modulus; otherwise, it remains unchanged, thus obtaining the centralized key symbol sequence. The decimal value of the most significant byte in the second key seed is cyclically shifted to the right by the index position of the centralized key symbol sequence to obtain a rearranged key symbol sequence; the number of bits shifted to the right is equal to the result of taking the value modulo the length of the centralized key symbol sequence; Perform a modulo operation on the preset ring modulus on each element in the rearranged key symbol sequence to obtain the mapped key symbol sequence.
[0012] In a second aspect, the present invention also provides a smart wearable device for implementing the data security encryption method as described in the first aspect; the smart wearable device includes: The hash operation module is used to perform hash operations based on the current timestamp and the pre-configured shared key to obtain the first key seed, and to perform hash operations based on the first key seed and the data sequence to be transmitted to determine the second key seed; The key mapping module is used to determine the mapped key symbol sequence based on the second key seed and the preset ring modulus, and to map the data sequence to be transmitted in the preset ring modulus to obtain the data symbol sequence. The key encryption module is used to calculate the Lee distance bit by bit based on the mapped key symbol sequence and the data symbol sequence to obtain the Lee distance sequence, and to encrypt the Lee distance sequence and the mapped key symbol sequence on the preset ring modulus to obtain the encrypted ciphertext symbol sequence. An encrypted transmission module is used to generate a transmission data packet based on the encrypted ciphertext symbol sequence and the current timestamp and send it to the receiving end.
[0013] Thirdly, the present invention also provides an electronic device, comprising: a memory for storing computer software programs; and a processor for reading and executing the computer software programs, thereby implementing the data security encryption method described above.
[0014] Fourthly, the present invention also provides a non-transitory computer-readable storage medium storing a computer software program, which, when executed by a processor, implements the data security encryption method described above.
[0015] Fifthly, the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the data security encryption method described above.
[0016] The data security encryption method provided in this invention involves performing a hash operation based on the current timestamp and a pre-configured shared key to obtain a first key seed. A second key seed is then determined by performing a hash operation based on the first key seed and the data sequence to be transmitted. This allows the key seed to be dynamically generated rather than fixed, associating both the time and data dimensions. A mapped key symbol sequence is determined based on the second key seed and a preset ring modulus. Simultaneously, the data sequence to be transmitted is mapped onto the preset ring modulus to obtain a data symbol sequence, completing the adaptation of the key and data to the same modulus space for subsequent collaborative computation. A Lee distance sequence is obtained by calculating the Lee distance bit-by-bit between the mapped key symbol sequence and the data symbol sequence. Finally, an encrypted ciphertext symbol sequence is obtained by encrypting the Lee distance sequence and the mapped key symbol sequence on the preset ring modulus. This deeply binds the encryption process to the dynamically generated key and data symbols. A transmission data packet is then generated based on the encrypted ciphertext symbol sequence and the current timestamp and sent to the receiving end, ensuring that the transmitted content simultaneously carries dynamic encryption information and a time identifier. Therefore, the embodiments of the present invention introduce timestamps to make the first key seed and the second key seed generated in each communication time-sensitive. After mapping, the key symbol sequence changes dynamically with the key seed, and the encrypted ciphertext symbol sequence is generated based on this dynamic key symbol sequence. Moreover, the data packet carrying the timestamp can help the receiving end synchronize dynamic key-related parameters. There is no need for a complex key negotiation protocol throughout the process, so that the key is no longer static. Even if an attacker attempts to obtain the key, they can only target the dynamic key fragment generated based on a specific timestamp and data sequence in a single instance. They cannot obtain the fixed key that runs through the entire communication cycle, and therefore cannot decrypt all historical and future transmitted data. Based on the finally obtained encrypted ciphertext symbol sequence and the transmission data packet containing the timestamp, the dynamic nature of the key and its anti-cracking ability are improved without relying on a complex key negotiation protocol, thereby improving the security of data transmission. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the data security encryption method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of the smart wearable device provided in an embodiment of the present invention; Figure 3 An embodiment diagram of the electronic device provided in this invention; Figure 4 An embodiment diagram of a computer-readable storage medium provided in accordance with the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0020] In the description of this invention, the term "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this invention is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed herein.
[0021] Optionally, see Figure 1 , Figure 1 This is a flowchart illustrating the data security encryption method provided by the present invention. In this embodiment, the executing entity of the data security encryption method is a smart wearable device. Therefore, the data security encryption method includes: Step 10: Perform a hash operation based on the current timestamp and the pre-configured shared key to obtain the first key seed. Perform a hash operation based on the first key seed and the data sequence to be transmitted to determine the second key seed.
[0022] Optionally, the smart wearable device obtains the current timestamp, which refers to the specific time information of the moment when the smart wearable device generates the first key seed. It records the time interval from a specific reference time point to that moment. This timestamp is unique and real-time, which can effectively prevent security risks caused by repeated encryption.
[0023] Furthermore, the smart wearable device calls a pre-configured shared key. The pre-configured shared key refers to a fixed key that is agreed upon and stored in advance by the smart wearable device and the receiving end before communication. This key is known only to the smart wearable device and the corresponding receiving end and is used to ensure the initial security of the hash operation. The pre-configured shared key has a fixed length and needs to be updated regularly to improve security.
[0024] Furthermore, the smart wearable device performs a hash operation based on the acquired current timestamp and the pre-configured shared key. The hash operation refers to taking the value corresponding to the current timestamp and the value corresponding to the pre-configured shared key as input data, and performing a mixed operation on the two sets of data through a preset hash algorithm to obtain a set of fixed-length, irreversible output values. This output value is the first key seed. The first key seed is the basis for generating the second key seed, and its uniqueness is determined by the real-time nature of the current timestamp.
[0025] Furthermore, after generating the first key seed, the smart wearable device calls the data sequence to be transmitted. This data sequence refers to the original data set that the smart wearable device needs to send to the receiving end. This data set consists of several consecutive data units, each corresponding to specific business data (such as heart rate data, step count data, etc.). Further, the smart wearable device performs a secondary hash operation based on the first key seed and the data sequence to be transmitted. The algorithm for the secondary hash operation is the same as the algorithm for the first hash operation. The value corresponding to the first key seed is sequentially mixed with the values corresponding to all data units in the data sequence to be transmitted, ultimately obtaining a new set of fixed-length, irreversible output values. This value is the second key seed. The second key seed combines time information, shared key information, and original data information, further enhancing the security and specificity of the key.
[0026] In one embodiment, the smart wearable device is a smartwatch, and its pre-configured shared key is a fixed value of 12345678 (this value is pre-agreed upon and encrypted by the smartwatch and the receiving end, and can only be read by the two parties). At a certain moment, the smartwatch needs to send heart rate data, and the current timestamp obtained at this time is 1740567890123 milliseconds (the base time point is January 1, 1970, 00:00:00, and this timestamp represents the number of milliseconds from the base time point to the current moment). The smartwatch performs a hash operation on the current timestamp 1740567890123 and the pre-configured shared key 12345678. The operation is as follows: the two values are superimposed sequentially from the most significant bit to the least significant bit, and then the remainder of the superimposed result is taken as a fixed length (based on the preset hash algorithm rules). For example, the superimposed result is 1740567890123 + 12345678 = 1740580235801. The remainder of this result is taken as 10 bits, resulting in the value 8023580123, which is the first key seed.
[0027] The data sequence to be transmitted consists of five consecutive sets of heart rate data collected by the smartwatch: 78, 80, 79, 81, and 82 (each set of data is a data unit, corresponding to the heart rate value at different time points). The smartwatch performs a secondary hash operation based on the first key seed 8023580123 and the data sequence to be transmitted. The operation process is as follows: the first key seed is multiplied by each data unit in the data sequence to be transmitted in turn, then all the product results are added together, and finally the remainder after adding the result to 10 digits is taken, that is, (8023580123*78+8023580123*80+8023580123*79+8023580123*81+8023580123*82)=3199408469077. Taking the remainder after 10 digits, we get 4084690773, which is the second key seed.
[0028] Step 20: Based on the second key seed and the preset ring modulus, determine the mapped key symbol sequence, and map it in the preset ring modulus based on the data sequence to be transmitted to obtain the data symbol sequence.
[0029] Optionally, the preset ring modulus refers to a fixed positive integer agreed upon in advance by the smart wearable device and the receiving end. This value is used to limit the range of values of the symbol sequence and ensure that the mapped symbol sequence is within a unified range.
[0030] Optionally, the second key seed is converted into several symbols that conform to the preset range of ring modulus values through a preset mapping rule, forming a sequence of mapped key symbols, as described in steps 201 to 204.
[0031] Furthermore, the smart wearable device maps the data sequence to be transmitted in a preset ring modulus. The mapping process in this embodiment of the invention is as follows: each data unit in the data sequence to be transmitted is calculated with the preset ring modulus to obtain the mapping value corresponding to each data unit. All mapping values are arranged in the order of the original data sequence to be transmitted to form a data symbol sequence. The length of the data symbol sequence is the same as the length of the data sequence to be transmitted. Each mapping value falls within the value range limited by the preset ring modulus.
[0032] Continuing with the above embodiment, the preset ring modulus of the smartwatch is 100 (pre-agreed upon by the smartwatch and the receiver, with a value range of 0 to 99). The second key seed generated in step 10 is 4084690773. Based on the second key seed and the preset ring modulus of 100, for example, a mapped key symbol sequence is obtained (for example, the mapped sequence is 23, 45, 67, 89, 12, with a length consistent with the data sequence to be transmitted).
[0033] The data sequence to be transmitted is 78, 80, 79, 81, 82. The smartwatch performs a remainder operation on each data unit with the preset ring modulus 100 (preset mapping rule) to obtain the mapping value of each data unit: 78 remainder 100 is 78, 80 remainder 100 is 80, 79 remainder 100 is 79, 81 remainder 100 is 81, and 82 remainder 100 is 82. Arranged in the original sequence order, the data symbol sequence is obtained as 78, 80, 79, 81, 82.
[0034] Step 30: Calculate the Lee distance bit by bit based on the mapped key symbol sequence and data symbol sequence to obtain the Lee distance sequence, and encrypt the Lee distance sequence and the mapped key symbol sequence on a preset ring modulus to obtain the encrypted ciphertext symbol sequence.
[0035] Optionally, the smart wearable device performs bit-by-bit calculation of the Lee distance based on the mapped key symbol sequence and data symbol sequence to obtain the Lee distance sequence, as described in steps 301 to 304. The Lee distance refers to the absolute difference between corresponding symbols in two symbol sequences.
[0036] Furthermore, based on the Li's distance sequence and the mapped key symbol sequence, encryption is performed on a preset ring modulus to obtain an encrypted ciphertext symbol sequence, as described in steps 305 to 308.
[0037] In this embodiment of the invention, the length of the encrypted ciphertext symbol sequence is the same as the length of the mapped key symbol sequence and data symbol sequence.
[0038] Step 40: Generate a transmission data packet based on the encrypted ciphertext symbol sequence and the current timestamp, and send it to the receiving end.
[0039] Optionally, the smart wearable device invokes an encrypted ciphertext symbol sequence. This ciphertext symbol sequence is a set of encrypted symbols that can only be restored to the original data by the receiving end using the corresponding decryption rules. The current timestamp used is retrieved to synchronously verify the validity of the key seed during decryption at the receiving end.
[0040] Furthermore, the smart wearable device generates a transmission data packet based on the encrypted ciphertext symbol sequence and the current timestamp. The transmission data packet refers to a data set conforming to the communication protocol format, and it contains three core parts: a packet header, a data body, and a packet trailer. The packet header identifies the data source (i.e., the smart wearable device's unique device ID), data type (such as heart rate data, exercise data, etc.), and the current timestamp; the data body is the encrypted ciphertext symbol sequence; and the packet trailer verifies the integrity of the data packet to prevent data tampering during transmission. Further, after generating the transmission data packet, the smart wearable device sends the packet to the receiving end through a pre-set communication module (such as a Bluetooth module, Wi-Fi module, etc.). During transmission, the security of the communication link must be ensured to prevent packet interception. After receiving the data packet, the receiving end can recover the key seed using the current timestamp in the packet header and the pre-configured shared key, thereby decrypting the encrypted ciphertext symbol sequence and obtaining the original data sequence to be transmitted.
[0041] In one embodiment, for example, the encrypted ciphertext symbol sequence is 35, 27, 14, 56, 73, and the current timestamp used is 1740567890123 milliseconds. The smartwatch generates a transmission data packet, wherein the header of the data packet includes: the smartwatch's unique device ID 100001, the data type is heart rate data, and the current timestamp is 1740567890123 milliseconds; the data body is the encrypted ciphertext symbol sequence 35, 27, 14, 56, 73; and the tail of the data packet is a checksum. The checksum is generated by adding all the values in the encrypted ciphertext symbol sequence and taking the remainder of 100, i.e., 35 + 27 + 14 + 56 + 73 = 205, and taking the remainder of 100 yields the checksum 05. After generating a complete data packet, the smartwatch sends the data packet to the receiving end (such as a smartphone) via the Bluetooth communication module (pre-configured communication module). After receiving the data packet, the smartphone can restore the key seed by using the timestamp 1740567890123 milliseconds in the header and the pre-configured shared key 12345678. Then, it verifies the integrity of the data packet by combining it with the check code 05, and finally decrypts it to obtain the original heart rate data sequence 78, 80, 79, 81, 82.
[0042] In this embodiment of the invention, a first key seed is obtained by hashing the current timestamp and a pre-configured shared key. A second key seed is determined by hashing the first key seed and the data sequence to be transmitted. This allows the key seed to be dynamically generated rather than fixed, associating both the time and data dimensions. A mapped key symbol sequence is determined based on the second key seed and a preset ring modulus. Simultaneously, the data sequence to be transmitted is mapped in the preset ring modulus to obtain a data symbol sequence, completing the adaptation of the key and data to the same modulus space to enable subsequent collaborative computation. The Lee distance sequence is obtained by calculating the Lee distance bit by bit based on the mapped key symbol sequence and the data symbol sequence. The encrypted ciphertext symbol sequence is obtained by encrypting the Lee distance sequence and the mapped key symbol sequence in the preset ring modulus. This allows the encryption process to deeply bind the dynamically generated key symbols and data symbols. Finally, a transmission data packet is generated based on the encrypted ciphertext symbol sequence and the current timestamp and sent to the receiving end, so that the transmitted content carries both dynamic encryption information and time identifiers. Therefore, by introducing timestamps, the first and second key seeds generated in each communication have timeliness. After mapping, the key symbol sequence changes dynamically with the key seed, and the encrypted ciphertext symbol sequence is generated based on this dynamic key symbol sequence. Furthermore, the timestamp carried in the data packet can assist the receiving end in synchronizing dynamic key-related parameters. The entire process does not require a complex key negotiation protocol, so the key is no longer static. Even if an attacker attempts to obtain the key, they can only target a dynamic key fragment generated based on a specific timestamp and data sequence in a single instance. They cannot obtain the fixed key that runs through the entire communication cycle, and thus cannot decrypt all historical and future transmitted data. Based on the final encrypted ciphertext symbol sequence and the transmission data packet with timestamps, the dynamic nature and anti-cracking ability of the key are improved without relying on a complex key negotiation protocol, thereby enhancing the security of data transmission.
[0043] Optionally, the processes of steps 201 to 204 include: Step 201: Perform a cyclic shift operation based on the second key seed to obtain a key symbol block, and perform modular arithmetic segmentation based on the key symbol block and a preset ring modulus to obtain multiple key sub-block sequences.
[0044] Optionally, a cyclic shift operation is performed on the second key seed. The cyclic shift operation refers to shifting the value corresponding to the second key seed in a preset direction (left or right) and by a preset number of bits. The part that exceeds the length of the value after shifting is added back to the other end of the value to form a key symbol block. The key symbol block refers to the continuous value block obtained after the cyclic shift process, and its length is consistent with the original length of the second key seed.
[0045] Furthermore, after generating the key symbol block, modular segmentation is performed based on the key symbol block and the preset ring modulus. Modular segmentation refers to first performing a modulo operation on the value corresponding to the key symbol block and the preset ring modulus to obtain a baseline segmentation value, and then dividing the key symbol block into multiple sub-blocks of equal length at intervals of the baseline segmentation value. Each sub-block forms a key sub-block sequence, and the total length of the multiple key sub-block sequences is consistent with the length of the key symbol block, and the value range of each key sub-block sequence does not exceed the preset ring modulus.
[0046] Step 202: Perform integer conversion on each key sub-block sequence to obtain a key integer sequence, and perform element-wise modulo operation based on the key integer sequence and the preset ring modulus to obtain a preliminary key symbol sequence.
[0047] Optionally, each key sub-block sequence is converted into an integer. Integer conversion refers to converting the values in each key sub-block sequence into integers that can be directly used in calculations according to a preset encoding rule (such as decimal encoding). Each converted integer corresponds to a key sub-block sequence. All integers are arranged in the order of the original key sub-block sequences to form a key integer sequence. The length of the key integer sequence is the same as the number of key sub-block sequences.
[0048] Furthermore, the smart wearable device performs element-wise modulo operation based on the key integer sequence and the preset ring modulus. The element-wise modulo operation refers to performing a remainder operation on each integer in the key integer sequence with the preset ring modulus in turn to obtain the remainder corresponding to each integer. All remainders are arranged in the order of the original key integer sequence to form a preliminary key symbol sequence. The length of the preliminary key symbol sequence is the same as the length of the key integer sequence, and the value of each element is within the range of 0 to the preset ring modulus minus 1.
[0049] Step 203: If the first length of the preliminary key symbol sequence is less than the second length of the data sequence to be transmitted, the preliminary key symbol sequence is periodically spliced until the first length is equal to the second length; otherwise, the target sequence exceeding the second length is truncated to obtain the extended key symbol sequence.
[0050] Optionally, the smart wearable device first obtains the first length of the preliminary key symbol sequence and the second length of the data sequence to be transmitted, respectively. The first length refers to the number of elements contained in the preliminary key symbol sequence, and the second length refers to the number of data units contained in the data sequence to be transmitted.
[0051] Optionally, if the first length is less than the second length, the smart wearable device periodically reassembles the initial key symbol sequence. Periodic reassembly refers to continuously superimposing the sequence according to the original order of the initial key symbol sequence until the length of the assembled sequence (i.e., the first length) is equal to the second length. If the first length is greater than the second length, the elements from the starting position to the second length in the initial key symbol sequence are truncated, and the target sequence (the set of elements exceeding the second length) is deleted. The sequence obtained after the above adjustment is the extended key symbol sequence. The length of the extended key symbol sequence is completely consistent with the second length of the data sequence to be transmitted, which can meet the requirements of subsequent bit-by-bit operations.
[0052] Step 204: Perform a centralized mapping based on the extended key symbol sequence and the preset ring modulus to obtain the mapped key symbol sequence.
[0053] Optionally, the smart wearable device performs a centralized mapping based on the extended key symbol sequence and the preset ring modulus. That is, each element in the extended key symbol sequence is adjusted to the central value range corresponding to the preset ring modulus through a preset mapping rule, so that the element distribution is more uniform, and finally the mapped key symbol sequence is obtained, as in steps 2041 to 2043.
[0054] The embodiments of the present invention, based on a second key seed, do not rely on complex key negotiation protocols, thereby improving the dynamism and randomness of the key. This makes the mapped key symbol sequence both strongly correlated with the original key seed and unpredictable, effectively resisting cracking attacks based on fixed symbol patterns. This enhances the anti-cracking capability and security of data transmission in smart wearable devices, thereby improving data transmission security.
[0055] Optionally, the processes of steps 2041 to 2043 include: Step 2041: For each target element in the extended key symbol sequence, if the target element value is greater than or equal to the floor value of the preset ring modulus divided by two, then replace the target element value with the target element value minus the preset ring modulus; otherwise, leave it unchanged to obtain the centralized key symbol sequence.
[0056] Optionally, the smart wearable device traverses each target element in the extended key symbol sequence, where the target element refers to a single numerical element arranged in index order in the extended key symbol sequence. First, it calculates the floor value of the preset ring modulus divided by two. The floor value means discarding the decimal part of the result obtained by dividing the preset ring modulus by two and retaining only the integer part of the value.
[0057] For each target element, the following checks are performed: If the target element value is greater than or equal to the rounded-down value calculated above, a replacement operation is performed on the target element value. Specifically, the target element value is subtracted from the preset ring modulus to obtain a new element value. If the target element value is less than the rounded-down value, the target element value remains unchanged. After all target elements have been processed, all processed elements are arranged in the index order of the original extended key symbol sequence to form a centralized key symbol sequence. The length of the centralized key symbol sequence is consistent with the length of the extended key symbol sequence.
[0058] Step 2042: The decimal value of the most significant byte in the second key seed is cyclically shifted right by the index position of the centralized key symbol sequence to obtain a rearranged key symbol sequence. The number of bits shifted right is equal to the result of taking the value modulo the length of the centralized key symbol sequence.
[0059] Optionally, the smart wearable device extracts the most significant byte from the second key seed, where the most significant byte refers to the byte with the highest weight in the binary value corresponding to the second key seed, and each byte consists of eight binary bits. This most significant byte is then converted into a decimal value, which is an integer represented by the digits 0 to 9, with a base of ten.
[0060] Furthermore, based on this decimal value, the smart wearable device performs a cyclic right shift operation on the index positions of the centralized key symbol sequence. The cyclic right shift operation involves shifting each element in the centralized key symbol sequence to the right by a specified number of positions according to its index position. The rightmost element in the sequence is then moved to its corresponding leftmost position. The number of positions for the cyclic right shift is obtained by taking the modulo of the decimal value with the length of the centralized key symbol sequence. The modulo operation involves dividing the decimal value by the length of the centralized key symbol sequence, and the remainder is the number of positions to be shifted. This ensures that the number of positions is less than the length of the centralized key symbol sequence, avoiding invalid shifts. After the cyclic right shift, a rearranged key symbol sequence is obtained. The number of elements in the rearranged key symbol sequence is exactly the same as that in the centralized key symbol sequence; only the element index positions are adjusted.
[0061] Step 2043: Perform a modulo operation on a preset ring modulus on each element in the rearranged key symbol sequence to obtain the mapped key symbol sequence.
[0062] Optionally, the smart wearable device iterates through each element in the rearranged key symbol sequence, performing a modulo operation on each element with respect to a preset ring modulus. The modulo operation involves dividing the element value by the preset ring modulus and taking the remainder as the new element value. After all elements have undergone the modulo operation, all new element values are arranged in the index order of the original rearranged key symbol sequence to obtain the mapped key symbol sequence, in which each element value falls within the range of 0 to the preset ring modulus minus 1.
[0063] The embodiments of the present invention do not rely on complex key negotiation protocols. Based on a pre-set dynamic key seed, multi-level optimization processing of the symbol sequence is achieved, so that the mapped key symbol sequence has both dynamic adaptability and unpredictability, effectively improving the anti-cracking capability of the key symbol sequence, enhancing key dynamism and anti-cracking capability, thereby improving data transmission security.
[0064] Optionally, the processes of steps 301 to 304 include: Step 301: Perform length alignment verification based on the mapped key symbol sequence and data symbol sequence to obtain the aligned key symbol subsequence and the aligned data symbol subsequence.
[0065] Optionally, the smart wearable device first obtains the length of the mapped key symbol sequence and the length of the data symbol sequence, where the sequence length refers to the number of elements contained in the corresponding sequence. Then, a length alignment check is performed, which compares whether the lengths of the two sets of sequences are consistent, ensuring that each corresponding position in each set has elements available for calculation during subsequent bit-by-bit operations, avoiding misalignment or missing elements in the calculations.
[0066] If the two sets of sequences have the same length, the mapped key symbol sequence is directly used as the aligned key symbol subsequence, and the data symbol sequence is used as the aligned data symbol subsequence. If the two sets of sequences have different lengths, they are adjusted based on a preset alignment rule. The preset alignment rule is to use the shorter sequence as the benchmark, truncate the longer sequence, and delete the elements that exceed the benchmark length so that the lengths of the two sets of sequences are completely consistent. The adjusted sequences are the aligned key symbol subsequence and the aligned data symbol subsequence, respectively. The lengths of the two sets of subsequences are kept consistent, and the order of the elements is consistent with the original sequence.
[0067] Step 302: Perform bit-by-bit difference calculation based on the aligned key symbol subsequence and the aligned data symbol subsequence to obtain the original difference symbol sequence.
[0068] Optionally, the smart wearable device traverses the aligned key symbol subsequence and the aligned data symbol subsequence in index order and performs bit-by-bit difference calculation. The bit-by-bit difference calculation refers to subtracting the corresponding element value in the aligned data symbol subsequence from the element value in the aligned key symbol subsequence for the element at the same index position in the two sets of subsequences to obtain the difference result at that index position.
[0069] After the difference calculation for all index positions is completed, all difference results are arranged and combined in the original index order to form the original difference symbol sequence. The length of the original difference symbol sequence is exactly the same as the length of the aligned key symbol subsequence and the aligned data symbol subsequence. The elements in the sequence can be positive, negative or zero.
[0070] Step 303: Perform modulo reduction processing based on the original difference symbol sequence and the preset ring modulus to obtain the modulo reduced difference symbol sequence, and generate symmetric distance candidates based on the modulo reduced difference symbol sequence and the preset ring modulus to obtain the symmetric distance candidate symbol sequence.
[0071] Optionally, the smart wearable device performs modular reduction processing based on the original difference symbol sequence and the preset ring modulus. Modular reduction processing refers to dividing each symbol difference element in the original difference symbol sequence by the preset ring modulus and taking the remainder of the operation result as the element value after modular reduction, ensuring that the element value after modular reduction falls within the value range corresponding to the preset ring modulus. All elements after modular reduction are arranged in the original sequence order to obtain the modular reduction difference symbol sequence.
[0072] Subsequently, symmetric distance candidates are generated based on the modulus reduction difference symbol sequence and the preset ring modulus. The symmetric distance candidate generation refers to calculating two symmetric distance candidate values for each target element in the modulus reduction difference symbol sequence in combination with the preset ring modulus. The two candidate values are the target element value itself and the result of the preset ring modulus minus the target element value, respectively. All candidate values are combined in the order of their corresponding element indices to form a symmetric distance candidate symbol sequence, in which each index position corresponds to two candidate values.
[0073] Step 304: Select the minimum value bit by bit based on the candidate symbol sequence of symmetric distance to obtain the Lee distance sequence.
[0074] Optionally, the smart wearable device performs bit-by-bit minimum value selection based on the symmetric distance candidate symbol sequence. That is, for each index position in the symmetric distance candidate symbol sequence, the candidate value with the smaller value is selected as the final distance value for that position. All final distance values are arranged in the original index order to obtain the Lee distance sequence, as shown in steps 3041 to 3044.
[0075] The embodiments of the present invention are based on a pre-generated dynamically mapped key symbol sequence, without relying on a complex key negotiation protocol. This allows the Lee distance sequence to be deeply bound to the dynamic key and the original data, which not only has dynamic adaptability, but also greatly improves the randomness and unpredictability of the distance sequence, effectively enhancing the anti-cracking capability of the overall encryption process and improving the security of data transmission in smart wearable devices.
[0076] Optionally, the processes of steps 3041 to 3044 include: Step 3041: For each pair of symmetric distance candidate values in the symmetric distance candidate symbol sequence, take the position corresponding to the smallest value as the preliminary Lee distance result to obtain the preliminary Lee distance symbol sequence.
[0077] Optionally, the smart wearable device traverses each pair of symmetrical distance candidate values in the symmetrical distance candidate symbol sequence. Each pair of symmetrical distance candidate values refers to two distance candidate values corresponding to the same index position in the symmetrical distance candidate symbol sequence. For each pair of candidate values, a numerical comparison is performed. This comparison determines the relative value of the two candidate values, selecting the candidate value with the smallest value as the preliminary Lee distance result for that index position. "Smallest value" refers to the value with the smaller absolute value among the two candidate values. If the two candidate values are equal, either one is arbitrarily selected as the preliminary result. After all candidate values at all index positions have been compared and selected, all preliminary Lee distance results are arranged and combined according to the index order of the original symmetrical distance candidate symbol sequence to form a preliminary Lee distance symbol sequence. The length of the preliminary Lee distance symbol sequence is consistent with the length of the symmetrical distance candidate symbol sequence.
[0078] Step 3042: Iterate through each item in the initial Lee distance symbol sequence. If there is a negative value item, replace it with the absolute value of the negative value item to obtain the corrected Lee distance symbol sequence.
[0079] Optionally, the smart wearable device iterates through each target element in the initial Lee distance symbol sequence. A target element refers to a single numerical element in the initial Lee distance symbol sequence arranged in index order. For each target element, a positive / negative judgment is performed, identifying whether the target element is positive, negative, or zero. If a negative value exists, and the index of the negative value is less than zero, a replacement operation is performed on that negative value. Specifically, the value of the negative value is replaced with its absolute value. The absolute value refers to the distance from the point corresponding to a number on the number line to the origin; that is, the absolute value of a negative number is its corresponding positive number, while the absolute values of positive numbers and zero remain unchanged. If the target element is positive or zero, its value remains unchanged. After all target elements have undergone positive / negative judgment and processing, all processed elements are arranged in the index order of the original initial Lee distance symbol sequence to form a corrected Lee distance symbol sequence. The length of the corrected Lee distance symbol sequence is the same as the length of the initial Lee distance symbol sequence, and all elements in the sequence are non-negative.
[0080] Step 3043: For each item in the corrected Lee distance symbol sequence, if its value is greater than the floor value of the preset ring modulus divided by two, then replace it with the floor value of the preset ring modulus divided by two to obtain the constrained Lee distance symbol sequence.
[0081] Optionally, the smart wearable device calculates the floor value of the preset ring modulus divided by two. The floor value refers to the result obtained by dividing the preset ring modulus by two, discarding the decimal part and retaining only the integer part. This value is used as the upper limit constraint threshold of the Lee distance.
[0082] Subsequently, the smart wearable device iterates through each target element in the corrected Lee distance symbol sequence, comparing the value of each target element with the upper limit constraint threshold. If the target element value is greater than the upper limit constraint threshold, a replacement operation is performed on the element value, specifically replacing it with the floor value of the preset ring modulus divided by two. If the target element value is less than or equal to the upper limit constraint threshold, the element value remains unchanged. After all target elements have undergone constraint processing, all processed elements are arranged in the index order of the original corrected Lee distance symbol sequence to form a constrained Lee distance symbol sequence. The length of the constrained Lee distance symbol sequence is the same as the length of the corrected Lee distance symbol sequence, and all element values do not exceed the upper limit constraint threshold.
[0083] Step 3044: Perform sequence encapsulation based on the constrained Lee distance symbol sequence to obtain the Lee distance sequence.
[0084] Optionally, the smart wearable device performs sequence encapsulation based on the constrained Lee distance symbol sequence. Sequence encapsulation refers to standardizing the constrained Lee distance symbol sequence according to a preset data format. The preset data format refers to the sequence storage and transmission format agreed upon in advance by the smart wearable device and the receiving end, including the addition of element separators, sequence start identifiers, and sequence end identifiers.
[0085] The sequence start identifier is used to mark the beginning position of the Lee distance sequence, the sequence end identifier is used to mark the end position of the Lee distance sequence, and the element separator is used to distinguish elements at different index positions in the sequence to avoid element confusion. After the sequence is encapsulated, the final Lee distance sequence is obtained.
[0086] The embodiments of the present invention are based on a pre-generated symmetric distance candidate symbol sequence, without relying on a complex key negotiation protocol. Through multi-level processing, the Lee distance sequence is deeply associated with the dynamic key and the original data, and has standardization, rationality and stability. This improves the randomness and unpredictability of the distance sequence, enhances the key dynamics and anti-cracking ability, and thus improves the security of data transmission.
[0087] Optionally, steps 305 to 308 include: Step 305: Combine each corresponding element at the same index position in the Lee distance sequence and the mapped key symbol sequence into a tuple to obtain a paired symbol tuple sequence. Each tuple in the paired symbol tuple sequence contains a Lee distance symbol and a mapped key symbol.
[0088] Optionally, the smart wearable device synchronously traverses the Lee distance sequence and the mapped key symbol sequence in index order, and performs a combination operation on each corresponding element at the same index position in the two sequences. The combination operation refers to associating a Lee distance symbol and a mapped key symbol at the same index position to form a tuple. A tuple refers to an ordered data unit containing two elements, and the order of the two elements is fixed as the first element being the Lee distance symbol and the second element being the mapped key symbol.
[0089] Furthermore, after all elements at all index positions have been combined, all tuples are arranged sequentially according to the index order of the original sequence to form a sequence of paired symbol tuples. The length of the paired symbol tuple sequence is consistent with the length of the Lee distance sequence and the mapped key symbol sequence, and each tuple uniquely corresponds to a set of Lee distance symbols and mapped key symbols at the same index position.
[0090] Step 306: For each pair of paired symbol tuples in the paired symbol tuple sequence, perform integer addition on the Lee distance symbol contained therein and the mapped key symbol to obtain the preliminary ciphertext symbol sequence.
[0091] Optionally, the smart wearable device traverses each pair of symbol tuples in the sequence of paired symbol tuples, and performs integer addition on the Lee distance symbol and the mapped key symbol contained in each pair of symbol tuples. Integer addition means summing the values corresponding to the two symbols according to the decimal addition rules, and the summing result is used as the initial ciphertext symbol corresponding to the pair of symbol tuples.
[0092] Furthermore, after all paired symbol tuples have completed integer addition operations, all preliminary ciphertext symbols are arranged and combined according to the index order of the original paired symbol tuple sequence to form a preliminary ciphertext symbol sequence. The length of the preliminary ciphertext symbol sequence is the same as the length of the paired symbol tuple sequence. The elements in the sequence are the integer results after addition operations, which can be positive or negative and can be greater than the preset ring modulus.
[0093] Step 307: For each preliminary ciphertext symbol in the preliminary ciphertext symbol sequence, perform the minimum non-negative residue operation on the preliminary ciphertext symbol with respect to the preset ring modulus to obtain the modulus-reduced ciphertext symbol sequence.
[0094] Optionally, the smart wearable device traverses each preliminary ciphertext symbol in the preliminary ciphertext symbol sequence and performs a minimum non-negative remainder operation on a preset ring modulus for each preliminary ciphertext symbol. The minimum non-negative remainder operation refers to dividing the value corresponding to the preliminary ciphertext symbol by the preset ring modulus and taking the smallest non-negative remainder in the operation result as the symbol value after modulus reduction. The minimum non-negative remainder refers to the remainder that is greater than or equal to zero and less than the preset ring modulus. If the value of the preliminary ciphertext symbol is negative, the remainder is converted to a non-negative value by accumulating the preset ring modulus to ensure that the final result falls within the range of zero to the preset ring modulus minus one.
[0095] Furthermore, after all the initial ciphertext symbols have completed the minimum non-negative residue operation, all the processed symbol values are arranged in the index order of the original initial ciphertext symbol sequence to form a modular reduction ciphertext symbol sequence. The length of the modular reduction ciphertext symbol sequence is the same as the length of the initial ciphertext symbol sequence, and all element values are adapted to the range of the preset ring modulus.
[0096] Step 308: Perform a bitwise XOR operation on each item in the modulo-reduced ciphertext symbol sequence with the corresponding position of the mapped key symbol in the mapped key symbol sequence to obtain the target ciphertext symbol sequence. Then, perform a second modulo reduction based on the target ciphertext symbol sequence and the preset ring modulus to obtain the encrypted ciphertext symbol sequence.
[0097] Optionally, the smart wearable device synchronously traverses the modular reduction ciphertext symbol sequence and the mapped key symbol sequence in index order. For each modular reduction ciphertext symbol and mapped key symbol at corresponding positions in the two sequences, a bitwise XOR operation is performed. The bitwise XOR operation refers to performing a logical XOR operation on the corresponding binary values of the two symbols bit by bit. The XOR operation rule is: if the corresponding binary values are the same, the result is zero; if the corresponding binary values are different, the result is one. Finally, the binary value after the XOR operation is converted into a decimal value, which is used as the target ciphertext symbol at that position. After the bitwise XOR operation is performed at all positions, the target ciphertext symbol sequence is obtained.
[0098] Furthermore, a second-order modulo reduction is performed based on the target ciphertext symbol sequence and the preset ring modulus. That is, the elements in the target ciphertext symbol sequence are further constrained within the range of the preset ring modulus value through the preset reduction rules, and finally the encrypted ciphertext symbol sequence is obtained, as shown in steps 3081 to 3084.
[0099] The embodiments of the present invention are based on the pre-generated Lee distance sequence and the mapped key symbol sequence. Without relying on complex key negotiation protocols, the encrypted ciphertext symbol sequence is deeply coupled with the dynamic key and original data features through multiple rounds of operations and constraints. This improves the randomness and dynamism of the ciphertext, thereby improving the key dynamism and anti-cracking ability, and thus enhancing the security of data transmission.
[0100] Optionally, the process of steps 3081 to 3084 includes: Step 3081: Perform a modulo operation on a preset ring modulus for each perturbed ciphertext symbol in the target ciphertext symbol sequence to obtain a quadratic reduced ciphertext symbol sequence.
[0101] Optionally, the smart wearable device traverses each perturbed ciphertext symbol in the target ciphertext symbol sequence, where a perturbed ciphertext symbol refers to a single numerical element in the target ciphertext symbol sequence arranged in index order.
[0102] For each perturbed ciphertext symbol, perform a modulo operation on a preset ring modulus. The modulo operation means dividing the value corresponding to the perturbed ciphertext symbol by the preset ring modulus and taking the remainder of the operation result as the symbol value after secondary reduction, ensuring that the symbol value falls within the range of zero to the preset ring modulus minus one.
[0103] Furthermore, after all perturbed ciphertext symbols have completed the modulo operation, all processed symbol values are arranged in the index order of the original target ciphertext symbol sequence to form a quadratic reduced ciphertext symbol sequence. The length of the quadratic reduced ciphertext symbol sequence is consistent with the length of the target ciphertext symbol sequence, and all element values are adapted to the range of preset ring modulus values.
[0104] Step 3082: Using each item in the Lee distance sequence as an offset, perform a cyclic right shift operation on the index position of the quadratic reduced ciphertext symbol sequence to generate a permutation index sequence. The number of bits shifted in the cyclic right shift operation is equal to the result of taking the Lee distance symbol modulo the length of the quadratic reduced ciphertext symbol sequence.
[0105] Optionally, the smart wearable device uses each element in the Lee distance sequence as an offset, where the offset refers to the numerical parameter used to adjust the index position. For the index positions of the quadratic reduced ciphertext symbol sequence, a cyclic right shift operation is performed. This operation shifts each element in the quadratic reduced ciphertext symbol sequence a specified number of positions to the right, with the rightmost element being moved to the leftmost position. The number of shifts is obtained by taking the modulo of the length of the quadratic reduced ciphertext symbol sequence for each Lee distance symbol. The modulo operation involves dividing the value corresponding to the Lee distance symbol by the length of the quadratic reduced ciphertext symbol sequence, and the remainder is the number of shifts for that position. This ensures that the number of shifts is less than the length of the quadratic reduced ciphertext symbol sequence to avoid invalid shifts. The adjusted index position sequence is obtained through this cyclic right shift operation; this sequence is the permutation index sequence. The length of the permutation index sequence is the same as the length of the quadratic reduced ciphertext symbol sequence, and each element corresponds to a new index position in the quadratic reduced ciphertext symbol sequence.
[0106] Step 3083: Based on the new index indicated by each position in the permutation index sequence, rearrange the symbols in the quadratic reduction ciphertext symbol sequence to the corresponding positions to obtain the rearranged ciphertext symbol sequence.
[0107] Optionally, the smart wearable device parses the permutation index sequence, where each position in the permutation index sequence indicates a new index, which refers to the target position to which the elements in the quadratic reduction ciphertext symbol sequence need to be adjusted. Based on the new index indicated by each position in the permutation index sequence, the symbols in the quadratic reduction ciphertext symbol sequence are rearranged to their corresponding positions. Rearrangement means mapping each element in the quadratic reduction ciphertext symbol sequence to the new index position according to the correspondence indicated by the permutation index sequence, ensuring that each element corresponds to a unique target position.
[0108] Furthermore, after all elements have been rearranged, a rearranged ciphertext symbol sequence is formed. The length of the rearranged ciphertext symbol sequence is the same as the length of the quadratic reduction ciphertext symbol sequence, except that the index positions of the elements are adjusted according to the permutation index sequence.
[0109] Step 3084: Perform sequence integrity encapsulation based on the rearranged ciphertext symbol sequence to obtain the encrypted ciphertext symbol sequence.
[0110] Optionally, the smart wearable device performs sequence integrity encapsulation based on the rearranged ciphertext symbol sequence. Sequence integrity encapsulation refers to processing the rearranged ciphertext symbol sequence according to a standardized data format pre-agreed between the smart wearable device and the receiving end. This processing includes adding a sequence start identifier, a sequence end identifier, and element separators. The sequence start identifier clearly marks the beginning position of the encrypted ciphertext symbol sequence, the sequence end identifier clearly marks the end position, and the element separator distinguishes elements at different index positions in the sequence, preventing element confusion or misalignment. Simultaneously, the sequence length and element value range are verified during the encapsulation process to ensure that the encapsulated sequence has no missing or abnormal elements, resulting in the final encrypted ciphertext symbol sequence.
[0111] The embodiments of the present invention do not rely on complex key negotiation protocols. Instead, they rely on pre-generated dynamic keys and distance sequences to achieve multi-level optimization of the ciphertext, thereby enhancing the ciphertext's dynamism and unpredictability, effectively improving its anti-cracking capabilities, building a solid final encryption defense for data transmission, and enhancing data transmission security.
[0112] Furthermore, the smart wearable device provided by the present invention will be described below. The smart wearable device described below and the data security encryption method described above can be referred to in correspondence.
[0113] Optionally, refer to Figure 2 , Figure 2 This is a schematic diagram of the structure of the smart wearable device provided by the present invention. The smart wearable device includes: The hash operation module 210 is used to perform hash operation based on the current timestamp and the pre-configured shared key to obtain the first key seed, and to perform hash operation based on the first key seed and the data sequence to be transmitted to determine the second key seed; The key mapping module 220 is used to determine the mapped key symbol sequence based on the second key seed and the preset ring modulus, and to map the data symbol sequence based on the data sequence to be transmitted in the preset ring modulus to obtain the data symbol sequence. The key encryption module 230 is used to calculate the Lee distance bit by bit based on the mapped key symbol sequence and the data symbol sequence to obtain the Lee distance sequence, and to encrypt the Lee distance sequence and the mapped key symbol sequence on a preset ring modulus to obtain the encrypted ciphertext symbol sequence. The encrypted transmission module 240 is used to generate a transmission data packet based on the encrypted ciphertext symbol sequence and the current timestamp and send it to the receiving end.
[0114] In this embodiment of the invention, a first key seed is obtained by hashing the current timestamp and a pre-configured shared key. A second key seed is determined by hashing the first key seed and the data sequence to be transmitted. This allows the key seed to be dynamically generated rather than fixed, associating both the time and data dimensions. A mapped key symbol sequence is determined based on the second key seed and a preset ring modulus. Simultaneously, the data sequence to be transmitted is mapped in the preset ring modulus to obtain a data symbol sequence, completing the adaptation of the key and data to the same modulus space to enable subsequent collaborative computation. The Lee distance sequence is obtained by calculating the Lee distance bit by bit based on the mapped key symbol sequence and the data symbol sequence. The encrypted ciphertext symbol sequence is obtained by encrypting the Lee distance sequence and the mapped key symbol sequence in the preset ring modulus. This allows the encryption process to deeply bind the dynamically generated key symbols and data symbols. Finally, a transmission data packet is generated based on the encrypted ciphertext symbol sequence and the current timestamp and sent to the receiving end, so that the transmitted content carries both dynamic encryption information and time identifiers. Therefore, by introducing timestamps, the first and second key seeds generated in each communication have timeliness. After mapping, the key symbol sequence changes dynamically with the key seed, and the encrypted ciphertext symbol sequence is generated based on this dynamic key symbol sequence. Furthermore, the timestamp carried in the data packet can assist the receiving end in synchronizing dynamic key-related parameters. The entire process does not require a complex key negotiation protocol, so the key is no longer static. Even if an attacker attempts to obtain the key, they can only target a dynamic key fragment generated based on a specific timestamp and data sequence in a single instance. They cannot obtain the fixed key that runs through the entire communication cycle, and thus cannot decrypt all historical and future transmitted data. Based on the final encrypted ciphertext symbol sequence and the transmission data packet with timestamps, the dynamic nature and anti-cracking ability of the key are improved without relying on a complex key negotiation protocol, thereby enhancing the security of data transmission.
[0115] Please see Figure 3 , Figure 3 An embodiment diagram of an electronic device provided in accordance with the present invention. For example... Figure 3 As shown, this embodiment of the invention provides an electronic device 300, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor 320. When the processor 320 executes the computer program 311, it implements the following steps: A hash operation is performed based on the current timestamp and the pre-configured shared key to obtain the first key seed. A hash operation is then performed based on the first key seed and the data sequence to be transmitted to determine the second key seed. Based on the second key seed and the preset ring modulus, the mapped key symbol sequence is determined, and the data sequence to be transmitted is mapped in the preset ring modulus to obtain the data symbol sequence; Lee distance is calculated bit by bit based on the mapped key symbol sequence and the data symbol sequence to obtain a Lee distance sequence. Then, based on the Lee distance sequence and the mapped key symbol sequence, encryption is performed on the preset ring modulus to obtain an encrypted ciphertext symbol sequence. Based on the encrypted ciphertext symbol sequence and the current timestamp, a transmission data packet is generated and sent to the receiving end.
[0116] Please see Figure 4 , Figure 4 An embodiment diagram of a computer-readable storage medium provided in accordance with an embodiment of the present invention is shown. Figure 4 As shown, this embodiment provides a computer-readable storage medium 400, on which a computer program 311 is stored. When the computer program 311 is executed by a processor, it implements the following steps: A hash operation is performed based on the current timestamp and the pre-configured shared key to obtain the first key seed. A hash operation is then performed based on the first key seed and the data sequence to be transmitted to determine the second key seed. Based on the second key seed and the preset ring modulus, the mapped key symbol sequence is determined, and the data sequence to be transmitted is mapped in the preset ring modulus to obtain the data symbol sequence; Lee distance is calculated bit by bit based on the mapped key symbol sequence and the data symbol sequence to obtain a Lee distance sequence. Then, based on the Lee distance sequence and the mapped key symbol sequence, encryption is performed on the preset ring modulus to obtain an encrypted ciphertext symbol sequence. Based on the encrypted ciphertext symbol sequence and the current timestamp, a transmission data packet is generated and sent to the receiving end.
[0117] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the data security encryption methods provided by the above methods, the method including the following steps: A hash operation is performed based on the current timestamp and the pre-configured shared key to obtain the first key seed. A hash operation is then performed based on the first key seed and the data sequence to be transmitted to determine the second key seed. Based on the second key seed and the preset ring modulus, the mapped key symbol sequence is determined, and the data sequence to be transmitted is mapped in the preset ring modulus to obtain the data symbol sequence; Lee distance is calculated bit by bit based on the mapped key symbol sequence and the data symbol sequence to obtain a Lee distance sequence. Then, based on the Lee distance sequence and the mapped key symbol sequence, encryption is performed on the preset ring modulus to obtain an encrypted ciphertext symbol sequence. Based on the encrypted ciphertext symbol sequence and the current timestamp, a transmission data packet is generated and sent to the receiving end.
[0118] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0119] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data security encryption method, characterized in that, include: A hash operation is performed based on the current timestamp and the pre-configured shared key to obtain the first key seed. A hash operation is then performed based on the first key seed and the data sequence to be transmitted to determine the second key seed. Based on the second key seed and the preset ring modulus, the mapped key symbol sequence is determined, and the data sequence to be transmitted is mapped in the preset ring modulus to obtain the data symbol sequence; Lee distance is calculated bit by bit based on the mapped key symbol sequence and the data symbol sequence to obtain a Lee distance sequence. Then, based on the Lee distance sequence and the mapped key symbol sequence, encryption is performed on the preset ring modulus to obtain an encrypted ciphertext symbol sequence. Based on the encrypted ciphertext symbol sequence and the current timestamp, a transmission data packet is generated and sent to the receiving end.
2. The data security encryption method according to claim 1, characterized in that, The encryption based on the Lee distance sequence and the mapped key symbol sequence on the preset ring modulus yields an encrypted ciphertext symbol sequence, including: Each corresponding element at the same index position in the Lee distance sequence and the mapped key symbol sequence is combined into a tuple to obtain a paired symbol tuple sequence; each tuple in the paired symbol tuple sequence contains a Lee distance symbol and a mapped key symbol. For each pair of paired symbol tuples in the sequence of paired symbol tuples, perform an integer addition operation between the Lee distance symbol contained in it and the mapped key symbol to obtain a preliminary ciphertext symbol sequence; For each preliminary ciphertext symbol in the preliminary ciphertext symbol sequence, perform a minimum non-negative residue operation on the preliminary ciphertext symbol with respect to the preset ring modulus to obtain a modulus-reduced ciphertext symbol sequence; Perform a bitwise XOR operation between each item in the modulo-reduced ciphertext symbol sequence and the corresponding position of the mapped key symbol in the mapped key symbol sequence to obtain the target ciphertext symbol sequence. Then, perform a second modulo reduction based on the target ciphertext symbol sequence and the preset ring modulus to obtain the encrypted ciphertext symbol sequence.
3. The data security encryption method according to claim 2, characterized in that, The step of performing a second-order modulo reduction based on the target ciphertext symbol sequence and the preset ring modulus to obtain the encrypted ciphertext symbol sequence includes: For each perturbed ciphertext symbol in the target ciphertext symbol sequence, perform a modulo operation on the preset ring modulus to obtain a quadratic reduced ciphertext symbol sequence; Using each item in the Lee distance sequence as an offset, a cyclic right shift operation is performed on the index position of the quadratic reduced ciphertext symbol sequence to generate a permutation index sequence; the number of shifts in the cyclic right shift operation is equal to the result of taking the Lee distance symbol modulo the length of the quadratic reduced ciphertext symbol sequence; Based on the new index indicated by each position in the permutation index sequence, the symbols in the quadratic reduction ciphertext symbol sequence are rearranged to their corresponding positions to obtain the rearranged ciphertext symbol sequence; Based on the rearranged ciphertext symbol sequence, sequence integrity encapsulation is performed to obtain an encrypted ciphertext symbol sequence.
4. The data security encryption method according to claim 1, characterized in that, The step of calculating the Lee distance bit by bit based on the mapped key symbol sequence and the data symbol sequence to obtain the Lee distance sequence includes: Based on the mapped key symbol sequence and the data symbol sequence, a length alignment check is performed to obtain an aligned key symbol subsequence and an aligned data symbol subsequence. Based on the aligned key symbol subsequence and the aligned data symbol subsequence, bit-by-bit difference calculation is performed to obtain the original difference symbol sequence; Modular reduction is performed based on the original difference symbol sequence and the preset ring modulus to obtain a modulo-reduced difference symbol sequence. Then, symmetric distance candidate generation is performed based on the modulo-reduced difference symbol sequence and the preset ring modulus to obtain a symmetric distance candidate symbol sequence. Based on the symmetric distance candidate symbol sequence, the minimum value is selected bit by bit to obtain the Lee distance sequence.
5. The data security encryption method according to claim 4, characterized in that, The step of selecting the minimum value bit by bit based on the symmetric distance candidate symbol sequence to obtain the Lee distance sequence includes: For each pair of symmetric distance candidate values in the symmetric distance candidate symbol sequence, the position corresponding to the smallest value is taken as the preliminary Lee distance result, thus obtaining the preliminary Lee distance symbol sequence; Iterate through each item in the initial Lee distance symbol sequence. If there is a negative item, replace it with the absolute value of the negative item to obtain the corrected Lee distance symbol sequence. For each item in the corrected Lee distance symbol sequence, if its value is greater than the floor value of the preset ring modulus divided by two, it is replaced with the floor value of the preset ring modulus divided by two to obtain the constrained Lee distance symbol sequence. The Lee distance sequence is obtained by encapsulating the Lee distance symbol sequence based on the constraints.
6. The data security encryption method according to any one of claims 1 to 5, characterized in that, The step of determining the mapped key symbol sequence based on the second key seed and the preset ring modulus includes: Based on the second key seed, a cyclic shift operation is performed to obtain a key symbol block, and based on the key symbol block and the preset ring modulus, a modular arithmetic is performed to divide the block into multiple key sub-block sequences. Each key sub-block sequence is converted to an integer to obtain a key integer sequence. Then, based on the key integer sequence and the preset ring modulus, an element-wise modulo operation is performed to obtain a preliminary key symbol sequence. If the first length of the preliminary key symbol sequence is less than the second length of the data sequence to be transmitted, the preliminary key symbol sequence is periodically and repeatedly spliced until the first length equals the second length; otherwise, the target sequence exceeding the second length is truncated to obtain the extended key symbol sequence. The mapped key symbol sequence is obtained by performing a centralized mapping based on the extended key symbol sequence and the preset ring modulus.
7. The data security encryption method according to claim 6, characterized in that, The process of centralizing the key symbol sequence based on the extended key symbol sequence and the preset ring modulus to obtain the mapped key symbol sequence includes: For each target element in the extended key symbol sequence, if the target element value is greater than or equal to the floor value of the preset ring modulus divided by two, then the target element value is replaced with the target element value minus the preset ring modulus; otherwise, it remains unchanged, thus obtaining the centralized key symbol sequence. The decimal value of the most significant byte in the second key seed is cyclically shifted to the right by the index position of the centralized key symbol sequence to obtain a rearranged key symbol sequence; the number of bits shifted to the right is equal to the result of taking the value modulo the length of the centralized key symbol sequence; Perform a modulo operation on the preset ring modulus on each element in the rearranged key symbol sequence to obtain the mapped key symbol sequence.
8. A smart wearable device, characterized in that, For implementing the data security encryption method as described in any one of claims 1 to 7; the smart wearable device includes: The hash operation module is used to perform hash operations based on the current timestamp and the pre-configured shared key to obtain the first key seed, and to perform hash operations based on the first key seed and the data sequence to be transmitted to determine the second key seed; The key mapping module is used to determine the mapped key symbol sequence based on the second key seed and the preset ring modulus, and to map the data sequence to be transmitted in the preset ring modulus to obtain the data symbol sequence. The key encryption module is used to calculate the Lee distance bit by bit based on the mapped key symbol sequence and the data symbol sequence to obtain the Lee distance sequence, and to encrypt the Lee distance sequence and the mapped key symbol sequence on the preset ring modulus to obtain the encrypted ciphertext symbol sequence. An encrypted transmission module is used to generate a transmission data packet based on the encrypted ciphertext symbol sequence and the current timestamp and send it to the receiving end.
9. An electronic device, comprising: Memory, used to store computer software programs; A processor for reading and executing the computer software program, characterized in that, when the processor executes the computer software program, it implements the data security encryption method as described in any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, wherein a computer software program is stored therein, characterized in that, When the computer software program is executed by the processor, it implements the data security encryption method as described in any one of claims 1 to 7.