Data character encoding, decoding method, system, device and storage medium
By using smart contracts and pre-agreed thresholds to encode data in the blockchain system, combined with the character encoding table, the problem of cumbersome existing encryption algorithms is solved, simple and secure encoding and decoding of data is achieved, and calculation is reduced. Quantities are measured and the operational life cycle is recorded.
Patent Information
- Application Number
- CN202210193676.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-01
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-03-01
AI Technical Summary
In the existing technology, the use of symmetric or asymmetric encryption algorithms to transmit sensitive data is cumbersome and computationally intensive, resulting in cumbersome solutions.
Through the smart contract of the blockchain system, the data to be encoded is converted into a hexadecimal value, and the threshold value pre-agreed by the receiving end is used for encoding, and the character encoding result is determined based on the preset character encoding table to achieve simple encoding and decoding of data.
It simplifies the coding process, reduces the amount of calculation, makes the data coding steps simple and safe, and records the operation life cycle through smart contracts to facilitate subsequent verification.
Smart Images

Figure CN114626338B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a data character encoding, decoding method, system, device and storage medium. Background Art
[0002] At present, most solutions for sensitive data encryption scenarios are implemented through symmetric or asymmetric encryption. In the end-to-end business process, it is ensured that the data is visible but not readable by middlemen. The above traditional solutions are applicable to most scenarios.
[0003] However, for the sending end, the encryption algorithm needs to be pre-configured. When sending sensitive data, the encryption algorithm is called to encrypt the sensitive data to be sent. The algorithm is relatively complicated and the calculation amount is large, making the solution cumbersome. Summary of the invention
[0004] The present application provides a data character encoding, decoding method, system, device and storage medium to solve the technical problem in the prior art that the algorithm using symmetric or asymmetric encryption is relatively complicated.
[0005] In a first aspect, an embodiment of the present application provides a data character encoding method applicable to a blockchain system, the method comprising:
[0006] Get the data to be encoded uploaded by the sender;
[0007] The smart contract of the blockchain system is called to convert the data into a first numerical value in the first base; the first numerical value is encoded using a threshold value pre-agreed with the receiving end to obtain a second numerical value in the first base corresponding to the data; and a character encoding result corresponding to the second numerical value is determined according to a preset character encoding table.
[0008] Optionally, encoding the first value by using a threshold value pre-agreed with the receiving end to obtain a second value in the first base corresponding to the data includes:
[0009] The smart contract is called to convert the threshold into the first base to obtain the threshold in the first base, and the sum of the first value and the threshold in the first base is calculated to obtain a second value in the first base corresponding to the data.
[0010] Optionally, determining the character encoding result corresponding to the second value according to a preset character encoding table includes:
[0011] Calling the smart contract to convert the second value into a third binary value;
[0012] A character encoding result corresponding to the third value is read from the character encoding table.
[0013] Optionally, the blockchain system stores the last conversation record between the sending end and the receiving end; before encoding the first value using the threshold value pre-agreed with the receiving end, the method further includes:
[0014] Calling the smart contract to obtain a session identification number corresponding to the last session record between the sending end and the receiving end;
[0015] A threshold value pre-agreed with the receiving end is determined according to the session identification number.
[0016] Optionally, determining a threshold value pre-agreed with the receiving end according to the session identification number includes:
[0017] At least one bit of target data is read from the session identification number, and the at least one bit of target data is used as a threshold value pre-agreed with the receiving end.
[0018] In a second aspect, an embodiment of the present application provides a data character decoding method, applicable to a receiving end, the method comprising:
[0019] Determine, according to a preset character encoding table, a second value in the first base corresponding to the character encoding result;
[0020] Decoding the second value using a threshold value pre-agreed with the transmitting end to obtain a first value in a first base;
[0021] A decoding result is determined based on the first value.
[0022] Optionally, the decoding the second value by using a threshold value pre-agreed with the transmitting end to obtain the first value in the first base includes:
[0023] Convert the threshold value into the first base to obtain the threshold value of the first base;
[0024] The difference between the second value and the threshold value in the first system is calculated to obtain the first value in the first system.
[0025] In a third aspect, an embodiment of the present application provides a data character encoding and decoding system, including: a blockchain system and a receiving end;
[0026] The blockchain system is used to obtain the data to be encoded uploaded by the sending end; call the smart contract of the blockchain system to convert the data into a first value in the first base; encode the first value using a threshold value pre-agreed with the target receiving end to obtain a second value in the first base corresponding to the data; determine a character encoding result corresponding to the second value according to a preset character encoding table; and send the character encoding result to the receiving end;
[0027] The receiving end is used to determine a second numerical value in the first base corresponding to a character encoding result according to a preset character encoding table; decode the second numerical value using a threshold value pre-agreed with the sending end to obtain a first numerical value in the first base; and determine a decoding result based on the first numerical value.
[0028] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a communication bus, wherein the processor and the memory communicate with each other via the communication bus;
[0029] The memory is used to store computer programs;
[0030] The processor is used to execute the program stored in the memory to implement the data character encoding method described in the first aspect or the data character decoding method described in the second aspect.
[0031] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the data character encoding method described in the first aspect or the data character decoding method described in the second aspect.
[0032] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application uses the threshold value pre-agreed by the sending end and the receiving end to encode the first value of the data to be encoded to obtain the second value, and then determines the character encoding result corresponding to the second value according to the character encoding table, and uses the idea of character encoding to encode the data, with simple steps and small amount of calculation during the encoding process. Moreover, the above process is completed in the smart contract of the blockchain system, and the whole life cycle of the above operation is recorded by the smart contract, which is convenient for subsequent verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0035] Figure 1 A flowchart of a method for character encoding of data provided in an embodiment of the present application;
[0036] Figure 2A flowchart of a method for character decoding of data provided in an embodiment of the present application;
[0037] Figure 3 A structural diagram of a data character encoding and decoding system provided in an embodiment of the present application;
[0038] Figure 4 A schematic diagram of the structure of a data character encoding device provided in an embodiment of the present application;
[0039] Figure 5 A schematic diagram of the structure of a data character decoding device provided in an embodiment of the present application;
[0040] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0042] In order to solve the technical problem that the symmetric or asymmetric encryption algorithm is relatively complicated in the prior art, the embodiment of the present application provides a character encoding method for data, such as Figure 1 As shown, a data character encoding method provided in an embodiment of the present application is applicable to a blockchain system, and the data character encoding method specifically includes the following steps:
[0043] Step 101, obtaining the data to be encoded uploaded by the sending end;
[0044] The data may be sensitive data, such as the user's mobile phone number, ID number, home address and other private data; it may also be other data, such as the conversation content sent from the sender to the receiver.
[0045] Step 102, calling the smart contract of the blockchain system to convert the data into a first numerical value in the first base;
[0046] In order for data to be stored in computers and transmitted over communication networks, the characters in a character set need to be encoded into an object in a specified set, such as a bit pattern, a sequence of natural numbers, an 8-bit group, or an electrical pulse. Common examples include encoding the Latin alphabet into Morse code and ASCII. ASCII numbers letters, numbers, and other symbols and represents the integer using 7 bits of binary. Usually an additional extended bit is used, for a total of 8 bits, to facilitate storage in 1 byte.
[0047] In a specific implementation, the first system may be binary, and the data to be encoded is converted into a first binary value.
[0048] Step 103, encoding the first value using a threshold value pre-agreed with the receiving end to obtain a second value in the first system corresponding to the data;
[0049] The threshold value pre-agreed with the receiving end needs to be globally unique to prevent other clients that receive the character encoding result from being interpreted.
[0050] In a specific embodiment, the blockchain system stores the last conversation record between the sender and the receiver; before encoding the first value using the threshold value pre-agreed with the receiver, the method further includes:
[0051] Calling the smart contract to obtain a session identification number corresponding to the last session record between the sending end and the receiving end;
[0052] A threshold value pre-agreed with the receiving end is determined according to the session identification number.
[0053] The session identification number of each session is globally unique. Therefore, determining the threshold agreed upon by the sender and the receiver through the session identification number can ensure the global uniqueness of the threshold and prevent other clients from deciphering the information after receiving it. At the same time, as time goes by, the last session between the sender and the receiver is constantly changing and is not fixed. This prevents the same threshold from being used for a long time and being imitated by someone with ulterior motives, further ensuring the security of encoding and decoding using the threshold.
[0054] In a specific implementation, at least one bit of target data is read from the session identification number, and the at least one bit of target data is used as a threshold value pre-agreed with the receiving end.
[0055] The session ID is usually composed of a string of numbers and letters. When determining the threshold, a segment of the session ID can be intercepted as the threshold. For example, the last 6 digits of the target data of the session ID can be read as the pre-agreed threshold. Of course, other digits of target data can also be used.
[0056] When the first numerical value is encoded using a threshold value pre-agreed with the receiving end, the smart contract can be called to convert the threshold value into the first base to obtain the threshold value in the first base, and the sum of the first numerical value and the threshold value in the first base is calculated to obtain a second numerical value in the first base corresponding to the data.
[0057] For ease of understanding, here is an example. Taking the first base as binary, the binary codes corresponding to "sensitive data" are: 110010101001111, 110000100011111, 110010101110000, 110001101101110. The threshold is 5, then 5 is converted to binary 101; then the threshold is added to the binary code, and the second value obtained is 10010101010100, 110000100100100, 110010101110101, 110001101110011.
[0058] In addition, in addition to calculating the sum of the first value and the threshold value in the first system for encoding to obtain the second value in the first system, the difference, product or quotient of the first value and the threshold value in the first system can also be calculated to obtain the second value in the first system. Of course, other encoding methods can also be used, as long as the sending end and the receiving end agree in advance.
[0059] In the embodiment of the present application, the entire process of encoding data using a threshold value only involves base conversion and simple addition, subtraction, multiplication or division calculations, which is very simple. However, for the receiving end, as long as there is no correct threshold value, the correct decoding result cannot be obtained, and the specific content of the transmission cannot be known.
[0060] Step 104: Determine a character encoding result corresponding to the second value according to a preset character encoding table.
[0061] Among them, the character encoding form (CEF), also known as the storage format, is a sequence of integer values (called code units) of a coded character set that are converted from non-negative integer values (i.e., abstract code points) to integer values of finite bit length (called code units). This is a null mapping to itself for fixed-length encodings, but for variable-length encodings, the mapping is more complex, mapping some code points to one code unit and others to a sequence of multiple code units. For example, using 16-bit storage units to store digital information, each unit of the system can only directly represent values from 0 to 65535, but if multiple 16-bit units are used, larger integers can be represented. This is the role of CEF, which can map each code point in the Unicode code space from 0 to 1.4 million to a single or multiple code values in the range of 0 to 65,5356. The simplest character encoding table simply chooses units large enough to ensure that all values in the coded character set can be directly encoded (one code point corresponds to one code value). This is reasonable for coded character sets that can be represented using 8 bits (such as most traditional non-CJK (Chinese, Japanese, Korean and Vietnamese unified ideographic characters) character set encodings), and it is also reasonable enough for coded character sets that can be represented using 16 bits (such as early versions of Unicode). However, as the size of coded character sets increases (for example, the current Unicode character set requires at least 21 bits to represent all of them), this direct representation becomes increasingly inefficient, and it is difficult for existing computer systems to adapt to larger code values. Therefore, many systems using the latest versions of Unicode either use UTF-8, which maps Unicode code points to variable-length 8-bit byte sequences, or UTF-16, which maps code points to variable-length 16-bit sequences.
[0062] In a specific implementation, the smart contract is called to convert the second value into a third value in binary format, and the character encoding result corresponding to the third value is read from the character encoding table, wherein the binary format may be decimal.
[0063] For ease of understanding, here we continue to give examples, taking the binary system as a decimal system as an example, in the example of step 103, the second value is 10010101010100, 110000100100100, 110010101110101, 110001101110011, according to the description of step 104, the above second value is converted into a decimal system, and the third value is 25940, 24868, 25973, 25459. If the character encoding table is UTF-8, the content corresponding to each number is determined by looking up the table, and the final character encoding result is the content corresponding to "UTF-8 25940|24868|25973|25459".
[0064] The character string obtained above, i.e., the result after data encoding, is unreadable for some clients whose thresholds are not visible. However, for clients whose thresholds are visible, the specific content can be obtained by manual or system reverse processing, which has a small amount of calculation and is very convenient. Moreover, in the process of data transmission, the data also needs to be converted into binary. The embodiment of the present application follows the trend, has simple steps, small amount of calculation, and is very flexible.
[0065] In the embodiment of the present application, the first value of the data to be encoded is encoded using the threshold value pre-agreed by the transmitting end and the receiving end to obtain the second value, and then the character encoding result corresponding to the second value is determined according to the character encoding table. The idea of character encoding is used to encode the data, and the steps are simple, and the amount of calculation is small during the encoding process. In addition, the above process is completed in the smart contract of the blockchain system, and the entire life cycle of the above operation is recorded through the smart contract, which is convenient for subsequent verification.
[0066] In addition, if Figure 2 As shown, the embodiment of the present application also provides a data character decoding method, which is applicable to a receiving end, and the method includes:
[0067] Step 201, determining a second value in the first base corresponding to the character encoding result according to a preset character encoding table;
[0068] In a specific implementation, the third binary value corresponding to the character encoding result is determined according to the character encoding table, and the third binary value is converted into the second value of the first base;
[0069] Step 202, decoding the second value using a threshold value pre-agreed with the transmitting end to obtain a first value in a first base;
[0070] Specifically, if the encoding method agreed upon in advance by both parties is to calculate the sum of the first numerical value and the threshold of the first base to obtain the second numerical value of the first base corresponding to the data, then during decoding, the threshold is converted into the first base to obtain the threshold of the first base; the difference between the second numerical value and the threshold of the first base is calculated to obtain the first numerical value of the first base.
[0071] The first system may be binary, and the second system may be decimal.
[0072] Step 203: determine a decoding result based on the first value.
[0073] Step 203 is actually the reverse step of step 102, and uses the first binary value to reversely determine the character in the character set, that is, the decoding result.
[0074] In the embodiment of the present application, the decoding process is actually the inverse process of the encoding process, and the amount of calculation is consistent with that of the encoding process. Therefore, the amount of calculation in the decoding process is also relatively small.
[0075] also, Figure 3 As shown, the embodiment of the present application also provides a data character encoding and decoding system, including: a blockchain system 301 and a receiving end 302;
[0076] The blockchain system 301 is used to obtain the data to be encoded uploaded by the sending end; call the smart contract of the blockchain system to convert the data into a first value in the first base; encode the first value using a threshold value pre-agreed with the target receiving end 302 to obtain a second value in the first base corresponding to the data; determine a character encoding result corresponding to the second value according to a preset character encoding table; and send the character encoding result to the receiving end 302;
[0077] The receiving end 302 is used to determine a second numerical value in the first base corresponding to the character encoding result according to a preset character encoding table; decode the second numerical value using a threshold pre-agreed with the sending end to obtain a first numerical value in the first base; and determine a decoding result based on the first numerical value.
[0078] In a specific implementation, the blockchain system 301 can broadcast the character encoding results, and only the receiving end with the same threshold can correctly decode and read the data; even if other receiving ends receive the character encoding results, they cannot correctly interpret the data because they do not have the correct threshold.
[0079] Based on the same concept, a data character encoding device is provided in the embodiment of the present application, which is applicable to the blockchain system. The specific implementation of the device can be found in the description of the method embodiment part, and the repetitive parts will not be repeated. Figure 4As shown, the device mainly includes:
[0080] The acquisition module 401 is used to acquire the data to be encoded uploaded by the sending end;
[0081] A conversion module 402, configured to call a smart contract of the blockchain system to convert the data into a first numerical value in a first base;
[0082] The encoding module 403 is used to encode the first value by using a threshold value pre-agreed with the receiving end to obtain a second value of the first system corresponding to the data;
[0083] The first determining module 404 is configured to determine a character encoding result corresponding to the second value according to a preset character encoding table.
[0084] In a specific embodiment, the encoding module 403 is used to call the smart contract to convert the threshold into the first base, obtain the threshold in the first base, and calculate the sum of the first value and the threshold in the first base to obtain the second value in the first base corresponding to the data.
[0085] In a specific embodiment, the first determination module 404 is used to call the smart contract to convert the second value into a third binary value; and read the character encoding result corresponding to the third value from the character encoding table.
[0086] In a specific embodiment, a character encoding device for data provided in an embodiment of the present application further includes: an agreement module, used to call the smart contract to obtain the session identification number corresponding to the last session record between the sending end and the receiving end; and determine a threshold pre-agreed with the receiving end based on the session identification number.
[0087] In a specific embodiment, the agreement module is used to read at least one bit of target data from the session identification number, and use the at least one bit of target data as a threshold pre-agreed with the receiving end.
[0088] Based on the same concept, the embodiment of the present application provides a data character decoding device, which is suitable for the receiving end. The specific implementation of the device can refer to the description of the method embodiment part, and the repeated parts will not be repeated. Figure 5 As shown, the device mainly includes:
[0089] The second determination module 501 is used to determine a second value in the first base corresponding to the character encoding result according to a preset character encoding table;
[0090] A decoding module 502, configured to decode the second value using a threshold value pre-agreed with the transmitting end to obtain a first value in a first system;
[0091] The third determination module 503 is configured to determine a decoding result based on the first value.
[0092] In a specific embodiment, the decoding module 502 is used to convert the threshold into a first base to obtain a threshold in the first base; and calculate the difference between the second value and the threshold in the first base to obtain a first value in the first base.
[0093] Based on the same concept, an electronic device is also provided in the embodiment of the present application, such as Figure 6 As shown, the electronic device mainly includes: a processor 601, a memory 602 and a communication bus 603, wherein the processor 601 and the memory 602 communicate with each other through the communication bus 603. The memory 602 stores a program executable by the processor 601, and the processor 601 executes the program stored in the memory 602 to implement the following steps:
[0094] Get the data to be encoded uploaded by the sender;
[0095] The smart contract of the blockchain system is called to convert the data into a first numerical value in the first base; the first numerical value is encoded using a threshold value pre-agreed with the receiving end to obtain a second numerical value in the first base corresponding to the data; and a character encoding result corresponding to the second numerical value is determined according to a preset character encoding table.
[0096] The communication bus 603 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 603 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0097] The memory 602 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor 601.
[0098] The above-mentioned processor 601 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0099] In another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program runs on a computer, the computer executes a data character encoding method or a data character decoding method described in the above embodiments.
[0100] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction is transmitted from a website site, a computer, a server or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk), etc.
[0101] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0102] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A character encoding method for data, characterized in that: Applicable to a blockchain system, the method includes: Get the data to be encoded uploaded by the sender; Calling the smart contract of the blockchain system to convert the data into a first numerical value in the first base; encoding the first numerical value using a threshold value pre-agreed with the receiving end to obtain a second numerical value in the first base corresponding to the data, including: calling the smart contract to convert the threshold value into the first base to obtain the threshold value in the first base, and calculating the sum of the first numerical value and the threshold value in the first base to obtain the second numerical value in the first base corresponding to the data; determining a character encoding result corresponding to the second numerical value according to a preset character encoding table.
2. The character encoding method for data according to claim 1, characterized in that: The determining, according to a preset character encoding table, a character encoding result corresponding to the second value includes: The smart contract is called to convert the second value into a third value in binary format; and a character encoding result corresponding to the third value is read from the character encoding table.
3. The data character encoding method according to any one of claims 1 to 2, characterized in that: The blockchain system stores the last conversation record between the sending end and the receiving end; before encoding the first value using the threshold value pre-agreed with the receiving end, it also includes: Calling the smart contract to obtain a session identification number corresponding to the last session record between the sending end and the receiving end; A threshold value pre-agreed with the receiving end is determined according to the session identification number.
4. The character encoding method for data according to claim 3, characterized in that: The determining, according to the session identification number, a threshold value pre-agreed with the receiving end includes: At least one bit of target data is read from the session identification number, and the at least one bit of target data is used as a threshold value pre-agreed with the receiving end.
5. A method for character decoding of data, characterized in that: Applicable to a receiving end, the method comprises: According to a preset character encoding table, determining a second value in the first base corresponding to the character encoding result, wherein the second value is obtained by encoding the first value by the blockchain system using a threshold value pre-agreed with the receiving end, including: calling a smart contract of the blockchain system to convert the threshold value into the first base to obtain the threshold value of the first base, and calculating the sum of the first value and the threshold value of the first base to obtain the second value of the first base, wherein the first value is to call the smart contract of the blockchain system to convert the data to be encoded uploaded by the sending end into the first value of the first base; Decoding the second value using a threshold value pre-agreed with the transmitting end to obtain a first value in a first base; A decoding result is determined based on the first value.
6. The method for character decoding of data according to claim 5, characterized in that: The decoding of the second value by using a threshold value pre-agreed with the transmitting end to obtain a first value of a first base includes: Convert the threshold value into the first base to obtain the threshold value of the first base; The difference between the second value and the threshold value in the first system is calculated to obtain the first value in the first system.
7. A data character encoding and decoding system, characterized in that: include: Blockchain system and receiving end; The blockchain system is used to obtain the data to be encoded uploaded by the sender; Calling a smart contract of the blockchain system to convert the data into a first numerical value in the first base; Encoding the first value by using a threshold value pre-agreed with a target receiving end to obtain a second value in the first base corresponding to the data, including: calling the smart contract to convert the threshold value into the first base to obtain the threshold value in the first base, and calculating the sum of the first value and the threshold value in the first base to obtain the second value in the first base corresponding to the data; determining a character encoding result corresponding to the second value according to a preset character encoding table; and sending the character encoding result to the receiving end; The receiving end is used to determine a second value in the first base corresponding to the character encoding result according to a preset character encoding table; decode the second value using a threshold value pre-agreed with the sending end to obtain a first value in the first base; determine the decoding result based on the first value, wherein the second value is the first value obtained by encoding the first value by the blockchain system using the threshold value pre-agreed with the receiving end to obtain a second value in the first base, including: calling the smart contract of the blockchain system to convert the threshold into the first base to obtain the threshold of the first base, and calculating the sum of the first value and the threshold of the first base to obtain the second value of the first base, wherein the first value is calling the smart contract of the blockchain system to convert the data to be encoded uploaded by the sending end into the first value of the first base.
8. An electronic device, characterized in that: include: A processor, a memory and a communication bus, wherein the processor and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to execute the program stored in the memory to implement the data character encoding method described in any one of claims 1 to 4 or the data character decoding method described in claim 5 or 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the data character encoding method according to any one of claims 1 to 4 or the data character decoding method according to claim 5 or 6 is implemented.
Citation Information
Patent Citations
Processing method, system and device for storing image-text data into block chain and storage medium
CN113535997A
