Watermark embedding method, watermark extracting method, watermark embedding device, watermark extracting device and medium
By grouping and sorting the data sets, inserting fake row data to embed watermark information, the problem of watermark extraction dependent parameter information in the prior art is solved, achieving higher robustness and availability, and resisting subset attacks.
Patent Information
- Application Number
- CN202310523110.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-10
- Publication Date
- 2024-11-12
AI Technical Summary
When extracting watermark information, existing data watermark technology needs to rely on parameter information when watermark embedding, and cannot resist subset addition and deletion attacks, reducing the usability and robustness of watermark extraction.
By grouping and sorting the data set to be processed, forged row data is inserted to make it the edge row data of the group, and watermark information is embedded in the embedible numerical fields in the forged row data. During extraction, forged row data is determined by grouping sorting. and shard information to avoid relying on parameter information when embedding watermarks.
It improves the usability and robustness of watermark extraction, can resist subset addition and deletion attacks, and enhances the reliability of watermark information extraction.
Smart Images

Figure CN118941432A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of security technology, and in particular to a watermark embedding method and a watermark extraction method, device and medium. Background Art
[0002] With the development of information technology, more and more information is stored as data, shared and transmitted on the Internet. At the same time, data leakage incidents also occur frequently. The application of data traceability technology can deter the occurrence of data leakage and locate the person responsible after the data leakage, effectively reducing data security risks. As a key tracking and tracing technology, data watermarking technology can effectively realize data tracking and tracing by marking the data set to make the data endogenous and traceable.
[0003] Data watermarking technology includes structured data watermarking; for structured data, watermark embedding is mainly performed by adding pseudo rows, adding pseudo columns, modifying attributes, modifying tuple order, etc. Among them, the advantages of embedding watermark information by adding forged row data (i.e., forged row data watermark) to structured data are: no modification of the original data set, no addition of attribute fields, etc.
[0004] The technical difficulties of forging row data watermarks include: how to find the forged row data inserted in the data set when extracting the watermark. As for how to find the forged row data inserted in the data set, most solutions currently extract the forged row data inserted in the data set by recording some parameters when the watermark is embedded and performing comparison and other operations when extracting. This method requires the establishment of a system to record the data when the watermark is embedded. If the corresponding data record cannot be found, the watermark cannot be extracted, which reduces the availability of watermark extraction. Alternatively, forged row data is extracted through data such as dataset adjacency and group domain. This method cannot resist subset addition and deletion attacks. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a watermark embedding method and a watermark extraction method, device and medium. The watermark extraction process does not need to rely on parameter information during watermark embedding, does not rely on other row data, can resist subset addition and deletion attacks, and has higher robustness.
[0006] To solve the above technical problems, the embodiments of the present invention provide the following technical solutions:
[0007] A watermark embedding method, comprising:
[0008] Slice the watermark information to obtain watermark information slices;
[0009] Selecting a key field and at least one embeddable numerical field from the data set to be processed, and grouping and sorting the data set according to the key field and the at least one embeddable numerical field;
[0010] Insert forged row data into each of the groups so that the forged row data becomes edge row data of the group, and embed the watermark fragmentation information into an embeddable numerical field in the forged row data according to the grouping value to generate a data set embedded with watermark.
[0011] In some embodiments, selecting key fields from the data set to be processed includes:
[0012] If the data set includes a primary key, selecting the primary key as the key field;
[0013] If the data set does not include a primary key, the first field in the data set is selected as the key field.
[0014] In some embodiments, selecting at least one embeddable numeric field from a data set to be processed includes:
[0015] Performing a numerical determination on the content of a preset position of each field in at least part of the data set to determine whether the content of the preset position is a numerical value;
[0016] When the proportion of the content of the preset position of the field is a numerical value greater than the preset first threshold, and the content of the preset position includes Q different values and Q is greater than the preset second threshold, the field is confirmed to be an embeddable numerical field, and Q is a positive integer.
[0017] In some embodiments, grouping and sorting the data set according to the key field and at least one embeddable numeric field includes:
[0018] Perform a preset transformation on the key field, group the data set according to the transformed key field and the preset embeddable numerical field to obtain multiple groups, and sort the groups according to the transformed key field and the preset embeddable numerical field, and the preset embeddable numerical field is selected from at least one embeddable numerical field.
[0019] In some embodiments, the method further comprises:
[0020] For each group, determine the content of the key field of the original edge row data of the group and the content of the preset embeddable value field;
[0021] The content of the key field is used as the forged content of the key field, the sum of the content of the preset embeddable numerical field and the preset multiple of the grouping value, or the difference between the content of the preset embeddable numerical field and the preset multiple of the grouping value as the forged content of the preset embeddable numerical field;
[0022] The forged content of the key field and the forged content of the preset embeddable numerical field replace the key field and the preset embeddable numerical field of the forged row data respectively, and the watermark information fragments are sequentially inserted into other embeddable numerical fields of the forged row data except the preset embeddable numerical field.
[0023] In some embodiments, when the grouping value is n and the number of other embeddable numerical fields except the preset embeddable numerical field is k, the k watermark information fragments starting from the nth watermark information fragment are respectively inserted into the k embeddable numerical fields, where n and k are positive integers.
[0024] In some embodiments, when the edge row data is the last row data in the group, the forged content of the preset embeddable numerical field is the sum of the content of the preset embeddable numerical field and a preset multiple of the group value;
[0025] When the edge row data is the first row data in the group, the forged content of the preset embeddable numerical field is the difference between the content of the preset embeddable numerical field and a preset multiple of the group value.
[0026] In some embodiments, if the data set includes a primary key, the method further includes:
[0027] If the primary key value of the data set is completely increasing, replace the primary key value of the edge row data in the group with the maximum primary key value plus 1; if the primary key value of the data set is not increasing, sort the primary key fields in the group and search for missing primary key values to obtain a set of forgeable primary key values, and replace the primary key value of the edge row data in the group with a randomly selected value from the set of forgeable primary key values.
[0028] The embodiment of the present invention also provides a watermark extraction method, comprising:
[0029] Get the data set after embedding the watermark;
[0030] Selecting a key field and at least one embeddable numerical field from the data set, and grouping and sorting the data set according to the key field and the at least one embeddable numerical field;
[0031] Selecting edge data rows in each group, and extracting watermark fragmentation information from embeddable numerical fields in the edge data rows;
[0032] Restore the watermark information based on the extracted watermark fragment information.
[0033] In some embodiments, selecting key fields from the data set includes:
[0034] If the data set includes a primary key, selecting the primary key as the key field;
[0035] If the data set does not include a primary key, the first field in the data set is selected as the key field.
[0036] In some embodiments, selecting a key field and at least one embeddable numerical field from the data set, and grouping and sorting the data set according to the key field and the at least one embeddable numerical field comprises:
[0037] Perform a preset transformation on the key field, group the data set according to the transformed key field and the preset embeddable numerical field to obtain multiple groups, and sort the groups according to the transformed key field and the preset embeddable numerical field, and the preset embeddable numerical field is selected from at least one embeddable numerical field.
[0038] In some embodiments, extracting watermark fragment information from the embeddable numerical field in the edge data row includes:
[0039] The watermark information fragments are sequentially extracted from other embeddable numerical fields in the edge data row except the preset embeddable numerical field according to the grouping value corresponding to the edge data row.
[0040] In some embodiments, when the grouping value is n and the number of other embeddable numerical fields except the preset embeddable numerical field is k, sequentially extracting watermark information fragments from other embeddable numerical fields except the preset embeddable numerical field in the edge data row according to the grouping value corresponding to the edge data row includes:
[0041] Sequentially extract k watermark information fragments from k embeddable numerical fields, and use the k watermark information fragments as the nth watermark information fragment, the n+1th watermark information fragment, ..., the n+k-1th watermark information fragment, respectively.
[0042] In some embodiments, if the extracted m p-th watermark information fragments have s different values, a score is assigned to each value, the score of the value is positively correlated with the number of watermark information fragments corresponding to the value, and the value with the highest score is selected as the value of the p-th watermark information fragment, where m, p, s are positive integers and s is not greater than m.
[0043] The embodiment of the present invention further provides a watermark embedding device, comprising:
[0044] A fragmentation module, used for fragmenting the watermark information to obtain watermark information fragments;
[0045] A processing module, used for selecting a key field and at least one embeddable numerical field from a data set to be processed, and grouping and sorting the data set according to the key field and at least one embeddable numerical field;
[0046] The insertion module is used to insert forged row data into each of the groups so that the forged row data becomes the edge row data of the group, and embed the watermark fragmentation information in the embeddable numerical field in the forged row data according to the grouping value to generate a data set after embedding the watermark.
[0047] The embodiment of the present invention further provides a watermark extraction device, comprising:
[0048] An acquisition module is used to acquire the data set after embedding the watermark;
[0049] A processing module, used for selecting a key field and at least one embeddable numerical field from the data set, and grouping and sorting the data set according to the key field and at least one embeddable numerical field;
[0050] An extraction module, used for selecting edge data rows in each group, and extracting watermark fragmentation information from embeddable numerical fields in the edge data rows;
[0051] The restoration module is used to restore the watermark information according to the extracted watermark fragment information.
[0052] An embodiment of the present invention further provides a watermark embedding device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor; when the processor executes the program, the steps in the watermark embedding method described above are implemented.
[0053] An embodiment of the present invention further provides a watermark extraction device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor; when the processor executes the program, the steps in the watermark extraction method described above are implemented.
[0054] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the watermark embedding method or the steps in the watermark extraction method described above are implemented.
[0055] The embodiments of the present invention have the following beneficial effects:
[0056] In the above scheme, after the data set is grouped and sorted, forged row data is inserted, the forged row data is the edge data row of the group, and the grouping value and the watermark sharding information are embedded in the embeddable numerical field in the forged row data. In this way, when extracting the watermark, the forged row data and sharding information can be determined by selecting the edge row data by grouping and sorting. The watermark extraction process does not need to rely on the parameter information when the watermark is embedded to extract the watermark information, thereby improving the availability of watermark extraction. In addition, the addition and deletion of non-edge row data in the group does not affect the extraction of the forged row data, and can resist subset addition and deletion attacks, with higher robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 A schematic diagram of a watermark embedding method according to an embodiment of the present invention;
[0058] Figure 2 Schematic diagram of the process of watermark extraction method according to an embodiment of the present invention;
[0059] Figure 3 A schematic diagram of the structure of a watermark embedding device according to an embodiment of the present invention;
[0060] Figure 4 It is a schematic diagram of the structure of a watermark extraction device according to an embodiment of the present invention;
[0061] Figure 5 A schematic diagram of the composition of a watermark embedding device according to an embodiment of the present invention;
[0062] Figure 6 It is a schematic diagram of the composition of the watermark extraction device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0063] In order to make the technical problems, technical solutions and advantages to be solved by the embodiments of the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0064] There are two aspects of technical difficulty in forging row data watermarks: one is how to find the forged row data inserted in the data set when extracting the watermark, and the other is how to forge the forged row data when embedding the watermark.
[0065] As for how to find the forged row data inserted in the data set, currently, most solutions extract the forged row data inserted in the data set by recording some parameters when the watermark is embedded and performing operations such as comparison during extraction. This method requires the establishment of a system to record the data when the watermark is embedded. If the corresponding data record cannot be found, the watermark cannot be extracted, which reduces the availability of watermark extraction. Alternatively, forged row data is extracted through data such as dataset adjacency and group domains. This method cannot resist subset addition and deletion attacks.
[0066] As for how to forge row data, for a data set with a primary key column, forging the primary key is a difficult point in the implementation of the watermarking scheme, because the primary key needs to remain unique and may be used for sorting. Most of the current schemes use random or overwriting methods to forge the primary key, which is not very practical.
[0067] The embodiments of the present invention provide a watermark embedding method and a watermark extraction method, device and medium. The watermark extraction process does not need to rely on parameter information during watermark embedding, does not rely on other row data, can resist subset addition and deletion attacks, and has higher robustness.
[0068] The embodiment of the present invention provides a watermark embedding method, such as Figure 1 As shown, including:
[0069] Step 101: Slice the watermark information to obtain watermark information slices;
[0070] This embodiment firstly segments the watermark information W to be inserted into a watermark information segment list {w1, w2, ..., wn}, where w1, w2, ..., wn are n watermark information segments respectively, and n is a positive integer.
[0071] Step 102: Select a key field and at least one embeddable numerical field from the data set to be processed, and group and sort the data set according to the key field and the at least one embeddable numerical field;
[0072] Specifically, the key field can be subjected to a preset transformation, the data set can be grouped according to the transformed key field and the preset embeddable numerical field to obtain multiple groups, and the groups can be sorted according to the transformed key field and the preset embeddable numerical field, and the preset embeddable numerical field is selected from at least one embeddable numerical field.
[0073] In some embodiments, selecting a key field from a data set to be processed includes: if the data set includes a primary key, selecting the primary key as the key field; if the data set does not include a primary key, selecting the first field in the data set as the key field. If the data set includes a primary key, the primary key includes important information of the structured data, and therefore, the primary key is selected as the key field; if the data set does not include a primary key, generally, the first field in the data set includes important information of the structured data, and therefore, the first field in the data set is selected as the key field.
[0074] The primary key is also called the primary keyword. For structured data, the primary key is a candidate keyword that is selected to uniquely identify the rows of a table. The primary key can consist of one field or multiple fields, which are called single-field primary key or multi-field primary key. It is also called the primary code. And it can uniquely identify a row of data in a table, or it can uniquely identify an entity.
[0075] Then determine the sequence of embeddable numerical fields. An embeddable numerical field refers to a field in the row data whose content at the specified position is a numerical value. Specifically, selecting at least one embeddable numerical field from the data set to be processed includes: performing numerical determination on the content at the preset position of each field in at least part of the data set to determine whether the content at the preset position is a numerical value; when the proportion of the content at the preset position of the field that is a numerical value is greater than a preset first threshold, and the content at the preset position includes Q different values and Q is greater than a preset second threshold, confirm that the field is an embeddable numerical field, and Q is a positive integer. Because the watermark information fragments are numerical values, embedding the watermark information fragments into an embeddable numerical field whose proportion of numerical values is greater than the preset first threshold will not have much impact on the format of the structured data.
[0076] The values of the first threshold and the second threshold may be set in advance.
[0077] In this embodiment, after determining the key field, the key field is subjected to a preset transformation, the main purpose of which is to discretize the data of the key field, and the data set is grouped and sorted according to the transformed key field in combination with the preset embeddable numerical field, wherein any embeddable numerical field can be selected from the embeddable numerical field as the preset embeddable numerical field, or multiple embeddable numerical fields can be selected as the preset embeddable numerical field, specifically, the first embeddable numerical field can be selected as the preset embeddable numerical field or the last embeddable numerical field can be selected as the preset embeddable numerical field. After grouping, for the data in each group, the key field of the edge row data and the preset embeddable numerical field content are selected and recorded as (Fn, Cn), wherein the edge row data is the first row of data or the last row of data.
[0078] Step 103: Insert forged row data into each of the groups so that the forged row data becomes the edge row data of the group, and embed the watermark sharding information in the embeddable numerical field in the forged row data according to the grouping value to generate a data set with embedded watermark, wherein the edge row data includes the first row data and / or the last row data.
[0079] Insert one or two forged row data into each of the groups, so that the forged row data are edge data rows of the group. For example, insert one forged row data into each of the groups, so that the forged row data are the first row data or the last row data of the group; or insert two forged row data into each of the groups, so that the forged row data are the first row data and the last row data of the group.
[0080] The forged content F of the key field of the forged row data is F=Fn, and the forged content C of the preset embeddable numerical field of the forged row data is Cn⊕key, where, when the selected edge row data is the last row data, "⊕" represents "+", so that the forged row data is still the last row data after being inserted into the group; when the selected edge row data is the first row data, "⊕" represents "-", so that the forged row data is still the first row data after being inserted into the group, where key is a preset multiple of the group value. This not only ensures that the order of the group remains unchanged after the forged row data is inserted into the group, but also that the forged row data is the edge row data of the group.
[0081] For a data set with a primary key, if the primary key value of the data set is completely increasing (that is, the maximum value of the primary key - the minimum value of the primary key is approximately equal to the number of rows in the data set), the primary key value of the edge row data in the group is replaced with the maximum primary key value plus 1, and placed at the end of the data set; if the primary key value of the data set is not increasing, the primary key fields in the group are sorted and then searched for missing primary key values to obtain a set of forgeable primary key values, and the primary key value of the edge row data in the group is replaced with a randomly selected value from the set of forgeable primary key values, and placed in the sorted position.
[0082] When forging row data, the forged contents of the key field and the preset embeddable numerical field are respectively embedded into the key field and the preset embeddable numerical field of the forged row data. For the remaining fields in the forged row data in which watermark information can be embedded, the watermark information fragments are sequentially inserted into the other embeddable numerical fields of the forged row data except the preset embeddable numerical field according to the grouping value. Specifically, when the grouping value is n and the number of other embeddable numerical fields except the preset embeddable numerical field is k, the k watermark information fragments starting from the nth watermark information fragment are respectively inserted into the k embeddable numerical fields, where n and k are positive integers. If the value of k is greater than the number of watermark information fragments, the watermark information fragments are looped and inserted into the k embeddable numerical fields. For example, if the number of other embeddable numerical fields other than the preset embeddable numerical fields is 10, the grouping value of the group is 3, and the number of watermark information fragments is 5, then the 3rd, 4th, 5th, 1st, 2nd, 3rd, 4th, 5th, 1st, and 2nd watermark information fragments are respectively inserted into the 10 embeddable numerical fields.
[0083] According to the selection of key fields, forged row data is inserted into the dataset to generate the dataset embedded with watermarks.
[0084] In this embodiment, after grouping and sorting the dataset, forged row data is inserted. The forged row data is the edge data row of the group, and the group value and the watermark shard information are embedded in the embeddable value field in the forged row data. In this way, when extracting the watermark, the forged row data and shard information can be determined by the method of grouping and sorting to select the edge row data. The watermark extraction process can extract the watermark information without relying on the parameter information during watermark embedding, improving the usability of watermark extraction. In addition, the addition and deletion of non-edge row data in the group do not affect the extraction of forged row data, and it can resist subset addition and deletion attacks, with higher robustness.
[0085] In a specific example, assume that the watermark information to be embedded is "cmri0902", and the dataset example is as follows:
[0086] ID,LOG_TIME,TYPE,DEV_ID,INTERFACE_ID,APP_ID,VERSION,LABEL,CONTENT
[0087] "5894","2023 / 3 / 1 00:00:20.26","1","92****10","800000000473","100000002961","1","[phone]","[phone:>152******00<(399-412)]"
[0088] "5895","2023 / 3 / 1 00:00:25.789","3","96****57","800000000042","100000002961","1","[phone]","[phone:>187******01小(1878-1891)]"
[0089] ……
[0090] "6891","2023 / 3 / 1
[0091] 00:01:21.705","1","92****10","100000000560","100000000720","1","[bankCard]","[bankCard:>595****76<(381-398)]"
[0092] That is, the dataset is structured data as shown in Table 1.
[0093] Table 1
[0094]
[0095]
[0096] In the watermark embedding process, the watermark information is firstly sliced and encoded as "636d726930393032" according to the encoding method. Based on the Chinese remainder theorem, the watermark value is divided into 17 slices: [00,00,00,03,04,11,01,03,17,00,06,13,11,03,35,15,56].
[0097] Determine the key field of the data set as the primary key field, that is, the first field ID.
[0098] Then determine the sequence of embeddable numerical fields. Select some data sets. Since the watermark fragment data is two-bit data, take the last two bits of the field to determine whether it is an embeddable numerical field sequence. The contents of the 2nd to 9th fields are taken as strings, and all the contents of each field are judged: first, the proportion of the last two characters of the field being numerical values is greater than 50% (that is, the possibility of the last two digits of the field being numerical values is high), and second, the number of different values of the field is greater than 20 (that is, the field may have multiple different numerical values, and it will not be particularly eye-catching due to watermark embedding). If both of the above two conditions are met, the field is considered to be an embeddable numerical field. The 2nd, 4th, 5th, and 6th fields of the above example data set, namely [LOG_TIME, DEV_ID, INTERFACE_ID, APP_ID], constitute an embeddable numerical field sequence.
[0099] Perform preset transformation on the key fields, and combine the preset embeddable numeric fields according to the transformed key field content to group and sort the data sets. For example, the last two digits of the MD5 value of the ID field can be taken, and the last two digits of the LOG_TIME field (i.e., the preset embeddable numeric field) can be combined to group and sort. Taking the first item of the sample data as an example, the MD5 value of "5894" is "8973ba741e7bd6450d8023552f43728e", and the last two digits are taken as "8e"; the last two digits of the LOG_TIME field "2023 / 3 / 100:00:20.726" are taken as "26", and the combination is "8e26" converted to decimal 36390. Then the grouping value is 36390%17=10, where 17 is the number of watermark information fragments.
[0100] All data with a grouping value of 10 are sorted according to the combination value (i.e., "36390"), and the row data of the row with the maximum value (i.e., the edge row data) are selected. Assuming that among all data with a grouping value of 10, 36390 is the maximum value, the key field and the preset embeddable numeric field content are recorded as (5894,26).
[0101] Insert a fake row of data in each group, where the fake contents of the key field and the preset embeddable numeric field are the attribute values selected by the algorithm. Since the primary key is a completely incremental type, in the group with a group value of 10, forge a row of data, set the key field to 5894, and set the last two digits of the LOG_TIME field to 94=26+17*4. Set the original primary key of the first data item to 6892 (the maximum value 6891 plus 1) and place it at the end of the data set.
[0102] There are many ways to forge row data, such as randomly extracting a row of data and copying it. Embed the forged content of the key field and the preset embeddable numeric field, and insert the watermark fragment information according to the grouping value for the remaining fields in the forged row data that can be embedded with watermarks. For example, if the grouping value is 10, then 00, 06, and 13 are embedded in sequence starting from the 10th watermark fragment "00". An example of forged row data is as follows:
[0103] "5894","2023 / 3 / 1
[0104] 00:00:29.594","1","92****00","800000000406","100000002913","1","[phone]","[phone:>152****00<(399-412)]"
[0105] According to the selection of key fields, the forged row data is inserted into the data set to generate a data set with embedded watermarks. The embedded example is as follows:
[0106] "5894","2023 / 3 / 1
[0107] 00:00:29.594","1","92****00","800000000406","100000002913","1","[phone]","[phone:>152****00<(399-412)]"
[0108] "5895","2023 / 3 / 1 00:00:25.789","3","96****57","800000000042","100000002961","1","[phone]","[phone:>187******01 small(1878 - 1891)]"
[0109] ……
[0110] "6891","2023 / 3 / 1
[0111] 00:01:21.705","1","92****10","100000000560","100000000720","1","[bankCard]","[bankCard:>595****76<(381 - 398)]"
[0112] "6892","2023 / 3 / 1 00:00:20.26","1","92****10","800000000473","100000002961","1","[phone]","[phone:>152******00<(399 - 412)]"
[0113] The embodiment of the present invention also provides a watermark extraction method, as Figure 2 shown, including:
[0114] Step 201: Obtain the dataset after embedding the watermark;
[0115] Step 202: Select key fields and at least one embeddable value field from the dataset, and group and sort the dataset according to the key fields and the at least one embeddable value field;
[0116] Specifically, perform a preset transformation on the key fields, group the dataset according to the transformed key fields and the preset embeddable value fields to obtain multiple groups, and sort the groups according to the transformed key fields and the preset embeddable value fields, where the preset embeddable value field is selected from the at least one embeddable value field.
[0117] In some embodiments, selecting a key field from a data set to be processed includes: if the data set includes a primary key, selecting the primary key as the key field; if the data set does not include a primary key, selecting the first field in the data set as the key field. If the data set includes a primary key, the primary key includes important information of the structured data, and therefore, the primary key is selected as the key field; if the data set does not include a primary key, generally, the first field in the data set includes important information of the structured data, and therefore, the first field in the data set is selected as the key field.
[0118] Then determine the sequence of embeddable numerical fields. An embeddable numerical field refers to a field in the row data whose content at the specified position is a numerical value. Specifically, selecting at least one embeddable numerical field from the data set to be processed includes: performing numerical determination on the content at the preset position of each field in at least part of the data set to determine whether the content at the preset position is a numerical value; when the proportion of the content at the preset position of the field that is a numerical value is greater than a preset first threshold, and the content at the preset position includes Q different values and Q is greater than a preset second threshold, confirm that the field is an embeddable numerical field, and Q is a positive integer. Because the watermark information fragments are numerical values, embedding the watermark information fragments into an embeddable numerical field whose proportion of numerical values is greater than the preset first threshold will not have much impact on the format of the structured data.
[0119] The values of the first threshold and the second threshold may be set in advance.
[0120] In this embodiment, after determining the key field, a preset transformation is performed on the key field. The main purpose is to discretize the data of the key field. According to the transformed key field, combined with the preset embeddable numerical field, the data set is grouped and sorted. Among them, any embeddable numerical field can be selected from the embeddable numerical fields as the preset embeddable numerical field, and multiple embeddable numerical fields can be selected as the preset embeddable numerical fields. Specifically, the first embeddable numerical field can be selected as the preset embeddable numerical field or the last embeddable numerical field can be selected as the preset embeddable numerical field.
[0121] Step 203: Select edge data rows in each group, and extract watermark fragmentation information from embeddable numerical fields in the edge data rows, wherein the edge data rows include the first row of data and / or the last row of data;
[0122] The edge data row may be the first row of data in the group, may be the last row of data, or may be both the first row of data and the last row of data.
[0123] Specifically, watermark information fragments are sequentially extracted from other embeddable numerical fields in the edge data row except the preset embeddable numerical field according to the grouping value corresponding to the edge data row.
[0124] In some embodiments, when the grouping value is n and the number of other embeddable value fields except the preset embeddable value field is k, k watermark information shards can be sequentially extracted from the k embeddable value fields, and the k watermark information shards are respectively used as the nth watermark information shard, the (n + 1)th watermark information shard, …, the (n + k - 1)th watermark information shard.
[0125] Step 204: Restore the watermark information according to the extracted watermark shard information.
[0126] For all selected row data, extract the watermark grouping shard information from the embeddable value fields, and restore the watermark information in combination with the grouping shard algorithm used during embedding.
[0127] In some embodiments, if the m pth watermark information shards extracted have s different values, assign a score to each value. The score of the value is positively correlated with the number of watermark information shards corresponding to the value, and select the value with the highest score as the value of the pth watermark information shard, where m, p, and s are positive integers and s is not greater than m. That is, the final watermark information shard sequence is determined by the voting method, which can ensure the accuracy of the watermark information shards.
[0128] In this embodiment, when extracting the watermark, the forged row data and shard information can be determined by the method of grouping and sorting to select the edge row data. The watermark extraction process can extract the watermark information without relying on the parameter information during watermark embedding, improving the usability of watermark extraction; in addition, the addition and deletion of non-edge row data in the grouping do not affect the extraction of the forged row data, and it can resist subset addition and deletion attacks, with higher robustness.
[0129] In a specific example, the data set after embedding the watermark is:
[0130] "5894","2023 / 3 / 1
[0131] 00:00:29.594","1","92****00","800000000406","100000002913","1","[phone]","[phone:>152****00<(399-412)]"
[0132] "5895","2023 / 3 / 1 00:00:25.789","3","96****57","800000000042","100000002961","1","[phone]","[phone:>187******01小(1878-1891)]"
[0133] ……
[0134] "6891","2023 / 3 / 1
[0135] 00:01:21.705","1","92****10","100000000560","100000000720","1","[bankCard]","[bankCard:>595****76<(381-398)]"
[0136] "6892","2023 / 3 / 1 00:00:20.26","1","92****10","800000000473","100000002961","1","[phone]","[phone:>152******00<(399-412)]"
[0137] When extracting watermarks from the above dataset, the key field of the dataset is first determined to be the primary key field, that is, the first field ID.
[0138] Then determine the sequence of embeddable numerical fields. Select some data sets. Since the watermark fragment data is two-bit data, take the last two bits of the field to determine whether it is an embeddable numerical field sequence. The contents of the 2nd to 9th fields are taken as strings, and all the contents of each field are judged: first, the proportion of the last two characters of the field being numerical values is greater than 50% (that is, the possibility of the last two digits of the field being numerical values is high), and second, the number of different values of the field is greater than 20 (that is, the field may have multiple different numerical values, and it will not be particularly eye-catching due to watermark embedding). If both of the above two conditions are met, the field is considered to be an embeddable numerical field. The 2nd, 4th, 5th, and 6th fields of the above example data set, namely [LOG_TIME, DEV_ID, INTERFACE_ID, APP_ID], constitute an embeddable numerical field sequence.
[0139] Perform preset transformation on the key fields, and combine the preset embeddable numeric fields according to the transformed key field content to group and sort the data sets. For example, the last two digits of the MD5 value of the ID field can be taken, and the last two digits of the LOG_TIME field (i.e., the preset embeddable numeric field) can be combined to group and sort. Taking the first item of the sample data as an example, the MD5 value of "5894" is "8973ba741e7bd6450d8023552f43728e", and the last two digits are taken as "8e"; the last two digits of the LOG_TIME field "2023 / 3 / 100:00:20.726" are taken as "26", and the combination is "8e26" converted to decimal 36390. Then the grouping value is 36390%17=10, where 17 is the number of watermark information fragments.
[0140] After grouping and sorting the data set, select the row data with the largest sorting in each group as the edge row data. For all selected row data, take the last two digits of each embeddable numerical field to extract the watermark grouping and fragmentation information. For example, suppose the row data selected from group 10 is:
[0141] "5894","2023 / 3 / 1
[0142] 00:00:29.594","1","92****00","800000000406","100000002913","1","[phone]","[phone:>152****00<(399-412)]"
[0143] The extracted fragment information is: the 10th watermark information fragment is "00", the 11th watermark information fragment is "06", and the 12th watermark information fragment is "13".
[0144] Combined with the grouping and sharding algorithm used during embedding, the watermark information is restored. That is, for all the watermark information fragments extracted from the selected row data, the final watermark information fragment sequence is determined by the election method, and the watermark information fragments are restored to watermark information using the fragmentation restoration method based on the Chinese remainder theorem.
[0145] The embodiment of the present invention also provides a watermark embedding device, such as Figure 3 As shown, including:
[0146] A fragmentation module 31, used for fragmenting the watermark information to obtain watermark information fragments;
[0147] The processing module 32 is used to select key fields and at least one embeddable numerical field from the data set to be processed, and group and sort the data set according to the key fields and at least one embeddable numerical field; the insertion module 33 is used to insert forged row data in each of the groups, so that the forged row data becomes the edge row data of the group, and embed the watermark fragmentation information in the embeddable numerical field in the forged row data according to the grouping value, so as to generate a data set with embedded watermark.
[0148] In some embodiments, the processing module 32 is specifically configured to select, if the data set includes a primary key, the primary key as the key field; if the data set does not include a primary key, select the first field in the data set as the key field.
[0149] In some embodiments, the processing module 32 is specifically used to perform a numerical judgment on the content of the preset position of each field in at least part of the data set to determine whether the content of the preset position is a numerical value; when the proportion of the content of the preset position of the field that is a numerical value is greater than a preset first threshold, and the content of the preset position includes Q different values and Q is greater than a preset second threshold, the field is confirmed to be an embeddable numerical field, and Q is a positive integer.
[0150] In some embodiments, the processing module 32 is specifically used to perform a preset transformation on the key field, group the data set according to the transformed key field and the preset embeddable numerical field to obtain multiple groups, and sort the groups according to the transformed key field and the preset embeddable numerical field, and the preset embeddable numerical field is selected from the at least one embeddable numerical field.
[0151] In some embodiments, the insertion module 33 is also used to determine, for each group, the content of the key field of the original edge row data of the group and the content of the preset embeddable numerical field; use the content of the key field as the forged content of the key field, the sum of the content of the preset embeddable numerical field and a preset multiple of the grouping value, or the difference between the content of the preset embeddable numerical field and the preset multiple of the grouping value as the forged content of the preset embeddable numerical field; use the forged content of the key field and the forged content of the preset embeddable numerical field to replace the key field and the preset embeddable numerical field of the forged row data respectively, and the watermark information segmentation is to sequentially insert other embeddable numerical fields of the forged row data except the preset embeddable numerical field.
[0152] In some embodiments, when the grouping value is n and the number of other embeddable numerical fields except the preset embeddable numerical field is k, the k watermark information fragments starting from the nth watermark information fragment are respectively inserted into the k embeddable numerical fields, where n and k are positive integers.
[0153] In some embodiments, when the edge row data is the last row data in the group, the forged content of the preset embeddable numerical field is the sum of the content of the preset embeddable numerical field and a preset multiple of the group value;
[0154] When the edge row data is the first row data in the group, the forged content of the preset embeddable numerical field is the difference between the content of the preset embeddable numerical field and a preset multiple of the group value.
[0155] In some embodiments, the processing module 32 is also used to replace the primary key value of the edge row data in the group with the maximum primary key value plus 1 if the primary key value of the data set is completely increasing; if the primary key value of the data set is not increasing, sort the primary key fields in the group and search for missing primary key values to obtain a set of forgeable primary key values, and replace the primary key value of the edge row data in the group with a randomly selected value from the set of forgeable primary key values.
[0156] The embodiment of the present invention also provides a watermark extraction device, such as Figure 4 As shown, including:
[0157] An acquisition module 41 is used to acquire a data set after embedding a watermark;
[0158] A processing module 42, configured to select a key field and at least one embeddable numerical field from the data set, and group and sort the data set according to the key field and at least one embeddable numerical field;
[0159] An extraction module 43 is used to select edge data rows in each group, and extract watermark fragmentation information from the embeddable numerical field in the edge data rows, wherein the edge data rows include the first row of data and / or the last row of data;
[0160] The restoration module 44 is used to restore the watermark information according to the extracted watermark fragment information.
[0161] In some embodiments, the processing module 42 is specifically configured to select, if the data set includes a primary key, the primary key as the key field; if the data set does not include a primary key, select the first field in the data set as the key field.
[0162] In some embodiments, the processing module 42 is specifically used to perform a preset transformation on the key field, group the data set according to the transformed key field and the preset embeddable numerical field to obtain multiple groups, and sort the groups according to the transformed key field and the preset embeddable numerical field, and the preset embeddable numerical field is selected from at least one embeddable numerical field.
[0163] In some embodiments, the extraction module 43 is specifically configured to sequentially extract watermark information fragments from other embeddable numerical fields in the edge data row except the preset embeddable numerical field according to the grouping value corresponding to the edge data row.
[0164] In some embodiments, when the grouping value is n and the number of other embeddable numerical fields except the preset embeddable numerical field is k, the extraction module 43 is specifically used to sequentially extract k watermark information fragments from the k embeddable numerical fields, and use the k watermark information fragments as the nth watermark information fragment, the n+1th watermark information fragment,..., the n+k-1th watermark information fragment, respectively.
[0165] In some embodiments, the restoration module 44 is specifically used to assign a score to each value if the extracted m p-th watermark information fragments have s different values, the score of the value is positively correlated with the number of watermark information fragments corresponding to the value, and select the value with the highest score as the value of the p-th watermark information fragment, where m, p, s are positive integers and s is not greater than m.
[0166] The embodiment of the present invention also provides a watermark embedding device, such as Figure 5 As shown, it includes a memory 51, a processor 52, and a computer program stored in the memory 51 and executable on the processor 52; when the processor 52 executes the program, the steps in the watermark embedding method described above are implemented.
[0167] The embodiment of the present invention also provides a watermark extraction device, such as Figure 6 As shown, it includes a memory 61, a processor 62, and a computer program stored in the memory 61 and executable on the processor 62; when the processor 62 executes the program, the steps in the watermark extraction method described above are implemented.
[0168] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the watermark embedding method or the steps in the watermark extraction method described above are implemented.
[0169] Computer readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage terminal devices to be detected or any other non-transmission media that can be used to store information that can be accessed by the computer terminal device to be detected. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carriers.
[0170] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A watermark embedding method, characterized in that: include: Slice the watermark information to obtain watermark information slices; Selecting a key field and at least one embeddable numerical field from the data set to be processed, and grouping and sorting the data set according to the key field and the at least one embeddable numerical field; Insert forged row data into each of the groups so that the forged row data becomes edge row data of the group, and embed the watermark fragmentation information into an embeddable numerical field in the forged row data according to the grouping value to generate a data set embedded with watermark.
2. The method according to claim 1, characterized in that The key fields to be selected from the data set to be processed include: If the data set includes a primary key, selecting the primary key as the key field; If the data set does not include a primary key, the first field in the data set is selected as the key field.
3. The method according to claim 1, characterized in that Selecting at least one embeddable numeric field from the data set to be processed includes: Performing a numerical determination on the content of a preset position of each field in at least part of the data set to determine whether the content of the preset position is a numerical value; When the proportion of the content of the preset position of the field is a numerical value greater than the preset first threshold, and the content of the preset position includes Q different values and Q is greater than the preset second threshold, the field is confirmed to be an embeddable numerical field, and Q is a positive integer.
4. The method according to claim 1, characterized in that: Grouping and sorting the data set according to the key field and at least one embeddable numerical field includes: Perform a preset transformation on the key field, group the data set according to the transformed key field and the preset embeddable numerical field to obtain multiple groups, and sort the groups according to the transformed key field and the preset embeddable numerical field, and the preset embeddable numerical field is selected from at least one embeddable numerical field.
5. The method according to claim 4, characterized in that The method further comprises: For each group, determine the content of the key field of the original edge row data of the group and the content of the preset embeddable value field; Using the content of the key field as the forged content of the key field, the sum of the content of the preset embeddable numerical field and the preset multiple of the grouping value, or the difference between the content of the preset embeddable numerical field and the preset multiple of the grouping value as the forged content of the preset embeddable numerical field; The forged content of the key field and the forged content of the preset embeddable numerical field respectively replace the key field and the preset embeddable numerical field of the forged row data, and the watermark information fragments are sequentially inserted into other embeddable numerical fields of the forged row data except the preset embeddable numerical field.
6. The method according to claim 5, characterized in that When the grouping value is n and the number of other embeddable numerical fields except the preset embeddable numerical fields is k, k watermark information fragments starting from the nth watermark information fragment are respectively inserted into the k embeddable numerical fields, where n and k are positive integers.
7. The method according to claim 5, characterized in that When the edge row data is the last row data in the group, the forged content of the preset embeddable numerical field is the sum of the content of the preset embeddable numerical field and a preset multiple of the group value; When the edge row data is the first row data in the group, the forged content of the preset embeddable numerical field is the difference between the content of the preset embeddable numerical field and a preset multiple of the group value.
8. The method according to claim 2, characterized in that: If the data set includes a primary key, the method further includes: If the primary key value of the data set is completely increasing, replace the primary key value of the edge row data in the group with the maximum primary key value plus 1; if the primary key value of the data set is not increasing, sort the primary key fields in the group and search for missing primary key values to obtain a set of forgeable primary key values, and replace the primary key value of the edge row data in the group with a randomly selected value from the set of forgeable primary key values.
9. A watermark extraction method, characterized in that: include: Get the data set after embedding the watermark; Selecting a key field and at least one embeddable numerical field from the data set, and grouping and sorting the data set according to the key field and the at least one embeddable numerical field; Selecting edge data rows in each group, and extracting watermark fragmentation information from embeddable numerical fields in the edge data rows; Restore the watermark information based on the extracted watermark fragment information.
10. The method according to claim 9, characterized in that The key fields selected from the dataset include: If the data set includes a primary key, selecting the primary key as the key field; If the data set does not include a primary key, the first field in the data set is selected as the key field.
11. The method according to claim 9, characterized in that The step of selecting a key field and at least one embeddable numerical field from the data set, and grouping and sorting the data set according to the key field and at least one embeddable numerical field comprises: Perform a preset transformation on the key field, group the data set according to the transformed key field and the preset embeddable numerical field to obtain multiple groups, and sort the groups according to the transformed key field and the preset embeddable numerical field, and the preset embeddable numerical field is selected from at least one embeddable numerical field.
12. The method according to claim 11, characterized in that The extracting of watermark fragment information from the embeddable numerical field in the edge data row comprises: The watermark information fragments are sequentially extracted from other embeddable numerical fields in the edge data row except the preset embeddable numerical field according to the grouping value corresponding to the edge data row.
13. The method according to claim 12, characterized in that When the grouping value is n and the number of other embeddable numerical fields except the preset embeddable numerical field is k, sequentially extracting watermark information fragments from other embeddable numerical fields except the preset embeddable numerical field in the edge data row according to the grouping value corresponding to the edge data row includes: Sequentially extract k watermark information fragments from k embeddable numerical fields, and use the k watermark information fragments as the nth watermark information fragment, the n+1th watermark information fragment, ..., the n+k-1th watermark information fragment, respectively.
14. The method according to claim 13, characterized in that If the extracted m p-th watermark information fragments have s different values, a score is assigned to each value, the score of the value is positively correlated with the number of watermark information fragments corresponding to the value, and the value with the highest score is selected as the value of the p-th watermark information fragment, where m, p, s are positive integers and s is not greater than m.
15. A watermark embedding device, characterized in that: include: A fragmentation module, used for fragmenting the watermark information to obtain watermark information fragments; A processing module, used for selecting a key field and at least one embeddable numerical field from a data set to be processed, and grouping and sorting the data set according to the key field and at least one embeddable numerical field; The insertion module is used to insert forged row data into each of the groups so that the forged row data becomes the edge row data of the group, and embed the watermark fragmentation information in the embeddable numerical field in the forged row data according to the grouping value to generate a data set after embedding the watermark.
16. A watermark extraction device, characterized in that: include: An acquisition module is used to acquire the data set after embedding the watermark; A processing module, used for selecting a key field and at least one embeddable numerical field from the data set, and grouping and sorting the data set according to the key field and at least one embeddable numerical field; An extraction module, used for selecting edge data rows in each group, and extracting watermark fragmentation information from embeddable numerical fields in the edge data rows; The restoration module is used to restore the watermark information according to the extracted watermark fragment information.
17. A watermark embedding device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor; characterized in that: When the processor executes the program, the steps in the watermark embedding method according to any one of claims 1 to 8 are implemented.
18. A watermark extraction device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor; characterized in that: When the processor executes the program, the steps of the watermark extraction method according to any one of claims 9 to 14 are implemented.
19. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the watermark embedding method according to any one of claims 1 to 8 or the steps of the watermark extraction method according to any one of claims 9 to 14 are implemented.
