CN116634029B - Work platform data rapid transmission method based on block chain - Google Patents

Work platform data rapid transmission method based on block chain Download PDF

Info

Publication number
CN116634029B
CN116634029B CN202310896779.9A CN202310896779A CN116634029B CN 116634029 B CN116634029 B CN 116634029B CN 202310896779 A CN202310896779 A CN 202310896779A CN 116634029 B CN116634029 B CN 116634029B
Authority
CN
China
Prior art keywords
character
string
compression
compressed
candidate
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.)
Active
Application number
CN202310896779.9A
Other languages
Chinese (zh)
Other versions
CN116634029A (en
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.)
Zhongke Cloud Beijing Technology Co ltd
Original Assignee
Zhongke Cloud Beijing 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 Zhongke Cloud Beijing Technology Co ltd filed Critical Zhongke Cloud Beijing Technology Co ltd
Priority to CN202310896779.9A priority Critical patent/CN116634029B/en
Publication of CN116634029A publication Critical patent/CN116634029A/en
Application granted granted Critical
Publication of CN116634029B publication Critical patent/CN116634029B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/04Protocols for data compression, e.g. ROHC
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Theoretical Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention relates to the technical field of data compression transmission, in particular to a rapid transmission method of work platform data based on block chains, which comprises the following steps: acquiring work platform data, acquiring a character sequence, performing longest matching on the character sequence in the process of compressing the character sequence, acquiring a first candidate compression string according to a matching result, performing longest matching on the character sequence again, acquiring a second candidate compression string according to the matching result, acquiring compression advantages of the second candidate compression string relative to the first candidate compression string, selecting a character string to be compressed according to the compression advantages, and compressing the character string to be compressed by adopting different coding modes according to different character strings to be compressed. The compressed data is transmitted to the blockchain. Compared with LZ coding compression efficiency, the invention ensures the rapid transmission of the work platform data.

Description

Work platform data rapid transmission method based on block chain
Technical Field
The invention relates to the technical field of data compression transmission, in particular to a rapid transmission method of work platform data based on a blockchain.
Background
The system has the advantages that the system is beneficial to the utilization of the employment requirements of upstream enterprise clients, provides a large number of employment opportunities for downstream free occupations and individuals, can realize interconnection and intercommunication of enterprises and free occupations in a blockchain mode, and provides a more transparent and credible employment platform for the enterprises and the free occupations.
The recruitment platform data, such as the free professional's application information, the enterprise's recruitment information, etc., needs to be transmitted to the blockchain. Because of the large data volume of the worker platform data, the worker platform data needs to be compressed and transmitted in order to ensure quick transmission. The existing compression algorithm LZ codes a compression mode while constructing a compression dictionary, and realizes compression by coding a character string into one codeword. However, LZ coding can only code the shortest string that first appears in the sequence, and compression efficiency is limited.
Disclosure of Invention
The invention provides a fast transmission method of work platform data based on a blockchain, which aims to solve the existing problems.
The rapid transmission method of the work platform data based on the blockchain adopts the following technical scheme:
the invention provides a rapid transmission method of work platform data based on a blockchain, which comprises the following steps:
collecting working platform data, and converting the working platform data into character sequences; acquiring a codeword of each character; constructing an empty compression dictionary;
compressing the character sequence according to the compression dictionary, including:
performing longest matching on the character sequence by taking the first character of the character sequence as a start according to the compression dictionary to obtain a first character string; when the first character string is empty, taking the first character in the character sequence as the character string to be compressed; when the first character string is not empty, acquiring a first candidate compression string and a second character string; when the second character string is empty, the first candidate compression string is used as the character string to be compressed; when the second compressed string is not empty, acquiring a second candidate compressed string; acquiring the compression advantage of the second candidate compression string relative to the first candidate compression string, and acquiring the character string to be compressed according to the compression advantage; updating the compression dictionary and the character sequence according to the character string to be compressed;
repeatedly compressing the new character sequence until the character sequence is empty, stopping iteration, and acquiring compressed data according to the finally obtained compression dictionary;
and transmitting the compressed data to a block chain, and decompressing the compressed data to obtain the working platform data.
Preferably, the step of obtaining the codeword of each character includes the following specific steps:
counting the types of characters in the character sequence, and obtaining all the characters with the length as NIs to randomly use each character with a length of +.>The binary number corresponding to each character is used as the code word of each character, wherein +.>To round the symbol up.
Preferably, the step of obtaining the first candidate compression string and the second character string includes the following specific steps:
taking the next character of the first character string in the character sequence as a starting character, and forming a new character string by the first character string and the starting character to serve as a first candidate compression string; and carrying out longest matching by taking the initial character of the character sequence as a start according to the compression dictionary, and acquiring the longest substring of the character sequence which is positioned in the compression dictionary and takes the initial character of the character sequence as the start, wherein the longest substring is used as a second character string.
Preferably, the step of obtaining the second candidate compression string includes the following specific steps:
and using the next character of the second character string in the character sequence as an ending character, and splicing the first character string, the second character string and the ending character together according to the sequence to be used as a second candidate compression string.
Preferably, the obtaining the compression advantage of the second candidate compression string relative to the first candidate compression string includes the following specific steps:
wherein ,a compression advantage for the second candidate compression string over the first candidate compression string; />Length for the second candidate compression string; />A length for the first candidate compression string; />The number of times the second candidate compressed string occurs in the character sequence; />In character sequence for first candidate compression stringThe number of occurrences; />As a hyperbolic tangent function.
Preferably, the obtaining the character string to be compressed according to the compression advantage includes the following specific steps:
and when the compression dominance of the second candidate compression string relative to the first candidate compression string is smaller than the preset compression threshold, the first candidate compression string is taken as the character string to be compressed.
Preferably, the updating of the compression dictionary and the character sequence according to the character string to be compressed includes the following specific steps:
when the character string to be compressed is a single character, forming a coding pair of the character string to be compressed by 0 and a code word of the character to be compressed;
when the character string to be compressed is a first candidate compression string, an index of the first character string in the compression dictionary and a codeword of the initial character form a coding pair of the character to be compressed;
when the character string to be compressed is a second candidate compression string, acquiring the difference between the index of the second character string of the character string to be compressed in the compression dictionary and the index of the first character string in the compression dictionary, and when the difference is a positive number, adding the index of the last non-empty row in the compression dictionary and the difference, and taking the result as the forward coding of the character string to be compressed; when the difference is negative, multiplying the index of the last non-empty line in the compression dictionary by 2, and then adding the index with the absolute value of the difference, and taking the result as the forward coding of the character string to be compressed; forming a coding pair of the character to be compressed by forward coding, an index of a first character string in the character string to be compressed in a compression dictionary and a code word of an ending character;
adding the character string to be compressed and the coding pair of the character string to be compressed into a compression dictionary; and deleting the character string to be compressed from the character sequence to obtain a new character sequence.
Preferably, the obtaining compressed data according to the finally obtained compression dictionary includes the following specific steps:
obtaining the maximum value of decimal numbers contained in all coding pairs in the compression dictionary, and recording the maximum value asThe method comprises the steps of carrying out a first treatment on the surface of the Will beAs code length, converting decimal numbers in all code pairs in the compression dictionary into lengthAll binary numbers in the code pair after conversion are spliced together in sequence as the code result of the corresponding character string to be compressed, wherein +.>Rounding up the symbol; and splicing the coding results of all the character strings to be compressed in the compression dictionary together in sequence to serve as compressed data.
The technical scheme of the invention has the beneficial effects that: the invention acquires the work platform data, acquires the character sequence, carries out longest matching on the character sequence in the process of compressing the character sequence, acquires the first candidate compression string according to the matching result, carries out longest matching on the character sequence again, acquires the second candidate compression string according to the matching result, and the second candidate compression string is the result of matching the character sequence based on a plurality of coding objects in the compression dictionary. The second candidate compression string corresponds to two coding objects in the compression dictionary, and the index difference of the two coding objects is represented by indexes which do not exist in the current compression dictionary, so that the index difference is distinguished from indexes of other coding objects in the compression dictionary, and smooth decoding is ensured. The LZ coding can only code the shortest character string which appears for the first time in the character sequence, and the invention can also code the long character string which appears for the first time.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of steps of a blockchain-based rapid transmission method for worker platform data according to the present invention;
FIG. 2 is a compression dictionary in an embodiment of the present invention;
fig. 3 is a compression dictionary of LZ coding.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following detailed description is given below of the specific implementation, structure, characteristics and effects of the fast transmission method for work platform data based on blockchain according to the invention by combining the attached drawings and the preferred embodiment. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following specifically describes a specific scheme of the rapid transmission method of the work platform data based on the blockchain, which is provided by the invention, with reference to the accompanying drawings.
Referring to fig. 1, a flowchart illustrating a step of a fast transmission method for work platform data based on blockchain according to an embodiment of the invention is shown, the method includes the following steps:
s001, acquiring the data of the working platform and acquiring a character sequence.
And collecting work platform data such as worker information, post information and the like.
It should be noted that, in order to facilitate interconnection and interworking between the free professional and the enterprise, the free professional may transmit personal data to the blockchain through the worker platform, and the enterprise may transmit post information to the blockchain through the worker platform. Because the number data of the free occupations, the post information of the enterprises and other data volumes are large, the number data of the free occupations, the post information of the enterprises and other data volumes need to be compressed in order to realize quick transmission.
In the embodiment of the invention, the data of the working platform, such as the number data of free occupations, the post information of enterprises and the like, are collected.
It should be noted that, the working platform data includes multiple data types, and in order to facilitate compression transmission, the working platform data needs to be encoded into a uniform data format.
In the embodiment of the invention, the GB2312 code is utilized to code the working platform data into a binary form, and the Base64 code is utilized to code the obtained binary data into characters, so that a character sequence is obtained. It should be noted that, in other embodiments, an operator may select the encoding method according to the actual implementation.
So far, the data of the labor platform are collected, and the character sequence is obtained.
S002, obtaining the code word of each character in the character sequence.
In the embodiment of the invention, the number of types of characters in the character sequence is counted, and the number is represented by N, and the acquisition length isIs to randomly use each character with a length of +.>Is represented by a binary number corresponding to each character, and the binary numbers corresponding to each character are differentThe number is a codeword of each character, in whichTo round the symbol up. Length of codeword for each character +.>Recorded as a first length.
To this end, a codeword for each character is obtained.
S003, compressing the character sequence.
It should be noted that, LZ encoding is a method of constructing a dictionary and compressing the character string, in which the character string is encoded according to the index of the corresponding sub-string of the character string in the compression dictionary and the codeword of the last character of the character string in the compression process, and LZ encoding can only encode the shortest character string appearing for the first time in the character sequence, so that compression efficiency is limited. Therefore, the embodiment of the invention matches the data in the character sequence according to different character strings in the compression dictionary, and can encode the long character string appearing for the first time, thereby improving the compression efficiency of LZ encoding.
In the embodiment of the present invention, an empty compression dictionary is constructed, the compression dictionary includes an index column, a coding object column, and a coding column, the index column is used to represent a line number of the compression dictionary, and in the embodiment of the present invention, the index starts from 1. The code object column is used for storing the compressed characters or character strings, and the code column stores the code pairs corresponding to the compressed characters or character strings.
Compressing the character sequence according to the compression dictionary, specifically:
and carrying out longest matching on the character sequence according to the compression dictionary by taking the first character of the character sequence as a start, and obtaining the longest substring of the character sequence which is positioned in the compression dictionary and takes the first character of the character sequence as the start, wherein the substring is a sequence consisting of continuous characters in the character sequence as a first character string.
When the first character string is empty, that is, the first character string does not exist, the first character in the character sequence does not exist in the compression dictionary, and at this time, the first character in the character sequence is taken as the character string to be compressed.
When the first character string is not empty, the next character of the first character string in the character sequence is taken as a starting character. The first character string and the initial character form a new character string as a first candidate compression string. And carrying out longest matching by taking the initial character of the character sequence as a start according to the compression dictionary, and acquiring the longest substring of the character sequence which is positioned in the compression dictionary and takes the initial character of the character sequence as the start, wherein the longest substring is used as a second character string.
When the second character string is empty, the first candidate compression string is used as a character to be compressed; when the second character string is not empty, the next character of the second character string in the character sequence is taken as an ending character, and the first character string, the second character string and the ending character are spliced together in sequence to be taken as a second candidate compression string.
It should be noted that, when the second candidate compression string is longer than the first candidate compression string, the compression efficiency can be improved by adopting the second candidate compression string to compress, but when the second candidate compression string is shorter than the first candidate compression string, the efficiency of adopting the first candidate compression string is higher. Meanwhile, when the occurrence times of the second candidate compression strings in the character sequence are more, if the current second candidate compression strings are added into the compression dictionary, the efficiency of compressing according to the second candidate compression strings in the dictionary is higher when the subsequent second candidate compression strings occur again, otherwise, when the occurrence times of the second candidate compression strings in the character sequence are less, the significance of adding the current second candidate compression strings into the compression dictionary is not great when the occurrence times of the first kitchen compression strings are more, and the efficiency of adding the first candidate compression strings into the compression dictionary is higher. Therefore, the compression advantages of the second candidate compression string relative to the first candidate compression string can be obtained according to the lengths and the occurrence times of the first candidate compression string and the second candidate compression string, so that the optimal candidate compression string is selected for compression, and the compression efficiency is ensured to be highest.
In the embodiment of the present invention, the number of occurrences of the first candidate compression string and the second candidate compression string in the character sequence is obtained respectively, and it should be noted that, when the number of occurrences of the first candidate compression string and the second candidate compression string in the character sequence is obtained in the embodiment of the present invention, a manner of no-put-back counting is adopted, that is, when one sub-string in the character sequence is the same as the first candidate compression string, the sub-string is used as a first candidate compression string, and all characters in the sub-string cannot be used as a part of other first candidate compression strings. Similarly, when a sub-string in the character sequence is identical to a second candidate compressed string, the sub-string is taken as a second candidate compressed string, and all characters in the sub-string cannot be taken as part of other second candidate compressed strings.
Obtaining the compression advantage of the second candidate compression string relative to the first candidate compression string according to the occurrence times of the first candidate compression string and the second candidate compression string in the character sequence:
wherein ,a compression advantage for the second candidate compression string over the first candidate compression string; />Length for the second candidate compression string; />A length for the first candidate compression string; />The number of times the second candidate compressed string occurs in the character sequence; />The number of times the first candidate compressed string occurs in the character sequence; />As a hyperbolic tangent function; when the second candidate is pressedWhen the length of the compressed string is larger than that of the first candidate compressed string, the local compression efficiency of compressing the second candidate compressed string is higher than that of compressing the first subsequent compressed string; since the first candidate compression string is a sub-string of the second candidate compression string, the number of occurrences of the second candidate compression string in the character sequence must be less than or equal to the number of occurrences of the first subsequent compression string, if the second candidate compression string is added to the compression dictionary, the ratio of the number of occurrences is->When the character string is larger, most of character strings containing the first candidate compression string which appear later in the character sequence can be compressed by using a second candidate compression string in the compression dictionary, so that the overall compression efficiency of the character sequence is higher, and the compression advantage of the second candidate compression string relative to the first candidate compression string is larger. When the frequency ratio is->The smaller the character string containing the first candidate compression string, the larger the character string containing the first candidate compression string which appears later in the character sequence, the compression is not carried out by using the second candidate compression string in the compression dictionary, and the compression efficiency is higher when the first candidate compression string is added into the compression dictionary according to the compression of the first candidate compression string, and the compression advantage of the second candidate compression string relative to the first candidate compression string is smaller.
A compression threshold T is preset, where the embodiment is described by taking t=0.5 as an example, and the embodiment is not specifically limited, where T may be determined according to the specific implementation situation. And when the compression dominance of the second candidate compression string relative to the first candidate compression string is smaller than the compression threshold, the first candidate compression string is taken as the character string to be compressed.
So far, the character string to be compressed is obtained.
When the character string to be compressed is a single character, the code word of the character to be compressed and 0 form a coding pair of the character string to be compressed. For example, when the character string to be compressed is a and the codeword of a is 00, the encoding pair is (0,00).
When the character string to be compressed is a first candidate compression string, an index of the first character string in the compression dictionary and a codeword of the initial character form a coding pair of the character to be compressed. For example, the character string to be compressed is ABC, AB is the first character string, C is the start character when the index in the compression dictionary is 2, and the code word of C is 10, the encoding pair is (2, 10).
It should be noted that, when the character string to be compressed is the second candidate compression string, the second candidate compression string corresponds to two encoding objects in the compression dictionary, in order to ensure that the subsequent decoding can be performed successfully, the difference between the indexes of the two encoding objects can be used for encoding, and in order to distinguish the difference between the indexes of the two encoding objects from other indexes in the compression dictionary, the difference between the indexes of the two encoding objects can be represented by combining the indexes which do not exist in the current compression dictionary.
In the embodiment of the invention, when the character string to be compressed is a second candidate compression string, the difference between the index of the second character string of the character string to be compressed in the compression dictionary and the index of the first character string in the compression dictionary is obtained, and when the difference is positive, the index of the last non-empty line in the compression dictionary is added with the difference, and the result is used as the forward coding of the character string to be compressed; when the difference is negative, multiplying the index of the last non-empty line in the compression dictionary by 2, and adding the index and the absolute value of the difference, and taking the result as the forward coding of the character string to be compressed. And forming a coding pair of the character to be compressed by forward coding, the index of the first character string in the compression dictionary and the code word of the ending character. For example, the character string to be compressed is AABA, a is a first character string, the index in the compression dictionary is 1, ab is a second character string, the index in the compression dictionary is 2, the index of the last non-empty line of the current compression dictionary is 4, the last a is an end character, and when the codeword of a is 00, the code pair is (5,1,00).
And respectively adding the character string to be compressed and the codes of the character string to be compressed to the code object column and the code column of the compression dictionary. And deleting the character string to be compressed from the character sequence to obtain a new character sequence.
The compression of the new character sequence is repeated until the character sequence is empty, and the iteration is stopped.
It should be noted that, the indexes of the 0, the forward code and the first character string in the character string to be compressed in the code pair in the compression dictionary are decimal numbers, and the code words of the start character and the end character are binary numbers. Inside a computer, all data is stored or transmitted in binary form, so that the forward encoding in the encoding pair and the index of the first string in the compression dictionary in the string to be compressed need to be converted into binary form.
In the embodiment of the invention, the maximum value of decimal numbers contained in all coding pairs in the compression dictionary is obtained and recorded as. Will->As coding length, wherein->To round up the symbols, the decimal numbers in all the encoding pairs in the compression dictionary are converted to length +.>All binary numbers in the converted code pair are spliced together in sequence to be used as the coding result of the corresponding character string to be compressed. And splicing the coding results of all the character strings to be compressed in the compression dictionary together according to the sequence to serve as compression data of the character sequence. Will->Recorded as the second length.
So far, compressed data is acquired.
For example, when the character sequence is aabdcaabaabccabaabacabcab, and the code words of A, B, C, D are 00, 01, 10, and 11, respectively, the compression is performed by using the method in the embodiment of the present invention, and the finally obtained compression dictionary is shown in fig. 2, where the corresponding compressed data is 000000000101000011000010010100010000101010000100001001010101010000 and the length is 66. The compression dictionary obtained by compressing the character sequence by using the existing LZ coding is shown in fig. 3, and the corresponding compressed data is 000000000101000011000010000100000001010101010010001010010100011000010000011010100100 and has a length of 84. The compression method in the embodiment of the invention has higher compression efficiency compared with LZ coding.
S004, transmitting and decompressing the compressed data.
The compressed data is transmitted to the blockchain. And transmitting the code words corresponding to the first length, the second length and each character together with the compressed data.
When the worker platform data in the blockchain needs to be checked, the compressed data is decompressed, specifically:
an empty compression dictionary is constructed, the compression dictionary comprises an index column, a coding object column and a coding column, the index column is used for representing the line number of the compression dictionary, and the index starts from 1. The first length is denoted by R and the second length is denoted by S.
The first S bits of compressed data are obtained and converted into decimal numbers, which are marked as prefixes.
Judging the prefix to realize the update of the compression dictionary, comprising:
and when the prefix is 0, R bits are continuously read backwards in the compressed data, the character with the same code word as the suffix is obtained as a decompression result, the decompression result is filled into a coding object column of the compression dictionary, the prefix and the suffix form a coding pair, and the coding pair is filled into a coding column of the compression dictionary.
When the prefix is not 0 and the index which is the same as the prefix exists in the front compression dictionary, taking the coding object corresponding to the index as a first character string, continuously and backwardly reading R bits in the compression data, taking the R bits as a suffix, obtaining the character which is the same as the suffix as a target character, splicing the target character after the first character string to obtain a decompression result, filling the decompression result into a coding object column of the compression dictionary, forming a coding pair by the prefix and the suffix, and filling the coding pair into a coding column of the compression dictionary.
When the prefix is not 0 and the index same as the prefix does not exist in the current compression dictionary, S bits are read backwards continuously in the compressed data, and are converted into decimal numbers and recorded as intermediate codes. And obtaining an encoding object corresponding to the same index as the intermediate encoding in the compression dictionary as a first character string. And obtaining the maximum index in the current compression dictionary, obtaining the quotient and remainder of the prefix divided by the maximum index in the current compression dictionary, adding the remainder to the intermediate code to be used as a first code when the quotient is 1, subtracting the remainder from the intermediate code to be used as the first code when the quotient is 2, and obtaining the code object corresponding to the index identical to the first code in the compression dictionary to be used as a second character string. And continuously and backwardly reading R bits in the compressed data, taking the R bits as a suffix, and acquiring the character with the same codeword and the suffix as a target character. And splicing the first character string, the second character string and the target character together according to the sequence to obtain a decompression result. Filling the decompression result into the coding object column of the compression dictionary, forming a coding pair by the prefix, the intermediate code and the suffix, and filling into the coding column of the compression dictionary.
And continuing to read S bits backwards in the compressed data, judging the new prefix as the new prefix, realizing the re-updating of the compressed character, and repeating the process until all bits in the compressed data are read, and stopping iteration.
And splicing all characters or character strings of the coding object columns in the final compression dictionary together according to the sequence to obtain a character sequence.
And (3) decoding the character sequence by utilizing the encoding method in the step S001 to obtain the work platform data.
Through the steps, the rapid transmission of the engineering platform data is completed.
According to the embodiment of the invention, the character sequence is acquired through acquiring the work platform data, the longest matching is carried out on the character sequence in the process of compressing the character sequence, the first candidate compression string is acquired according to the matching result, the longest matching is carried out on the character sequence again, the second candidate compression string is acquired according to the matching result, the second candidate compression string is the result of matching the character sequence based on a plurality of coding objects in the compression dictionary, the compression advantage of the second candidate compression string relative to the first candidate compression string is acquired, the optimal candidate compression string is selected according to the compression advantage to be used as the character string to be compressed, and the compression efficiency can be ensured to be highest. The second candidate compression string corresponds to two coding objects in the compression dictionary, and the index difference of the two coding objects is represented by indexes which do not exist in the current compression dictionary, so that the index difference is distinguished from indexes of other coding objects in the compression dictionary, and smooth decoding is ensured. The LZ coding can only code the shortest character string which appears for the first time in the character sequence, and the invention can also code the long character string which appears for the first time.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, alternatives, and improvements that fall within the spirit and scope of the invention.

Claims (3)

1. The rapid transmission method of the work platform data based on the block chain is characterized by comprising the following steps:
collecting working platform data, and converting the working platform data into character sequences; acquiring a codeword of each character; constructing an empty compression dictionary;
compressing the character sequence according to the compression dictionary, including:
performing longest matching on the character sequence by taking the first character of the character sequence as a start according to the compression dictionary to obtain a first character string; when the first character string is empty, taking the first character in the character sequence as the character string to be compressed; when the first character string is not empty, acquiring a first candidate compression string and a second character string; when the second character string is empty, the first candidate compression string is used as the character string to be compressed; when the second compressed string is not empty, acquiring a second candidate compressed string; acquiring the compression advantage of the second candidate compression string relative to the first candidate compression string, and acquiring the character string to be compressed according to the compression advantage; updating the compression dictionary and the character sequence according to the character string to be compressed;
repeatedly compressing the new character sequence until the character sequence is empty, stopping iteration, and acquiring compressed data according to the finally obtained compression dictionary;
transmitting the compressed data to a block chain, decompressing the compressed data, and obtaining working platform data;
the method for acquiring the first candidate compression string and the second character string comprises the following specific steps:
taking the next character of the first character string in the character sequence as a starting character, and forming a new character string by the first character string and the starting character to serve as a first candidate compression string; performing longest matching by taking the initial character of the character sequence as a start according to the compression dictionary, and acquiring the longest substring of the character sequence which is positioned in the compression dictionary and takes the initial character of the character sequence as the start, wherein the longest substring is used as a second character string;
the step of obtaining the second candidate compression string comprises the following specific steps:
the next character of the second character string in the character sequence is used as an ending character, and the first character string, the second character string and the ending character are spliced together according to the sequence to be used as a second candidate compression string;
the method for acquiring the compression advantage of the second candidate compression string relative to the first candidate compression string comprises the following specific steps:
wherein ,a compression advantage for the second candidate compression string over the first candidate compression string; />Length for the second candidate compression string; />A length for the first candidate compression string; />The number of times the second candidate compressed string occurs in the character sequence; />The number of times the first candidate compressed string occurs in the character sequence; />As a hyperbolic tangent function;
the method for acquiring the character string to be compressed according to the compression advantage comprises the following specific steps:
when the compression advantage of the second candidate compression string relative to the first candidate compression string is larger than or equal to a preset compression threshold, the second candidate compression string is taken as a character string to be compressed, and when the compression advantage of the second candidate compression string relative to the first candidate compression string is smaller than the preset compression threshold, the first candidate compression string is taken as the character string to be compressed;
the method for updating the compression dictionary and the character sequence according to the character string to be compressed comprises the following specific steps:
when the character string to be compressed is a single character, forming a coding pair of the character string to be compressed by 0 and a code word of the character to be compressed;
when the character string to be compressed is a first candidate compression string, an index of the first character string in the compression dictionary and a codeword of the initial character form a coding pair of the character to be compressed;
when the character string to be compressed is a second candidate compression string, acquiring the difference between the index of the second character string of the character string to be compressed in the compression dictionary and the index of the first character string in the compression dictionary, and when the difference is a positive number, adding the index of the last non-empty row in the compression dictionary and the difference, and taking the result as the forward coding of the character string to be compressed; when the difference is negative, multiplying the index of the last non-empty line in the compression dictionary by 2, and then adding the index with the absolute value of the difference, and taking the result as the forward coding of the character string to be compressed; forming a coding pair of the character to be compressed by forward coding, an index of a first character string in the character string to be compressed in a compression dictionary and a code word of an ending character;
adding the character string to be compressed and the coding pair of the character string to be compressed into a compression dictionary; and deleting the character string to be compressed from the character sequence to obtain a new character sequence.
2. The rapid transmission method for work platform data based on blockchain as in claim 1, wherein the step of obtaining the code word of each character comprises the following specific steps:
counting the types of characters in the character sequence, and obtaining all the characters with the length as NIs to randomly use each character with a length of +.>The binary number corresponding to each character is used as the code word of each character, wherein +.>To round the symbol up.
3. The rapid transmission method for the work platform data based on the blockchain as in claim 1, wherein the obtaining the compressed data according to the finally obtained compression dictionary comprises the following specific steps:
obtaining the maximum value of decimal numbers contained in all coding pairs in the compression dictionary, and recording the maximum value asThe method comprises the steps of carrying out a first treatment on the surface of the Will->As the coding length, decimal numbers in all coding pairs in the compression dictionary are converted to length +.>All binary numbers in the code pair after conversion are spliced together in sequence as the code result of the corresponding character string to be compressed, wherein +.>Rounding up the symbol; and splicing the coding results of all the character strings to be compressed in the compression dictionary together in sequence to serve as compressed data.
CN202310896779.9A 2023-07-21 2023-07-21 Work platform data rapid transmission method based on block chain Active CN116634029B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310896779.9A CN116634029B (en) 2023-07-21 2023-07-21 Work platform data rapid transmission method based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310896779.9A CN116634029B (en) 2023-07-21 2023-07-21 Work platform data rapid transmission method based on block chain

Publications (2)

Publication Number Publication Date
CN116634029A CN116634029A (en) 2023-08-22
CN116634029B true CN116634029B (en) 2023-09-29

Family

ID=87638568

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310896779.9A Active CN116634029B (en) 2023-07-21 2023-07-21 Work platform data rapid transmission method based on block chain

Country Status (1)

Country Link
CN (1) CN116634029B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116915260B (en) * 2023-09-13 2023-11-24 无锡市明通动力工业有限公司 Wind power motor cooling fan fault data optimization acquisition method
CN117081602B (en) * 2023-10-13 2024-01-26 青岛场外市场清算中心有限公司 Capital settlement data optimization processing method based on blockchain
CN117119120B (en) * 2023-10-25 2023-12-22 上海伯镭智能科技有限公司 Cooperative control method based on multiple unmanned mine cars

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107565972A (en) * 2017-09-19 2018-01-09 郑州云海信息技术有限公司 A kind of compression method, device, equipment and the storage medium of LZ codings
CN108880556A (en) * 2018-05-30 2018-11-23 中国人民解放军战略支援部队信息工程大学 Destructive data compressing method, error-resilience method and encoder and decoder based on LZ77
CN114244373A (en) * 2022-02-24 2022-03-25 麒麟软件有限公司 LZ series compression algorithm coding and decoding speed optimization method
CN116192154A (en) * 2023-04-28 2023-05-30 北京爱芯科技有限公司 Data compression and data decompression method and device, electronic equipment and chip

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110784225A (en) * 2018-07-31 2020-02-11 华为技术有限公司 Data compression method, data decompression method, related device, electronic equipment and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107565972A (en) * 2017-09-19 2018-01-09 郑州云海信息技术有限公司 A kind of compression method, device, equipment and the storage medium of LZ codings
CN108880556A (en) * 2018-05-30 2018-11-23 中国人民解放军战略支援部队信息工程大学 Destructive data compressing method, error-resilience method and encoder and decoder based on LZ77
CN114244373A (en) * 2022-02-24 2022-03-25 麒麟软件有限公司 LZ series compression algorithm coding and decoding speed optimization method
CN116192154A (en) * 2023-04-28 2023-05-30 北京爱芯科技有限公司 Data compression and data decompression method and device, electronic equipment and chip

Also Published As

Publication number Publication date
CN116634029A (en) 2023-08-22

Similar Documents

Publication Publication Date Title
CN116634029B (en) Work platform data rapid transmission method based on block chain
RU2403677C1 (en) Method for lossless data compression and retrieval
KR101049699B1 (en) Data Compression Method
US7990289B2 (en) Combinatorial coding/decoding for electrical computers and digital data processing systems
US7671767B2 (en) LIFO radix coder for electrical computers and digital data processing systems
US7545291B2 (en) FIFO radix coder for electrical computers and digital data processing systems
US20100085224A1 (en) Adaptive combinatorial coding/decoding with specified occurrences for electrical computers and digital data processing systems
CN106407285A (en) RLE and LZW-based optimized bit file compression and decompression method
CN110021369B (en) Gene sequencing data compression and decompression method, system and computer readable medium
CN116614139B (en) User transaction information compression storage method in wine selling applet
CN116521093B (en) Smart community face data storage method and system
JP5656593B2 (en) Apparatus and method for decoding encoded data
CN117177100B (en) Intelligent AR polarized data transmission method
CN116805537B (en) Data processing method for heart-lung rehabilitation management system
CN110021368B (en) Comparison type gene sequencing data compression method, system and computer readable medium
CN112956131B (en) Encoding device, decoding device, encoding method, decoding method, and computer-readable recording medium
US9235610B2 (en) Short string compression
US20220005229A1 (en) Point cloud attribute encoding method and device, and point cloud attribute decoding method and devcie
CN117097441B (en) Carrier communication system transmission efficiency optimization method based on data analysis
CN117240304B (en) Electronic invoice data processing method and system
JP2590287B2 (en) Data compression method and data compression apparatus
CN117155408B (en) Efficient transmission method for production data
CN1098565C (en) Method and apparatus for decoding variable length code
CN115086684B (en) Image compression method, system and medium based on CRC
JPH05224878A (en) Data compressing system using universal code

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
GR01 Patent grant
GR01 Patent grant