Coding and decoding method, device, computer equipment and readable storage medium
By converting non-hexadecimal characters in object encoding into conversion encoding and identifiers in the RFID system, and directly saving them in the EPC module and cache components, the problem of inefficient object encoding recognition caused by mapping tables in the prior art is solved, and more efficient and accurate object encoding acquisition is achieved.
Patent Information
- Application Number
- CN202110870514.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-30
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2041-07-30
AI Technical Summary
In the existing RFID system, due to the huge amount of mapping table data, mapping errors between the identification tag and object encoding are inefficient.
By obtaining non-hexadecimal original characters in the object encoding, performing static table conversion, generating conversion encoding and conversion identifiers, and saving the binary code in the EPC module, and saving the conversion identifiers in the cache component, avoiding the use of mapping tables.
It improves the efficiency and accuracy of object encoding acquisition, reduces object encoding maintenance costs, and avoids error recognition problems caused by mapping table errors.
Smart Images

Figure CN113630122B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud storage technology of cloud technology, and in particular to an encoding and decoding method, device, computer equipment and readable storage medium. Background Art
[0002] Object codes are used as unique identifiers of target objects, such as asset information tags, SN codes, etc., and are widely set on various products. Since only binary codes can be recorded in the EPC module of the current RFID system, binary codes are generally used as identification tags of target objects, and a mapping table with a large amount of data is maintained in the terminal to associate the identification tag with the object code. The RFID system obtains the binary code after scanning the identification tag and saves it in the EPC module. When the terminal needs to obtain the object code of the currently scanned target object, it needs to obtain the binary code, i.e., the identification tag, from the EPC module, and then obtain the object code corresponding to the identification tag through the mapping table.
[0003] However, as the number of products increases, the amount of data in the mapping table becomes larger and larger, making the mapping table difficult to maintain. Not only is it easy to cause mapping errors between identification tags and object codes, which in turn causes the terminal to obtain the wrong object code, but the object code recognition efficiency is also low due to the need to frequently call the mapping table with a large amount of data. Summary of the invention
[0004] The purpose of the present invention is to provide an encoding and decoding method, apparatus, computer equipment and readable storage medium, which are used to solve the problem that the mapping table in the prior art is difficult to maintain, which not only easily causes mapping errors between identification tags and object codes, resulting in the terminal obtaining incorrect object codes, but also causes low efficiency in object code recognition due to the need to frequently call mapping tables with huge data volumes.
[0005] To achieve the above object, the present invention provides an encoding and decoding method, comprising:
[0006] Obtaining an object code, setting an original character in the object code that does not belong to the hexadecimal code as a to-be-converted character, converting the to-be-converted character into a conversion character through a preset static table to obtain a conversion code, and obtaining a conversion identifier according to the position of the to-be-converted character in the object code; wherein the object code is composed of at least one original character, and the conversion code is composed of at least one original character and / or at least one conversion character;
[0007] Performing binary conversion on the conversion code to obtain a binary code, associating the conversion identifier with the binary code, saving the binary code to a preset EPC module, and saving the conversion identifier to a preset cache component;
[0008] According to the received decoding request, a binary code is obtained from the EPC module, the binary code is converted into hexadecimal to obtain a conversion set, a conversion identifier associated with the binary code is obtained from the cache component, and according to the conversion identifier, the conversion characters in the conversion set are converted into original characters to obtain the object encoding.
[0009] In the above solution, before obtaining the object code, the method further includes:
[0010] A communication connection is established with a preset radio frequency device to receive an object signal sent by the radio frequency device and representing a unique identifier of a target object, and perform analog-to-digital conversion on the object signal to obtain an object code.
[0011] In the above scheme, the original characters in the object code that do not belong to the hexadecimal code are set as characters to be converted, and the characters to be converted are converted into conversion characters through a preset static table to obtain a conversion code, including:
[0012] Segmenting the object code to form an original set consisting of at least one original string, wherein the original string has at least one original character;
[0013] Determine whether the coded character in the original string belongs to hexadecimal encoding; if so, determine that the coded character is a direct conversion character; if not, determine that the coded character is a character to be converted;
[0014] Determine whether the identification string of the original string contains the character to be converted; if so, obtain the conversion character corresponding to the character to be converted from the static table, and replace the character to be converted in the original string with the conversion character to obtain a conversion string; if not, set the original string as the conversion string;
[0015] The conversion strings are aggregated to form a conversion code.
[0016] In the above solution, obtaining the conversion identifier according to the position of the character to be converted in the object code includes:
[0017] Assigning a direct conversion value to the direct conversion characters in the original string, and assigning a conversion value to the characters to be converted, and summing up the direct conversion values and the conversion values to obtain an identification string of the original string, wherein the identification string is a character string consisting of the direct conversion values and / or the conversion values;
[0018] Performing hexadecimal conversion on the identification string to obtain an identification character, and associating the identification character with the conversion string;
[0019] The identification characters are aggregated to obtain the conversion identifier.
[0020] In the above scheme, the binary conversion of the conversion code to obtain a binary code, associating the conversion identifier with the binary code, saving the binary code to a preset EPC module, and saving the conversion identifier to a preset cache component include:
[0021] Extracting a conversion string in the conversion code, performing binary conversion on the conversion string to obtain a binary string, and summarizing the binary string to obtain the binary code;
[0022] The binary code is stored in a preset EPC module, and a module address of the binary code in the EPC module is obtained;
[0023] Cache the conversion identifier in a preset cache component, and obtain the component address where the conversion identifier is stored in the cache component;
[0024] The component address and the module address are entered into a conversion table preset in the cache component, and a mapping relationship is constructed between the component address and the module address to associate the binary code with the conversion identifier.
[0025] In the above solution, before obtaining the binary code from the EPC module according to the received decoding request, the method further includes:
[0026] A communication connection is established with a preset terminal to receive a decoding request sent by the terminal for decoding the binary code and obtaining the object code.
[0027] In the above solution, the hexadecimal conversion of the binary code to obtain a conversion set includes:
[0028] Convert the binary code into hexadecimal to obtain a conversion code;
[0029] Dividing the conversion code into at least one conversion string, and summarizing the conversion strings to obtain a conversion set; wherein the conversion string has at least one conversion character;
[0030] The acquiring the conversion identifier associated with the binary code from the cache component, and converting the conversion characters in the conversion set into original characters according to the conversion identifier to obtain the object encoding, comprises:
[0031] According to the conversion table, a conversion identifier associated with the binary code is obtained from the cache component, the conversion identifier is binary converted to obtain a conversion identifier set, and a conversion string and an identifier string having a corresponding relationship are obtained from the conversion set and the conversion identifier set; wherein the conversion identifier set is composed of at least one identifier string, and the identifier string is composed of a direct conversion value and / or a conversion value;
[0032] Perform binary conversion on the identification character to obtain an identification string, and determine whether the identification string contains a conversion value; if so, identify the conversion value in the identification string, and convert the conversion character corresponding to the conversion value in the conversion string into an original character according to the static table to obtain an original string; if not, set the conversion string to be the original string;
[0033] Aggregating the original strings to form an object code;
[0034] After aggregating the original strings to form the object code, the method further includes:
[0035] The object code is uploaded to the blockchain.
[0036] To achieve the above object, the present invention further provides an encoding and decoding device, comprising:
[0037] a conversion module, used for obtaining an object code, setting an original character in the object code that does not belong to the hexadecimal code as a character to be converted, converting the character to be converted into a conversion character through a preset static table to obtain a conversion code, and obtaining a conversion identifier according to the position of the character to be converted in the object code; wherein the object code is composed of at least one original character, and the conversion code is composed of at least one original character and / or at least one conversion character;
[0038] an encoding module, configured to perform binary conversion on the conversion code to obtain a binary code, associate the conversion identifier with the binary code, save the binary code to a preset EPC module, and save the conversion identifier to a preset cache component;
[0039] A decoding module is used to obtain a binary code from the EPC module according to a received decoding request, perform hexadecimal conversion on the binary code to obtain a conversion set, obtain a conversion identifier associated with the binary code from the cache component, and convert conversion characters in the conversion set into original characters according to the conversion identifier to obtain the object encoding.
[0040] To achieve the above objectives, the present invention also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor of the computer device implements the steps of the above encoding and decoding methods when executing the computer program.
[0041] To achieve the above objectives, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program stored in the computer-readable storage medium is executed by a processor, the steps of the above encoding and decoding methods are implemented.
[0042] The encoding and decoding method, device, computer equipment and readable storage medium provided by the present invention identify the original characters that do not belong to the hexadecimal code in the object code and set them as the characters to be converted, and convert the characters to be converted in the object code into conversion characters through a static table to obtain the conversion code, so that the characters to be converted will become conversion characters that can be converted into hexadecimal codes, and the conversion characters greatly reduce the memory occupation of the generated binary characters because they belong to the hexadecimal code; by associating the conversion identifier with the binary code, the conversion identifier can accurately mark the position of the conversion character corresponding to the binary code, thereby ensuring that the binary code can accurately correspond to the object code; by directly obtaining the binary code from the EPC module and converting it, the object code is directly obtained, avoiding the use of the mapping table, thereby eliminating the current need to construct a mapping table with a large amount of data, resulting in low efficiency in object code recognition of the target object due to calling the mapping table, as well as the high cost caused by the large amount of data in maintaining the mapping table and the occurrence of the terminal obtaining the wrong object code due to the mapping error, thereby improving the efficiency and accuracy of object code acquisition and reducing the object code maintenance cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 This is a flow chart of Embodiment 1 of the encoding and decoding method of the present invention;
[0044] Figure 2 This is a schematic diagram of an environmental application of the encoding and decoding method in Embodiment 2 of the encoding and decoding method of the present invention;
[0045] Figure 3 is a specific method flow chart of the encoding and decoding method in Embodiment 2 of the encoding and decoding method of the present invention;
[0046] Figure 4 This is a schematic diagram of program modules of Embodiment 3 of the encoding and decoding device of the present invention;
[0047] Figure 5 Schematic diagram of the hardware structure of the computer device in the fourth embodiment of the computer device of the present invention. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0049] The encoding and decoding method, device, computer equipment and readable storage medium provided by the present invention are applicable to the cloud storage technology field of cloud technology, and provide an encoding and decoding method based on a conversion module, an encoding module and a decoding module. The present invention obtains an object code, sets the original characters in the object code that do not belong to the hexadecimal code as characters to be converted, converts the characters to be converted into conversion characters through a preset static table to obtain a conversion code, and obtains a conversion identifier according to the position of the characters to be converted in the object code; performs binary conversion on the conversion code to obtain a binary code, associates the conversion identifier with the binary code, saves the binary code to a preset EPC module, and saves the conversion identifier to a preset cache component; obtains a binary code from the EPC module according to a received decoding request, performs hexadecimal conversion on the binary code to obtain a conversion set, obtains a conversion identifier associated with the binary code from the cache component, and converts the conversion characters in the conversion set into original characters according to the conversion identifier to obtain the object code.
[0050] Embodiment 1:
[0051] See also Figure 1 , a coding and decoding method of this embodiment, running in an RFID system, includes:
[0052] S102: Obtain an object code, set original characters in the object code that do not belong to the hexadecimal code as characters to be converted, convert the characters to be converted into conversion characters through a preset static table to obtain a conversion code, and obtain a conversion identifier according to the position of the characters to be converted in the object code; wherein the object code is composed of at least one original character, and the conversion code is composed of at least one original character and / or at least one conversion character.
[0053] S103: performing binary conversion on the conversion code to obtain a binary code, associating the conversion identifier with the binary code, saving the binary code to a preset EPC module, and saving the conversion identifier to a preset cache component.
[0054] S105: Obtain a binary code from the EPC module according to the received decoding request, perform hexadecimal conversion on the binary code to obtain a conversion set, obtain a conversion identifier associated with the binary code from the cache component, and convert conversion characters in the conversion set into original characters according to the conversion identifier to obtain the object encoding.
[0055] In an exemplary embodiment, an object code is obtained through an RFID system, wherein the object code has at least one coded character, and in this embodiment, the object code is a radio frequency identification (RFID) tag. Since the original characters that cannot be converted into hexadecimal will generate binary codes with very high memory usage once they are directly converted into binary, the original characters that do not belong to the hexadecimal code in the object code are identified and set as the characters to be converted, and the characters to be converted in the object code are converted into conversion characters through the static table to obtain the conversion code, so that the characters to be converted will become conversion characters that can be converted into hexadecimal code, and the conversion characters greatly reduce the memory usage of the generated binary characters because they belong to the hexadecimal code.
[0056] By associating the conversion identifier with the binary code, the conversion identifier can accurately mark the position of the conversion character corresponding to the binary code, thereby ensuring that the binary code can accurately correspond to the object code.
[0057] By directly acquiring binary code from the EPC module and parsing it to obtain a conversion set, and converting the conversion characters in the conversion set into original characters according to the conversion identifier associated with the binary code, the object code can be directly obtained. Compared with the current method of obtaining the object code of the target object through a mapping table, the use of a mapping table is avoided, thereby eliminating the current need to construct a mapping table with a huge amount of data, resulting in low efficiency in object code recognition of the target object due to calling the mapping table, high costs due to the huge amount of data in maintaining the mapping table, and the occurrence of the terminal obtaining the wrong object code due to mapping errors, thereby improving the efficiency and accuracy of object code acquisition and reducing the cost of object code maintenance.
[0058] Embodiment 2:
[0059] This embodiment is a specific application scenario of the above-mentioned embodiment 1. Through this embodiment, the method provided by the present invention can be explained more clearly and specifically.
[0060] In the following, the method provided in this embodiment is specifically described by taking, in an RFID system running an encoding and decoding method, identifying and converting original characters in an object code that do not belong to a hexadecimal code, and obtaining a binary code and a conversion identifier according to the converted object code, and converting the binary code to obtain a conversion set and obtaining the object code according to the conversion identifier as an example. It should be noted that this embodiment is only exemplary and does not limit the scope of protection of the embodiment of the present invention.
[0061] Figure 2 The following is a schematic diagram showing an environmental application of the encoding and decoding method according to the second embodiment of the present application.
[0062] In an exemplary embodiment, the RFID system 2 in which the encoding and decoding method is located is connected to the radio frequency device 3 and the terminal 4 respectively through a network; the RFID system 2 can provide services through one or more networks, and the network can include various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices and / or the like. The network can include physical links, such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof and / or the like. The network can include wireless links, such as cellular links, satellite links, Wi-Fi links and / or the like; the terminal 4 can be a computer device such as a cloud server, a master control server, a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.
[0063] Figure 3 It is a specific method flow chart of an encoding and decoding method provided by an embodiment of the present invention, and the method specifically includes steps S201 to S205.
[0064] S201: Establishing a communication connection with a preset radio frequency device to receive an object signal sent by the radio frequency device and representing a unique identifier of a target object; performing analog-to-digital conversion on the object signal to obtain an object code.
[0065] In this step, the RFID system is a radio frequency identification system, which is a contactless automatic identification system that automatically identifies the target object through radio frequency wireless signals and obtains relevant data. It is composed of electronic tags, readers and computer networks. The radio frequency device is a scanning device used to scan the object code on the target object according to the radio frequency wireless signal and generate an electrical signal.
[0066] The object signal is converted into an object code by a preset analog-to-digital conversion module, wherein the analog-to-digital converter refers to an analog-to-digital converter. An analog-to-digital converter, also known as an A / D converter, or ADC for short, generally refers to an electronic component that converts an analog signal into a digital signal. A common analog-to-digital converter converts an input voltage signal into an output digital signal.
[0067] The object code is an SN code, where the SN code is the abbreviation of Serial Number, sometimes also called SerialNo, that is, the product serial number. The product serial number is a concept introduced to verify the "legal identity of the product". It is used to protect the user's genuine rights and interests and enjoy legal services; a set of genuine products only corresponds to one set of product serial numbers, for example: 16PS************.
[0068] S202: Obtain an object code, set original characters in the object code that do not belong to the hexadecimal code as characters to be converted, convert the characters to be converted into conversion characters through a preset static table to obtain a conversion code, and obtain a conversion identifier according to the position of the characters to be converted in the object code; wherein the object code is composed of at least one original character, and the conversion code is composed of at least one original character and / or at least one conversion character.
[0069] In order to identify the original characters that cannot be converted into hexadecimal codes and convert them into conversion characters that can be converted into hexadecimal codes, all characters in the obtained conversion codes can be converted into hexadecimal codes, thereby reducing the memory space occupied by the binary characters obtained by the conversion code during binary conversion. In this step, the object code is obtained through the RFID system, wherein the object code has at least one coded character. In this embodiment, the object code is a radio frequency identification (RFID) tag. Since the original characters that cannot be converted into hexadecimal codes will generate binary codes with very high memory usage once they are directly converted into binary, therefore, by identifying the original characters that do not belong to the hexadecimal code in the object code and setting them as the characters to be converted, and converting the characters to be converted in the object code into conversion characters through the static table to obtain the conversion code, the characters to be converted will become conversion characters that can be converted into hexadecimal codes, and the conversion characters greatly reduce the memory usage of the generated binary characters because they belong to the hexadecimal code.
[0070] In a preferred embodiment, setting the original characters in the object code that are not hexadecimal codes as characters to be converted, and converting the characters to be converted into conversion characters to obtain conversion codes through a preset static table includes:
[0071] S21: Segment the object code to form an original set consisting of at least one original string, wherein the original string has at least one original character.
[0072] In this step, the object code is segmented into original strings with characters equal to the number of segmentation bits n. For example, if the number of segmentation bits is 4 and the object code is 16-bit characters, then 4 original strings with 4-bit characters will be obtained.
[0073] Furthermore, if the number of character bits in the object encoding cannot be divided by the number of split bits, then the number of character bits in the last original string in the original set will be less than the number of split bits; the last original string in the original set will be obtained, and a terminator will be inserted at the end of the original string, so that when the encoding task is performed on the original string, once the terminator is parsed, the encoding task will be stopped immediately.
[0074] For example, assuming that the number of split bits is 4, for the case where the last group after the SN coding grouping is less than 4 bits: the value of the binary identification conversion feature corresponding to the group is all 1, and 4 bits are padded. The converted character is recorded as "FF", that is, the terminator in the "character mapping table", and other encoding and decoding processes are handled according to the common principles. Once the terminator is parsed during the decoding process, the subsequent decoding process is directly stopped, and the final decoded field is obtained.
[0075] S22: Determine whether the coded character in the original string is a hexadecimal code; if so, determine that the coded character is a direct conversion character; if not, determine that the coded character is a character to be converted.
[0076] In this step, hexadecimal is called Hex number system, which is a method of representing data in computers. It is different from the decimal representation in our daily life. It consists of 0-9, AF, and the corresponding relationship with the decimal system is: 0-9 corresponds to 0-9; AF corresponds to 10-15.
[0077] Then, if the coded character is any character in 0-9 or AF, it is determined that the coded character is a direct conversion character; if the coded character is not any character in 0-9 or AF, such as: P, S, then, it is determined that the coded character is a character to be converted.
[0078] S23: Determine whether the identification string of the original string contains the character to be converted.
[0079] S24: If yes, then obtain the conversion character corresponding to the character to be converted from the static table, and replace the character to be converted in the original string with the conversion character to obtain a conversion string.
[0080] In this step, the static table is a mapping table for converting non-hexadecimal codes into hexadecimal codes, for example:
[0081]
[0082]
[0083] S25: If not, setting the original string as the converted string.
[0084] S26: Summarize the conversion strings to form a conversion code.
[0085] Exemplarily, if the original string is 16PS, then 1 and 6 are hexadecimal codes, but P and S are not hexadecimal codes. Therefore, P and S are converted to 9 and C respectively through the above static table to obtain the conversion string 169C, and the obtained conversion strings are integrated into the conversion code through the above method.
[0086] In a preferred embodiment, obtaining a conversion identifier according to the position of the character to be converted in the object code includes:
[0087] S27: Assign direct conversion values to the direct conversion characters in the original string, and assign conversion values to the characters to be converted, and summarize the direct conversion values and the conversion values to obtain an identification string of the original string, wherein the identification string is a character string composed of direct conversion values and / or conversion values.
[0088] In this step, the direct conversion value is set to 0 and the conversion value is set to 1, so as to obtain an identification string displayed in the form of binary code, wherein the characters in the identification string correspond one-to-one to the characters in the original string.
[0089] Exemplarily, the original string is 16PS. Since 1 and 6 are direct conversion characters, they are assigned a direct conversion value of 0 respectively. P and S are characters to be converted, so they are assigned a conversion value of 1. Finally, the obtained identification string is 0011.
[0090] S28: Perform hexadecimal conversion on the identification string to obtain an identification character, and associate the identification character with the conversion string.
[0091] In this step, the identification string is converted into hexadecimal to reduce the space occupied by the obtained identification character. Exemplarily, the identification string 0011 is converted into hexadecimal to obtain the identification character 0×3. The identification string is converted into hexadecimal by an ASCII code conversion tool to obtain the identification character, wherein the ASCII conversion is a computer tool for converting characters into hexadecimal.
[0092] S29: Summarize the identification characters to obtain the conversion identifier.
[0093] In this step, the conversion strings are summarized by the above method to obtain a conversion identifier consisting of at least one of the conversion strings connected end to end. Since the identification string arranged by the direct conversion value and the conversion value reflects the position of the direct conversion character and the character to be converted in the original string, the obtained identification character will record the position of the direct conversion value and the conversion value in the form of hexadecimal encoding.
[0094] S203: performing binary conversion on the conversion code to obtain a binary code, associating the conversion identifier with the binary code, saving the binary code to a preset EPC module, and saving the conversion identifier to a preset cache component.
[0095] Usually, the EPC module usually supports a 96-bit binary encoding system for storing binary codes in the form of 0,1. To obtain the binary code that can be stored in the EPC module, this step obtains the binary code by performing binary conversion on the conversion code, and the obtained binary code can be stored in the EPC module.
[0096] Furthermore, since the binary code contains a code corresponding to the conversion character, in order to ensure that the binary code can accurately correspond to the object code, this step associates the conversion identifier with the binary code so that the conversion identifier can accurately mark the position of the conversion character corresponding to the binary code, thereby ensuring that the binary code can accurately correspond to the object code.
[0097] In a preferred embodiment, the step of performing binary conversion on the conversion code to obtain a binary code, associating the conversion identifier with the binary code, saving the binary code to a preset EPC module, and saving the conversion identifier to a preset cache component includes:
[0098] S31: extracting a conversion string from the conversion code, performing binary conversion on the conversion string to obtain a binary string, and summarizing the binary string to obtain the binary code.
[0099] In this step, based on the above example, the conversion string in the conversion code is extracted, such as: 169C, and the conversion string is converted into binary to obtain a binary string 1011010011100; it can be seen that if the original string 16PS is directly converted into binary, a binary string 1001101100111100 will be obtained. Therefore, the binary string corresponding to the conversion string is smaller than the memory space occupied by the binary string corresponding to the original string, thereby effectively reducing the space occupied by the EPC module.
[0100] The binary character string is obtained by performing binary conversion on the conversion string through an ASCII code conversion tool, wherein the ASCII conversion is a computer tool for performing base conversion on characters.
[0101] S32: Save the binary code in a preset EPC module, and obtain the module address of the binary code in the EPC module.
[0102] S33: Cache the conversion identifier in a preset cache component, and obtain the component address where the conversion identifier is stored in the cache component.
[0103] S34: Entering the component address and the module address into a conversion table preset in the cache component, and constructing a mapping relationship between the component address and the module address to associate the binary code with the conversion identifier.
[0104] In this embodiment, the module address reflects the storage location of the binary code in the EPC module, and the component address reflects the storage location of the conversion identifier in the cache component. By mapping the above two storage locations in association with each other and saving them in the conversion table, the binary code and the conversion identifier are associated with each other, thereby ensuring the accuracy of the mapping between the binary code and the conversion identifier.
[0105] S204: Establishing a communication connection with a preset terminal to receive a decoding request sent by the terminal for decoding the binary code and obtaining the object code.
[0106] In this step, a communication connection is established with the terminal to receive a decoding request, so as to decode the binary code stored in the EPC module to obtain the object code, wherein the decoding request is a request message for decoding the binary code, and specifically, by obtaining the address information recorded in the request header in the request message, the binary code corresponding to the address information is obtained from the EPC module, and the conversion identifier associated with the binary code is obtained from the cache component through the conversion table. Therefore, this step obtains the corresponding binary code and the conversion identifier associated with it according to the address information recorded in the decoding request, thereby ensuring the accuracy of information acquisition.
[0107] S205: Obtain a binary code from the EPC module according to the received decoding request, perform hexadecimal conversion on the binary code to obtain a conversion set, obtain a conversion identifier associated with the binary code from the cache component, and convert conversion characters in the conversion set into original characters according to the conversion identifier to obtain the object encoding.
[0108] Since the EPC module can only store binary codes, it is necessary to produce identification tags of binary codes, and to express the mapping relationship between the identification tags and the object codes by constructing a mapping table with a large amount of data, so that the target object can be identified and data can be managed through the RFID system. Therefore, in order to avoid the problem of invoking a mapping table with a large amount of data to obtain the object code of the target object, resulting in low recognition efficiency and a large amount of mapping table maintenance, this step directly obtains the binary code from the EPC module and parses it to obtain a conversion set, and according to the conversion identifier associated with the binary code, the conversion characters in the conversion set are converted into original characters to directly obtain the object code. Compared with the current method of obtaining the object code of the target object through a mapping table, the use of a mapping table is avoided, thereby eliminating the current need to construct a mapping table with a large amount of data, resulting in low efficiency in object code recognition of the target object due to calling the mapping table, as well as the high cost caused by the large amount of data in maintaining the mapping table and the terminal obtaining the wrong object code due to mapping errors.
[0109] In a preferred embodiment, the hexadecimal conversion of the binary code to obtain a conversion set includes:
[0110] S51: Convert the binary code into hexadecimal to obtain a conversion code.
[0111] In this step, the binary code is converted into hexadecimal by using an ASCII code conversion tool to obtain a conversion code, wherein the ASCII conversion is a computer tool for converting characters into hexadecimal.
[0112] S52: Divide the conversion code into at least one conversion string, and aggregate the conversion strings to obtain a conversion set; wherein the conversion string has at least one conversion character.
[0113] In this step, the conversion code is segmented into at least one conversion string by a preset segmentation bit number n. For example, if the segmentation bit number is 4 and the conversion code is a 16-bit character, then 4 conversion strings with 4-bit characters will be obtained.
[0114] In a preferred embodiment, the step of obtaining a conversion identifier associated with the binary code from the cache component and converting conversion characters in the conversion set into original characters according to the conversion identifier to obtain the object encoding includes:
[0115] S53: Obtain a conversion identifier associated with the binary code from the cache component according to the conversion table, perform binary conversion on the conversion identifier to obtain a conversion identifier set, and obtain a conversion string and an identifier string having a corresponding relationship from the conversion set and the conversion identifier set; wherein the conversion identifier set is composed of at least one identifier string, and the identifier string is composed of a direct conversion value and / or a conversion value.
[0116] In this step, the conversion identifier is converted into binary by the ASCII code conversion tool to obtain a conversion identifier set. In this embodiment, the corresponding relationship between the conversion string and the identifier string is established according to the position of the conversion string in the conversion set and the position of the identifier string in the conversion identifier set. By obtaining the storage position of the conversion string in the conversion set and obtaining the identifier string located at the storage position from the conversion identifier set, the technical effect of obtaining the identifier string having a corresponding relationship with the conversion string is achieved.
[0117] S54: performing binary conversion on the identification character to obtain an identification string, and determining whether the identification string contains a conversion value;
[0118] S55: If yes, identify the conversion value in the identification string, and convert the conversion characters in the conversion string corresponding to the conversion value into original characters according to the static table to obtain an original string.
[0119] In this step, since the identification string arranged by the direct conversion value and the conversion value reflects the position of the direct conversion character and the conversion character in the conversion string, the conversion character of the conversion string is identified according to the conversion value in the identification string in a one-to-one correspondence manner; and the conversion character is converted into the original character through the static table.
[0120] Exemplarily, assuming that the conversion identifier is 0×3, an identification string of 0011 will be obtained, so that the characters in the identification string correspond one-to-one with the original characters and conversion characters in the conversion character 169C, 9 and C will be identified as conversion characters, and the original characters P and S of the conversion characters can be obtained through the static table.
[0121] S56: If not, setting the converted string to the original string.
[0122] S57: Aggregate the original strings to form object codes.
[0123] Furthermore, after aggregating the original strings to form the object code, the method further includes:
[0124] The object code is sent to the terminal.
[0125] The terminal has a database for storing and managing the object codes.
[0126] After aggregating the original strings to form the object code, the method further includes:
[0127] The object code is uploaded to the blockchain.
[0128] It should be noted that the corresponding summary information is obtained based on the object code. Specifically, the summary information is obtained by hashing the object code, such as by using the sha256s algorithm. Uploading the summary information to the blockchain can ensure its security and fairness and transparency to users. The user device can download the summary information from the blockchain to verify whether the object code has been tampered with. The blockchain referred to in this example is a new application model of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.
[0129] Embodiment three:
[0130] See also Figure 4 , a coding and decoding device 1 of this embodiment includes:
[0131] The conversion module 12 is used to obtain an object code, set an original character in the object code that does not belong to the hexadecimal code as a character to be converted, convert the character to be converted into a conversion character through a preset static table to obtain a conversion code, and obtain a conversion identifier according to the position of the character to be converted in the object code; wherein the object code is composed of at least one original character, and the conversion code is composed of at least one original character and / or at least one conversion character;
[0132] The encoding module 13 is used to perform binary conversion on the conversion code to obtain a binary code, associate the conversion identifier with the binary code, save the binary code to a preset EPC module, and save the conversion identifier to a preset cache component;
[0133] The decoding module 15 is used to obtain the binary code from the EPC module according to the received decoding request, perform hexadecimal conversion on the binary code to obtain a conversion set, obtain the conversion identifier associated with the binary code from the cache component, and convert the conversion characters in the conversion set into original characters according to the conversion identifier to obtain the object encoding.
[0134] Optionally, the encoding and decoding device 1 further includes:
[0135] The radio frequency conversion module 11 is used to establish a communication connection with a preset radio frequency device, and is used to receive an object signal sent by the radio frequency device and representing a unique identifier of a target object; and perform analog-to-digital conversion on the object signal to obtain an object code.
[0136] Optionally, the conversion module 12 further includes:
[0137] The code segmentation unit 121 is used to segment the object code to form an original set consisting of at least one original string, wherein the original string has at least one original character.
[0138] The direct conversion judgment unit 122 is used to judge whether the coded character in the original string belongs to hexadecimal encoding; if so, the coded character is determined to be a direct conversion character; if not, the coded character is determined to be a character to be converted.
[0139] The character determination unit 123 is used to determine whether the identification string of the original string contains the character to be converted.
[0140] The character conversion unit 124 is configured to obtain a conversion character corresponding to the character to be converted from the static table, and replace the character to be converted in the original string with the conversion character to obtain a conversion string.
[0141] The character direct conversion unit 125 is used to set the original string as a conversion string.
[0142] The code summarizing unit 126 is used to summarize the conversion strings to form a conversion code.
[0143] The character identification unit 127 is used to assign direct conversion values to the direct conversion characters in the original string, and assign conversion values to the characters to be converted, and summarize the direct conversion values and the conversion values to obtain an identification string of the original string, wherein the identification string is a character string composed of direct conversion values and / or conversion values.
[0144] The identification associating unit 128 is used to perform hexadecimal conversion on the identification string to obtain an identification character, and associate the identification character with the conversion string.
[0145] The identification summarizing unit 129 is used to summarize the identification characters to obtain the conversion identifier.
[0146] Optionally, the encoding module 13 further includes:
[0147] The code conversion unit 131 is used to extract the conversion string in the conversion code, perform binary conversion on the conversion string to obtain a binary string, and summarize the binary string to obtain the binary code.
[0148] The EPC saving unit 132 is used to save the binary code in a preset EPC module and obtain the module address of the binary code in the EPC module.
[0149] The component storage unit 133 is used to cache the conversion identifier in a preset cache component and obtain the component address where the conversion identifier is stored in the cache component.
[0150] The address associating unit 134 is used to enter the component address and the module address into the conversion table preset in the cache component, and to construct a mapping relationship between the component address and the module address to associate the binary code with the conversion identifier.
[0151] Optionally, the encoding and decoding device 1 further includes:
[0152] The request input module 14 is used to establish a communication connection with a preset terminal to receive a decoding request sent by the terminal for decoding the binary code and obtaining the object code.
[0153] Optionally, the decoding module 15 further includes:
[0154] The decoding conversion unit 151 is used to perform hexadecimal conversion on the binary code to obtain a conversion code.
[0155] The decoding segmentation unit 152 is used to divide the conversion code into at least one conversion string, and summarize the conversion strings to obtain a conversion set; wherein the conversion string has at least one conversion character.
[0156] The identification string recognition unit 153 is used to obtain a conversion identifier associated with the binary code from the cache component according to the conversion table, perform binary conversion on the conversion identifier to obtain a conversion identifier set, and obtain a conversion string and an identification string with a corresponding relationship from the conversion set and the conversion identifier set; wherein the conversion identifier set is composed of at least one identification string, and the identification string is composed of a direct conversion value and / or a conversion value.
[0157] The identification conversion unit 154 is used to perform binary conversion on the identification character to obtain an identification string, and determine whether the identification string contains a conversion value;
[0158] The character replacement unit 155 is used to identify the conversion value in the identification string, and convert the conversion characters corresponding to the conversion value in the conversion string into original characters according to the static table to obtain an original string.
[0159] The character direct conversion unit 156 is used to set the converted string as the original string.
[0160] The decoding and summarizing unit 157 is used to summarize the original string to form an object code.
[0161] The technical solution is applied to the cloud storage field of cloud technology. The original characters that do not belong to the hexadecimal code in the object code are set as characters to be converted, the characters to be converted are converted into conversion characters through a static table to obtain a conversion code, and a conversion identifier is obtained according to the position of the characters to be converted in the object code; the conversion code is binary-converted to obtain a binary code, the conversion identifier and the binary code are associated, and the binary code is saved in an EPC module and the conversion identifier is saved in a cache component, so as to realize hierarchical storage of binary codes and conversion identifiers.
[0162] Embodiment 4:
[0163] To achieve the above purpose, the present invention further provides a computer device 5. The components of the encoding and decoding device of the third embodiment can be dispersed in different computer devices. The computer device 5 can be a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including independent server, or server cluster composed of multiple application servers) for executing programs. The computer device of this embodiment includes at least but is not limited to: a memory 51 and a processor 52 that can be interconnected through a system bus, such as Figure 5 It should be pointed out that Figure 5 Only a computer device with components is shown, but it should be understood that implementing all of the components shown is not a requirement and more or fewer components may alternatively be implemented.
[0164] In this embodiment, the memory 51 (i.e., readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 51 can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the memory 51 can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 51 can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 51 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the encoding and decoding device of the third embodiment. In addition, the memory 51 can also be used to temporarily store various types of data that have been output or are to be output.
[0165] The processor 52 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 52 is generally used to control the overall operation of the computer device. In this embodiment, the processor 52 is used to run the program code stored in the memory 51 or process data, such as running the encoding and decoding device to implement the encoding and decoding methods of the first and second embodiments.
[0166] Embodiment five:
[0167] To achieve the above purpose, the present invention also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, and the program implements the corresponding function when executed by the processor 52. The computer-readable storage medium of this embodiment is used to store a computer program for implementing the encoding and decoding method, and when executed by the processor 52, the encoding and decoding methods of Embodiments 1 and 2 are implemented.
[0168] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0169] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0170] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A coding and decoding method, characterized in that: include: Obtaining an object code, setting an original character in the object code that does not belong to the hexadecimal code as a to-be-converted character, converting the to-be-converted character into a conversion character through a preset static table to obtain a conversion code, and obtaining a conversion identifier according to the position of the to-be-converted character in the object code; wherein the object code is composed of at least one original character, and the conversion code is composed of at least one original character and / or at least one conversion character; Performing binary conversion on the conversion code to obtain a binary code, associating the conversion identifier with the binary code, saving the binary code to a preset EPC module, and saving the conversion identifier to a preset cache component; According to the received decoding request, a binary code is obtained from the EPC module, the binary code is converted into hexadecimal to obtain a conversion set, a conversion identifier associated with the binary code is obtained from the cache component, and according to the conversion identifier, the conversion characters in the conversion set are converted into original characters to obtain the object encoding.
2. The encoding and decoding method according to claim 1, characterized in that: Before obtaining the object code, the method further includes: A communication connection is established with a preset radio frequency device to receive an object signal sent by the radio frequency device and representing a unique identifier of a target object, and perform analog-to-digital conversion on the object signal to obtain an object code.
3. The encoding and decoding method according to claim 1, characterized in that: The step of setting the original characters in the object code that are not in the hexadecimal code as characters to be converted, and converting the characters to be converted into conversion characters by using a preset static table to obtain a conversion code includes: Segmenting the object code to form an original set consisting of at least one original string, wherein the original string has at least one original character; Determine whether the coded character in the original string belongs to hexadecimal encoding; if so, determine that the coded character is a direct conversion character; if not, determine that the coded character is a character to be converted; Determine whether the identification string of the original string contains the character to be converted; if so, obtain the conversion character corresponding to the character to be converted from the static table, and replace the character to be converted in the original string with the conversion character to obtain a conversion string; if not, set the original string as the conversion string; The conversion strings are aggregated to form a conversion code.
4. The encoding and decoding method according to claim 3, characterized in that: The step of obtaining a conversion identifier according to the position of the character to be converted in the object encoding comprises: Assigning a direct conversion value to the direct conversion characters in the original string, and assigning a conversion value to the characters to be converted, and summing up the direct conversion values and the conversion values to obtain an identification string of the original string, wherein the identification string is a character string composed of the direct conversion values and / or the conversion values; Performing hexadecimal conversion on the identification string to obtain an identification character, and associating the identification character with the conversion string; The identification characters are aggregated to obtain the conversion identifier.
5. The encoding and decoding method according to claim 1, characterized in that: The step of performing binary conversion on the conversion code to obtain a binary code, associating the conversion identifier with the binary code, saving the binary code to a preset EPC module, and saving the conversion identifier to a preset cache component includes: Extracting a conversion string in the conversion code, performing binary conversion on the conversion string to obtain a binary string, and summarizing the binary string to obtain the binary code; The binary code is stored in a preset EPC module, and a module address of the binary code in the EPC module is obtained; Cache the conversion identifier in a preset cache component, and obtain the component address where the conversion identifier is stored in the cache component; The component address and the module address are entered into a conversion table preset in the cache component, and a mapping relationship is constructed between the component address and the module address to associate the binary code with the conversion identifier.
6. The encoding and decoding method according to claim 1, characterized in that: Before obtaining the binary code from the EPC module according to the received decoding request, the method further includes: A communication connection is established with a preset terminal to receive a decoding request sent by the terminal for decoding the binary code and obtaining the object code.
7. The encoding and decoding method according to claim 1, characterized in that: The hexadecimal conversion of the binary code to obtain a conversion set includes: Convert the binary code into hexadecimal to obtain a conversion code; Dividing the conversion code into at least one conversion string, and summarizing the conversion strings to obtain a conversion set; wherein the conversion string has at least one conversion character; The acquiring the conversion identifier associated with the binary code from the cache component, and converting the conversion characters in the conversion set into original characters according to the conversion identifier to obtain the object encoding, comprises: According to a preset conversion table, a conversion identifier associated with the binary code is obtained from the cache component, the conversion identifier is binary converted to obtain a conversion identifier set, and a conversion string and an identifier string having a corresponding relationship are obtained from the conversion set and the conversion identifier set; wherein the conversion identifier set is composed of at least one identifier string, and the identifier string is composed of a direct conversion value and / or a conversion value; Perform binary conversion on the identification characters in the conversion identifier to obtain an identification string, and determine whether the identification string contains a conversion value; if so, identify the conversion value in the identification string, and convert the conversion characters corresponding to the conversion value in the conversion string into original characters according to the static table to obtain an original string; if not, set the conversion string to be the original string; Aggregating the original strings to form an object code; After aggregating the original strings to form the object code, the method further includes: The object code is uploaded to the blockchain.
8. A coding and decoding device, characterized in that: include: a conversion module, used for obtaining an object code, setting an original character in the object code that does not belong to the hexadecimal code as a character to be converted, converting the character to be converted into a conversion character through a preset static table to obtain a conversion code, and obtaining a conversion identifier according to the position of the character to be converted in the object code; wherein the object code is composed of at least one original character, and the conversion code is composed of at least one original character and / or at least one conversion character; an encoding module, configured to perform binary conversion on the conversion code to obtain a binary code, associate the conversion identifier with the binary code, save the binary code to a preset EPC module, and save the conversion identifier to a preset cache component; A decoding module is used to obtain a binary code from the EPC module according to a received decoding request, perform hexadecimal conversion on the binary code to obtain a conversion set, obtain a conversion identifier associated with the binary code from the cache component, and convert conversion characters in the conversion set into original characters according to the conversion identifier to obtain the object encoding.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor of the computer device executes the computer program, the steps of the encoding and decoding method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer program stored in the readable storage medium implements the steps of the encoding and decoding method according to any one of claims 1 to 7 when executed by a processor.
Citation Information
Patent Citations
Radio-frequency identifying code encoding and decoding method
CN1677424A
Efficient encoding and decoding of mixed data strings in RFID tags and other media
US20100302078A1