CN116346482A - Data compression and encryption method based on prefix coding - Google Patents
Data compression and encryption method based on prefix coding Download PDFInfo
- Publication number
- CN116346482A CN116346482A CN202310349341.9A CN202310349341A CN116346482A CN 116346482 A CN116346482 A CN 116346482A CN 202310349341 A CN202310349341 A CN 202310349341A CN 116346482 A CN116346482 A CN 116346482A
- Authority
- CN
- China
- Prior art keywords
- prefix
- command
- version number
- calculating
- coding
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 21
- 238000013144 data compression Methods 0.000 title claims abstract description 9
- 230000005540 biological transmission Effects 0.000 abstract description 8
- 230000000694 effects Effects 0.000 abstract description 5
- 238000007906 compression Methods 0.000 description 7
- 230000006835 compression Effects 0.000 description 7
- 230000006978 adaptation Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/04—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
- H04L63/0428—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W12/00—Security arrangements; Authentication; Protecting privacy or anonymity
- H04W12/03—Protecting confidentiality, e.g. by encryption
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W84/00—Network topologies
- H04W84/18—Self-organising networks, e.g. ad-hoc networks or sensor networks
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Small-Scale Networks (AREA)
Abstract
A data compression and encryption method based on prefix coding. Relates to the technical field of data transmission. The method comprises the following steps: s1, all ad hoc network terminals are provided with an initial full-quantity character set { x } 1 ,x 2 ,…,x n Each character appears at a frequency of 1; s2, installing and calculating an optimal prefix coding program on all terminals; s3, calculating the optimal prefix coding program to the full-quantity character set { x } 1 ,x 2 ,…,x n Calculating prefix codes and setting a coding table version number as one; s4, any terminal sends a command A, and the command A is encoded by using a prefix code with a version number of one; s5, the rest terminals restore the command A by inquiring the coding table with the version number of one. The invention uses the history information to generate the optimal prefix code, so that the prefix code has more randomness, and the invention can realize the following purposesThe encryption effect is better.
Description
Technical Field
The invention relates to the technical field of data transmission, in particular to a prefix coding-based data compression and encryption method.
Background
The self-networking is based on the MESH technology as a core, and the broadband self-networking system adopts a centerless same-frequency self-networking technology and a distributed network architecture. Since the network is not centered, any node is both a host and a route; thus, there is a data security risk. Thus, the data needs to be transmitted in an encrypted manner, and in order to make the ad hoc network terminal portable, the transmission power is generally not too large, so that the actual bandwidth is far smaller than the theoretical value, and data compression transmission is needed.
However, the length and storage space of the message content after encryption processing by conventional encryption techniques are much larger than those before encryption. How encryption and compression can be achieved is a problem that is currently in need of solution.
The national intellectual property office 2016.09.28 entitled "encryption method for data transmission threshold scheme based on Huffman compression" has an announcement number of CN 103178968B, and includes: the user sends the plaintext data to a server through a client; the Huffman compression algorithm encodes according to the probability of character occurrence in the plaintext, thus constructing a Huffman tree; taking each byte of the Huffman tree as a shared secret key s, calculating to obtain n shadows with a threshold scheme of (t, n), and sending the m shadows to a trusted third party CA by a client; the client sends t-m parts of the shadow and the ciphertext to the server through a network; the server initiates a request for obtaining m parts of shadows to a trusted third party CA according to the received t-m parts of shadows and ciphertext; after the identity of the server is authenticated, the trusted third party CA responds to the request of the server and sends m shadows to the server; the server side recovers the Huffman tree by utilizing an interpolation polynomial according to a threshold scheme; and the server side decompresses by utilizing the Huffman according to the Huffman tree and the ciphertext to obtain a plaintext.
The method is applied to the transmission and the reception of plaintext data, and can utilize the concise and efficient coding and decoding efficiency, greatly reduce the length and the storage space of ciphertext, enhance the transmission rate of a channel and further reduce the transmission delay of data; meanwhile, the security of the transmitted data is increased by using a threshold scheme and a trusted third party.
However, it has the following drawbacks: the method needs a trusted third party CA to host m copies of the shadow, if the third party CA is not available, the threshold scheme cannot be implemented, and the trusted third party CA is difficult to find for the ad hoc network environment.
Disclosure of Invention
The present invention aims to solve at least one of the technical problems existing in the prior art.
The technical scheme of the invention is as follows: a prefix encoding-based data compression and encryption method, comprising the steps of:
s1, all ad hoc network terminals are provided with an initial full-quantity character set { x } 1 ,x 2 ,…,x n Each character appears at a frequency of 1;
s2, installing and calculating an optimal prefix coding program on all terminals;
s3, calculating the optimal prefix coding program to the full-quantity character set { x } 1 ,x 2 ,…,x n Calculating prefix codes and setting a coding table version number as one;
s4, any terminal sends a command A, and the command A is encoded by using a prefix code with a version number of one;
s5, the rest terminals restore the command A by inquiring a coding table with the version number of one;
s6, the terminal continues to send a plurality of commands, and if the command A appears most repeatedly in a set time period;
s7, adding a plurality of commands into the full-quantity character set to obtain a new character set;
s8, repeating the step S3, and calculating a new prefix code for the new character set, wherein the version number of the new code table is two;
s9, any terminal transmits a command A again, wherein the command A is encoded by using a prefix code with a version number of two;
s10, the rest terminals restore the command A by inquiring a coding table with the version number of two;
s11, repeating the steps S6-S10 in sequence.
In step S2, the calculated optimal prefix encoding procedure is a huffman encoding procedure.
In step S6, the time period is 1 day, 2 days or n days, and n is more than 2.
In operation, an initial full-quantity character set is set in each main network terminal, prefix codes are calculated on the full-quantity character sets through Huffman codes, a version number I is set, a command A is sent through the prefix codes, and the rest terminals need to use the version number I for restoration when restoring the command A.
The next time in the set time period, when sending the most commands A, by forming a new character set, calculating the prefix code again, setting the version number, then using the new prefix code to send the commands A, and when the other terminals restore the commands A, restoring the commands by using the version number II.
By sequentially and circularly generating the optimal prefix codes, and meanwhile, when decoding, the corresponding version numbers are required to be decrypted and restored.
The invention uses the history information to generate the optimal prefix code, so that the prefix code has more randomness and the encryption effect is better.
Detailed Description
The invention provides a data compression and encryption method based on prefix coding, which comprises the following steps:
s1, all ad hoc network terminals are provided with an initial full-quantity character set { x } 1 ,x 2 ,…,x n Each character appears at a frequency of 1, denoted as f (x i ) =1;
S2, installing and calculating an optimal prefix coding program on all terminals;
s3, calculating the optimal prefix coding program to the full-quantity character set { x } 1 ,x 2 ,…,x n Calculating prefix codes and setting a coding table version number as one;
s4, any terminal sends a command A, and the command A is encoded by using a prefix code with a version number of one;
s5, the rest terminals restore the command A by inquiring a coding table with the version number of one;
s6, the terminal continues to send a plurality of commands, and the occurrence frequency of each character is changed at the moment, namely f (x) i ) The value will no longer be 1, and if command a is repeated the most frequently within a set period of time, the frequency f (x) i ) Will be relatively high;
s7, adding a plurality of commands into the full-quantity character set to obtain a new character set, wherein the character set is unchanged, but the occurrence frequency of the characters is changed, and the frequency of the commonly used characters is increased at the moment;
s8, repeating the step S3, and calculating a new prefix code for a new character set (namely, the character set and the new frequency), wherein the version number of the new code table is two; the compression effect is better for the characters with higher occurrence frequency.
S9, any terminal transmits a command A again, wherein the command A is encoded by using a prefix code with a version number of two;
s10, the rest terminals restore the command A by inquiring a coding table with the version number of two;
s11, repeating the steps S6-S10 in sequence. The frequency of the characters is changing and then the optimal prefix encoding table is also changing dynamically. The variation of the prefix encoding table is dynamic and random.
The invention uses the history information to generate the optimal prefix code, so that the prefix code has more randomness and the encryption effect is better.
With the increase of the history messages, the common character weight can be increased, so that the message content has higher compression rate, and the encrypted message content becomes shorter.
Meanwhile, all terminals locally calculate the optimal prefix code by using historical data, so that the optimal prefix code does not need to be transmitted in a network, and only ciphertext is transmitted in the network.
In step S2, the calculated optimal prefix encoding procedure is a huffman encoding procedure.
In step S6, the time period is 1 day, 2 days or n days, and n is more than 2. The specific time period can be set autonomously as required.
The specific application is as follows:
s1, putting all possibly used character sets on all ad hoc network terminals;
s2, installing and calculating an optimal prefix coding program (i.e. a Huffman coding program) on all the ad hoc network terminals;
s3, calculating prefix codes for the full characters by using an optimal prefix coding program, setting the version number of a coding table to be one,
assume that the full character set at this time is: "abcdefghijklnnopqrstuvwxyz", encoded using an encoding program;
the same prefix codes are obtained in all the ad hoc network terminals as follows:
-->01010
a-->01011
b-->01100
c-->01101
d-->01110
e-->01111
f-->10000
g-->10001
h-->10010
i-->10011
j-->10100
k-->10101
l-->10110
m-->10111
n-->11000
o-->11001
p-->11010
q-->11011
r-->11100
s-->11101
t-->11110
u-->11111
v-->0000
w-->0001
x-->0010
y-->0011
z-->0100
s4, sending command
Any terminal sends a command 'sensor name code' which is 14 characters before coding, and occupies 14 x 8 bits of storage space;
the prefix is used for encoding to obtain:
s-->11101
e-->01111
n-->11000
d-->01110
-->01010
s-->11101
o-->11001
m-->10111
e-->01111
-->01010
c-->01101
o-->11001
d-->01110
e-->01111
the storage space is occupied by 14 x 5 bits, and the compression rate is 62.5%.
S5, receiving a command
The command after being received and encoded can not be decoded if the encoding table with the version number of one is not used, and encryption of the command is realized.
The "sensor name code" command is restored by querying the prefix encoding table.
S6, after a plurality of commands are sent, the commands are supposed to be repeatedly sent for 5 times at the moment;
s7, adding the sent commands into the full-quantity characters,
to obtain a new character set of abcdefghijklmnopqrstuvwxyz send some code send some code send some code send some code send some code "
S8, calculating to obtain a new prefix code by the method in S3, and setting a version number of the code table to be two;
-->001
a-->1100010
b-->1100011
c-->0001
d-->010
e-->111
f-->1100100
g-->1100101
h-->1100110
i-->1100111
j-->1101000
k-->1101001
l-->1101010
m-->1010
n-->1011
o-->011
p-->1101011
q-->1101100
r-->1101101
s-->100
t-->1101110
u-->1101111
v-->000000
w-->000001
x-->000010
y-->000011
z-->110000
s9, resending the command
The command 'sensor code' is 14 characters before coding, and occupies 14 x 8 bits of storage space
The obtained product is obtained after encoding the two prefixes by using the version number:
s-->100
e-->111
n-->1011
d-->010
-->001
s-->100
o-->011
m-->1010
e-->111
-->001
c-->0001
o-->011
d-->010
e-->111
occupies a smaller storage space 3+3+4+3+3+3+3+4+2+4+3 bit, and achieves a compression ratio of 40.2%.
S10, receiving a command
If the received coded command cannot be decoded without the prefix coding table with the version number of two, because each version coding table is different, decoding cannot be realized by using other version coding tables, and dynamic updating of the prefix coding table is realized, so that the encryption effect is better.
The foregoing is only a preferred embodiment of the invention, it being noted that: it will be apparent to those skilled in the art that various modifications and adaptations can be made without departing from the principles of the present invention, and such modifications and adaptations are intended to be comprehended within the scope of the invention.
Claims (3)
1. A prefix encoding-based data compression and encryption method, comprising the steps of:
s1, all ad hoc network terminals are provided with an initial full-quantity character set { x } 1 ,x 2 ,…,x n Each character appears at a frequency of 1;
s2, installing and calculating an optimal prefix coding program on all terminals;
s3, calculating the optimal prefix coding program to the full-quantity character set { x } 1 ,x 2 ,…,x n Calculating prefix codes and setting a coding table version number as one;
s4, any terminal sends a command A, and the command A is encoded by using a prefix code with a version number of one;
s5, the rest terminals restore the command A by inquiring a coding table with the version number of one;
s6, the terminal continues to send a plurality of commands, and if the command A appears most repeatedly in a set time period;
s7, adding a plurality of commands into the full-quantity character set to obtain a new character set;
s8, repeating the step S3, and calculating a new prefix code for the new character set, wherein the version number of the new code table is two;
s9, any terminal transmits a command A again, wherein the command A is encoded by using a prefix code with a version number of two;
s10, the rest terminals restore the command A by inquiring a coding table with the version number of two;
s11, repeating the steps S6-S10 in sequence.
2. The method for compressing and encrypting data based on prefix encoding according to claim 1, wherein in step S2, said calculating optimal prefix encoding procedure is a huffman encoding procedure.
3. A method of data compression and encryption based on prefix coding according to claim 1, characterized in that in step S6, the time period is 1 day, 2 days or n days, n > 2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310349341.9A CN116346482A (en) | 2023-04-04 | 2023-04-04 | Data compression and encryption method based on prefix coding |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310349341.9A CN116346482A (en) | 2023-04-04 | 2023-04-04 | Data compression and encryption method based on prefix coding |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116346482A true CN116346482A (en) | 2023-06-27 |
Family
ID=86894834
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310349341.9A Pending CN116346482A (en) | 2023-04-04 | 2023-04-04 | Data compression and encryption method based on prefix coding |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116346482A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7737870B1 (en) * | 2007-09-04 | 2010-06-15 | Nortel Networks Limited | Bit-stream huffman coding for data compression |
CN110868223A (en) * | 2019-12-06 | 2020-03-06 | 广东海洋大学 | A Numerical Operation Implementation Method and Circuit of Huffman Coding |
CN111510156A (en) * | 2020-06-03 | 2020-08-07 | 合肥师范学院 | Method for dynamically compressing and decompressing large file based on segmentation |
-
2023
- 2023-04-04 CN CN202310349341.9A patent/CN116346482A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7737870B1 (en) * | 2007-09-04 | 2010-06-15 | Nortel Networks Limited | Bit-stream huffman coding for data compression |
CN110868223A (en) * | 2019-12-06 | 2020-03-06 | 广东海洋大学 | A Numerical Operation Implementation Method and Circuit of Huffman Coding |
CN111510156A (en) * | 2020-06-03 | 2020-08-07 | 合肥师范学院 | Method for dynamically compressing and decompressing large file based on segmentation |
Non-Patent Citations (1)
Title |
---|
吴元君;张婷;: "数据压缩技术的原理及其实现", 电脑知识与技术, no. 11, 15 April 2009 (2009-04-15), pages 2998 - 2999 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3982688B2 (en) | Communication system and method using temporary compression table | |
CN1244998C (en) | Enciphering method using double keys and its wireless local network system | |
JP5392102B2 (en) | Apparatus and method for reducing overhead in a wireless network | |
CN116032474A (en) | A computer network security protection system based on big data | |
CN108696867B (en) | Lightweight group key distribution method based on wireless channel characteristics | |
US6963587B2 (en) | Communication system and method utilizing request-reply communication patterns for data compression | |
Kiskani et al. | A secure approach for caching contents in wireless ad hoc networks | |
CN107196732A (en) | The anti-eavesdrop coding method encoded based on fountain codes | |
CN119070955B (en) | A data transmission method based on quantum communication | |
CN111654484B (en) | A covert communication method in Ethereum based on whisper protocol | |
EP1334557A2 (en) | Static information knowledge used with binary compression methods | |
CN108259138A (en) | A kind of safe transmission method repeatedly fed back using fountain codes | |
CN115150066A (en) | CAES traditional Chinese medicine material tracing code encryption and decryption algorithm scheme | |
CN116346482A (en) | Data compression and encryption method based on prefix coding | |
CN110138423B (en) | A non-orthogonal multiplexing method | |
CN100452713C (en) | Network data concast transmission method based on distributed coding storage | |
EP1334559A2 (en) | Communication system and method utilizing request-reply communication patterns for data compression | |
CN116866052A (en) | An efficient blockchain covert communication method based on address coding | |
US6101281A (en) | Method for improving data encoding and decoding efficiency | |
CN102307075A (en) | Voice transmission encryption method of DMR (digital mobile radio) communication terminal | |
Yao et al. | Error estimating codes with constant overhead: A random walk approach | |
CN105515845A (en) | Data transmission method, data receiving method, data transmitting end and data receiving end | |
Chong et al. | Stepping-random code: a rateless erasure code for short-length messages | |
KR101632651B1 (en) | Method, server and computer program for transmitting binary data | |
Uryvsky et al. | Increasing the wireless systems information efficiency using LDPC coding |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20230627 |
|
RJ01 | Rejection of invention patent application after publication |