CN115510811A - Character string encoding and decoding methods, encoding device and decoding device - Google Patents

Character string encoding and decoding methods, encoding device and decoding device Download PDF

Info

Publication number
CN115510811A
CN115510811A CN202110631418.2A CN202110631418A CN115510811A CN 115510811 A CN115510811 A CN 115510811A CN 202110631418 A CN202110631418 A CN 202110631418A CN 115510811 A CN115510811 A CN 115510811A
Authority
CN
China
Prior art keywords
data
character string
coded
decoded
binary
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110631418.2A
Other languages
Chinese (zh)
Inventor
申习之
刘金松
施扬
郑锐锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Zhuozhou Technology Co ltd
Original Assignee
Chengdu Zhuozhou Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Zhuozhou Technology Co ltd filed Critical Chengdu Zhuozhou Technology Co ltd
Priority to CN202110631418.2A priority Critical patent/CN115510811A/en
Publication of CN115510811A publication Critical patent/CN115510811A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention discloses a character string encoding and decoding method, an encoding device and a decoding device, wherein data to be encoded are obtained in the encoding method, and are grouped to obtain a plurality of character string arrays; carrying out 62-system coding on the data in each character string array to obtain a coded result of each character string array; and splicing the results of each character after data conversion and coding to obtain coded data corresponding to the data to be coded, wherein the coded data are the data which are coded by using 0 to 9 and upper and lower case letters. The invention only applies 0 to 9 and upper and lower case letters to complete coding, solves the problem that special characters cannot be compatible in the prior art, and groups the input binary characters, and codes each group respectively, so that the application range is wider.

Description

Character string encoding and decoding methods, encoding device and decoding device
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method and an apparatus for encoding and decoding a character string.
Background
In a data application scenario, applications such as log text, web text, etc., each contain a large number of character-type numbers, which refer to characters that can be displayed and printed in text form, and are stored in the form of character strings. Character type numbers occupy more storage space than numeric type numbers, and therefore, in order to reduce the storage space of character type numbers, the storage space of character string numbers is reduced in the prior art by increasing the number scale of the numbers so that each character type number can store more states.
For example, the binary string is encoded by base64 (64 system) to obtain a string supported by various text protocols such as email/json. However, when the base64 is used for encoding, special symbols such as "+"/"-" "=" appear in the encoding result, and when the special symbols are displayed on html, the functions selected by double mouse clicks on a browser cannot be compatible; and when base64 is used for encoding, the three special symbols "+"/"" = "are required to be shifted when being displayed in url, which causes poor readability and also causes poor spatial performance of encoding, and thus cannot be better applied.
Disclosure of Invention
In view of the above problems, the present invention provides a method for encoding and decoding a character string, and an encoding device and a decoding device thereof, so as to solve the problems of poor compatibility and poor applicability of encoded data in the prior art.
In order to achieve the purpose, the invention provides the following technical scheme:
a method of string encoding, comprising:
acquiring data to be coded, wherein the data to be coded is a binary character string;
grouping the data to be coded to obtain a plurality of character string arrays;
carrying out 62-system coding on the data in each character string array to obtain a coded result of each character string array;
and splicing the results of each character after data conversion and coding to obtain coded data corresponding to the data to be coded, wherein the coded data are the data which are coded by using 0 to 9 and upper and lower case letters.
Optionally, the grouping the data to be encoded to obtain a plurality of character string arrays includes:
and grouping the data to be coded according to eight-bit binary bytes to obtain a plurality of character string arrays.
Optionally, the performing 62-ary encoding on the data in each string array to obtain the result after encoding each string array includes:
determining an initial binary number according to a target mode for each character string array, wherein the initial binary number is a binary positive integer with the length of 64 bits at most;
converting the initial binary number to obtain a target binary number, wherein the target binary number is a 62-system positive integer with the maximum eleven bits;
converting the target binary number according to the target mode to obtain a plurality of positive integers, wherein the positive integers are positive integers from 0 to 61;
based on the 62-system coding comparison table, converting a plurality of positive integers into integers and/or upper and lower case letters to obtain the coded result of each character string array.
Optionally, the method further comprises:
and if the last character string array in the character string arrays is less than eight binary characters, filling the digits in the last character string array by using the target characters.
A string decoding method, comprising:
acquiring data to be decoded, wherein the data to be decoded is data which completes coding by using 0 to 9 and upper and lower case letters;
grouping the data to be decoded to obtain a plurality of character string arrays;
decoding the data in each character string array to obtain a decoded result of each character string array, wherein the decoded result is a binary character;
and splicing the decoded result of each character string array to obtain decoded data corresponding to the data to be decoded.
Optionally, the grouping the data to be decoded to obtain a plurality of character string arrays includes:
and grouping the data to be decoded according to 11 characters to obtain a plurality of character string arrays.
Optionally, the decoding the data in each string array to obtain a decoded result of each string array includes:
converting characters in each character string array into initial positive integers, wherein the initial positive integers are positive integers from 0 to 61;
converting the initial positive integer to obtain a target positive integer, wherein the target positive integer is a binary positive integer with the maximum 64 bits;
and converting the target positive integer into eight binary data according to a target mode to obtain a decoded result of each character conversion array.
Optionally, the method further comprises:
and if the last character string array in the character string arrays is less than 11 characters, filling the digits in the last character string array by using the target characters.
A character string encoding device comprising:
the device comprises a first acquisition unit, a second acquisition unit and a control unit, wherein the first acquisition unit is used for acquiring data to be coded, and the data to be coded is a binary character string;
the first grouping unit is used for grouping the data to be coded to obtain a plurality of character string arrays;
the encoding unit is used for carrying out 62-system encoding on the data in each character string array to obtain the result of each character string array after encoding;
and the first splicing unit is used for splicing the result of each character after data conversion and coding to obtain coded data corresponding to the data to be coded, wherein the coded data are data which are coded by using 0 to 9 and upper and lower case letters.
A character string decoding apparatus comprising:
the second acquisition unit is used for acquiring data to be decoded, wherein the data to be decoded is data which completes coding by using 0 to 9 and upper and lower case letters;
the second grouping unit is used for grouping the data to be decoded to obtain a plurality of character string arrays;
the decoding unit is used for decoding the data in each character string array to obtain a decoded result of each character string array, and the decoded result is a binary character;
and the second splicing unit is used for splicing the decoded result of each character string array to obtain the decoded data corresponding to the data to be decoded.
Compared with the prior art, the invention provides a character string encoding and decoding method, an encoding device and a decoding device, wherein data to be encoded are obtained in the encoding method, and are grouped to obtain a plurality of character string arrays; carrying out 62-system coding on the data in each character string array to obtain a coded result of each character string array; and splicing the results of each character after data conversion and coding to obtain coded data corresponding to the data to be coded, wherein the coded data are data which are coded by using 0 to 9 and upper and lower case letters. The invention only applies 0 to 9 and upper and lower case letters to complete coding, solves the problem that special characters cannot be compatible in the prior art, and groups the input binary characters, and codes each group respectively, so that the application range is wider.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flow chart of a character string encoding method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a data reading method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a 62-ary coding lookup table according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of a method for decoding a character string according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a character string encoding apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a character string decoding apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first" and "second," and the like in the description and claims of the present invention and the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not set forth for a listed step or element but may include steps or elements not listed.
The embodiment of the invention provides a character string coding method, which is based on a binary character string coding method of 62 system, and is a mode of coding a binary character string into an ASCII (American Standard Code for Information Interchange) printable character string, so that the coded character string can be placed in json/email or a doc document to be printed without losing any Information of the original binary.
Referring to fig. 1, a schematic flow chart of a character string encoding method provided in an embodiment of the present invention is shown, where the method includes:
s101, acquiring data to be coded.
In the embodiment of the present invention, data to be encoded is a binary string, generally, all data in a computer are represented by binary numbers during storage and operation, if character-type numbers are stored in a binary manner, the occupied storage space is large, and in order to reduce the occupied space for storing the character-type numbers, the character-type numbers need to be encoded, and in the embodiment of the present invention, the binary string may be subjected to 62-ary encoding.
S102, grouping the data to be coded to obtain a plurality of character string arrays.
The binary character string to be input by the data to be coded is classified according to 8-bit binary bytes, namely, each 8-bit 256-system integer is classified into one group. Thereby obtaining a plurality of character string data. Usually, the 62-ary encoding can only encode positive integers, either the input string length is limited to 8 characters, or the encoding and decoding time increases with the square of the string length, which makes the applicability poor. The invention divides the input binary character string into groups according to 8 binary characters, and codes each group respectively, thereby solving the problem that the 62-system technology can only code positive integers.
S103, carrying out 62-system coding on the data in each character string array to obtain a coded result of each character string array.
In the embodiment of the invention, only 0 to 9 and upper and lower case letters are used for completing the coding when carrying out the 62-system coding. Specifically, in an implementation manner of the embodiment of the present invention, the performing 62-ary encoding on the data in each string array to obtain the result after each string array is encoded includes:
determining an initial binary number for each character string array according to a target mode, wherein the initial binary number is a binary positive integer with the length of 64 bits at most;
converting the initial binary number to obtain a target binary number, wherein the target binary number is a 62-system positive integer with the maximum eleven bits;
converting the target binary number according to the target mode to obtain a plurality of positive integers, wherein the positive integers are positive integers from 0 to 61;
based on the 62-system coding comparison table, converting a plurality of positive integers into integers and/or upper and lower case letters to obtain the coded result of each character string array.
The target mode refers to a mode (Big-ending) in which the high address bits store the high data, and may also be referred to as a Big-end mode (Big-end), as shown in fig. 2, the high bits are arranged at the low address end of the memory, and the low bits are arranged at the high address end of the memory. In each group, the binary positive integer with the maximum length of 64 bits is read out in a big-ending mode. The positive integer is converted into a maximum 11-bit 62-ary positive integer by repeatedly taking the remainder 62 and dividing the remainder 62 by the integer 62. And changing the converted positive integer into 11 positive integers of 0-61 according to a big-ending mode, and converting the 11 positive integers into integers and 11 characters of capital and lower case letters by inquiring a 62-system coding comparison table shown in FIG. 3.
And S104, splicing the results of the data-changing coding of each character to obtain coded data corresponding to the data to be coded.
The coded data is data which is coded by using 0 to 9 and upper and lower case letters. That is, the results of all the groups are sequentially connected and spliced to obtain the final result.
On the basis of the above embodiment, the encoding method of the present invention further includes:
and if the last character string array in the character string arrays is less than eight binary characters, filling the digits in the last character string array by using the target characters.
Wherein the target character is "\ x00". Therefore, in the last grouping of less than 8 binary characters, the \ x00 character is added in front to supplement 8 bits for encoding, and the 11 generated characters are used for deleting the redundant '0' character in front according to the input length by using a table look-up mode.
The embodiment of the invention provides a character string coding method, which comprises the steps of obtaining data to be coded, grouping the data to be coded, and obtaining a plurality of character string arrays; carrying out 62-system coding on the data in each character string array to obtain a coded result of each character string array; and splicing the results of each character after data conversion and coding to obtain coded data corresponding to the data to be coded, wherein the coded data are data which are coded by using 0 to 9 and upper and lower case letters. The invention only applies 0 to 9 and upper and lower case letters to complete coding, solves the problem that special characters cannot be compatible in the prior art, and groups the input binary characters, and codes each group respectively, so that the application range is wider.
To illustrate the above encoding method, the data to be encoded, i.e., the input binary string, is a 17-byte string whose contents are {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}. The character string output after the character string encoding method of the embodiment of the invention is a character string with the length of 24 bytes, and the content of the character string is {05McJmDgrvc0m7AQFuv3B20H }. Specifically, the encoding process is as follows:
the input character strings {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17} are grouped according to eight octets of binary bytes to obtain 3 groups, the contents of which are:
{1,2,3,4,5,6,7,8},{9,10,11,12,13,14,15,16},{17}。
in each group, the binary positive integer with the length of 64 at most is read out in a big-ending mode, and the content is expressed in decimal (the front 16 is expressed in binary, and the back is expressed in 10 in parentheses):
0x102030405060708(72623859790382856),0x90a0b0c0d0e0f10(651345242494996240),0x11(17)。
the positive integer is converted into a maximum 11-bit 62-ary positive integer by repeatedly taking the remainder 62 and dividing the remainder 62 and the integer 62, and the contents are respectively (wherein each number in the positive integer is a one-bit value of the 62-ary):
{38,57,53,42,13,48,19,38,22,5},{2,11,3,57,56,15,26,10,7,48},{17}。
by looking up the look-up table in fig. 3, 11 positive integers are converted into integers and 11 characters of upper and lower case letters, the contents of which are respectively:
05McJmDgrvc,0m7AQFuv3B2,0H。
and sequentially connecting and splicing the results of all the groups to obtain a final result, wherein the contents are as follows:
“05McJmDgrvc0m7AQFuv3B20H”。
on the basis of the above coding embodiment, an embodiment of the present invention further provides a character string decoding method, which, with reference to fig. 4, includes:
s201, obtaining data to be decoded.
The data to be decoded is data which completes coding by using 0 to 9 and upper and lower case letters;
s202, grouping the data to be decoded to obtain a plurality of character string arrays;
s203, decoding the data in each character string array to obtain a decoded result of each character string array, wherein the decoded result is a binary character;
and S204, splicing the decoded result of each character string array to obtain decoded data corresponding to the data to be decoded.
Further, the grouping the data to be decoded to obtain a plurality of character string arrays includes:
and grouping the data to be decoded according to 11 characters to obtain a plurality of character string arrays.
Further, the decoding the data in each string array to obtain the decoded result of each string array includes:
converting characters in each character string array into initial positive integers, wherein the initial positive integers are positive integers from 0 to 61;
converting the initial positive integer to obtain a target positive integer, wherein the target positive integer is a binary positive integer with the maximum 64 bits;
and converting the target positive integer into eight binary data according to a target mode to obtain a decoded result of each character conversion array.
The decoding method in the embodiment of the present invention further includes: and if the last character string array in the character string arrays is less than 11 characters, filling the digits in the last character string array by using the target characters.
Specifically, the method for decoding the character string in the embodiment of the present invention is to decode the character string into binary, group the input binary character string according to 11 characters, and convert the 11 characters into 11 positive integers of 0 to 61 by table lookup (62-ary coding comparison table). It is converted into a maximum 64-bit binary positive integer by means of repeated multiplication by 62 and summation. And converting the 64-bit binary system into 8 binary systems according to a big-ending mode. And splicing the results of all the groups to obtain a final result. It should be noted that, the last packet with less than 11 characters is encoded by adding "0" character to the front to supplement 8 bits, and the generated 8 characters are used to delete the redundant "\ x00" character in front according to the input length by using a table lookup method.
In the embodiment of the invention, the coding is finished by only using 0-9 and upper and lower case letters, no special symbol is used, all upper and lower case sensitive text systems are compatible, and binary character string input with any length is supported. The binary size comparison results of the input character string and the output character string are always consistent for any input character string A/B with the same length. String encoding and decoding time grows linearly with binary strings. Verified, on the cpu of a 2.3GHz 4-core i7, a golang programming tool is used for realizing the scheme, the average time consumed by a single-thread coded 1024-byte character string is 3.596 microseconds, the average input processing speed is 268.9MB/s, the average time consumed by a single-thread decoded 1408-byte coded character string is 2.433 microseconds, and the average input processing speed is 552.0MB/s.
Referring to fig. 5, an embodiment of the present invention provides a character string encoding apparatus, including:
a first obtaining unit 11, configured to obtain data to be encoded, where the data to be encoded is a binary string;
a first grouping unit 12, configured to group the data to be encoded to obtain a plurality of character string arrays;
the encoding unit 13 is configured to perform 62-ary encoding on the data in each string array to obtain an encoded result of each string array;
the first splicing unit 14 is configured to splice a result of data conversion and encoding of each character to obtain encoded data corresponding to the data to be encoded, where the encoded data is data that is encoded using 0 to 9 and upper and lower case letters.
On the basis of the encoding apparatus, the first grouping unit is specifically configured to:
and grouping the data to be coded according to eight-bit binary bytes to obtain a plurality of character string arrays.
Further, the encoding unit includes:
the first determining subunit is used for determining an initial binary number according to a target mode for each character string array, wherein the initial binary number is a binary positive integer with the length of 64 bits at most;
a first conversion subunit, configured to convert the initial binary number to obtain a target binary number, where the target binary number is a 62-ary positive integer with a maximum of eleven bits;
the second conversion subunit is used for converting the target binary number according to the target mode to obtain a plurality of positive integers, wherein the positive integers are positive integers from 0 to 61;
and the third conversion subunit is used for converting a plurality of positive integers into integers and/or upper and lower case letters based on the 62-system coding comparison table so as to obtain a coded result of each character string array.
Further, the apparatus further comprises:
and the completion unit is used for completing the digits in the last character string array by using the target character if the last character string array in the character string arrays is less than eight binary characters.
Referring to fig. 6, in an embodiment of the present invention, there is further provided a character string decoding apparatus, including:
a second obtaining unit 21, configured to obtain data to be decoded, where the data to be decoded is data that is encoded using 0 to 9 and upper and lower case letters;
a second grouping unit 22, configured to group the data to be decoded to obtain a plurality of character string arrays;
the decoding unit 23 is configured to decode data in each string array to obtain a decoded result of each string array, where the decoded result is a binary character;
and the second splicing unit 24 is configured to splice the decoded result of each character string array to obtain decoded data corresponding to the data to be decoded.
Further, the second packet unit is specifically configured to:
and grouping the data to be decoded according to 11 characters to obtain a plurality of character string arrays.
Optionally, the decoding unit includes:
a fourth conversion subunit, configured to convert the characters in each character string array into initial positive integers, where the initial positive integers are positive integers from 0 to 61;
a fifth conversion subunit, configured to convert the initial positive integer to obtain a target positive integer, where the target positive integer is a binary positive integer with a maximum 64 bits;
and the sixth conversion subunit is used for converting the target positive integer into eight binary data according to a target mode so as to obtain a result of decoding each character conversion array.
Optionally, the apparatus further comprises:
and the completion unit is used for completing the digits in the last character string array by using the target character if the last character string array in the character string arrays is less than 11 characters.
Based on the foregoing embodiments, embodiments of the present application provide a computer-readable storage medium storing one or more programs, which are executable by one or more processors to implement a character string encoding method and/or a character string decoding method as any one of the above.
The embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and is characterized in that the processor executes the steps of the character string encoding method and/or the character string decoding method implemented when the processor executes the program.
The Processor or the CPU may be at least one of an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a Central Processing Unit (CPU), a controller, a microcontroller, and a microprocessor. It is understood that the electronic device implementing the above-described processor function may be other electronic devices, and the embodiments of the present application are not limited in particular.
The computer storage medium/Memory may be a Read Only Memory (ROM), a Programmable Read Only Memory (PROM), an Erasable Programmable Read Only Memory (EPROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a magnetic Random Access Memory (FRAM), a Flash Memory (Flash Memory), a magnetic surface Memory, an optical Disc, or a Compact Disc Read-Only Memory (CD-ROM), and the like; and may be various terminals such as mobile phones, computers, tablet devices, personal digital assistants, etc., including one or any combination of the above-mentioned memories.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or in other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all functional units in the embodiments of the present application may be integrated into one processing module, or each unit may be separately used as one unit, or two or more units may be integrated into one unit; the integrated unit may be implemented in the form of hardware, or in the form of hardware plus a software functional unit. Those of ordinary skill in the art will understand that: all or part of the steps of implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer-readable storage medium, and when executed, executes the steps including the method embodiments; and the aforementioned storage medium includes: various media capable of storing program codes, such as a removable Memory device, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The methods disclosed in the several method embodiments provided in the present application may be combined arbitrarily without conflict to obtain new method embodiments.
The features disclosed in the several product embodiments presented in this application can be combined arbitrarily, without conflict, to arrive at new product embodiments.
The features disclosed in the several method or apparatus embodiments provided herein may be combined in any combination to arrive at a new method or apparatus embodiment without conflict.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed in the embodiment corresponds to the method disclosed in the embodiment, so that the description is simple, and the relevant points can be referred to the description of the method part.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of string coding, comprising:
acquiring data to be coded, wherein the data to be coded is a binary character string;
grouping the data to be coded to obtain a plurality of character string arrays;
carrying out 62-system coding on the data in each character string array to obtain a coded result of each character string array;
and splicing the results of each character after data conversion and coding to obtain coded data corresponding to the data to be coded, wherein the coded data are the data which are coded by using 0 to 9 and upper and lower case letters.
2. The method according to claim 1, wherein the grouping the data to be encoded to obtain a plurality of character string arrays comprises:
and grouping the data to be coded according to eight-bit binary bytes to obtain a plurality of character string arrays.
3. The method of claim 1, wherein the performing 62-ary encoding on the data in each string array to obtain the encoded result of each string array comprises:
determining an initial binary number for each character string array according to a target mode, wherein the initial binary number is a binary positive integer with the length of 64 bits at most;
converting the initial binary number to obtain a target binary number, wherein the target binary number is a 62-system positive integer with the maximum eleven bits;
converting the target binary number according to the target mode to obtain a plurality of positive integers, wherein the positive integers are positive integers from 0 to 61;
based on the 62-system coding comparison table, converting a plurality of positive integers into integers and/or upper and lower case letters to obtain the coded result of each character string array.
4. The method of claim 2, further comprising:
and if the last character string array in the character string arrays is less than eight binary characters, utilizing the target character to fill the digits in the last character string array.
5. A method for decoding a character string, comprising:
acquiring data to be decoded, wherein the data to be decoded is data which completes coding by using 0 to 9 and upper and lower case letters;
grouping the data to be decoded to obtain a plurality of character string arrays;
decoding the data in each character string array to obtain a decoded result of each character string array, wherein the decoded result is a binary character;
and splicing the decoded result of each character string array to obtain decoded data corresponding to the data to be decoded.
6. The method of claim 5, wherein the grouping the data to be decoded to obtain a plurality of character string arrays comprises:
and grouping the data to be decoded according to 11 characters to obtain a plurality of character string arrays.
7. The method of claim 5, wherein decoding the data in each string array to obtain the decoded result of each string array comprises:
converting characters in each character string array into initial positive integers, wherein the initial positive integers are positive integers from 0 to 61;
converting the initial positive integer to obtain a target positive integer, wherein the target positive integer is a binary positive integer with the maximum 64 bits;
and converting the target positive integer into eight binary data according to a target mode to obtain a decoded result of each character conversion array.
8. The method of claim 6, further comprising:
and if the last character string array in the character string arrays is less than 11 characters, filling the digits in the last character string array by using the target characters.
9. A character string encoding device, comprising:
the device comprises a first acquisition unit, a second acquisition unit and a control unit, wherein the first acquisition unit is used for acquiring data to be coded, and the data to be coded is a binary character string;
the first grouping unit is used for grouping the data to be coded to obtain a plurality of character string arrays;
the encoding unit is used for carrying out 62-system encoding on the data in each character string array to obtain the result of each character string array after encoding;
and the first splicing unit is used for splicing the result of each character after data conversion and coding to obtain coded data corresponding to the data to be coded, wherein the coded data are data which are coded by using 0 to 9 and upper and lower case letters.
10. A character string decoding apparatus, comprising:
the second acquisition unit is used for acquiring data to be decoded, wherein the data to be decoded is data which is encoded by using 0 to 9 and upper and lower case letters;
the second grouping unit is used for grouping the data to be decoded to obtain a plurality of character string arrays;
the decoding unit is used for decoding the data in each character string array to obtain a decoded result of each character string array, and the decoded result is a binary character;
and the second splicing unit is used for splicing the decoded result of each character string array to obtain the decoded data corresponding to the data to be decoded.
CN202110631418.2A 2021-06-07 2021-06-07 Character string encoding and decoding methods, encoding device and decoding device Pending CN115510811A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110631418.2A CN115510811A (en) 2021-06-07 2021-06-07 Character string encoding and decoding methods, encoding device and decoding device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110631418.2A CN115510811A (en) 2021-06-07 2021-06-07 Character string encoding and decoding methods, encoding device and decoding device

Publications (1)

Publication Number Publication Date
CN115510811A true CN115510811A (en) 2022-12-23

Family

ID=84500383

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110631418.2A Pending CN115510811A (en) 2021-06-07 2021-06-07 Character string encoding and decoding methods, encoding device and decoding device

Country Status (1)

Country Link
CN (1) CN115510811A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116668465A (en) * 2023-07-31 2023-08-29 成都卓拙科技有限公司 Data synchronization method, device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116668465A (en) * 2023-07-31 2023-08-29 成都卓拙科技有限公司 Data synchronization method, device, computer equipment and storage medium
CN116668465B (en) * 2023-07-31 2023-10-03 成都卓拙科技有限公司 Data synchronization method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN100495318C (en) Compression and uncompression method of integer data and device thereof
CN103400174B (en) The coded method of a kind of Quick Response Code, coding/decoding method and system
AU2017342863B2 (en) Methods and devices for encoding and decoding binary data
CN104579360B (en) A kind of method and apparatus of data processing
JP7321208B2 (en) Polar code rate matching method and apparatus
CN105450232A (en) Encoding method, decoding method, encoding device and decoding device
CN110545106B (en) Method and device for coding time series data
CN112307369A (en) Short link processing method, device, terminal and storage medium
JP5656593B2 (en) Apparatus and method for decoding encoded data
US9798721B2 (en) Innovative method for text encodation in quick response code
CN113055455A (en) File uploading method and equipment
CN115510811A (en) Character string encoding and decoding methods, encoding device and decoding device
CN113852379A (en) Data encoding method, system, equipment and computer readable storage medium
CN112131202B (en) Distributed file storage and reading method, terminal device and storage medium
CN112232025B (en) Character string storage method and device and electronic equipment
CN112016270A (en) Chinese-sensible code logistics information coding method, device and equipment
CN108062289B (en) Fast Fourier Transform (FFT) address order changing method, signal processing method and device
CN116846600A (en) File transmission method, apparatus, computer device, storage medium, and program product
CN108734149B (en) Text data scanning method and device
CN110287147B (en) Character string sorting method and device
CN114513209A (en) Data compression method, device, equipment and storage medium
CN114626338A (en) Character encoding method, character decoding method, character encoding system, character decoding system, character encoding device, character decoding device, and storage medium
CN115033549A (en) File link storage method and device based on block chain
CN111970007B (en) Decoding method, decoder, device and medium
CN115203600A (en) Method, device, equipment and medium for generating short link

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination