Data Transmission Method, Device, Electronic Device, and Computer-Readable Storage Medium

By determining the key value of the character combination of data shards and using data dictionary for encoding and transmission, the resource occupation and security problems of computer equipment in data interaction are solved, and data volume is reduced and security is improved.

CN114691813BActive Publication Date: 2025-07-25GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011636657.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2025-07-25
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

The amount of data transmitted by computer equipment during data interaction is large, occupying a large amount of resources from the central processor, and there is a risk of data leakage through plain text transmission.

Method used

By dividing the data to be transmitted into data shards, obtaining the preset position character combination of each data shard, determining the key value, and using the key value instead of the data shard for transmission, and encoding and decoding in combination with the data dictionary.

Benefits of technology

It reduces the amount of data transmitted, saves resource usage, and improves the security of data transmission, avoids data leakage caused by plain text transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691813B_ABST
    Figure CN114691813B_ABST
Patent Text Reader

Abstract

The present application relates to a data transmission method, apparatus, electronic device, and computer-readable storage medium. The method includes: obtaining data shards corresponding to data to be transmitted; for each data shard, obtaining characters at preset positions in each word of the data shard to obtain a character combination corresponding to each data shard; determining key values corresponding to the data shards based on the character combinations corresponding to the data shards; and transmitting the key values corresponding to the data shards. By using this method, the amount of data transmitted can be reduced, thereby reducing the occupation of transmission resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and particularly to a data transmission method, apparatus, electronic device, and computer-readable storage medium. Background Art

[0002] With the development of computer technology, various computer device industries have been continuously emerging, and the functions of computer devices have become more and more perfect and rich. As a result, the amount of data that computer devices can operate on is becoming increasingly huge. And a large amount of data transmitted during the interaction of computer devices often occupies a large amount of resources of the central processing unit. Summary of the Invention

[0003] Embodiments of this application provide a data transmission method, apparatus, electronic device, and computer-readable storage medium, which can save resources.

[0004] A data transmission method includes:

[0005] Obtaining data shards corresponding to the data to be transmitted;

[0006] For each data shard, obtaining characters at preset positions in each word of the data shard to obtain a character combination corresponding to each data shard;

[0007] Based on the character combinations corresponding to the data shards, determining key values corresponding to the data shards;

[0008] Transmitting the key values corresponding to the data shards.

[0009] A data transmission apparatus, the apparatus includes:

[0010] A shard obtaining module, configured to obtain data shards corresponding to the data to be transmitted;

[0011] A character obtaining module, configured to, for each data shard, obtain characters at preset positions in each word of the data shard to obtain a character combination corresponding to each data shard;

[0012] A determining module, configured to determine key values corresponding to the data shards based on the character combinations corresponding to the data shards;

[0013] A transmission module, configured to transmit the key values corresponding to the data shards.

[0014] An electronic device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0015] Obtaining data shards corresponding to the data to be transmitted;

[0016] For each data shard, obtain the characters at a preset position in each word of the data shard to obtain a character combination corresponding to each data shard;

[0017] Based on the character combinations corresponding to the data shards, determine the key values corresponding to the data shards;

[0018] Transmit the key values corresponding to the data shards.

[0019] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0020] Obtain the data shards corresponding to the data to be transmitted;

[0021] For each data shard, obtain the characters at a preset position in each word of the data shard to obtain a character combination corresponding to each data shard;

[0022] Based on the character combinations corresponding to the data shards, determine the key values corresponding to the data shards;

[0023] Transmit the key values corresponding to the data shards.

[0024] The above data transmission method, device, electronic device and computer-readable storage medium, by obtaining the data shards corresponding to the data to be transmitted, and for each data shard, obtaining the characters at a preset position in each word of the data shard to obtain a character combination corresponding to each data shard, can represent the key information of the data shard through the character combination. Based on the character combinations corresponding to the data shards, determine the key values corresponding to the data shards, and transmit the key values corresponding to the data shards, can use the key values corresponding to the data shards to replace the data shards for transmission, can reduce the data length and the amount of data transmitted, thereby reducing the occupation of the transmission resources of the electronic device. And, by transmitting with the key value replacing the real and complete data, it can avoid data leakage caused by plaintext transmission and improve the security of data transmission.

[0025] A data transmission method, including:

[0026] Receive data, and obtain the key value from the received data; the key value is determined according to the character combination corresponding to the data shard of the data to be transmitted, and the character combination is obtained based on the characters at a preset position in each word of the data shard;

[0027] Obtain a data dictionary, and obtain the data shards corresponding to the key values from the data dictionary;

[0028] Generate target transmission data based on the data shards.

[0029] A data transmission device, the device includes:

[0030] A receiving module, configured to receive data and obtain key values from the received data; the key values are determined according to character combinations corresponding to data shards of data to be transmitted, and the character combinations are obtained based on characters at preset positions in each word of the data shards.

[0031] An obtaining module, configured to obtain a data dictionary and obtain data shards corresponding to the respective key values from the data dictionary.

[0032] A generating module, configured to generate target transmission data based on the respective data shards.

[0033] An electronic device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0034] Receive data and obtain key values from the received data; the key values are determined according to character combinations corresponding to data shards of data to be transmitted, and the character combinations are obtained based on characters at preset positions in each word of the data shards.

[0035] Obtain a data dictionary and obtain data shards corresponding to the respective key values from the data dictionary.

[0036] Generate target transmission data based on the respective data shards.

[0037] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0038] Receive data and obtain key values from the received data; the key values are determined according to character combinations corresponding to data shards of data to be transmitted, and the character combinations are obtained based on characters at preset positions in each word of the data shards.

[0039] Obtain a data dictionary and obtain data shards corresponding to the respective key values from the data dictionary.

[0040] Generate target transmission data based on the respective data shards.

[0041] In the above data transmission method, device, electronic device, and computer-readable storage medium, the sender encodes the data shards of the data to be transmitted based on the data dictionary, so as to use key values to replace the data shards for transmission, which can reduce the amount of data transmitted, thereby saving resources. The receiver receives the transmitted data, decodes and restores the received data based on the data dictionary to obtain data shards, and thus restores the target transmission data based on the data shards, realizing accurate restoration of the data. Moreover, by using key values to replace the real and complete data for transmission, it is possible to avoid data leakage caused by plaintext transmission and improve the security of data transmission.

[0042] A method for generating a data dictionary, comprising:

[0043] Creating index nodes of the data dictionary and index branches formed by the index nodes;

[0044] Configuring stored data corresponding to each index branch in the data dictionary, where the index nodes of the index branches are characters at preset positions in each word of the stored data;

[0045] Storing the stored data corresponding to each index branch, and obtaining the data dictionary based on the index nodes and the stored data.

[0046] A data dictionary generation device, the device comprising:

[0047] A creation module, configured to create index nodes of the data dictionary and index branches formed by the index nodes;

[0048] A configuration module, configured to configure stored data corresponding to each index branch in the data dictionary, where the index nodes of the index branches are characters at preset positions in each word of the stored data;

[0049] A storage module, configured to store the stored data corresponding to each index branch, and obtaining the data dictionary based on the index nodes and the stored data.

[0050] An electronic device, comprising a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0051] Creating index nodes of the data dictionary and index branches formed by the index nodes;

[0052] Configuring stored data corresponding to each index branch in the data dictionary, where the index nodes of the index branches are characters at preset positions in each word of the stored data;

[0053] Storing the stored data corresponding to each index branch, and obtaining the data dictionary based on the index nodes and the stored data.

[0054] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0055] Creating index nodes of the data dictionary and index branches formed by the index nodes;

[0056] Configuring stored data corresponding to each index branch in the data dictionary, where the index nodes of the index branches are characters at preset positions in each word of the stored data;

[0057] Store the stored data corresponding to each index branch, and obtain the data dictionary based on the index node and the stored data.

[0058] The above data dictionary generation method, device, electronic device, and computer-readable storage medium create an index node of the data dictionary and index branches formed by the index nodes, configure the stored data corresponding to each index branch in the data dictionary, the index node of the index branch is the character at a preset position in each word of the stored data, store the stored data corresponding to each index branch, and can generate a data dictionary based on the index node and the stored data. The data sender can accurately encode the data to be transmitted based on the generated data dictionary, so as to reduce the amount of data transmitted and improve the security of data transmission, while the data receiver can accurately restore the data based on the data dictionary. Description of the Drawings

[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0060] Figure 1 It is an application environment diagram of the data transmission method in an embodiment;

[0061] Figure 2 It is a flowchart of the data transmission method in an embodiment;

[0062] Figure 3 It is a flowchart of determining the key value corresponding to each data shard based on the character combination corresponding to each data shard in an embodiment;

[0063] Figure 4 It is a flowchart of the data transmission method in another embodiment;

[0064] Figure 5 It is a flowchart of the data dictionary generation method in an embodiment;

[0065] Figure 6 It is a flowchart of creating an index node of the data dictionary and index branches formed by the index nodes in an embodiment;

[0066] Figure 7 It is a schematic diagram of the data dictionary in an embodiment;

[0067] Figure 8 It is a structural block diagram of the data transmission device in an embodiment;

[0068] Figure 9It is a structural block diagram of a data transmission device in another embodiment;

[0069] Figure 10 It is a structural block diagram of a data dictionary generation device in one embodiment;

[0070] Figure 11 It is an internal structural block diagram of an electronic device in one embodiment. Specific implementation manners

[0071] In order to make the objectives, technical solutions and advantages of the present application more clear and understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0072] Figure 1 It is a schematic diagram of an application environment of a data transmission method in one embodiment. As Figure 1 shown, the application environment includes various electronic devices, such as terminal 110, terminal 120, and server 130. Among them, terminal 110 and terminal 120 communicate with server 130 through a network. Terminal 110 obtains data shards corresponding to the data to be transmitted. For each data shard, terminal 110 obtains characters at preset positions in each word of the data shard to obtain a character combination corresponding to each data shard. Terminal 110 determines key values corresponding to each data shard based on the character combinations corresponding to each data shard, and transmits the key values corresponding to each data shard to server 130. Server 130 receives the data sent by terminal 110 and forwards the data sent by terminal 110 to terminal 120. Terminal 120 receives the data and obtains the key value from the received data; the key value is determined according to the character combination corresponding to the data shard of the data to be transmitted, and the character combination is obtained based on the characters at preset positions in each word of the data shard. Terminal 120 obtains a data dictionary, obtains the data shards corresponding to each key value from the data dictionary, and terminal 120 generates target transmission data based on each data shard. Among them, terminal 110 and terminal 120 can be but are not limited to various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices, and server 130 can be implemented by an independent server or a server cluster composed of multiple servers.

[0073] In one embodiment, the data transmission method can be implemented through direct interaction between terminal 110 and terminal 120, and the data can be forwarded without passing through server 130.

[0074] In other embodiments, the terminal 110 and the terminal 120 each have a corresponding server. The terminal 110 transmits the key values corresponding to each data shard to the server corresponding to the terminal 120 through the corresponding server. The server corresponding to the terminal 120 receives the data sent by the server corresponding to the terminal 110 and sends the data to the terminal 120.

[0075] Figure 2 FIG. 4 is a flowchart of a data transmission method in an embodiment. The data transmission method in this embodiment is applied to an electronic device of a sender and is described by taking the electronic device running in Figure 1 as an example. As Figure 2 shown, the data transmission method includes steps 202 to 208.

[0076] Step 202, obtain data shards corresponding to the data to be transmitted.

[0077] Among them, the data to be transmitted is the data that needs to be transmitted, such as character data that needs to be transmitted. The data to be transmitted is any data that needs to be transmitted during the interaction process of the electronic device, and may include at least one of instant messaging data, multimedia data, and software test data, but is not limited thereto. Instant messaging data refers to the data generated during the interaction between instant messaging applications. Multimedia data refers to audio data and video data. Software test data may be test data generated during the development and testing of software and log information for recording the tests, such as test data and log records generated during the process of debugging software in an embedded environment.

[0078] A data shard refers to a data segment obtained from the data to be transmitted. Each data shard can be obtained by dividing the data to be transmitted, or a segment that needs to be used can be obtained from the data to be transmitted as a data shard.

[0079] Specifically, the electronic device can obtain the data to be transmitted and divide the data to be transmitted to obtain data shards. Further, the electronic device divides the data to be transmitted to obtain at least two corresponding data shards.

[0080] Step 204, for each data shard, obtain the characters at the preset positions in each word of the data shard to obtain a character combination corresponding to each data shard.

[0081] Among them, a character refers to letters, numbers, words, symbols, etc. used in a computer, and a word is composed of at least one character. In this embodiment, the character is a letter used in a computer, and a word is composed of at least one letter.

[0082] Data sharding consists of each word and represents a specific meaning, such as "memory not enough", "runtime errors", etc. The preset position refers to the position of a character in a word, such as the first or last position. The character at the preset position is the character at a specific position in the word. For example, the character at the first position of "memory" is "m", and the character at the first position of "not" is "n".

[0083] The character combination refers to the combination of characters obtained from the preset positions of each word in a data shard. The position of each character in the character combination is the same as the position of the corresponding word in the data shard. For example, the combination obtained by getting the first letters of each word in the data shard "memorynot enough" is "mne".

[0084] Specifically, for each data shard, the electronic device obtains the characters at the preset positions of each word in the data shard. According to the positions of each word in the data shard, the characters at the preset positions of each word are combined to obtain the character combination corresponding to the data shard. In the same processing manner, the electronic device can obtain the character combinations corresponding to each data shard respectively.

[0085] In one embodiment, the character at the preset position is the first letter. For each data shard, the electronic device obtains the first letter of each word in the data shard, and according to the positions of each word in the data shard, combines the first letters to obtain the first letter combination corresponding to the data shard.

[0086] In one embodiment, the character at the preset position is the last letter. For each data shard, the electronic device obtains the last letter of each word in the data shard, and according to the positions of each word in the data shard, combines the last letters to obtain the last letter combination corresponding to the data shard.

[0087] Step 206, based on the character combinations corresponding to each data shard, determine the key values corresponding to each data shard.

[0088] Among them, the key value refers to the encoding representing the character combination, or it can also refer to the encoding representing the key feature information of the data shard. The key value may include an index code. In other embodiments, the key value also includes a conflict code, an additional code, etc.

[0089] An index is a separate, physical storage structure that sorts the values of one or more columns in a database table. It is a collection of the values of one or several columns in a certain table and a list of logical pointers corresponding to the data pages in the table that physically identify these values. The role of an index is equivalent to the table of contents of a book, and the required content can be quickly found according to the page numbers in the table of contents. The index code refers to the encoding for index search of the data shard.

[0090] A conflict code refers to a code set to distinguish the same index code, which can be represented by a numerical value, such as 1, 2 / 3, etc. The conflict code can also be represented by a single special character plus a numerical value, such as *1, $1, &1, etc. Using a single special character plus a numerical value can save data volume. The conflict code can also be represented by enclosing a numerical value in parentheses, and the parentheses can be [] or {}, such as [1], {1}, but not limited to this.

[0091] Specifically, the electronic device obtains a data dictionary, and for the character combination of the data shard, obtains the key value corresponding to the character combination from the data dictionary, so as to obtain the key value corresponding to the data shard. In the same processing manner, the electronic device can obtain the key value corresponding to each data shard. It can be understood that the electronic device can traverse each data shard to obtain the corresponding key value, or can also obtain the key values corresponding to each data shard in the data dictionary at the same time.

[0092] The data dictionary is used to store the index branches composed of index nodes and the corresponding stored data. The index node can be the node represented by the index code. The data dictionary can also include the conflict code corresponding to the index code. The data dictionary can be a trie tree, also known as a word search tree, prefix tree or key tree, which is a tree structure and a variant of a hash tree. The tree structure refers to a data structure in which there is a one-to-many tree relationship between data elements, and it is an important type of non-linear data structure. The tree structure can represent a hierarchical relationship. A tree can include a root, subtrees and leaves. The root is equivalent to the root node in the tree structure, the subtrees are equivalent to multiple child nodes in the tree structure, and the leaves are equivalent to the leaf nodes in the tree structure. Each subtree can also have its own subtrees. In the tree structure, the root node has no predecessor node, and each of the remaining nodes has exactly one predecessor node. The leaf node has no successor node, and the number of successor nodes of each of the remaining nodes can be one or multiple. Among them, multiple means at least two.

[0093] Step 208: Transmit the key values corresponding to each data shard.

[0094] Specifically, the electronic device can transmit the key values corresponding to each data shard to another electronic device. Further, the electronic device can merge the key values corresponding to each data shard into a data packet and transmit the data packet to another electronic device.

[0095] In one embodiment, the sending electronic device can compress the data packet and transmit the compressed data packet to the receiving electronic device.

[0096] In one embodiment, when the electronic device is a terminal, the sending terminal can transmit the key values of each data shard, or the data packet, or the compressed data packet to the receiving terminal.

[0097] In other embodiments, in the case where the electronic device includes a terminal and a server, the sending terminal can transmit the key values of each data shard, or data packets, or compressed data packets to the server, and the server forwards the key values of each data shard, or data packets, or compressed data packets to the receiving terminal.

[0098] In this embodiment, data shards corresponding to the data to be transmitted are obtained. For each data shard, characters at preset positions in each word of the data shard are obtained to obtain a character combination corresponding to each data shard, and the key information of the data shard can be represented by the character combination. Based on the character combinations corresponding to each data shard, the key values corresponding to each data shard are determined, and the key values corresponding to each data shard are transmitted. It is possible to use the key values corresponding to the data shards to replace the data shards for transmission, which can reduce the data length and the amount of data transmitted, thereby reducing the occupation of the transmission resources of the electronic device, effectively reducing the transmission bandwidth. After encoding, the amount of data can be 10% to 20% of the original data amount. The specific data depends on the actual string. If the words in the string are all characters, the more the number, the greater the data compression rate. Moreover, by transmitting using the key values to replace the real and complete data, it is possible to avoid data leakage caused by plaintext transmission and improve the security of data transmission.

[0099] In one embodiment, as Figure 3 shown, determining the key values corresponding to each data shard based on the character combinations corresponding to each data shard includes:

[0100] Step 302, determining the character combinations corresponding to each data shard as the index codes corresponding to each data shard.

[0101] Step 304, obtaining a data dictionary and looking up the conflict codes corresponding to each index code in the data dictionary.

[0102] Specifically, the electronic device takes the character combination corresponding to each data shard as the index code of each data shard. The electronic device obtains a pre-created data dictionary, and for each index code, looks up the conflict code corresponding to the index code in the data dictionary.

[0103] Step 306, when there is a conflict code corresponding to the index code, determining the index code and the corresponding conflict code as the key value of the data shard.

[0104] Specifically, when the electronic device can find the conflict code corresponding to the index code in the data dictionary, it means that there is a conflict code corresponding to the index code. When there is a conflict code corresponding to the index code, the electronic device determines the index code and the corresponding conflict code as the key value of the corresponding data shard.

[0105] Step 308, in the case where there is no conflict code for the index code, determine the index code as the key value of the data shard.

[0106] Specifically, when the electronic device does not find the conflict code corresponding to the index code in the data dictionary, it means that there is no corresponding conflict code for the index code. In the case where there is no conflict code for the index code, the electronic device determines the index code as the key value of the corresponding data shard.

[0107] In this embodiment, the data dictionary can be pre-created by the electronic device of the sender, or can be pre-created by the electronic device of the receiver, or can be pre-created by a third-party electronic device. The electronic device of the sender and the electronic device of the receiver can store the data dictionary, or call the data dictionary from the third-party electronic device.

[0108] In this embodiment, the conflict code is used in the data dictionary to distinguish the same index code. The electronic device of the sender looks up whether there is a conflict code for each index code in the data dictionary, and can accurately obtain the key value corresponding to each data shard based on the data dictionary, avoiding errors when encoding the data shards.

[0109] In one embodiment, obtaining the data dictionary and looking up the conflict code corresponding to each index code in the data dictionary includes:

[0110] Obtain the data dictionary, look up the data pointer in the data dictionary according to the index code; when there are at least two stored data in the data block pointed to by the data pointer, determine the stored data that is the same as the data shard corresponding to the index code among the at least two stored data; according to the sorting serial number of the storage location where the same stored data belongs in the data block, determine the conflict code corresponding to the index code.

[0111] Among them, a pointer is an object in a programming language. Using the address, its value directly points to the value in another place in the memory. The data pointer refers to the index branch composed of each index code, and the data pointer of the data dictionary points to the address of the stored data. The data block is used to store data, and the stored data refers to the data stored in the data block. Further, the stored data refers to the data stored at the storage location in the data block.

[0112] Specifically, the electronic device obtains the pre-created data dictionary and traverses the data dictionary according to the index code to obtain the data pointer formed by the index code in the data dictionary. For example, if the index code is fyi, the computer looks up in the data dictionary in the order of f, y, i, and obtains the data pointer f→y→i of the index code in the data dictionary.

[0113] The electronic device determines the data block pointed to by the data pointer and determines the stored data stored in the data block. When there are at least two pieces of stored data in the data block pointed to by the data pointer, it means that the index codes of the stored data in the data block are the same. Then the electronic device can determine the stored data with the same data shard corresponding to the index code among the at least two pieces of stored data. The electronic device determines the storage location to which the same stored data belongs and determines the sorting serial number of the storage location in the data block, and determines the sorting serial number of the storage location to which the same stored data belongs in the data block as the conflict code corresponding to the index code.

[0114] In this embodiment, when there are at least two pieces of stored data in the data block pointed to by the data pointer, the electronic device obtains the starting stored data at the starting storage location from the data block. The electronic device compares the starting stored data with the data shard corresponding to the index code. When the starting stored data is the same as the data shard corresponding to the index code, it determines the sorting serial number of the starting storage location in the data block as the conflict code corresponding to the index code. For example, if the sorting serial number of the starting storage location in the data block is 1, then the conflict code corresponding to the index code is 1.

[0115] When the starting stored data is not the same as the data shard corresponding to the index code, the electronic device obtains the stored data at the next storage location adjacent to the starting storage location, compares the obtained stored data with the data shard, and if they are different, obtains the stored data at the next storage location adjacent to this storage location, and so on. Starting from the starting storage location of the data block, the electronic device sequentially obtains the stored data from the storage locations and compares it with the data shard corresponding to the index code, and stops when the obtained stored data is the same as the data shard, and determines the sorting serial number of the storage location to which the same stored data belongs in the data block as the conflict code corresponding to the index code.

[0116] In this embodiment, the data pointer in the data dictionary corresponding to the index code is determined to determine the address pointed to by the data pointer. When there are at least two pieces of stored data in the data block pointed to by the data pointer, it means that the index codes of the stored data in the data block are the same. The stored data with the same data shard corresponding to the index code among the at least two pieces of stored data is determined, and the sorting serial number of the storage location to which the same stored data belongs in the data block is determined as the conflict code corresponding to the index code to ensure the accuracy of the key value of the determined data shard. And it can take into account the distinction of the index code by the conflict code when there are the same index codes, avoiding coding errors of the data shards.

[0117] In one embodiment, determining the conflict code corresponding to the index code according to the sorting serial number of the storage location to which the same stored data belongs in the data block includes:

[0118] When the storage location to which the same stored data belongs is the starting storage location in the data block, no conflict code is configured for the index code; when the storage location to which the same stored data belongs is not the starting storage location in the data block, the conflict code corresponding to the index code is determined according to the sorting sequence number of the starting storage location in the data block and the sorting sequence number of the storage location to which the same stored data belongs in the data block.

[0119] Specifically, the electronic device determines the data block pointed to by the data pointer and determines the stored data stored in the data block. When there are at least two stored data in the data block pointed to by the data pointer, it means that the index codes of the stored data in the data block are the same. The electronic device can determine the stored data among the at least two stored data that have the same data shard corresponding to the index code. The electronic device determines the storage location to which the same stored data belongs. When the storage location to which the same stored data belongs is the starting storage location in the data block, no conflict code is configured for the index code.

[0120] When the storage location of the same stored data is not the starting storage location in the data block, the electronic device determines the sorting sequence number of the storage location in the data block and determines the sorting sequence number of the storage location to which the same stored data belongs in the data block as the conflict code corresponding to the index code.

[0121] In this embodiment, the electronic device obtains the starting stored data in the starting storage location from the data block, compares the starting stored data with the data shard corresponding to the index code, and when the starting stored data is the same as the data shard corresponding to the index code, no conflict code is configured for the index code.

[0122] When the starting stored data is not the same as the data shard corresponding to the index code, the electronic device obtains the stored data in the next storage location adjacent to the starting storage location, compares the obtained stored data with the data shard, and if they are different, obtains the stored data in the next storage location adjacent to this storage location, and so on. Starting from the starting storage location of the data block, the electronic device sequentially obtains the stored data from the storage locations and compares them with the data shard corresponding to the index code, stops when the obtained stored data is the same as the data shard, and determines the sorting sequence number of the storage location to which the same stored data belongs in the data block as the conflict code corresponding to the index code.

[0123] In this embodiment, when the storage location to which the same stored data belongs is the starting storage location in a non-data block, the conflict code corresponding to the index code is determined according to the sorting serial number of the starting storage location in the data block and the sorting serial number of the storage location to which the same stored data belongs in the data block, including: when the storage location to which the same stored data belongs is the starting storage location in a non-data block, the difference between the sorting serial number of the storage location to which the same stored data belongs in the data block and the sorting serial number of the starting storage location in the data block is determined as the conflict code corresponding to the index code.

[0124] Specifically, the electronic device sequentially obtains stored data from the storage locations starting from the starting storage location of the data block and compares it with the data shard corresponding to the index code. It stops when the obtained stored data is the same as the data shard, and determines the sorting serial number of the storage location to which the same stored data belongs in the data block. Then, the sorting serial number of the storage location to which the same stored data belongs in the data block is subtracted from the sorting serial number of the starting storage location in the data block to obtain the conflict code corresponding to the index code.

[0125] In this embodiment, when the storage location to which the same stored data belongs is the starting storage location in the data block, no conflict code is configured for the index code. In the case of a non-starting storage location, the sorting serial number of the storage location to which the same stored data belongs in the data block is determined as the conflict code corresponding to the index code, so as to accurately encode the data shards based on the settings in the data dictionary and ensure the accuracy of the key values of the determined data shards. Moreover, fully considering that when there are the same index codes, no conflict code is set for one of the same index codes, and conflict codes are set for other index codes, it is possible to distinguish the index codes and avoid inaccurate encoding of the data shards.

[0126] In one embodiment, the method further includes: when there is a numerical value in the data shard, configuring the numerical value as an additional code of the data shard;

[0127] Determining the key value corresponding to each data shard based on the character combination corresponding to each data shard includes: determining the key value corresponding to each data shard based on the character combination corresponding to each data shard and the corresponding additional code.

[0128] Wherein, the additional code refers to the code used to represent the numerical value in the data shard. The additional code can be the numerical value in the data shard, or can include the numerical value in the data shard and a separator. The separator is used to distinguish the character combination in the data shard and the numerical value in the data shard. For example, tadie##3, the character combination is tadie, and the additional code is 3 or ##3, and the ## is the separator.

[0129] In this embodiment, when there is a numerical value in a data shard, an additional code containing the numerical value is configured for the data shard, and the key value corresponding to the data shard is determined according to the character combination corresponding to the data shard and the corresponding additional code. For a data shard without a numerical value, the key value corresponding to the data shard is determined according to the character combination corresponding to the data shard.

[0130] In one embodiment, the electronic device determines the character combination corresponding to the data shard as the index code.

[0131] When there is a numerical value in the data shard, an additional code containing the numerical value is configured for the data shard, and the key value corresponding to the data shard is determined according to the index code corresponding to the data shard and the corresponding additional code. When there is no numerical value in the data shard, the index code corresponding to the data shard is determined as the key value.

[0132] In this embodiment, when there is a numerical value in the data shard, the numerical value is configured as the additional code of the data shard. Based on the character combination corresponding to each data shard and the corresponding additional code, the key value corresponding to each data shard is determined, which can accurately and completely represent the words and numerical values in the data shard through the index code and the additional code, thereby realizing the secure transmission of the data to be transmitted.

[0133] In one embodiment, obtaining the data shards corresponding to the data to be transmitted includes: obtaining the data to be transmitted and dividing the data to be transmitted to obtain each data shard.

[0134] After the electronic device obtains the data to be transmitted, it can determine the data volume of the data to be transmitted. The electronic device divides the data to be transmitted according to a preset data volume to obtain the data shards corresponding to the data to be transmitted.

[0135] In this embodiment, after the electronic device obtains the data to be transmitted, it can determine the data length of the data to be transmitted and divide the data to be transmitted according to a preset data length to obtain the data shards corresponding to the data to be transmitted.

[0136] In this embodiment, if the data to be transmitted is composed of each word, the electronic device can perform semantic recognition on the data to be transmitted. Based on the semantic recognition, the data to be transmitted is divided to obtain each data shard.

[0137] In this embodiment, after obtaining the data to be transmitted and dividing the data to be transmitted to obtain each data shard, the method further includes: configuring a serial number for each data shard according to the position of each data shard in the data to be transmitted;

[0138] Transmitting the key value corresponding to each data shard includes: transmitting the key value corresponding to each data shard and the corresponding serial number.

[0139] Specifically, after the electronic device obtains the data shards, it can determine the positions of the data shards in the data to be transmitted. According to the positions of the data shards in the data to be transmitted, the electronic device configures sequence numbers for the data shards. The sequence number corresponding to the same data shard is the same as its position in the data to be transmitted. For example, if data shard A is the third data shard in the data to be transmitted, the sequence number of this data shard is 3.

[0140] After the electronic device obtains the key values corresponding to the data shards, it transmits the key values and sequence numbers corresponding to the data shards to another electronic device. Further, the sending electronic device can combine the key values and sequence numbers corresponding to the data shards into a data packet and transmit the data packet to the receiving electronic device.

[0141] In other embodiments, the electronic device can compress the data packet and transmit the compressed data packet to another electronic device.

[0142] In this embodiment, the data to be transmitted is divided into data shards, and corresponding sequence numbers are configured based on the positions of the data shards in the data to be transmitted. The key values and sequence numbers are transmitted, enabling the receiving party to determine the positional relationship of the data shards based on the sequence numbers when receiving the data, thereby accurately restoring the data.

[0143] Figure 4 It is a flowchart of the data transmission method in an embodiment. The data transmission method in this embodiment is applied to the electronic device of the receiving party and is described by taking the electronic device running in Figure 1 as an example. As Figure 4 shown, the data transmission method includes the following steps:

[0144] Step 402, receive data and obtain the key value from the received data; the key value is determined according to the character combination corresponding to the data shard of the data to be transmitted, and the character combination is obtained based on the characters at the preset positions in each word of the data shard.

[0145] Specifically, the receiving electronic device receives the data transmitted by the sending electronic device and obtains the key value from the received data.

[0146] Further, the data can be transmitted in the form of a data packet, a data compression packet, etc., but is not limited thereto. The electronic device can receive the data transmitted in the form of a data packet or a data compression packet and obtain the key value therefrom. The key value is determined by the sending electronic device according to the character combination corresponding to the data shard of the data to be transmitted, and the character combination is obtained based on the characters at the preset positions in each word of the data shard.

[0147] Data sharding is composed of each word. The preset position refers to the position of a character in a word, such as the first or last position. The character at the preset position is the character at a specific position in the word. For example, the character at the first position of "memory" is "m", and the character at the first position of "not" is "n".

[0148] In one embodiment, the received data further includes the sequence numbers corresponding to each key value, and the sequence number corresponding to the key value is the same as the sequence number of the data shard corresponding to the key value in the data to be transmitted.

[0149] Step 404: Obtain a data dictionary, and obtain the data shards corresponding to each key value from the data dictionary.

[0150] Specifically, the electronic device obtains a data dictionary, traverses and searches in the data dictionary based on each key value, so as to obtain the data shards corresponding to each key value from the data dictionary. One key value corresponds to one data shard.

[0151] In one embodiment, the key value includes an index code, or an index code and a conflict code, or an index code, a conflict code, and a numerical value.

[0152] In one embodiment, obtaining a data dictionary and obtaining the data shards corresponding to each key value from the data dictionary includes: obtaining the corresponding data dictionary based on the data volume of the key value.

[0153] Specifically, the data dictionary may include a first data dictionary and a second data dictionary. Different data dictionaries contain different data volumes. The electronic device can determine the data volume of the key value, and compare the data volume of the key value with a preset data volume. When the data volume of the key value is greater than or equal to the preset data volume, obtain the first data dictionary, and obtain the data shards corresponding to each key value from the first data dictionary.

[0154] When the data volume of the key value is less than the preset data volume, obtain the second data dictionary, and obtain the data shards corresponding to each key value from the second data dictionary. The data volume of the first data dictionary is greater than that of the second data dictionary.

[0155] Step 406: Generate target transmission data based on each data shard.

[0156] Among them, the target transmission data refers to the transmission data obtained by the receiving electronic device decoding and restoring the received data.

[0157] Specifically, after the electronic device obtains the data shards corresponding to each key value, splice each data shard to generate the target transmission data.

[0158] In this embodiment, when the received data further includes the sequence numbers of the key values, after the electronic device obtains the data shards corresponding to each key value, it splices the data shards according to the sequence numbers of the key values, so as to generate the target transmission data.

[0159] Under the conditions of secure transmission and accurate data restoration, the target transmission data restored by the receiving electronic device is the same as the data to be transmitted processed by the sending electronic device.

[0160] In this embodiment, the data dictionary used by the sending electronic device to determine the key values corresponding to the data shards of the data to be transmitted is the same as the data dictionary used by the corresponding receiving electronic device to determine the data shards corresponding to the key values.

[0161] In this embodiment, the sending party encodes the data shards of the data to be transmitted based on the data dictionary, so as to use key values to replace the data shards for transmission, which can reduce the amount of data transmitted, thereby saving resources. The receiving party receives the transmitted data, decodes and restores the received data based on the data dictionary to obtain the data shards, and thus restores the target transmission data based on the data shards, realizing accurate data transmission. Moreover, by using key values to replace the real and complete data for transmission, it can avoid data leakage caused by plaintext transmission and improve the security of data transmission. When the string is compressed using the first letter, the common prefix of the string is used to reduce the query time, minimizing unnecessary string comparisons and improving the query efficiency.

[0162] In one embodiment, the key value includes an index code; obtaining the data shards corresponding to each key value from the data dictionary includes:

[0163] Search for a data pointer in the data dictionary according to the index code in the key value; obtain the data shard corresponding to the index code from the data block pointed to by the data pointer.

[0164] Specifically, the key value includes an index code. For each key value, the electronic device traverses the data dictionary according to the index code to obtain the data pointer formed by the index code in the data dictionary. For example, if the index code is fyi, the computer traverses and searches in the data dictionary in the order of f, y, and i to obtain the data pointer f→y→i of the index code fyi in the data dictionary. The electronic device determines the data block pointed to by the data pointer and obtains the data shard corresponding to the index code from the data block.

[0165] In this embodiment, the data pointer points to the starting address of the data block, and this starting address refers to the address of the starting storage position in the data block. The electronic device obtains the data shard corresponding to the index code from the data block based on the starting address of the data block pointed to by the data pointer.

[0166] In this embodiment, by determining the data pointer of the index code in the data dictionary to determine the data block pointed to by the data pointer, the storage address of the data shard corresponding to the index code can be initially determined, so as to obtain the data shard from the storage address.

[0167] In one embodiment, obtaining the data shard corresponding to the index code from the data block pointed to by the data pointer includes:

[0168] In the case where there is no conflict code in the key value, the stored data at the starting storage position in the data block pointed to by the data pointer is obtained and determined as the data shard corresponding to the key value; in the case where there is a conflict code in the key value, the stored data in the storage position corresponding to the conflict code in the data block pointed to by the data pointer is determined as the data shard corresponding to the key value.

[0169] Specifically, the electronic device determines whether there is a conflict code in the key value. In the case where there is no conflict code in the key value, the electronic device can obtain the stored data stored at the starting address in the data block pointed to by the data pointer, that is, the stored data at the starting storage position in the data block. The electronic device determines the stored data at the starting storage position as the data shard corresponding to the key value without a conflict code.

[0170] In the case where there is a conflict code in the key value, the electronic device can determine the storage position corresponding to the conflict code in the data block pointed to by the data pointer. The computer obtains the stored data at the storage position corresponding to the conflict code and determines the stored data as the data shard corresponding to the key value.

[0171] In this embodiment, in the case where there is no conflict code in the key value, the stored data at the starting storage position in the data block is used as the data shard corresponding to the key value; in the case where there is a conflict code in the key value, the stored data in the storage position corresponding to the conflict code in the data block is determined as the data shard corresponding to the key value, so that the data shard of the same key value can be accurately determined according to the two elements of the index code and the conflict code, and the key value can be accurately restored to the data shard.

[0172] In one embodiment, in the case where there is a conflict code in the key value, determining the stored data in the storage position corresponding to the conflict code in the data block pointed to by the data pointer as the data shard corresponding to the key value includes:

[0173] In the case where there is a conflict code in the key value, the stored data in the storage position whose sorting serial number in the data block is the same as the value of the conflict code is determined as the data shard corresponding to the key value; there are at least two storage positions in the data block pointed to by the data pointer.

[0174] Specifically, there are at least two storage locations in the data block. When there is a conflict code in the key value, the electronic device can determine whether the sorting serial number of each storage location in the data block pointed to by the data pointer is the same as the value in the conflict code. The electronic device determines the stored data in the storage location where the sorting serial number is the same as the value in the conflict code as the data shard corresponding to the key value to which the conflict code belongs.

[0175] In this embodiment, each storage location in the data block has a corresponding conflict code.

[0176] In this embodiment, when there is a conflict code in the key value, the electronic device can obtain the stored data at the starting storage location in the data block pointed to by the data pointer. The electronic device can determine the sorting of the starting storage location in the data block. When the sorting serial number of the starting storage location in the data block is the same as the value in the conflict code, the stored data at the starting storage location is determined as the data shard corresponding to the key value to which the conflict code belongs.

[0177] When the sorting serial number of the starting storage location in the data block is not the same as the value in the conflict code, the electronic device determines the sorting serial number of the next storage location adjacent to the starting storage location in the data block. If the sorting serial number is the same as the value in the conflict code, the stored data at the adjacent next storage location is used as the data shard corresponding to the key value to which the conflict code belongs. If the sorting serial numbers are not the same, the sorting serial number of the next storage location adjacent to this storage location in the data block is determined, and so on, until a storage location with a sorting serial number the same as the value in the conflict code is obtained. The stored data in the same storage location is determined as the data shard corresponding to the key value.

[0178] For example, the conflict code in key value A is 1. When the electronic device determines that the sorting serial number of the starting storage location in the data block is 1, the stored data at the starting storage location is determined as the data shard corresponding to key value A. The conflict code in key value B is 2. When the electronic device determines that the sorting serial number of the next storage location adjacent to the starting storage location in the data block is 2, the stored data at the adjacent next storage location is determined as the data shard corresponding to key value B.

[0179] In one embodiment, the end of each stored data is represented by an end symbol. For example, / 0 is used as the end symbol of the stored data. By representing the completeness of the stored data with the end symbol, it is not necessary to determine the length of each stored data. When the computer obtains the end symbol of the stored data, it means that the stored data has been completely obtained.

[0180] In this embodiment, there is a corresponding conflict code for each storage location in the data block including the starting storage location, and the value in the conflict code corresponding to each storage location is the same as the sorting serial number of the storage location in the data block. Then, by determining the storage location where the value in the conflict code of the sorting serial number is the same as the key value, the storage location of the data shard corresponding to the key value can be accurately obtained, so as to accurately obtain the data shard corresponding to the key value.

[0181] In one embodiment, when there is a conflict code in the key value, among the data blocks pointed to by the data pointer, the stored data in the storage location corresponding to the conflict code is determined as the data shard corresponding to the key value, including: when there is a conflict code in the key value, according to the sorting serial number of the starting storage location in the data block and the value of the conflict code, determine the target storage location; determine the stored data in the target storage location as the data shard corresponding to the key value.

[0182] When there is a conflict code in the key value, according to the sorting serial number of the starting storage location in the data block and the value of the conflict code, determining the target storage location includes: when there is a conflict code in the key value, according to the sorting serial number obtained by adding the value of the conflict code to the sorting serial number of the starting storage location in the data block, find the corresponding target storage location in the data block.

[0183] In one embodiment, when there is a conflict code in the key value, among the data blocks pointed to by the data pointer, the stored data in the storage location corresponding to the conflict code is determined as the data shard corresponding to the key value, including:

[0184] When there is a conflict code in the key value, according to the sorting serial number obtained by adding the value of the conflict code to the sorting serial number of the starting storage location in the data block, find the corresponding target storage location in the data block; determine the stored data in the target storage location as the data shard corresponding to the key value.

[0185] Specifically, there is no corresponding conflict code for the starting storage location in the data block, and there is a corresponding conflict code for other storage locations except the starting storage location.

[0186] When there is a conflict code in the key value, the electronic device can determine the sorting serial number of the starting storage location in the data block, and add the sorting serial number of the starting storage location and the value in the conflict code. According to the sorting serial number obtained by adding the sorting serial number of the starting storage location and the value in the conflict code, find the corresponding target storage location in the data block. The electronic device determines the stored data in the target storage location as the data shard corresponding to the key value to which the conflict code belongs.

[0187] For example, the conflict code in key value A is 1. When the electronic device determines that the sorting serial number of the starting storage location in the data block is 1, but there is no corresponding conflict code for the starting storage location. The electronic device adds the conflict code 1 in key value A and the sorting serial number 1 of the starting storage location to obtain the sorting serial number 2. Determine the storage location with the sorting serial number 2 in the data block. For example, if the sorting serial number of the next storage location adjacent to the starting storage location in the data block is 2, then determine the stored data in the storage location with the sorting serial number 2 as the data shard corresponding to key value A.

[0188] In this embodiment, there is no corresponding conflict code for the starting storage location in the data block. For other storage locations except the starting storage location, there are corresponding conflict codes. According to the sorting serial number of the starting storage location in the data block plus the value of the conflict code, find the corresponding target storage location in the data block, and the storage location where the data shard corresponding to the key value with this conflict code exists can be accurately found. Determine the stored data in the target storage location as the data shard corresponding to the key value, so as to accurately obtain the data shard.

[0189] In one embodiment, obtaining the data shards corresponding to each key value from the data dictionary includes:

[0190] When there is an additional code in the key value, obtain the value in the additional code; obtain the data dictionary, and obtain the stored data corresponding to the key value from the data dictionary; determine the value in the additional code of the key value and the corresponding stored data as the data shard corresponding to the key value; when there is no additional code in the key value, determine the stored data obtained from the data dictionary corresponding to the key value as the data shard corresponding to the key value.

[0191] Specifically, the key value contains an index code, and may also contain a conflict code and an additional code. The electronic device determines whether there is an additional code in the key value. When there is an additional code in the key value, obtain the value in the additional code. The electronic device obtains the data dictionary and searches for the corresponding stored data from the data dictionary according to the index code, or the index code and the conflict code. After the electronic device obtains the corresponding stored data according to the index code, or the index code and the conflict code, determine the stored data corresponding to the same key value and the value in the conflict code as the shard data of the key value.

[0192] In this embodiment, when there is no additional code in the key value, the electronic device searches for the corresponding stored data from the data dictionary according to the index code in the key value, or the index code and the conflict code, and determines the found stored data as the data shard corresponding to the key value.

[0193] In this embodiment, for key values with additional codes, in addition to obtaining the corresponding stored data from the data dictionary, it is also necessary to restore the values in the additional codes so that the obtained data shards are complete and accurate, avoiding data omission and ensuring data integrity and accuracy.

[0194] In one embodiment, receiving data and obtaining key values from the received data includes:

[0195] Receiving data and obtaining key values and the serial numbers corresponding to each key value from the received data;

[0196] Generating target transmission data based on each data shard includes:

[0197] Generating target transmission data based on each data shard and the serial numbers corresponding to each key value.

[0198] Specifically, when the electronic device receives data, it obtains key values and the serial numbers corresponding to each key value from the data. After obtaining the corresponding data shards based on the key values, the serial numbers corresponding to the same key value are used as the serial numbers of the data shards corresponding to the same key value, thereby obtaining the serial numbers of each data shard. The data shards are concatenated according to the serial numbers of each data shard, thereby accurately obtaining the target transmission data.

[0199] Figure 5 It is a flowchart of a data dictionary generation method in an embodiment. The data dictionary generation method in this embodiment is described by taking an electronic device running in Figure 1 as an example. As Figure 5 shown, this data dictionary generation method includes:

[0200] Step 502, creating an index node of the data dictionary and an index branch formed by the index nodes.

[0201] The data dictionary is used to store the index branch formed by index nodes and the corresponding stored data. The index node can be the node represented by the index code. The data dictionary may also include a conflict code corresponding to the index code. The data dictionary can be a trie, also known as a prefix tree or a key tree, which is a tree structure and a variant of a hash tree. A tree structure refers to a data structure in which there is a one-to-many tree relationship between data elements, and it is an important type of non-linear data structure. A tree structure can represent a hierarchical relationship. A tree can include a root, subtrees, and leaves. The root is equivalent to the root node in the tree structure, the subtrees are equivalent to multiple child nodes in the tree structure, and the leaves are equivalent to the leaf nodes in the tree structure. Each subtree can also have its own subtrees. In a tree structure, the root node has no predecessor node, and each of the remaining nodes has exactly one predecessor node. The leaf nodes have no successor nodes, and the number of successor nodes of each of the remaining nodes can be one or multiple. Here, multiple means at least two. The index node includes a root node and child nodes.

[0202] Specifically, the electronic device creates index nodes of the data dictionary and creates index branches based on the index nodes.

[0203] Step 504, configure the stored data corresponding to each index branch in the data dictionary. The index node of the index branch is the character at a preset position in each word of the stored data.

[0204] Specifically, the electronic device can obtain sample data shards, obtain the characters at preset positions in each word of the sample data shards to obtain a sample character combination. The electronic device determines the index nodes on each index branch in the data dictionary, and uses the sample data shards corresponding to the sample character combination that is the same as the index nodes on the index branch as the stored data corresponding to the index branch.

[0205] In this embodiment, the electronic device combines the characters at preset positions in each word of the sample data shards according to the positions of the words in the data shards to obtain a sample character combination. The electronic device sequentially compares the characters of the index nodes on the index branch and the characters in the sample character combination according to the pointers of each index node. For example, the index nodes on the index branch are: A→B→C, and the sample character combination is ABW. Then the electronic device compares index node A with character A, index node B with character B, and index node C with character W.

[0206] Step 506, store the stored data corresponding to each index branch, and obtain a data dictionary based on the index nodes and the stored data.

[0207] Specifically, the electronic device can store the stored data corresponding to each index branch in the data area. The electronic device stores the stored data corresponding to each branch in the data area. After completing the data storage, a data dictionary containing index branches and stored data is obtained.

[0208] In this embodiment, this data dictionary generation method can be applied to the electronic device of the sender, can also be applied to the electronic device of the receiver, and can also be applied to the electronic device of a third party.

[0209] In this embodiment, creating index nodes of the data dictionary and index branches formed by the index nodes, configuring the stored data corresponding to each index branch in the data dictionary, where the index node of the index branch is the character at a preset position in each word of the stored data, storing the stored data corresponding to each index branch, and a data dictionary can be generated based on the index nodes and the stored data. Based on the generated data dictionary, the data sender can accurately encode the data to be transmitted, so as to reduce the amount of data transmitted and improve the security of data transmission, while the data receiver can accurately restore the data based on the data dictionary.

[0210] In one embodiment, storing the stored data corresponding to each index branch includes:

[0211] When there is one stored data in the index branch, store the stored data in the data block pointed to by the index branch; when there are at least two stored data corresponding to the same index branch, divide at least two storage positions in the data block of the data dictionary, and store at least two stored data in the at least two storage positions in sequence; the data block pointed to by the same index branch corresponds to the stored data, and the characters at the preset positions in each word of the at least two stored data are the same.

[0212] Specifically, after the electronic device configures the stored data corresponding to each index branch, when there is one stored data in the same index branch, store the stored data in the data block pointed to by the index branch. Further, the electronic device can determine whether there is already stored data in the data block pointed to by the index branch. When there is no already stored data in the data block, divide a storage position in the data block as the starting storage position, and store the stored data to the starting storage position.

[0213] In this embodiment, the index nodes on the index branch are combined to obtain an index code. When there are at least two stored data corresponding to the same index branch, the index codes corresponding to the at least two stored data are the same. That is, the characters at the preset positions in each word of the at least two stored data are the same.

[0214] The electronic device can determine the data block pointed to by the index branch, divide at least two adjacent storage positions in the data block, and the electronic device stores at least two stored data to the at least two storage positions respectively.

[0215] In this embodiment, when there are at least two stored data corresponding to the same index branch, the electronic device can determine the data block pointed to by the index branch. The electronic device can determine whether there is already stored data in the data block. When there is no already stored data in the data block, divide at least two adjacent storage positions in the data block, and one of the at least two storage positions is used as the starting storage position. It can be understood that the number of each storage position is the same as the number of each stored data. The electronic device stores at least two stored data to the at least two storage positions respectively, and one storage position is used to store one stored data.

[0216] In the case where there is no stored data in the data block, the electronic device divides at least two storage positions adjacent to the last storage position in the data block, and stores at least two stored data in the at least two storage positions respectively. It can be understood that the adjacent referred to in this embodiment means that one storage position is adjacent to the next storage position. For example, storage position A is adjacent to storage position B, and storage position B is adjacent to storage position C.

[0217] In this embodiment, in the case where there is one stored data in the index branch, the stored data can be directly stored in the data block pointed to by the index branch. In the case where at least two stored data correspond to the same index branch, at least two storage positions are divided in the data block to store at least two stored data respectively, so that the stored data can be stored separately, avoiding the chaos of storing each stored data. Moreover, storing the stored data separately can ensure the accuracy of data encoding by the sender based on the data dictionary and the accuracy of data restoration by the receiver based on the data dictionary.

[0218] In one embodiment, the data dictionary includes an index area and a data area. The index area includes index branches composed of index nodes, and the data area includes data blocks; at least two storage positions for storing at least two stored data are consecutive in the data blocks in the data area.

[0219] Specifically, the data dictionary includes an index area and a data area. The index area includes index nodes and index branches formed by the index nodes. The data area includes data blocks, and each storage position in the data block is used to store stored data. Each storage position in the same data block is consecutive. For example, storage position A is adjacent to storage position B, and storage position B is adjacent to storage position C, and there is no empty storage position between any two storage positions. An empty storage position refers to a storage position where no stored data is stored.

[0220] In this embodiment, the index branch in the index area points to the data block in the data area. Further, the index branch in the index area points to the starting address in the data block, that is, the starting address of the starting storage position in the data block.

[0221] In this embodiment, the data dictionary includes an index area and a data area. Through the index area, the index branch can be found, so that the stored data can be quickly obtained through the data block in the data area pointed to by the index branch.

[0222] In one embodiment, as Figure 6 shown, the index node includes a root node and a child node; creating the index nodes and index branches formed by the index nodes of the data dictionary includes:

[0223] Step 602, create a root node in the index area of the data dictionary.

[0224] Step 604: Obtain the sample data shards in the first candidate set, and obtain the characters at the preset positions in each word of the sample data shards to obtain a sample character combination.

[0225] Specifically, the electronic device creates a root node in the index area of the data dictionary, and the root node can be empty. The electronic device obtains the first candidate set, and each sample data shard is stored in the first candidate set. For each sample data shard in the first candidate set, the electronic device obtains the characters at the preset positions in each word of the sample data shard. According to the positions of the words in the sample data shard, the characters at the preset positions of each word are combined to obtain the sample character combination corresponding to the sample data shard. In the same processing manner, the electronic device can obtain the sample character combination corresponding to each sample data shard.

[0226] Step 606: Connect the root node and the child nodes represented by the characters in the sample character combination in sequence to obtain an index branch; the root node and the child nodes represented by the characters in the character combination are used as nodes at different levels in the index branch, and the root node and the child nodes point to the child nodes at the next level.

[0227] Specifically, the root node and the child nodes represented by the characters in the character combination are used as nodes at different levels in the index branch, and the root node and the child nodes point to the child nodes at the next level. After the electronic device creates the root node of the data dictionary, it selects any sample character combination.

[0228] The electronic device traverses starting from the root node of the data dictionary in the order of the characters in the sample character combination. When there is no child node represented by the first character in the sample character combination among the child nodes at the next level pointed to by the root node, a child node represented by the first character in the sample character combination is created, and the root node points to the created child node.

[0229] When there is a child node represented by the first character in the sample character combination among the child nodes at the next level pointed to by the root node, it is determined whether there is a child node represented by the second character in the sample character combination among the child nodes at the next level pointed to by the determined child node.

[0230] When there is no child node represented by the second character in the sample character combination among the child nodes at the next level pointed to by the child node, a child node represented by the second character in the sample character combination is created, and the child node points to the created child node.

[0231] According to the same processing steps, stop when there are no unselected characters in the sample character combination, and obtain the index branch corresponding to the sample character combination. The number of child nodes in the index branch is the same as the number of characters in the sample character combination, and the child nodes in the index branch are the same as the child nodes represented by the characters in the sample character combination.

[0232] Step 608, traverse the sample data shards in the first candidate set until an index branch formed by the last sample data shard and the root node is obtained.

[0233] Specifically, according to the operation process in step 606, traverse the sample data shards in the candidate set, and an index branch can be constructed based on each sample data shard and the root node, so as to obtain the index branches formed by each sample data shard and the root node in the first candidate set.

[0234] Configure the stored data corresponding to each index branch in the data dictionary, including:

[0235] Step 610, configure the sample data shard corresponding to each index branch as the stored data corresponding to each index branch.

[0236] Specifically, the electronic device configures the sample data shard corresponding to the index branch in the first candidate set as the stored data corresponding to this index branch. In the same processing manner, the electronic device can configure the stored data corresponding to each index branch.

[0237] In this embodiment, by creating a root node, obtaining the characters at the preset positions in each word of the sample data shards in the first candidate set to obtain a sample character combination, and sequentially connecting the root node and the child nodes represented by the characters in the sample character combination, an index branch is obtained, and an index branch corresponding to the sample data shard can be formed. The data volume of the data dictionary generated thereby is relatively small, and the empty nodes are also relatively few, so the data search with a small data volume is faster and more accurate.

[0238] In one embodiment, the index node includes a root node and child nodes; creating the index nodes of the data dictionary and the index branches formed by the index nodes includes:

[0239] Create a root node in the index area of the data dictionary; obtain each character in the second candidate set, sequentially use the child nodes represented by each character in the second candidate set as the child nodes of the root node, and then sequentially use the child nodes represented by each character in the second candidate set as the child nodes of the next level under the child nodes until the child nodes of the last level are obtained; the root node and the child nodes point to the child nodes of the next level; based on the child nodes and the root node of different levels, obtain the index branch.

[0240] Among them, each character is stored in the second candidate set, such as 26 child nodes including A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, S, Y, Z, or 26 child nodes including a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, s, y, z.

[0241] Specifically, the electronic device creates a root node in the index area of the data dictionary, and the root node is empty. The electronic device obtains a second candidate set, and each character is stored in the second candidate set. Each character is used to represent a child node. The electronic device sequentially uses the child nodes represented by the characters in the second candidate set as the child nodes at the next level under the root node, and points from the root node to the child nodes at the next level. For each child node, the child nodes represented by the characters in the second candidate set are sequentially used as the child nodes at the next level of the child node, and the corresponding upper-level child node points to the child nodes at the next level. For example, the root node and each child node point to the child nodes represented by A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, S, Y, Z at the next level.

[0242] According to the same processing method, until the child nodes at the last level are obtained. The electronic device determines each index branch according to the pointing between the root node and the child nodes, and between the child nodes.

[0243] In this embodiment, by creating a root node and using the child nodes represented by the characters in the second candidate set as the child nodes of the root node and each child node, it can be ensured that there are child nodes for all nodes except the leaf nodes, covering the index branches formed by various characters, making the index branches of the created data dictionary rich and complete. The data volume of the data dictionary generated thereby is large, and it is faster and more accurate when performing a large number of data lookups.

[0244] In one embodiment, the index branches in the index area and the stored data in the data area of the electronic device data dictionary are saved to the same file.

[0245] As Figure 7 shown, it is a schematic diagram of a data dictionary in one embodiment. As Figure 7 shown, the data dictionary includes an index area and a data area. The index area contains index branches composed of index nodes, such as m→n→e, t→a→d→e. The data area contains data blocks and the stored data stored in the data blocks. The index branch points to the starting address of the data block, and the data block displays the first character of the stored data in the starting address, such as y, n, o, etc. in the data block.

[0246] At the sender, the data to be transmitted can be encoded through the data dictionary to obtain the key values of each data shard in the data to be transmitted, as shown in the following table:

[0247]

[0248] The electronic device of the sender divides the data to be transmitted into 6 data shards, obtains the first letters of each data shard and combines them. For example, the combination of the first letters of the data shard "memory not enough" is "mne". The electronic device of the sender can use the combination of the first letters as the index code of the data shard, and look up the index branch corresponding to the index code in the index area of the data dictionary. For example, look up the index branch of the index code "mne" and get the index branch m→n→e.

[0249] The electronic device can determine the stored data in the data block pointed to by the index branch. When there are at least two stored data in the data block, determine the stored data that is the same as the data shard corresponding to the index code among the at least two stored data. In the case where the storage location to which the same stored data belongs is the starting storage location in the data block, no conflict code is configured for the index code. In the case where the storage location to which the same stored data belongs is not the starting storage location in the data block, the electronic device determines the difference between the sorting serial number of the storage location to which the same stored data belongs in the data block and the sorting serial number of the starting storage location in the data block as the conflict code corresponding to the index code, so as to use the index code and the conflict code as the key value of the data shard.

[0250] For example, the index codes in Serial No. 5 and Serial No. 6 are both rowie. In Serial No. 5, the data shard "read or write ioerrors" is stored at the starting storage location in the data block, so the index code rowie in Serial No. 5 is not configured with a conflict code. The data shard "read or write information established" in Serial No. 6 is stored at the next adjacent storage location to the starting storage location in the data block. The sorting serial number of the starting storage location in the data block is 1, and the sorting serial number of the next adjacent storage location in the data block is 2. Then, the sorting serial number of the next adjacent storage location minus the sorting serial number of the starting storage location is 1, which is used as the conflict code of the index code rowie in Serial No. 6. That is, the key value in Serial No. 6 is rowie[1], where rowie is the index code and 1 is the conflict code. The square brackets "[]" can be used to distinguish the index code and the conflict code. In other embodiments, rowie is the index code and [1] can be used as the conflict code.

[0251] The electronic device of the sender can obtain the key values corresponding to these 6 data shards in the same processing manner and transmit the 6 key values to the electronic device of the receiver.

[0252] The receiving party's electronic device receives these 6 key values, and looks up the index branch corresponding to the index code in the index area of the data dictionary. When there is no conflict code in the key values, the electronic device obtains the stored data at the starting storage position in the data block pointed to by the data pointer, and determines it as the data shard corresponding to the key value. When there is a conflict code in the key values, according to the sorting sequence number obtained by adding the conflict code value to the sorting sequence number in the data block at the starting storage position, the corresponding target storage position in the data block is searched, and the stored data in the target storage position is determined as the data shard corresponding to the key value, thereby obtaining the data shards corresponding to these 6 key values. According to the data shards corresponding to these 6 key values, the electronic device can generate target transmission data, and the target transmission data is the same as the data to be transmitted by the sending party.

[0253] In this embodiment, as shown in the data compression ratio in the above table, it is the ratio of the data volume of the key value and the corresponding data shard after encoding 6 data shards into 6 key values. It can be seen that the data volume after encoding the data to be transmitted is 10%-20% of the original data volume. The more characters there are in each word of the data shard, the greater its data compression ratio. By searching for data through the index branch of the data dictionary, the query time can be reduced, useless string comparisons can be reduced, and the data query efficiency can be greatly improved.

[0254] In one embodiment, a data transmission method is provided, including:

[0255] The third-party electronic device creates a root node in the index area of the data dictionary; obtains the sample data shards in the first candidate set, and obtains the characters at the preset positions in each word of the sample data shards to obtain a sample character combination; sequentially connects the root node and the child nodes represented by the characters in the sample character combination to obtain an index branch; the root node and the characters in the character combination represent the nodes at different levels in the index branch, and the root node and the child nodes point to the child nodes at the next level; traverses the sample data shards in the first candidate set until the index branch formed by the last sample data shard and the root node is obtained; configures the sample data shards corresponding to each index branch as the stored data corresponding to each index branch.

[0256] Alternatively, the third-party electronic device creates a root node in the index area of the data dictionary; obtains each character in the second candidate set, sequentially takes the child nodes represented by each character in the second candidate set as the child nodes of the root node, and then sequentially takes the child nodes represented by each character in the second candidate set as the child nodes at the next level of the child nodes until the last level of child nodes is obtained; the root node and the child nodes point to the child nodes at the next level; based on the child nodes at different levels and the root node, an index branch is obtained; configures the stored data corresponding to each index branch in the data dictionary, and the child nodes of the index branch are the characters at the preset positions in each word of the stored data.

[0257] Next, when there is stored data in the index branch, the third-party electronic device stores the stored data at the starting storage position of the data block pointed to by the index branch.

[0258] Further, when there are at least two stored data corresponding to the same index branch, the third-party electronic device divides at least two storage positions in the data block of the data dictionary, and sequentially stores the at least two stored data in the at least two storage positions; the at least two storage positions for storing the at least two stored data are consecutive in the data block of the data area; the same index branch points to the data block to which the stored data belongs, and the characters at the preset positions in each word of the at least two stored data are the same.

[0259] Further, the third-party electronic device obtains a data dictionary based on the index branch and the stored data.

[0260] The sending electronic device obtains the data shards corresponding to the data to be transmitted.

[0261] Next, for each data shard, the characters at the preset positions in each word of the data shard are obtained to obtain the character combination corresponding to each data shard.

[0262] Next, the sending electronic device determines the character combination corresponding to each data shard as the index code corresponding to each data shard.

[0263] Further, when there is a numerical value in the data shard, the sending electronic device configures the numerical value as the additional code of the data shard.

[0264] Next, the sending electronic device calls the data dictionary of the third-party electronic device and looks up the data pointer in the data dictionary according to the index code.

[0265] Further, when there are at least two stored data in the data block pointed to by the data pointer, the sending electronic device determines the stored data that is the same as the data shard corresponding to the index code among the at least two stored data.

[0266] Further, when the storage position to which the same stored data belongs is the starting storage position in the data block, no conflict code is configured for the index code.

[0267] Or, when the storage position to which the same stored data belongs is not the starting storage position in the data block, the sending electronic device determines the difference between the sorting serial number of the storage position to which the same stored data belongs in the data block and the sorting serial number of the starting storage position in the data block as the conflict code corresponding to the index code.

[0268] Next, when there is a corresponding conflict code for the index code and there is no additional code, the index code and the corresponding conflict code are determined as the key value of the data shard.

[0269] Alternatively, when there is a corresponding conflict code for the index code and there is an additional code, the index code, the corresponding conflict code, and the additional code are determined as the key value of the data shard.

[0270] Alternatively, when there is no conflict code for the index code and there is no additional code, the index code is determined as the key value of the data shard.

[0271] Alternatively, when there is no conflict code for the index code and there is an additional code, the index code and the additional code are determined as the key value of the data shard.

[0272] Furthermore, the electronic device of the sender determines the sequence number of each data shard in the data to be transmitted as the sequence number of the corresponding key value, and transmits the key value corresponding to each data shard and the corresponding sequence number to the electronic device of the receiver.

[0273] The electronic device of the receiver receives the data, and obtains the key value and the sequence number corresponding to each key value from the received data; the key value is determined according to the character combination corresponding to the data shard of the data to be transmitted, and the character combination is obtained based on the characters at the preset positions in each word of the data shard.

[0274] Next, when there is an additional code in the key value, the electronic device of the receiver obtains the value in the additional code.

[0275] Next, the electronic device of the receiver looks up the data pointer in the data dictionary according to the index code in the key value.

[0276] Furthermore, when there is no conflict code and no additional code in the key value, the electronic device of the receiver obtains the stored data at the starting storage position in the data block pointed to by the data pointer, and determines it as the data shard corresponding to the key value.

[0277] Alternatively, when there is no conflict code and there is an additional code in the key value, the stored data at the starting storage position in the data block pointed to by the data pointer and the value in the additional code are determined as the data shard corresponding to the key value.

[0278] Alternatively, when there is a conflict code and there is an additional code in the key value, the electronic device of the receiver looks up the corresponding target storage position in the data block according to the sequence number obtained by adding the value of the conflict code to the sequence number of the starting storage position in the data block; the stored data in the target storage position and the value in the additional code are determined as the data shard corresponding to the key value.

[0279] Alternatively, in the case where there is a conflict code in the key value and no additional code, the sorting sequence obtained by adding the value of the conflict code to the sorting sequence in the data block according to the starting storage position is used to find the corresponding target storage position in the data block; the stored data in the target storage position is determined as the data shard corresponding to the key value.

[0280] Further, the receiving electronic device generates target transmission data based on each data shard and the sequence numbers corresponding to each key value.

[0281] In this embodiment, the index nodes and the index branches formed by the index nodes of the data dictionary are created, the stored data corresponding to each index branch in the data dictionary is configured, the index nodes of the index branches are the characters at the preset positions in each word of the stored data, the stored data corresponding to each index branch is stored, and based on the index nodes and the stored data, the data dictionary can be created in advance for use by the data sender and the data receiver.

[0282] Based on the generated data dictionary, the data sender can accurately encode the data to be transmitted, that is, obtain the data shards corresponding to the data to be transmitted, for each data shard, obtain the characters at the preset positions in each word of the data shard, obtain the character combinations corresponding to each data shard, and can represent the key information of the data shard through the character combinations. Based on the character combinations corresponding to each data shard, the key values corresponding to each data shard are determined, and the key values corresponding to each data shard are transmitted. It is possible to use the key values corresponding to the data shards to replace the data shards for transmission, which can reduce the data length and the amount of data transmitted, thereby reducing the occupation of the transmission resources of the electronic device.

[0283] The receiving party receives the transmitted data, decodes and restores the received data based on the data dictionary to obtain data shards, and thus restores the target transmission data based on the data shards, realizing the accurate restoration of the data. Moreover, the transmission between the sender and the receiver using key values to replace the real and complete data can avoid data leakage caused by plaintext transmission and improve the security of data transmission.

[0284] It should be understood that although Figures 2 - 6 the steps in the flowchart of Figures 2 - 6 are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, Figures 2 - 6 at least a part of the steps in Figures 2 - 6 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.

[0285] In one embodiment, as Figure 8 shown, a data transmission device is provided. This device can be a software module, a hardware module, or a combination of both to form part of an electronic device. Specifically, the device includes: a shard acquisition module 802, a character acquisition module 804, a determination module 806, and a transmission module 808, where:

[0286] The shard acquisition module 802 is used to acquire data shards corresponding to the data to be transmitted.

[0287] The character acquisition module 804 is used to, for each data shard, acquire characters at preset positions in each word of the data shard to obtain a character combination corresponding to each data shard.

[0288] The determination module 806 is used to determine key values corresponding to each data shard based on the character combinations corresponding to each data shard.

[0289] The transmission module 808 is used to transmit the key values corresponding to each data shard.

[0290] In this embodiment, by acquiring data shards corresponding to the data to be transmitted, and for each data shard, acquiring characters at preset positions in each word of the data shard to obtain a character combination corresponding to each data shard, the key information of the data shard can be characterized by the character combination. Based on the character combinations corresponding to each data shard, determining the key values corresponding to each data shard and transmitting the key values corresponding to each data shard can use the key values corresponding to the data shards to replace the data shards for transmission, which can reduce the data length and the amount of data transmitted, thereby reducing the occupation of the transmission resources of the electronic device. Moreover, by transmitting using the key values to replace the real and complete data, data leakage caused by plaintext transmission can be avoided, improving the security of data transmission.

[0291] In one embodiment, the determination module 806 is further used to: determine the character combinations corresponding to each data shard as the index codes corresponding to each data shard; acquire a data dictionary, and look up the conflict codes corresponding to each index code in the data dictionary; in the case where there is a corresponding conflict code for the index code, determine the index code and the corresponding conflict code as the key value of the data shard; in the case where there is no conflict code for the index code, determine the index code as the key value of the data shard.

[0292] In this embodiment, the data dictionary uses conflict codes to distinguish the same index codes. The electronic device of the sender looks up whether there is a conflict code for each index code in the data dictionary, and can accurately obtain the key value corresponding to each data shard based on the data dictionary, avoiding errors when encoding the data shards.

[0293] In one embodiment, the determining module 806 is further configured to: obtain a data dictionary, and look up a data pointer in the data dictionary according to an index code; when there are at least two stored data in the data block pointed to by the data pointer, determine the stored data among the at least two stored data that is the same as the data shard corresponding to the index code; and determine a conflict code corresponding to the index code according to the sorting sequence number of the storage location where the same stored data belongs in the data block.

[0294] In this embodiment, the data pointer of the index code in the data dictionary is determined to determine the address pointed to by the data pointer. When there are at least two stored data in the data block pointed to by the data pointer, it means that the index codes of the stored data in this data block are the same. The stored data among the at least two stored data that is the same as the data shard corresponding to the index code is determined, and the sorting sequence number of the storage location where the same stored data belongs in the data block is determined as the conflict code corresponding to the index code to ensure the accuracy of the key value of the determined data shard. Moreover, it can be considered that when there are the same index codes, the index codes are distinguished by the conflict code to avoid coding errors of the data shards.

[0295] In one embodiment, the determining module 806 is further configured to: when the storage location where the same stored data belongs is the starting storage location in the data block, not configure a conflict code for the index code; when the storage location where the same stored data belongs is not the starting storage location in the data block, determine a conflict code corresponding to the index code according to the sorting sequence number of the starting storage location in the data block and the sorting sequence number of the storage location where the same stored data belongs in the data block.

[0296] In this embodiment, when the storage location where the same stored data belongs is the starting storage location in the data block, no conflict code is configured for the index code. In the case of a non-starting storage location, the sorting sequence number of the storage location where the same stored data belongs in the data block is determined as the conflict code corresponding to the index code to accurately encode the data shards based on the settings in the data dictionary and ensure the accuracy of the key value of the determined data shard. Moreover, it is fully considered that when there are the same index codes, no conflict code is set for one of the same index codes, and a conflict code is set for other index codes, so as to distinguish the index codes and avoid inaccurate coding of the data shards.

[0297] In one embodiment, the determining module 806 is further configured to: when there is a numerical value in the data shard, configure the numerical value as an additional code of the data shard; and determine the key value corresponding to each data shard based on the character combination corresponding to each data shard and the corresponding additional code.

[0298] In this embodiment, when there is a numerical value in a data shard, the numerical value is configured as an additional code for the data shard. Based on the character combination corresponding to each data shard and the corresponding additional code, the key value corresponding to each data shard is determined, and the words and numerical values in the data shard can be accurately and completely represented by the index code and the additional code, thereby realizing the secure transmission of the data to be transmitted.

[0299] In one embodiment, the sharding acquisition module 802 is further configured to: acquire the data to be transmitted, divide the data to be transmitted to obtain each data shard; and configure a serial number for each data shard according to the position of each data shard in the data to be transmitted.

[0300] The transmission module 808 is further configured to: transmit the key value corresponding to each data shard and the corresponding serial number.

[0301] In this embodiment, the data to be transmitted is divided to obtain each data shard, and the corresponding serial number is configured based on the position of the data shard in the data to be transmitted, and the key value and the serial number are transmitted, so that when the receiving party receives the data, it can determine the positional relationship of each data shard based on the serial number, thereby accurately restoring the data.

[0302] In one embodiment, as Figure 9 shown, a data transmission device is provided. The device can be a software module or a hardware module, or a combination of both to be part of an electronic device. The device specifically includes: a receiving module 902, an acquisition module 904, and a generation module 906, where:

[0303] The receiving module 902 is configured to receive data and obtain a key value from the received data; the key value is determined according to the character combination corresponding to the data shard of the data to be transmitted, and the character combination is obtained based on the characters at preset positions in each word of the data shard.

[0304] The acquisition module 904 is configured to acquire a data dictionary and obtain the data shard corresponding to each key value from the data dictionary.

[0305] The generation module 906 is configured to generate target transmission data based on each data shard.

[0306] In this embodiment, the sender encodes the data shards of the data to be transmitted based on the data dictionary so as to use the key value to replace the data shard for transmission, which can reduce the amount of data transmitted, thereby saving resources. The receiving party receives the transmitted data, decodes and restores the received data based on the data dictionary to obtain the data shard, and then restores the target transmission data based on the data shard, realizing the accurate transmission of the data. Moreover, by using the key value to replace the real and complete data for transmission, it can avoid data leakage caused by plaintext transmission and improve the security of data transmission.

[0307] In one embodiment, the key value includes an index code; the obtaining module 904 is further configured to: look up a data pointer in a data dictionary according to the index code in the key value; obtain a data shard corresponding to the index code from the data block pointed to by the data pointer.

[0308] In this embodiment, by determining the data pointer of the index code in the data dictionary to determine the data block pointed to by the data pointer, the storage address of the data shard corresponding to the index code can be initially determined, so as to obtain the data shard from this storage address.

[0309] In one embodiment, the obtaining module 904 is further configured to: in the case where there is no conflict code in the key value, obtain the stored data at the starting storage position in the data block pointed to by the data pointer, and determine it as the data shard corresponding to the key value; in the case where there is a conflict code in the key value, determine the stored data in the storage position corresponding to the conflict code in the data block pointed to by the data pointer as the data shard corresponding to the key value.

[0310] In this embodiment, in the case where there is no conflict code in the key value, the stored data at the starting storage position in the data block is used as the data shard corresponding to the key value; in the case where there is a conflict code in the key value, the stored data in the storage position corresponding to the conflict code in the data block is determined as the data shard corresponding to the key value, so that the data shard of the same key value can be accurately determined according to the two elements of the index code and the conflict code, and thus the key value can be accurately restored to the data shard.

[0311] In one embodiment, the obtaining module 904 is further configured to: in the case where there is a conflict code in the key value, determine the stored data in the storage position in the data block whose sorting serial number is the same as the value of the conflict code as the data shard corresponding to the key value; there are at least two storage positions in the data block pointed to by the data pointer.

[0312] In this embodiment, there is a corresponding conflict code for each storage position in the data block including the starting storage position, and the value in the conflict code corresponding to each storage position is the same as the sorting serial number of the storage position in the data block. Then, by determining the storage position whose sorting serial number is the same as the value in the conflict code of the key value, the storage position of the data shard corresponding to the key value can be accurately obtained, so as to accurately obtain the data shard corresponding to the key value.

[0313] In one embodiment, the obtaining module 904 is further configured to: in the case where there is a conflict code in the key value, look up the corresponding target storage position in the data block according to the sorting serial number obtained by adding the value of the conflict code to the sorting serial number of the starting storage position in the data block; determine the stored data in the target storage position as the data shard corresponding to the key value.

[0314] In this embodiment, there is no corresponding conflict code at the starting storage position in the data block. For other storage positions except the starting storage position, there are corresponding conflict codes. By looking up the target storage position in the data block according to the sorting serial number obtained by adding the value of the conflict code to the sorting serial number of the starting storage position in the data block, the storage position of the data shard corresponding to the key value to which the conflict code belongs can be accurately found. The stored data in the target storage position is determined as the data shard corresponding to the key value, so as to accurately obtain the data shard.

[0315] In one embodiment, the obtaining module 904 is further configured to: when there is an additional code in the key value, obtain the value in the additional code; obtain a data dictionary, and obtain the stored data corresponding to the key value from the data dictionary; determine the value in the additional code of the key value and the corresponding stored data as the data shard corresponding to the key value; when there is no additional code in the key value, determine the stored data obtained from the data dictionary corresponding to the key value as the data shard corresponding to the key value.

[0316] In this embodiment, for a key value with an additional code, in addition to obtaining the corresponding stored data from the data dictionary, it is also necessary to restore the value in the additional code to make the obtained data shard complete and accurate, so as to avoid data omission and ensure the integrity and accuracy of the data.

[0317] In one embodiment, as Figure 10 shown, a data dictionary generation device is provided. The device can be a software module, a hardware module, or a combination of the two to form a part of an electronic device. The device specifically includes: a creation module 1002, a configuration module 1004, and a storage module 1006, where:

[0318] The creation module 1002 is configured to create an index node of the data dictionary and an index branch formed by the index nodes.

[0319] The configuration module 1004 is configured to configure the stored data corresponding to each index branch in the data dictionary. The index node of the index branch is the character at a preset position in each word of the stored data.

[0320] The storage module 1006 is configured to store the stored data corresponding to each index branch, and obtain a data dictionary based on the index node and the stored data.

[0321] In this embodiment, an index node of a data dictionary and an index branch formed by the index nodes are created, the stored data corresponding to each index branch in the data dictionary is configured, the index node of the index branch is a character at a preset position in each word of the stored data, the stored data corresponding to each index branch is stored, and a data dictionary can be generated based on the index node and the stored data. Based on the generated data dictionary, the data sender can accurately encode the data to be transmitted, so as to reduce the amount of transmitted data and improve the security of data transmission, while the data receiver can accurately restore the data based on the data dictionary.

[0322] In one embodiment, the storage module 1006 is further configured to: when there is one piece of stored data in an index branch, store the stored data in the data block pointed to by the index branch; when there are at least two pieces of stored data corresponding to the same index branch, divide at least two storage positions in the data block of the data dictionary and store at least two pieces of stored data in the at least two storage positions in sequence; the data block pointed to by the same index branch corresponds to the stored data, and the characters at the preset positions in each word of at least two pieces of stored data are the same.

[0323] In this embodiment, when there is one piece of stored data in an index branch, the stored data can be directly stored in the data block pointed to by the index branch. When there are at least two pieces of stored data corresponding to the same index branch, at least two storage positions are divided in the data block to store at least two pieces of stored data respectively, so that the stored data can be stored separately to avoid confusion in the storage of each piece of stored data. Moreover, storing the stored data separately can ensure the accuracy of data encoding by the sender based on the data dictionary and the accuracy of data restoration by the receiver based on the data dictionary.

[0324] In one embodiment, the data dictionary includes an index area and a data area, the index area contains index branches formed by index nodes, and the data area contains data blocks; at least two storage positions for storing at least two pieces of stored data are consecutive in the data blocks of the data area.

[0325] In this embodiment, the data dictionary includes an index area and a data area. Through the index area, the index branch can be found, so that the stored data can be quickly obtained from the data block in the data area pointed to by the index branch.

[0326] In one embodiment, the index node includes a root node and a child node;

[0327] The creation module 1002 is further configured to: create a root node in the index area of the data dictionary; obtain the sample data shards in the first candidate set, and obtain the characters at the preset positions in each word of the sample data shards to obtain a sample character combination; sequentially connect the root node and the child nodes represented by the characters in the sample character combination to obtain an index branch; the root node and the child nodes represented by the characters in the character combination are used as nodes at different levels in the index branch, and the root node and the child nodes point to the child nodes at the next level; traverse the sample data shards in the first candidate set until an index branch formed by the last sample data shard and the root node is obtained.

[0328] The configuration module 1004 is further configured to configure the sample data shards corresponding to each index branch as the stored data corresponding to each index branch.

[0329] In this embodiment, by creating a root node, obtaining the characters at the preset positions in each word of the sample data shards in the first candidate set to obtain a sample character combination, and sequentially connecting the root node and the child nodes represented by the characters in the sample character combination to obtain an index branch, an index branch corresponding to the sample data shards can be formed. The data volume of the data dictionary generated thereby is relatively small, and the empty nodes are also relatively few, so that data search with a small data volume is faster and more accurate.

[0330] In one embodiment, the creation module 1002 is further configured to: create a root node in the index area of the data dictionary.

[0331] Obtain the characters in the second candidate set, sequentially use the child nodes represented by the characters in the second candidate set as the child nodes of the root node, and then sequentially use the child nodes represented by the characters in the second candidate set as the child nodes at the next level of the child nodes until the child nodes at the last level are obtained; the root node and the child nodes point to the child nodes at the next level; based on the child nodes and the root node at different levels, obtain an index branch.

[0332] In this embodiment, by creating a root node and using the child nodes represented by the characters in the second candidate set as the child nodes of the root node and each child node, it can be ensured that all nodes except the leaf nodes have child nodes, covering the index branches formed by various characters, and making the index branches of the created data dictionary rich and complete. The data volume of the data dictionary generated thereby is large, and it is faster and more accurate when performing a large number of data searches.

[0333] The division of each module in the above data transmission and data dictionary generation device is only for illustrative purposes. In other embodiments, the data transmission and data dictionary generation device can be divided into different modules as needed to complete all or part of the functions of the above data transmission and data dictionary generation device.

[0334] For the specific limitations on the data transmission and data dictionary generation device, reference can be made to the limitations on the data transmission and data dictionary generation method in the above text, which will not be elaborated here. Each module in the above data transmission and data dictionary generation device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above modules can be embedded in the processor of the electronic device in hardware form or be independent of it, or can be stored in the memory of the electronic device in software form, so as to facilitate the processor to call and execute the operations corresponding to each of the above modules.

[0335] Figure 11 FIG. is a schematic internal structure diagram of an electronic device in an embodiment. As Figure 11 shown, the electronic device includes a processor and a memory connected through a system bus. Among them, the processor is used to provide computing and control capabilities to support the operation of the entire electronic device. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement the data transmission and data dictionary generation methods provided in the following various embodiments. The internal memory provides a high-speed cache operating environment for the operating system computer program in the non-volatile storage medium. The electronic device can be any terminal device such as a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, a wearable device, etc.

[0336] In the embodiments of the present application, the implementation of each module in the data transmission and data dictionary generation device can be in the form of a computer program. The computer program can run on a terminal or a server. The program module constituted by the computer program can be stored in the memory of the electronic device. When the computer program is executed by the processor, the steps of the method described in the embodiments of the present application are implemented.

[0337] The embodiments of the present application also provide a computer-readable storage medium. One or more non-volatile computer-readable storage media containing computer-executable instructions, when the computer-executable instructions are executed by one or more processors, cause the processors to execute the steps of the data transmission and data dictionary generation methods.

[0338] A computer program product containing instructions, when it runs on a computer, causes the computer to execute the data transmission and data dictionary generation methods.

[0339] Any reference to memory, storage, database, or other media used in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which serves as an external cache. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct Rambus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM).

[0340] The above-described embodiments merely represent several implementation manners of this application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation to the patent scope of this application. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of the patent of this application shall be subject to the appended claims.

Claims

1. A data transmission method, characterized in that, Including: Obtain data shards corresponding to the data to be transmitted; For each data shard, obtain the characters at the preset positions in each word of the data shard to obtain a character combination corresponding to each data shard; Based on the character combinations corresponding to the respective data shards, determine the key values corresponding to the respective data shards; Transmit the key values corresponding to the respective data shards; The determining the key values corresponding to the respective data shards based on the character combinations corresponding to the respective data shards includes: Determine the character combinations corresponding to the respective data shards as the index codes corresponding to the respective data shards; Obtain a data dictionary, and look up the conflict codes corresponding to the respective index codes from the data dictionary; When there is a conflict code corresponding to the index code, determine the index code and the corresponding conflict code as the key value of the data shard; When there is no conflict code for the index code, determine the index code as the key value of the data shard.

2. The method according to claim 1, wherein The obtaining a data dictionary and looking up the conflict codes corresponding to the respective index codes from the data dictionary includes: Obtain a data dictionary, and look up a data pointer in the data dictionary according to the index code; When there are at least two stored data in the data block pointed to by the data pointer, determine the stored data that is the same as the data shard corresponding to the index code among the at least two stored data; According to the sorting serial number of the storage position where the same stored data belongs in the data block, determine the conflict code corresponding to the index code.

3. The method according to claim 2, characterized in that, The determining the conflict code corresponding to the index code according to the sorting serial number of the storage position where the same stored data belongs in the data block includes: When the storage position where the same stored data belongs is the starting storage position in the data block, do not configure a conflict code for the index code; When the storage position where the same stored data belongs is not the starting storage position in the data block, determine the conflict code corresponding to the index code according to the sorting serial number of the starting storage position in the data block and the sorting serial number of the storage position where the same stored data belongs in the data block.

4. The method according to claim 1, wherein The method further includes: When there is a numerical value in the data shard, configure the numerical value as an additional code of the data shard; The determining the key values corresponding to the respective data shards based on the character combinations corresponding to the respective data shards includes: Based on the character combinations corresponding to the respective data shards and the corresponding additional codes, determine the key values corresponding to the respective data shards.

5. The method according to any one of claims 1 to 4, characterized in that The obtaining the data shards corresponding to the data to be transmitted includes: Obtain the data to be transmitted, and divide the data to be transmitted to obtain each data shard; The method further includes: Configure serial numbers for the respective data shards according to the positions of the respective data shards in the data to be transmitted; The transmitting the key values corresponding to the respective data shards includes: Transmit the key values corresponding to the respective data shards and the corresponding serial numbers.

6. A data transmission method, characterized in that, Including: Receive data, and obtain key values from the received data; The key values are determined according to the character combinations corresponding to the data shards of the data to be transmitted, and the character combinations are obtained based on the characters at the preset positions in each word of the data shards; Obtain a data dictionary, and obtain data shards corresponding to each key value from the data dictionary; Generate target transmission data based on each data shard; The key value includes an index code; The obtaining data shards corresponding to each key value from the data dictionary includes: Search for a data pointer in the data dictionary according to the index code in the key value; In the case where there is no conflict code in the key value, obtain the stored data at the starting storage position in the data block pointed to by the data pointer, and determine it as the data shard corresponding to the key value; In the case where there is a conflict code in the key value, determine the stored data in the storage position corresponding to the conflict code in the data block pointed to by the data pointer as the data shard corresponding to the key value.

7. The method according to claim 6, characterized in that, The case where in the case where there is a conflict code in the key value, determine the stored data in the storage position corresponding to the conflict code in the data block pointed to by the data pointer as the data shard corresponding to the key value includes: In the case where there is a conflict code in the key value, determine the stored data in the storage position whose sorting number in the data block is the same as the value of the conflict code as the data shard corresponding to the key value; there are at least two storage positions in the data block pointed to by the data pointer.

8. The method according to claim 6, wherein The case where in the case where there is a conflict code in the key value, determine the stored data in the storage position corresponding to the conflict code in the data block pointed to by the data pointer as the data shard corresponding to the key value includes: In the case where there is a conflict code in the key value, find the corresponding target storage position in the data block according to the sorting number obtained by adding the value of the conflict code to the sorting number of the starting storage position in the data block; Determine the stored data in the target storage position as the data shard corresponding to the key value.

9. The method according to claim 6, characterized in that, The obtaining data shards corresponding to each key value from the data dictionary includes: In the case where there is an additional code in the key value, obtain the value in the additional code; Obtain a data dictionary, and obtain the stored data corresponding to the key value from the data dictionary; Determine the value in the additional code of the key value and the corresponding stored data as the data shard corresponding to the key value; In the case where there is no additional code in the key value, determine the stored data obtained from the data dictionary corresponding to the key value as the data shard corresponding to the key value.

10. A method for generating a data dictionary, characterized in that, Includes: Create index nodes of the data dictionary and index branches formed by the index nodes; Configure the stored data corresponding to each index branch in the data dictionary, and the index node of the index branch is the character at a preset position in each word of the stored data; Store the stored data corresponding to each index branch, and obtain the data dictionary based on the index node and the stored data; The storing the stored data corresponding to each index branch includes: In the case where there is one stored data in the index branch, store the stored data in the data block pointed to by the index branch; When there are at least two stored data corresponding to the same index branch, at least two storage locations are divided in the data block of the data dictionary, and the at least two stored data are sequentially stored in the at least two storage locations; the same index branch points to the data block to which the corresponding stored data belongs, and the characters at the preset positions in each word of the at least two stored data are the same.

11. The method according to claim 10, wherein, The data dictionary includes an index area and a data area. The index area contains index branches composed of the index nodes, and the data area contains the data blocks; the at least two storage locations for storing the at least two stored data are consecutive in the data blocks of the data area.

12. The method according to any one of claims 10 to 11, characterized in that, The index node includes a root node and a child node; the creation of the index nodes of the data dictionary and the index branches formed by the index nodes includes: Create a root node in the index area of the data dictionary; Obtain the sample data shards in the first candidate set, and obtain the characters at the preset positions in each word of the sample data shards to obtain a sample character combination; Connect the root node and the child nodes represented by the characters in the sample character combination in sequence to obtain an index branch; the root node and the characters in the character combination that represent the child nodes are used as nodes at different levels in the index branch, and the root node and the child nodes point to the child nodes at the next level; Traverse the sample data shards in the first candidate set until an index branch formed by the last sample data shard and the root node is obtained; The configuration of the stored data corresponding to each index branch in the data dictionary includes: Configure the sample data shards corresponding to each index branch as the stored data corresponding to each index branch.

13. The method according to any one of claims 10 to 11, characterized in that, The index node includes a root node and a child node; the creation of the index nodes of the data dictionary and the index branches formed by the index nodes includes: Create a root node in the index area of the data dictionary; Obtain each character in the second candidate set, and sequentially use the child nodes represented by each character in the second candidate set as the child nodes of the root node, and then sequentially use the child nodes represented by each character in the second candidate set as the child nodes at the next level of the child nodes until the last level of child nodes is obtained; the root node and the child nodes point to the child nodes at the next level; Obtain an index branch based on the child nodes and the root node at different levels.

14. A data transmission device, characterized in that, Includes: A sharding acquisition module for acquiring data shards corresponding to the data to be transmitted; A character acquisition module for, for each data shard, acquiring the characters at the preset positions in each word of the data shard to obtain a character combination corresponding to each data shard; A determination module, configured to determine key values corresponding to the respective data shards based on the character combinations corresponding to the respective data shards, including: determining the character combinations corresponding to the respective data shards as index codes corresponding to the respective data shards; obtaining a data dictionary, and looking up conflict codes corresponding to the respective index codes from the data dictionary; in the case where a conflict code corresponding to an index code exists, determining the index code and the corresponding conflict code as the key value of the data shard; in the case where no conflict code exists for the index code, determining the index code as the key value of the data shard; A transmission module, configured to transmit the key values corresponding to the respective data shards.

15. A data transmission device, characterized in that, including: A receiving module, configured to receive data and obtain a key value from the received data; The key value is determined based on the character combination corresponding to the data shard of the data to be transmitted, and the character combination is obtained based on the characters at preset positions in each word of the data shard; An obtaining module, configured to obtain a data dictionary and obtain data shards corresponding to the respective key values from the data dictionary, including: looking up a data pointer in the data dictionary according to the index code in the key value; in the case where no conflict code exists in the key value, obtaining the stored data at the starting storage position in the data block pointed to by the data pointer and determining it as the data shard corresponding to the key value; in the case where a conflict code exists in the key value, determining the stored data at the storage position corresponding to the conflict code in the data block pointed to by the data pointer as the data shard corresponding to the key value; A generating module, configured to generate target transmission data based on the respective data shards.

16. A data dictionary generation device, characterized in that including: A creating module, configured to create index nodes of the data dictionary and index branches formed by the index nodes; A configuring module, configured to configure the stored data corresponding to each index branch in the data dictionary, and the index node of the index branch is the character at the preset position in each word of the stored data; A storing module, configured to store the stored data corresponding to each index branch, and obtain the data dictionary based on the index nodes and the stored data; It is also configured to, in the case where there is one stored data in the index branch, store the stored data in the data block pointed to by the index branch; in the case where there are at least two stored data corresponding to the same index branch, divide at least two storage positions in the data block of the data dictionary and store the at least two stored data in the at least two storage positions in sequence; The data blocks corresponding to the stored data pointed to by the same index branch, and the characters at the preset positions in each word of the at least two stored data are the same.

17. An electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 13.

18. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 13.

19. A computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Character string dictionary indexing method and system

    CN103699647A