CN115632661B - Efficient compression transmission method for network security information - Google Patents
Efficient compression transmission method for network security information Download PDFInfo
- Publication number
- CN115632661B CN115632661B CN202211651652.2A CN202211651652A CN115632661B CN 115632661 B CN115632661 B CN 115632661B CN 202211651652 A CN202211651652 A CN 202211651652A CN 115632661 B CN115632661 B CN 115632661B
- Authority
- CN
- China
- Prior art keywords
- coded
- point
- adjacent
- encoded
- current point
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion 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/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/40—Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion 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/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/40—Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code
- H03M7/4006—Conversion to or from arithmetic code
- H03M7/4012—Binary arithmetic codes
Landscapes
- Engineering & Computer Science (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 high-efficiency compression transmission method of network security information, which comprises the following steps: converting the network security information data into a two-dimensional matrix, acquiring the appropriateness of each point to be encoded according to the number of directly reachable points to be encoded and the number of indirectly reachable points to be encoded of each point to be encoded in the two-dimensional matrix, and taking the point to be encoded with the maximum appropriateness as a wharf; and taking the encoded point to be encoded as an encoded point, acquiring the adjacent direction of the current point to be encoded according to the encoded point, giving a code value to each adjacent direction of the current point to be encoded according to the previous point linked with the current point to be encoded, performing chain code encoding according to the adjacent direction code value of each point to be encoded, and further compressing the chain code encoding result. The invention has high compression efficiency, and enables the network security information transmission to be more efficient.
Description
Technical Field
The invention relates to the technical field of data compression and transmission, in particular to a high-efficiency compression and transmission method for network security information.
Background
With the development of internet technology, networks become an essential part of people's lives. The network security problem that follows is also becoming more severe, and network security attacks continue to increase. In order to avoid serious loss caused by network security attack, network security protection needs to be done.
The security device and the network device may monitor for network security attacks. The security equipment comprises a firewall, an intrusion prevention detection system, vulnerability scanning equipment and the like, and can generate data such as firewall logs, intrusion prevention detection data, vulnerability scanning reports and the like. Network devices include routers, switches, etc., and may generate network traffic data, etc. The data generated by the security device and the network device are used as network security information data, and abnormal information in the network security information data can be mined by analyzing the network security information data, so that the network security attack can be monitored.
The analysis of the network security information data is performed on a centralized network security analysis platform, so that the network security information data needs to be transmitted to the network security analysis platform. The data volume of the network security information data is large, and the network security information data needs to be compressed to ensure the transmission efficiency.
In the conventional compression method, for example, chain code coding is performed on data first, and huffman coding is used for compressing chain code coding results, different compression results can be obtained by selecting different wharfs in the method, the corresponding compression efficiency is different, and the chain code coding is performed usually through a manually specified wharf at present, so that the obtained compression result is not optimal. Meanwhile, the adjacent direction and the code value of the adjacent direction of each data point in the method are the same, if the data distribution is disordered, different code values in the obtained chain code coding result are distributed uniformly, at the moment, the effect of further compressing the chain code coding result by utilizing the Huffman coding is poor, and even the effect of further compressing the chain code coding result can not be realized.
Disclosure of Invention
The invention provides a high-efficiency compression transmission method of network security information, which aims to solve the existing problems.
The invention relates to a network security information high-efficiency compression transmission method, which adopts the following technical scheme:
one embodiment of the invention provides a method for efficiently compressing and transmitting network security information, which comprises the following steps:
s1: collecting network security information data, and converting the network security information data into a two-dimensional matrix; acquiring points to be coded in a two-dimensional matrix;
s2: counting the number of the points to be coded, which are directly reachable, of each point to be coded and the number of the points to be coded, which are indirectly reachable, and acquiring the appropriateness of each point to be coded according to the number of the points to be coded, which are directly reachable, and the number of the points to be coded, which are indirectly reachable; taking the point to be coded with the maximum fitness as a wharf;
s3: taking the coordinates of the wharf in the two-dimensional matrix as a wharf coding result, and taking the wharf as a current point to be coded;
s4: acquiring the adjacent direction and the adjacent direction code value of the current point to be coded, wherein the method comprises the following steps:
acquiring all positions of a current point to be coded in an eight-neighborhood range in a two-dimensional matrix except a coded point, and taking the direction from the current point to be coded to all the positions as the adjacent direction of the current point to be coded; acquiring the initial direction of a current point to be coded, and giving a code value 0 to an adjacent direction of the current point to be coded according to whether the adjacent direction exists in the initial direction or not; giving code values to the rest adjacent pointers of the current point to be coded according to the adjacent pointer of the code value 0;
s5: taking each point to be coded to which all adjacent directions of the current point to be coded point to be candidate points to be coded, marking the current point to be coded point as a coded point, and acquiring any adjacent direction of the adjacent directions with the minimum absolute value of the code value in all candidate points to be coded points as a candidate point to be coded corresponding to the new current point to be coded; taking the code value of the adjacent direction from the coded point to the new current point to be coded as a coding result;
s6: repeating S4-S5 until the obtained latest adjacent point of the current point to be coded does not exist, stopping iteration, and taking all coding results as a chain code coding result; all the coding results comprise the coding result of the wharf, and the coding results obtained in the repeated process in S5 and S6;
s7: repeating S2-S6 until the two-dimensional matrix has no point to be encoded, stopping iteration to obtain a plurality of chain code encoding results, and taking all the chain code encoding results as first encoding results; the all chain code encoding results comprise the chain code encoding results obtained in the repeating process in S6 and S7;
s8: and compressing the first coding result to obtain compressed data.
Preferably, the converting the network security information data into the two-dimensional matrix includes the following specific steps:
encoding network security information data into a binary string, according to the length of the binary stringObtaining a number of linesAnd the number of columnsBuilding an emptyTwo dimensional moment of magnitudeArray, the length of the binary string being made to reach by supplementing the binary string with a 0 at its end(ii) a Sequentially filling each binary bit in the binary string to each position in the two-dimensional matrix, whereinIs rounding up the symbol.
Preferably, the acquiring the point to be encoded in the two-dimensional matrix includes the following specific steps:
and counting the number of 0 and 1 in the two-dimensional matrix, and marking the positions of the values with small number in the two-dimensional matrix as points to be coded.
Preferably, the appropriate expression is:
whereinIs as followsThe appropriateness of each point to be encoded;is as followsThe number of indirectly reachable points to be coded;the length of a binary string coded for the network security information data;is a firstThe number of the points to be coded which can be directly reached by the points to be coded;is a hyperbolic cosine tangent function.
Preferably, the obtaining of the initial direction of the current point to be encoded, and assigning a code value of 0 to an adjacent pointer of the current point to be encoded according to whether the adjacent pointer exists in the initial direction includes the following specific steps:
if the current point to be coded is a wharf, the current point to be coded is a wharfThe direction is taken as an initial direction; if the current point to be coded is not a wharf, acquiring the adjacent pointing direction from the last point linked with the current point to be coded to the current point to be coded as an initial direction;
if the adjacent orientation of the current point to be coded in the initial direction exists, the adjacent orientation of the current point to be coded in the initial direction is given to a code value 0, if the adjacent orientation of the current point to be coded in the initial direction does not exist, the adjacent orientation which is closest to the initial direction in the adjacent orientation of the current point to be coded is obtained, and if two closest adjacent orientations exist, the first adjacent orientation which is positioned in the initial direction clockwise in the two closest adjacent orientations is given to the code value 0.
Preferably, the method for assigning code values to the remaining adjacent pointers of the current point to be encoded according to the adjacent pointer of code value 0 includes the following specific steps:
acquiring the number of adjacent directions of the current point to be codedWith code value 0 adjacent to point in clockwise directionEach contiguous pointer being assigned a code value of-1 toWith code value 0 adjacent pointing in the counter-clockwise directionEach contiguous pointer being assigned code values 1 toWhereinIn order to round the symbol down,is rounding up the symbol.
The technical scheme of the invention has the beneficial effects that: the method obtains the appropriate degree of each point to be coded according to the number of the points to be coded which can be directly reached and the number of the points to be coded which can be indirectly reached, predicts the influence of each point to be coded as a wharf on the final compression efficiency by the appropriate degree under the condition of not carrying out chain code coding, and selects the point to be coded which is most likely to reach the highest compression efficiency as the wharf according to the appropriate degree. The compression efficiency of the subsequent network security information data is maximized, and the transmission of the subsequent network security information data is more efficient; when the adjacent direction of each point to be coded is obtained, the direction from the current point to be coded to the coded point is removed, code values are newly given to all adjacent directions of the current point to be coded according to the adjacent direction from the previous point linked with the current point to be coded to the current point to be coded, so that the number of the adjacent directions of the points to be coded is small, the code values are small, meanwhile, the candidate point to be coded corresponding to the adjacent direction with the minimum absolute value of the code values is preferentially selected as a new current point to be coded, the code values corresponding to the coding results can be small as much as possible, the smaller code value repetition rate in the obtained chain code coding results is higher, the larger code value repetition rate is lower, the compression efficiency is higher when the chain code coding results are further coded by utilizing Huffman coding, and the high-efficiency transmission of network security information data is further ensured.
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 embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart illustrating the steps of the method for efficiently compressing and transmitting network security information according to the present invention;
FIG. 2 is a diagram of points to be encoded of the network security information efficient compression transmission method of the present invention;
FIG. 3 is a schematic diagram of eight-directional chain codes of the method for efficiently compressing and transmitting network security information according to the present invention;
fig. 4 is a schematic view of chain code encoding of the network security information efficient compression transmission method of the present invention.
Detailed Description
To further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description is provided for the efficient compression transmission method of network security information according to the present invention, and the specific implementation, structure, features and effects thereof with reference to the accompanying drawings and the preferred embodiments. In the following description, different "one embodiment" or "another embodiment" refers to not necessarily the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
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 describes a specific scheme of the network security information efficient compression transmission method provided by the present invention in detail with reference to the accompanying drawings.
Referring to fig. 1, a flowchart illustrating steps of a method for efficiently compressing and transmitting network security information according to an embodiment of the present invention is shown, where the method includes the following steps:
and S001, collecting network security information data.
It should be noted that the network security information data includes data generated by the security device and the network device, including firewall logs, intrusion detection data, vulnerability scanning reports, network traffic data, and the like.
In this embodiment, data such as firewall logs, intrusion detection data, vulnerability scanning reports, and the like are collected by security devices such as firewalls, intrusion detection systems, vulnerability scanning devices, and the like. Network traffic data and the like are collected by network devices such as routers, switches and the like.
Thus, network security information data is obtained.
And S002, converting the network security information data into a two-dimensional matrix, and acquiring points to be coded in the two-dimensional matrix.
It should be noted that the network security information data includes multiple data types, and in order to implement compression of the network security information data, the network security information data needs to be encoded into a uniform data format.
In this embodiment, the network security information data is encoded into a binary form by using an existing encoding method, which includes but is not limited to ASCII code, GBK code, etc., to obtain a binary string. For example, in the network traffic monitoring data, "ip = 172" in 20.
It should be noted that, in order to compress the network security information data by using the improved chain code technique, the binary string converted from the network security information data is a one-dimensional data sequence. In order to increase the correlation between different binary bits in the binary string, increase the length of the subsequent chain code, and increase the subsequent compression efficiency, the embodiment converts the binary string into a two-dimensional matrix.
In this embodiment, the method for converting the binary string into the two-dimensional matrix is as follows:
for convenience of calculation, the two-dimensional matrix obtained by binary string conversion in this embodiment has the same number of rows and columns, and the values of the number of rows and columns are usedAnd (4) showing. According to the length of the binary stringObtaining:
WhereinTaking the values of the number of rows and the number of columns;is the length of the binary string;is the open root symbol;is rounding up the symbol.
The number of rows and columns is respectivelyAn empty column is constructed according to the number of rows and columnsTwo-dimensional matrix of size when two-dimensional matrices are sharedAnd (4) a position. Length of binary stringLess than or equal to the number of positions in the two-dimensional matrixAt this point, complement is applied to the end of the binary stringAnd 0, and enabling the length of the binary string after 0 is supplemented to be consistent with the number of positions in the two-dimensional matrix.
And filling each binary bit of the binary string after being supplemented with 0 to each position of the two-dimensional matrix in turn.
Thus, a two-dimensional matrix is obtained.
In order to reduce the amount of compressed data, the number of 0 s and the number of 1 s in the two-dimensional matrix are counted, and the small number is used as a point to be encoded. If the number of 0 in the two-dimensional matrix is less, marking each 0 in the two-dimensional matrix as a point to be coded, and otherwise, marking each 1 in the two-dimensional matrix as a point to be coded. And recording the value corresponding to the point to be coded, namely when the number of 0 in the two-dimensional matrix is less, the value corresponding to the point to be coded is 0, otherwise, the value corresponding to the point to be coded is 1.
Thus, the point to be encoded is obtained. It should be noted that, in the embodiment, by converting the network security information data into a binary string, the format unification of different data in the network security information data is realized, and the difficulty in subsequent compression is reduced; in the embodiment, the binary string is converted into the two-dimensional matrix, and the relevance between data is increased, so that the length of the subsequent chain code obtained according to the two-dimensional matrix is longer, and the compression efficiency is higher.
And S003, calculating the fitness of each point to be coded, and acquiring the wharf according to the fitness.
It should be noted that different points to be encoded are used as a dock to perform chain code encoding, and the obtained encoding results are different, and the lengths of the chain codes are different, which results in different final compression efficiencies. In order to make the compression efficiency as high as possible, the present embodiment introduces a fitness measure for the impact of each point to be coded as a quay on the final compression efficiency. When the more points to be coded that a point to be coded can indirectly reach, the more the points to be coded can be linked by a chain code, so the longer the length of the chain code constructed by taking the point to be coded as a wharf is, the higher the possibility is. Since the encoded to-be-encoded points are not repeatedly encoded in the subsequent chain code encoding method of this embodiment, the mark of the encoded to-be-encoded points is modified into the encoded points, and after one to-be-encoded point is used as a dock for encoding, the to-be-encoded point is marked as the encoded point, if the number of the to-be-encoded points that can be directly reached by the encoded point is more, the directly reachable points may not be directly reachable or indirectly reachable, so that the directly reachable points to be encoded cannot be linked by one chain code, and the shorter the chain code length is, the higher compression efficiency cannot be achieved at this time; if the number of the points to be coded which can be directly reached by the coded point is less, the influence on the points to be coded which can be directly reached by the coded point is less, so that the influence on the length of the chain code is less, and the length of the chain code is as long as possible. This embodiment takes fig. 2 as an example to illustrate the influence of the number of points to be coded that the dock can directly reach on the length of the chain code, where the black part in fig. 2 is the points to be coded and the white part is the rest of the points. In fig. 2, the number of points to be coded, where the point to be coded a can directly reach, is 1, the number of points to be coded, where the point to be coded B can directly reach, is 4, the length of the chain code obtained by using the point to be coded a as a dock is 5, and the length of the chain code obtained by using the point to be coded B as a dock is 2, 3, or 4.
It should be further noted that, in this embodiment, directly reachable means that if another to-be-coded point exists in the eight neighborhoods of one to-be-coded point, the two to-be-coded points are directly reachable; the indirect accessibility means that one point to be coded and another point to be coded are not directly accessible, but other points to be coded which are directly accessible exist between the two points to be coded, so that the two points to be coded are communicated. In the present embodiment, fig. 2 is taken as an example to illustrate direct accessibility and indirect accessibility, in fig. 2, a point to be coded, which is directly accessible by a point a to be coded, is B, and points to be coded, which are indirectly accessible by the point a to be coded, are C, D, and E.
In this embodiment, the appropriate degree of each point to be coded is obtained according to the number of directly reachable and indirectly reachable points to be coded, and the specific method is as follows:
firstly, acquiring each point to be coded in a two-dimensional matrixThe number of other points to be coded contained in the neighborhood is used as the number of points to be coded, which can be directly reached by each point to be codedIndicating that, for example, the number of points to be coded which are directly reachable by the first point to be coded is. Counting the number of the indirectly reachable points to be coded of each point to be codedIs shown as followsThe number of the points to be coded which can be indirectly reached by the point to be coded is. Then it is firstSuitability of a point to be encodedComprises the following steps:
whereinIs as followsThe appropriateness of each point to be encoded;is as followsThe number of indirectly reachable points to be coded;the length of a binary string coded for the network security information data;is a firstA point to be codedThe number of directly reachable points to be coded;is a hyperbolic cosine tangent function due toIs greater than or equal to 0, thusCan be used forNormalization; when it comes toThe larger the number of indirectly reachable points to be encoded of each point to be encoded is, andthe smaller the number of directly reachable points to be encoded is, theThe longer the chain code length obtained by using the wharf as the point to be coded is, the higher the compression efficiency is, at this momentThe greater the fitness of the individual points to be encoded.
And similarly, acquiring the appropriateness of each point to be coded. And taking the point to be coded with the maximum fitness as a wharf.
Thus, a dock is obtained. It should be noted that, in this embodiment, a fitness of each to-be-encoded point is obtained according to the number of directly reachable to-be-encoded points and the number of indirectly reachable to-be-encoded points of each to-be-encoded point, under the condition that chain code encoding is not performed, the influence of each to-be-encoded point as a dock on the final compression efficiency is predicted by the fitness, and the to-be-encoded point that is most likely to achieve the highest compression efficiency is selected as the dock according to the fitness. The compression efficiency of the subsequent network security information data is maximized, and the transmission of the subsequent network security information data is more efficient.
And S004, sequentially acquiring adjacent pointing code values of each point to be coded, and performing chain code coding according to the adjacent pointing code values to obtain a first coding result.
It should be noted that, referring to fig. 3, for a point in a two-dimensional matrix, the point has eight adjacent directions, which are respectively shown as、、、、、、、Eight directions, the code value corresponding to each adjacent direction is: 0. 1,2, 3, 4, 5, 6 and 7. And for all points in the two-dimensional matrix, the code values corresponding to the adjacent directions of all points at the same angle are the same. In order to improve the compression efficiency, at present, data is often encoded by chain codes first, and then the result of the chain code encoding is further compressed by using huffman coding. The principle of huffman coding is that the overall compression of data is achieved by assigning shorter codewords to characters with higher frequency of occurrence in the data and longer codewords to characters with lower frequency of occurrence in the data. In this embodiment, the two-dimensional matrix is obtained according to the binary string converted from the network security information data, so that the points to be encoded in the two-dimensional matrix are distributed irregularly, and the directions between adjacent points to be encoded are disordered, so that all the points to be encoded are chain-coded by using the conventional eight-direction chain code to obtain the chain-coded point codeThe number distribution of code values 0, 1,2, 3, 4, 5, 6, 7 in the coding result may be relatively uniform, at this time, when the coding result of the chain code coding is further coded by using the huffman coding, the code words given to each code value are basically consistent in length and are relatively long, at this time, the compression effect of further compressing by using the huffman coding is poor, and even the effect of further compressing the coding result of the chain code coding may not be realized. In order to improve the compression efficiency of the subsequent huffman coding on the chain code coding result, the uniformity of code value distribution in the chain code coding result needs to be broken.
It should be further noted that, in order to ensure compression efficiency, in the embodiment, the encoded points to be encoded are not repeatedly encoded, in the process of chain code encoding, some points adjacent to the points to be encoded are encoded, and at this time, the adjacent direction of the points to be encoded does not need to point to the encoded points, and then the adjacent direction of the points to be encoded is less than eight directions, and at this time, if the number of the adjacent directions is recorded asAccording toAll contiguous pointers are reassigned code values 0, 1,2, \8230,And the smaller number of the code values in the coding result of the final chain code coding appears more, and the larger number of the code values appears less, so that the compression effect of further compressing the coding result of the chain code coding by utilizing the Huffman coding is good. Meanwhile, the chain code directions of the previous point to be coded and the next point to be coded are considered to have certain similarity, so that the code value can be given to the adjacent direction of the next point to be coded according to the adjacent direction code value of the previous point to be coded.
In this embodiment, the step of performing chain code encoding on all to-be-encoded points in the two-dimensional matrix is as follows:
1. firstly, encoding the wharf, and acquiring the coordinates of the wharf in a two-dimensional matrix as the encoding result of the wharf. And taking the wharf as the current point to be coded.
2. Acquiring the adjacent direction of the current point to be coded, wherein the specific method comprises the following steps:
all positions of the current point to be coded, except the coded point, in the eight-neighborhood range in the two-dimensional matrix are obtained, and the direction from the current point to be coded to the positions is used as the adjacent direction of the current point to be coded. It should be noted that, when the adjacent orientation of the current point to be encoded is obtained, if the current point to be encoded is located at the boundary position in the two-dimensional matrix and there are no eight positions in the current eight-neighborhood range of the point to be encoded, all the positions except the encoded point are selected only from the positions existing in the current eight-neighborhood range of the point to be encoded. For example, in fig. 2, a is at a position of a boundary of the two-dimensional matrix, and only three positions exist in the eight-neighborhood range of a, all the positions except for the encoded point in the three positions existing in the eight-neighborhood range of a are obtained, and the directions of a to these positions are taken as the adjacent orientations of a.
3. Acquiring an adjacent pointing code value of a current point to be coded, wherein the specific method comprises the following steps:
firstly, acquiring an initial direction of a current point to be coded, and giving a code value 0 to an adjacent direction of the current point to be coded according to the initial direction, wherein the method specifically comprises the following steps:
if the current point to be coded is the wharf and the current point to be coded is the beginning of the chain code, then the current point to be coded is the beginning of the chain codeThe direction is taken as an initial direction; if the current point to be coded is not a wharf, acquiring the adjacent pointing direction from the last point linked with the current point to be coded to the current point to be coded as an initial direction;
if the adjacent orientation of the current point to be coded in the initial direction exists, the adjacent orientation of the current point to be coded in the initial direction is given to code value 0, if the adjacent orientation of the current point to be coded in the initial direction does not exist, the adjacent orientation which is closest to the initial direction in the adjacent orientation of the current point to be coded is obtained, and if two closest adjacent orientations exist, the first adjacent orientation which is located in the clockwise direction in the initial direction is given to code value 0.
Secondly, according to the adjacent direction of the code value 0, giving the code value to the rest adjacent directions of the current point to be coded, specifically:
acquiring the number of adjacent directions of the current point to be coded, and pointing the adjacent direction with the code value of 0 clockwiseEach contiguous pointer is assigned a code value of-1, -2, ·,with code value 0 adjacent pointing in a counter-clockwise directionEach contiguous pointer is assigned a code value of 1,2,。
4. and acquiring the candidate to-be-coded point corresponding to any adjacent point with the minimum absolute value of the code values in all the candidate to-be-coded points as a new current to-be-coded point. And taking the code value of the adjacent point from the encoded point to the new current point to be encoded as the encoding result. At this time, the encoded point is the last point linked by the new current point to be encoded.
It should be noted that, in this embodiment, the candidate to-be-encoded point corresponding to the adjacent pointer with the smallest absolute value of the code value is preferentially selected as the new current to-be-encoded point, so that the code value corresponding to the encoding result is as small as possible, a smaller code value repetition rate in the subsequently obtained chain code encoding result is higher, and further, the compression efficiency is higher when the chain code encoding result is further encoded by using huffman encoding subsequently.
5. And repeating the step 3-4 until the obtained adjacent point of the latest current point to be coded does not exist, and stopping iteration, wherein all the coding results are used as a chain code coding result. Wherein all the coding results comprise the coding result of the wharf and the coding result obtained in the repeated process in the step 4 and the step 5; it should be noted that all the points to be encoded in the chain code have been marked as encoded points, and the remaining points to be encoded in the two-dimensional matrix are points that have not been encoded yet.
6. And (5) according to the remaining points to be coded in the two-dimensional matrix, utilizing the step S003 to obtain a new wharf again, and utilizing the steps 1-5 to perform chain code coding on the remaining points to be coded in the two-dimensional matrix according to the new wharf.
7. And repeating the step 6 until the two-dimensional matrix has no point to be coded, stopping iteration, obtaining a plurality of chain codes at the moment, and taking all the chain codes as a first coding result.
Fig. 4 is a schematic diagram of chain code encoding performed on the to-be-encoded point in fig. 2 in this embodiment, where the to-be-encoded point a is a dock. In fig. 4, black portions are dots to be encoded, gray portions are encoded dots, and white portions are the remaining dots. The first encoding result obtained finally is { (1, 1), -1,0, -3,0}, wherein (1, 1) is the coordinate of the wharf, -1,0, -3,0 is the code value.
Therefore, the adjacent pointing code value of each point to be coded is obtained, and the coding of all the points to be coded in the two-dimensional matrix is completed according to the adjacent pointing code value, so that a first coding result is obtained.
It should be noted that, in the present embodiment, when acquiring the adjacent direction of each to-be-encoded point, the direction from the current to-be-encoded point to the encoded point is removed, and code values are reassigned to all adjacent directions of the current to-be-encoded point according to the adjacent direction from the previous point linked to the current to-be-encoded point, so that the number of adjacent directions of the to-be-encoded point is small, and further, the smaller code value repetition rate in the obtained chain code encoding result is higher, and the larger code value repetition rate is lower. The compression efficiency is higher when the chain code coding result is further coded by utilizing the Huffman coding subsequently.
And S005, further compressing the first coding result to obtain compressed data, and transmitting the compressed data.
And performing Huffman coding on all code values in the first coding result to obtain a second coding result. The coordinates of the wharf in the first coding result, the second coding result and the point to be coded obtained in the step S002 are correspondedValue of (d) and length of binary stringTogether constituting compressed data.
And transmitting the compressed data to a network security analysis platform.
And S006, decompressing the compressed data.
The network security analysis platform decompresses the received compressed data, and the specific method comprises the following steps:
the compressed data includes the coordinate of the wharf, the second encoding result, the value corresponding to the point to be encoded and the length of the binary stringAnd decoding the second encoding result by using a Huffman encoding method, wherein the decoding result is a code value in the chain code. The coordinates of the wharf and the code value of the chain code together constitute a first encoding result.
According to the length of the binary stringObtaining the values of the number of rows and columns by the method in step S002According toConstructing an emptyA two-dimensional matrix of sizes.
The first encoding result comprises a plurality of chain codes, and each chain code is decoded in sequence:
1. and acquiring the corresponding position of the wharf of the chain code in the two-dimensional matrix according to the coordinate of the wharf of the chain code, and marking the position as a point to be coded.
2. And (4) acquiring an adjacent pointing code value of the point to be coded by using the method in the step (S004), marking the point to be coded as a coded point, and marking the position pointed by the adjacent pointing as a new point to be coded according to the adjacent pointing direction of the coded point corresponding to the next code value in the chain code.
3. And (5) repeating the step (2) until all code values in the chain code find the corresponding point to be coded, and marking the point to be coded which is finally obtained as a coded point.
And acquiring the positions of all the encoded points in the two-dimensional matrix by decoding all the chain codes contained in the first encoding result, and filling the position of each encoded point with a value corresponding to the point to be encoded. Filling the remaining positions of the two-dimensional matrix with values opposite to the values corresponding to the points to be encoded, for example, if the value corresponding to the point to be encoded is 0, the value opposite to the value corresponding to the point to be encoded is 1, otherwise, if the value corresponding to the point to be encoded is 1, the value opposite to the value corresponding to the point to be encoded is 0.
Converting the two-dimensional matrix into a one-dimensional sequence, and preceding the one-dimensional sequenceThe elements are used as a binary string, and the binary string is decoded by the encoding method in the step S002 to obtain the network security information data.
Therefore, decompression of the compressed data is completed, and the network security information data is obtained.
And the network security analysis platform performs abnormal information mining according to the network security information data obtained by decompression, so as to realize monitoring of network security attack.
Through the steps, compression transmission and decompression of the network security information data are completed.
According to the number of the directly reachable points to be coded and the number of the indirectly reachable points to be coded of each point to be coded, the method and the device obtain the fitness of each point to be coded, under the condition that chain code coding is not carried out, the influence of the fitness of each point to be coded as a wharf on the final compression efficiency is predicted, and the point to be coded which is most likely to reach the highest compression efficiency is selected as the wharf according to the fitness. The compression efficiency of subsequent network security information data is maximized, and the transmission of the subsequent network security information data is more efficient; when the adjacent direction of each point to be coded is obtained, the direction from the current point to be coded to the coded point is removed, and code values are newly given to all adjacent directions of the current point to be coded according to the adjacent direction from the previous point linked with the current point to be coded to the current point to be coded, so that the number of the adjacent directions of the points to be coded is small, the code values are small, the smaller code value repetition rate in the obtained chain code coding result is higher, the larger code value repetition rate is lower, the compression efficiency is higher when the chain code coding result is further coded by utilizing the Huffman coding, and the high-efficiency transmission of network security information data is further ensured.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (5)
1. The method for efficiently compressing and transmitting the network security information is characterized by comprising the following steps of:
s1: collecting network security information data, and converting the network security information data into a two-dimensional matrix; acquiring points to be coded in a two-dimensional matrix;
s2: counting the number of directly reachable points to be coded and the number of indirectly reachable points to be coded of each point to be coded, and acquiring the appropriateness of each point to be coded according to the number of directly reachable points to be coded and the number of indirectly reachable points to be coded; taking the point to be coded with the maximum fitness as a wharf;
s3: taking the coordinates of the wharf in the two-dimensional matrix as a wharf coding result, and taking the wharf as a current point to be coded;
s4: acquiring an adjacent pointer and an adjacent pointer code value of a current point to be coded, wherein the method comprises the following steps:
acquiring all positions of a current point to be coded in an eight-neighborhood range in a two-dimensional matrix except a coded point, and taking the direction from the current point to be coded to all the positions as the adjacent direction of the current point to be coded; acquiring the initial direction of the current point to be coded, and giving a code value 0 to an adjacent direction of the current point to be coded according to whether the adjacent direction exists in the initial direction or not; giving code values to the rest adjacent pointers of the current point to be coded according to the adjacent pointer of the code value 0;
s5: taking each point to be coded to which all adjacent directions of the current point to be coded point to be candidate points to be coded, marking the current point to be coded point as a coded point, and acquiring any adjacent direction of the adjacent directions with the minimum absolute value of the code value in all candidate points to be coded points as a candidate point to be coded corresponding to the new current point to be coded; taking the code value of the adjacent direction from the coded point to the new current point to be coded as a coding result;
s6: repeating S4-S5 until the obtained latest adjacent point of the current point to be coded does not exist, stopping iteration, and taking all coding results as a chain code coding result; all the coding results comprise a coding result of a wharf, and coding results obtained in the repeated process in S5 and S6;
s7: repeating S2-S6 until the two-dimensional matrix has no point to be encoded, stopping iteration to obtain a plurality of chain code encoding results, and taking all the chain code encoding results as first encoding results; the all chain code encoding results comprise the chain code encoding results obtained in the repeating process in S6 and S7;
s8: compressing the first coding result to obtain compressed data;
the expression of the fitness is:
whereinIs as followsThe appropriateness of each point to be encoded;is a firstThe number of the indirectly reachable points to be coded;the length of a binary string encoded for the network security information data;is as followsThe number of the points to be coded which can be directly reached by the points to be coded;is a hyperbolic cosine tangent function.
2. The method for efficient compression and transmission of network security information according to claim 1, wherein the converting of the network security information data into the two-dimensional matrix comprises the following specific steps:
encoding network security information data into a binary string, according to the length of the binary stringObtaining the number of linesAnd the number of columnsBuilding an emptyTwo-dimensional matrix of size, with 0 at the end of the binary string to make the length of the binary string reach(ii) a Sequentially filling each binary bit in the binary string to each position in the two-dimensional matrix, whereinIs rounding up the symbol.
3. The method for efficient compression and transmission of network security information according to claim 1, wherein the obtaining of the point to be encoded in the two-dimensional matrix comprises the following specific steps:
and counting the number of 0 and 1 in the two-dimensional matrix, and marking the positions of the values with small number in the two-dimensional matrix as points to be coded.
4. The method for efficient compression and transmission of network security information according to claim 1, wherein the obtaining of the initial direction of the current point to be encoded and assigning a code value of 0 according to whether there is an adjacent pointer in the initial direction as an adjacent pointer of the current point to be encoded comprises the following specific steps:
if the current point to be coded is a wharf, the current point to be coded is a wharfThe direction is taken as an initial direction; if the current point to be coded is not a wharf, acquiring the adjacent pointing direction from the last point linked with the current point to be coded to the current point to be coded as an initial direction;
if the adjacent orientation of the current point to be coded in the initial direction exists, the adjacent orientation of the current point to be coded in the initial direction is given to a code value 0, if the adjacent orientation of the current point to be coded in the initial direction does not exist, the adjacent orientation which is closest to the initial direction in the adjacent orientation of the current point to be coded is obtained, and if two closest adjacent orientations exist, the first adjacent orientation which is positioned in the initial direction clockwise in the two closest adjacent orientations is given to the code value 0.
5. The method for efficient compression and transmission of network security information according to claim 1, wherein said assigning code values to the remaining contiguous pointers of the current point to be encoded according to the contiguous pointer with code value 0 comprises the following specific steps:
obtaining the current code to be codedNumber of adjacent pointsWith the code value 0 adjacent pointing clockwiseEach contiguous pointer being assigned a code value of-1 toWith code value 0 adjacent pointing in the counter-clockwise directionEach contiguous pointer being assigned code values 1 toWhereinIn order to round the symbol down,is rounding up the symbol.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211651652.2A CN115632661B (en) | 2022-12-22 | 2022-12-22 | Efficient compression transmission method for network security information |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211651652.2A CN115632661B (en) | 2022-12-22 | 2022-12-22 | Efficient compression transmission method for network security information |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115632661A CN115632661A (en) | 2023-01-20 |
CN115632661B true CN115632661B (en) | 2023-03-07 |
Family
ID=84911115
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211651652.2A Active CN115632661B (en) | 2022-12-22 | 2022-12-22 | Efficient compression transmission method for network security information |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115632661B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115955513B (en) * | 2023-03-10 | 2023-05-05 | 湖南洛普洛科技有限公司 | Data optimization transmission method for Internet of things |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB1488912A (en) * | 1973-12-26 | 1977-10-19 | Rca Corp | Method and apparatus for encoding an information signal and compressing the transmission bandwidth |
CN105978573A (en) * | 2015-05-11 | 2016-09-28 | 上海兆芯集成电路有限公司 | Hardware data compressor for constructing and using dynamic initial Huffman coding table |
CN110995391A (en) * | 2019-11-18 | 2020-04-10 | 国能日新科技股份有限公司 | Data transmission method in isolated network, server and terminal |
CN114567681A (en) * | 2022-01-25 | 2022-05-31 | 浙江数秦科技有限公司 | High-efficiency data transmission method for block chain network |
CN115269659A (en) * | 2022-09-19 | 2022-11-01 | 江苏泰恩特环境技术有限公司 | Remote monitoring system for energy consumption detection of combined air conditioning box |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8290782B2 (en) * | 2008-07-24 | 2012-10-16 | Dts, Inc. | Compression of audio scale-factors by two-dimensional transformation |
-
2022
- 2022-12-22 CN CN202211651652.2A patent/CN115632661B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB1488912A (en) * | 1973-12-26 | 1977-10-19 | Rca Corp | Method and apparatus for encoding an information signal and compressing the transmission bandwidth |
CN105978573A (en) * | 2015-05-11 | 2016-09-28 | 上海兆芯集成电路有限公司 | Hardware data compressor for constructing and using dynamic initial Huffman coding table |
CN110995391A (en) * | 2019-11-18 | 2020-04-10 | 国能日新科技股份有限公司 | Data transmission method in isolated network, server and terminal |
CN114567681A (en) * | 2022-01-25 | 2022-05-31 | 浙江数秦科技有限公司 | High-efficiency data transmission method for block chain network |
CN115269659A (en) * | 2022-09-19 | 2022-11-01 | 江苏泰恩特环境技术有限公司 | Remote monitoring system for energy consumption detection of combined air conditioning box |
Non-Patent Citations (2)
Title |
---|
李超 ; 杜赓 ; 杨义先 ; 钮心忻 ; .一种最优化链码指纹二值细化图像压缩编码.2006,第26卷(第10期),第2357-2359页. * |
邹黎黎 ; 唐棣 ; .基于六角网格的一种新链码编码方法.2007,第43卷(第13期),第73-75页. * |
Also Published As
Publication number | Publication date |
---|---|
CN115632661A (en) | 2023-01-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7786907B2 (en) | Combinatorial coding/decoding with specified occurrences for electrical computers and digital data processing systems | |
CN115632661B (en) | Efficient compression transmission method for network security information | |
CN101496288A (en) | Data compression | |
WO2009009574A2 (en) | Blocking for combinatorial coding/decoding for electrical computers and digital data processing systems | |
CN110021369B (en) | Gene sequencing data compression and decompression method, system and computer readable medium | |
WO2009009602A1 (en) | Data coding/decoding for electrical computers and digital data processing systems | |
CN115529357B (en) | Updating abnormity matching method based on MES intercommunication interconnection production data | |
CN115296862A (en) | Network data secure transmission method based on data coding | |
CN107437976B (en) | Data processing method and equipment | |
Yeh et al. | On the optimality of code options for a universal noiseless coder | |
EP2962396A1 (en) | Entropy modifier and method | |
Hidayat et al. | Survey of performance measurement indicators for lossless compression technique based on the objectives | |
KR100636370B1 (en) | Apparatus and method for coding using bit-precision, and apparatus and method for decoding according to the same | |
RU2488960C2 (en) | Method for data compression-decompression and device for its realisation | |
CN112262578A (en) | Point cloud attribute encoding method and device and point cloud attribute decoding method and device | |
KR100462789B1 (en) | method and apparatus for multi-symbol data compression using a binary arithmetic coder | |
US8754791B1 (en) | Entropy modifier and method | |
Challa et al. | A novel compression technique for DNA sequence compaction | |
CN117155408B (en) | Efficient transmission method for production data | |
Fong et al. | Multimedia applications of self-synchronizing T-codes | |
EP0810737A2 (en) | Method and apparatus for performing simultaneous data compression and encryption | |
Makala et al. | Stiff Frame Encryption Using Compression | |
CN115589229A (en) | Efficient storage method for e-commerce platform transaction data | |
CN114125072A (en) | Data processing method and device | |
CN107801033B (en) | Decoding method and decoding device applied to digital audio and video coding and decoding technical standard system |
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 |