A watermark embedding method, device, equipment and storage medium

By encrypting and grouping the text-type and numerical data sets of database tables, combined with the corresponding embedding algorithm, the problem that watermark embedding in the prior art is only suitable for a single type of database, and the security protection of multiple data types of databases is realized.

CN114398375BActive Publication Date: 2025-08-15SHANJIE INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210060204.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-19
Publication Date
2025-08-15
Estimated Expiration
2042-01-19

AI Technical Summary

Technical Problem

In the prior art, the watermark embedding method is only applicable to a single type of database and cannot meet the database requirements of multiple data types.

Method used

By obtaining the data set of the database table, including text-type and numerical data, multiple primary keys are encrypted, encrypted primary keys are generated, and a corresponding embedding algorithm is used to embed array elements into watermarks according to the data type.

Benefits of technology

It realizes security protection for various data types databases, which are suitable for security protection of text-type and numerical data sets, and meets the needs of real production and life.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114398375B_ABST
    Figure CN114398375B_ABST
Patent Text Reader

Abstract

This application provides a watermark embedding method, apparatus, device, and storage medium, relating to the field of data security technology. The method comprises: obtaining a dataset from a database table, the dataset comprising textual data and numerical data; encrypting multiple primary keys of the dataset to obtain multiple encrypted primary keys; grouping the dataset according to the encrypted primary keys and the row of data corresponding to the encrypted primary keys to obtain a dataset array; and embedding a watermark into the array elements in the dataset array using a corresponding embedding algorithm based on the data type of the array elements. This method achieves security protection for datasets in a database and is applicable to databases with a variety of data types, meeting the needs of real-world production and life.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data security technology, and in particular to a watermark embedding method, apparatus, device and storage medium. Background Art

[0002] With the widespread application of relational databases, the demand for data sharing and data exchange continues to increase, and problems such as data leakage, data theft, and data tampering have emerged. Therefore, effective copyright authentication protection and security mechanisms need to be adopted for data.

[0003] In the existing technology, watermarks can be added to the data table of the database to protect the data in the database. However, the currently used watermarking method is only applicable to a single type of database, that is, a simple text database or a simple numerical database, which cannot meet the needs of real production and life. Summary of the Invention

[0004] The purpose of the present invention is to provide a watermark embedding method, device, equipment and storage medium to address the above-mentioned deficiencies in the prior art, so as to solve the problem that watermark embedding in the prior art is only applicable to a single type of database.

[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of the present application are as follows:

[0006] In a first aspect, an embodiment of the present application provides a watermark embedding method, the method comprising:

[0007] Obtaining a data set from a database table, the data set including text data and numerical data;

[0008] Encrypting multiple primary keys of the data set to obtain multiple encrypted primary keys;

[0009] Grouping the data set according to the encryption primary key and a row of data corresponding to the encryption primary key to obtain a data set array;

[0010] According to the data type of the array element in the data set array, a corresponding embedding algorithm is used to embed the watermark into the array element.

[0011] Optionally, encrypting the multiple primary keys of the data set to obtain multiple encrypted primary keys includes:

[0012] Get the key and each primary key in the dataset;

[0013] Calculate the key and the primary key through a hash function to obtain a hash discrete primary key corresponding to each primary key;

[0014] Perform hash calculation on the hashed discrete primary key and the secret key to obtain an identity verification value corresponding to the hashed discrete primary key;

[0015] Modulo the authentication value and the primary key to obtain the encryption primary key corresponding to each primary key.

[0016] Optionally, the data type of the array element is numerical data; and embedding the watermark into the array element using a corresponding embedding algorithm according to the data type of the array element in the data set array includes:

[0017] Get the data to be embedded from the dataset array and get the input binary watermark information;

[0018] According to the binary watermark information and the subscripts of the array elements in the data set array, the target position of the binary watermark information where the data to be embedded of each array element should be embedded is calculated;

[0019] Embedding the data to be embedded of the array element into the target position of the binary watermark information to obtain the watermarked data;

[0020] The watermarked data elements are replaced into the data set array to obtain a watermarked data set array.

[0021] Optionally, embedding the array element into a target position of the binary watermark information to obtain watermarked data includes:

[0022] Convert each array element to be embedded with a watermark into a binary number;

[0023] Adding a step size to each value of the binary digit to obtain an updated binary digit, wherein each new value of the updated binary digit satisfies a preset condition;

[0024] The updated binary digit is embedded into the target position of the binary watermark information to obtain the watermarked data.

[0025] Optionally, after replacing the watermarked data element into the data set array to obtain the watermarked data set array, the method further includes:

[0026] Dividing the data elements in the watermarked data set array into two groups according to the binary value at the target position of the binary watermark information;

[0027] Calculate and obtain an optimal decoding threshold according to the data elements in the two groups;

[0028] Among them, when the binary value at the position of the binary watermark is 0, the data element in the data set array after the watermark is embedded corresponding to one group, and when the binary value at the position of the binary watermark is 1, the data element in the data set array after the watermark is embedded corresponding to another group.

[0029] Optionally, the data type of the array element is text data; and embedding the watermark into the array element using a corresponding embedding algorithm according to the data type of the array element in the data set array includes:

[0030] Embed watermarks into array elements in the data set array according to a space embedding algorithm.

[0031] Optionally, the data type of the array element is text data; and embedding the watermark into the array element using a corresponding embedding algorithm according to the data type of the array element in the data set array includes:

[0032] Embed watermarks into array elements in the data set array according to a sign modification algorithm.

[0033] In a second aspect, an embodiment of the present application provides a watermark embedding device, comprising:

[0034] An acquisition module is used to acquire a data set from a database table, wherein the data set includes text data and numerical data;

[0035] An encryption module, configured to encrypt multiple primary keys of the data set to obtain multiple encrypted primary keys;

[0036] a grouping module, configured to group the data set according to the encryption primary key and a row of data corresponding to the encryption primary key to obtain a data set array;

[0037] The embedding module is used to embed watermarks into the array elements in the data set array by using a corresponding embedding algorithm according to the data type of the array elements.

[0038] In a third aspect, an embodiment of the present application provides a computer device, comprising: a memory and a processor, wherein the memory stores a computer program executable by the processor, and when the processor executes the computer program, the watermark embedding method of the first aspect is implemented.

[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the watermark embedding method of the first aspect is implemented.

[0040] Compared with the prior art, this application has the following beneficial effects:

[0041] The embodiments of the present application provide a watermark embedding method, apparatus, device and storage medium. The method obtains a data set from a database table, where the data set includes text data and numeric data, encrypts multiple primary keys of the data set to obtain multiple encrypted primary keys, groups the data set according to the encrypted primary key and a row of data corresponding to the encrypted primary key to obtain a data set array, and embeds watermarks into the array elements using a corresponding embedding algorithm based on the data type of the array elements in the data set array. The method identifies the data type of the array elements and embeds watermarks into the array elements using a corresponding watermark embedding algorithm based on the data type. This method not only implements security protection of the data set in the database through watermarks, but is also applicable to databases of various data types to meet the needs of real production and life. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.

[0043] Figure 1 A schematic diagram of a watermark embedding method according to an embodiment of the present invention;

[0044] Figure 2 A flowchart of a method for generating an encryption master key provided in an embodiment of the present application;

[0045] Figure 3 A flow chart of a numerical watermark embedding method provided in an embodiment of the present application;

[0046] Figure 4 A flowchart of another numerical watermark embedding method provided in an embodiment of the present application;

[0047] Figure 5 A flowchart of another numerical watermark embedding method provided in an embodiment of the present application;

[0048] Figure 6 A schematic diagram of a watermark embedding device provided in an embodiment of the present application;

[0049] Figure 7 A schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations.

[0051] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for protection, but merely represents selected embodiments of the present application. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0052] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.

[0053] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0054] To address the problem that existing watermark embedding methods are only applicable to a single type of database and meet the needs of real-world production and life, the present application provides a watermark embedding method, apparatus, device, and storage medium. The following describes the implementation process of the watermark embedding method provided in the present application through multiple examples. Figure 1 A flow chart of a watermark embedding method provided in an embodiment of the present application is shown as follows: Figure 1 As shown, the method includes:

[0055] S101, obtaining a data set of a database table, wherein the data set includes text data and numerical data.

[0056] Before embedding a watermark into a dataset, the dataset to be watermarked should first be obtained. The dataset can be obtained from a database table. In the embodiment of the present application, the database can be MySQL, Oracle, SQL Server, SQLite, PostgreSQL, etc. The type of database is not specifically limited in the embodiment of the present application.

[0057] A database table is an object used to store data in a database. Optionally, each column in a database table stores the same type of data. Multiple columns in a database table can store different types of data, such as multiple columns storing text data and multiple columns storing numeric data. When watermarking a dataset in a database table, the appropriate watermark embedding algorithm can be used based on the dataset type.

[0058] S102: Encrypt multiple primary keys of the data set to obtain multiple encrypted primary keys.

[0059] The primary key is used to uniquely identify records in a database table. Each record corresponds to a primary key, and each record can correspond to a row of data.

[0060] After obtaining a data set from a database table, multiple primary keys of multiple records in the data set are encrypted respectively to obtain multiple encrypted primary keys.

[0061] S103 , grouping the data set according to the encrypted primary key and a row of data corresponding to the encrypted primary key to obtain a data set array.

[0062] The primary key is used to uniquely identify records in a database table. Correspondingly, the encrypted primary key can also be used to uniquely identify records in a database table. That is, in a database table, each encrypted primary key corresponds to a unique row of data in the table and can serve as an index for this row of data.

[0063] The database table's dataset is stored in a dataset array. Each array element in the dataset array contains each record in the database table, which is the encrypted primary key and the row of data corresponding to the primary key. Each record is stored in the dataset array as a Map container, that is, each array element is a key-value pair. The encrypted primary key is used as the key, and the row of data corresponding to the encrypted primary key is used as the value.

[0064] For example, if the data representation of each array element is the corresponding key value and value value connected by a colon, and there is a record in the data set with the encrypted primary key key1, and the primary key corresponding to the encrypted primary key is a row of data value1, then the array element where the record is stored can be represented as key1:value1.

[0065] The encrypted primary key of each record and a row of data corresponding to the primary key are stored in the data set array in the form of key-value data, and the data set array carrying the data set in the database table is obtained.

[0066] S104, embedding watermarks into the array elements in the data set array using a corresponding embedding algorithm according to the data types of the array elements.

[0067] Determine the data type of the data to be watermarked in the data set array. If the data type is text data, use a text-based watermark embedding algorithm to embed watermarks on the array elements. If the data type is numeric data, use a numeric-based watermark embedding algorithm to embed watermarks on the array elements.

[0068] In summary, the embodiment of the present application provides a watermark embedding method, which obtains a data set of a database table, where the data set includes: text data and numeric data, encrypts multiple primary keys of the data set to obtain multiple encrypted primary keys, groups the data set according to the encrypted primary key and a row of data corresponding to the encrypted primary key to obtain a data set array, and embeds watermarks into the array elements according to the data type of the array elements in the data set array using a corresponding embedding algorithm. The method identifies the data type of the array elements and embeds watermarks into the array elements using a corresponding watermark embedding algorithm according to the different data types. Not only does the watermark realize the security protection of the data set in the database, but the method is also applicable to databases of multiple data types to meet the needs of real production and life.

[0069] In the above Figure 1 Based on the aforementioned watermark embedding method, the present embodiment further provides a method for generating an encryption master key. This embodiment is explained in detail below with reference to the accompanying drawings. Figure 2 This is a flow chart of a method for generating an encryption master key provided in an embodiment of the present application. Figure 2 As shown, in the above S102, multiple primary keys of the data set are encrypted to obtain multiple encrypted primary keys, including:

[0070] S201, obtaining a key and each primary key in a data set.

[0071] The key can be a number, a character, or a string, and is not specifically limited in the embodiments of the present application.

[0072] When a database creates a data table, each database table is set with a corresponding primary key column, and each primary key corresponding to each record exists in the primary key column.

[0073] S202: Calculate the secret key and the primary key through a hash function to obtain a hash discrete primary key corresponding to each primary key.

[0074] The primary key and the secret key are concatenated to obtain a concatenated string of data, which can be a string of numbers, a string of characters, or a mixture of numbers and strings. For example, if the primary key is pr and the secret key is ks, the concatenated string of data is the string prks.

[0075] In an embodiment of the present application, a BKDR hash function is used to calculate a hash discrete primary key of data after the key and the primary key are concatenated, such as calculating a hash discrete primary key of the string prks.

[0076] The calculation of the BKDR hash function is shown in the following formula (1):

[0077]

[0078] Where p is the concatenation of the key and the primary key, n is the number of bits minus one, and SUM(p) is the hashed discrete primary key of the concatenation of the key and the primary key. Taking the above prks as an example, p[0] is the ASCII value of the character p, p[1] is the ASCII value of the character r, p[2] is the ASCII value of the character k, and p[3] is the ASCII value of the character s. The hashed discrete primary key of the string prks can be obtained by summing them.

[0079] S203: Perform hash calculation on the hashed discrete primary key and the secret key to obtain an authentication value corresponding to the hashed discrete primary key.

[0080] The key is concatenated with the hash discrete primary key obtained in S202 to obtain a concatenated string of data. The BKDR hash function in S202 is used to calculate the concatenated data to obtain an authentication value corresponding to the hash discrete primary key.

[0081] The authentication value corresponding to the hash discrete primary key is shown in the following formula (2):

[0082] mac=H(ks||H(pr||ks)) Formula (2)

[0083] Among them, H(pr||ks) is the hash discrete primary key corresponding to the primary key pr, and mac is the authentication value.

[0084] S204: Perform a modulo operation on the primary key based on the authentication value to obtain an encrypted primary key corresponding to each primary key.

[0085] A modulo operation is performed on the authentication value and the primary key. For example, the authentication value mac is modulo operated on the primary key pr, as shown in the following formula (3):

[0086] p=mac mod pr Formula (3)

[0087] Among them, p is the encryption primary key.

[0088] The method for generating an encrypted primary key provided in the embodiment of the present application encrypts the primary key through a hash function and a secret key, thereby improving the security of the data set in the database table.

[0089] In the above Figure 2 Based on the method for generating an encryption master key shown, the embodiment of the present application further provides a method for embedding a numerical watermark. This embodiment is explained in detail below with reference to the accompanying drawings. Figure 3 This is a flow chart of a numerical watermark embedding method provided in an embodiment of the present application. Figure 3As shown, when the data type of the array element is numerical data, in the above S104, a corresponding embedding algorithm is used to embed a watermark into the array element according to the data type of the array element in the data set array, including:

[0090] S301, obtaining the data to be embedded from the data set array, and obtaining the input binary watermark information.

[0091] The data to be embedded is at least one column of data in the database table except the primary key, that is, part of the value in each array element in the dataset array.

[0092] The binary watermark information is a string of values carrying 0 and / or 1, such as 000, 001, 100, 110, etc., wherein, in the embodiment of the present application, the length of the binary watermark information needs to be smaller than the length of the data set array.

[0093] S302 , according to the binary watermark information and the subscripts of the array elements in the data set array, calculate and obtain the target position of the binary watermark information where the data to be embedded of each array element should be embedded.

[0094] Perform a modulo operation on the subscript of the array element in the data set array and the length of the binary watermark information to obtain the target position of the binary watermark information where the data to be embedded in each array element should be embedded.

[0095] For example, when the binary watermark information is 100, the length of the binary watermark information is 3. If the subscript of the array element in the data set array is 4, the modulo operation of 4 on 3 is 1, then the target position of the embedded data in the array element corresponding to the subscript to be embedded in the binary watermark information 100 is the second 0 from the left to the right.

[0096] S303: embed the data to be embedded in the array element into the target position of the binary watermark information to obtain the watermarked data.

[0097] For multiple data elements in the data set array, after respectively calculating the target positions, the data to be embedded of the multiple array elements are respectively embedded into the target positions of the binary watermark information, wherein the binary watermark information corresponding to each array element is the same.

[0098] S304: Replace the watermarked data element into the data set array to obtain the watermarked data set array.

[0099] The data to be embedded of each array element in the data set array is embedded into the target position of the binary watermark information to obtain a plurality of watermarked data, and the plurality of watermarked data are used to replace the plurality of original data to be embedded to obtain the watermarked data set array.

[0100] An embodiment of the present application provides a numerical watermark embedding method, which obtains the data to be embedded and binary watermark information, calculates the target position of embedding, embeds the data to be embedded into the watermark, obtains the data set array after the watermark is embedded, and embeds the watermark into the original data set, thereby improving the security of the numerical data set in the database table.

[0101] In the above Figure 3 Based on the numerical watermark embedding method shown above, the present embodiment also provides another numerical watermark embedding method, which is explained in detail below with reference to the accompanying drawings. Figure 4 This is a flow chart of another numerical watermark embedding method provided in the embodiment of the present application. Figure 4 As shown, when the data type of the array element is numerical data, in the above S303, the data to be embedded in the array element is embedded into the target position of the binary watermark information to obtain the data after the watermark is embedded, including:

[0102] S401, converting each array element to be embedded with a watermark into a binary number.

[0103] For numerical data, it can be converted into binary numbers. For example, if the watermark to be embedded is 8, the corresponding binary number is 1000.

[0104] S402: Add a step length to each value in the binary number to obtain an updated binary number.

[0105] Extract each value from a binary number and store it in an array. For example, if the binary number is 1000, the corresponding array is {1,0,0,0}, which can be represented by record[] notation. Thus, the array record[] = {1,0,0,0}.

[0106] Loop out each value from the array and update it.

[0107] Taking the first value record[0] as an example, when updating, if the number of loops or the search step size meets the preset loop condition, the search step size is added to record[0] to obtain a new value. It is then determined whether the current new value meets the preset evaluation condition. If it does, the current new value replaces record[0]. At this point, the search step size is reduced to obtain a new search step size, which replaces the current search step size. At the same time, the number of loops is increased by one, and the current number of loops or the new search step size continues to be determined. The new search step size is added to the new value, and the determination of whether the preset condition is met is continued. This cycle ends until the number of loops or the search step size does not meet the preset loop condition. The update process ends, the update ends, and the first updated value is obtained. This results in the updated array.

[0108] Among them, the preset loop condition can be: the number of loops has not reached the preset loop number threshold or the search step size is not 0.

[0109] Among them, there is a hidden function in the preset condition, and the hidden function is shown in the following formula (4):

[0110]

[0111] Among them, ref is a preset constant, and sigmoid(x) is a hidden value.

[0112] If, in a loop process, the value before adding the search step size is OriginData, and the value after adding the search step size is NewData, then the preset condition is: sigmoid(NewData)>sigmoid(OriginData) and the value of this bit in the current binary number is 1, or, sigmoid(NewData)<sigmoid(OriginData) and the value of this bit in the current binary number is 0.

[0113] Loop through and take out each value from this array for update until each new value in the updated binary number satisfies the preset condition.

[0114] S403, embed the updated binary number into the target position of the binary watermark information to obtain the data after embedding the watermark.

[0115] After updating the binary number, an updated binary number is obtained. For example, the array corresponding to the updated binary number is record1[] = {12, 15, 30, 49}.

[0116] Call the above hidden function to calculate and sum each data in the array corresponding to the updated binary number, divide the sum result by the length of this array to obtain the optimized data corresponding to this updated binary number, and embed the optimized data into the target position of the binary watermark information to obtain the data after embedding the watermark.

[0117] Another numerical watermark embedding method provided by the embodiments of this application updates the data to be embedded to obtain an updated binary number, then obtains optimized data according to the updated binary number, and embeds the optimized data into the target position of the binary watermark information to obtain the data after embedding the watermark, which improves the security of the numerical data set in the database table.

[0118] In the above Figure 3Based on the numerical watermark embedding method shown above, the present embodiment also provides another numerical watermark embedding method, which is explained in detail below with reference to the accompanying drawings. Figure 5 This is a flow chart of another numerical watermark embedding method provided in the embodiment of the present application. Figure 5 As shown, when the data type of the array element is numerical data, after the above S304, the data element after the watermark is embedded is replaced into the data set array, and after the data set array after the watermark is embedded is obtained, the following further includes:

[0119] S501 , dividing the data elements in the watermarked data set array into two groups according to the binary value at the target position of the binary watermark information.

[0120] In the process of watermark embedding of the data to be embedded, if the binary value at the target position of the corresponding binary watermark information is 0, then the data elements in the watermarked data set array corresponding to the data to be embedded are stored in one group. For example, the group can be recorded as X. If the binary value at the target position of the corresponding binary watermark information is 1, then the data elements in the watermarked data set array corresponding to the data to be embedded are stored in another group. For example, the other group can be recorded as Y.

[0121] S502: Calculate and obtain an optimal decoding threshold according to the data elements in the two groups.

[0122] The watermark embedding data corresponding to the to-be-embedded data of all data elements in group X and group Y are averaged, and the average value of group X can be recorded as μ0, and the average value of group Y can be recorded as σ0.

[0123] The variance of the watermark embedded data corresponding to the to-be-embedded data of all data elements in group X and group Y is calculated, and the variance of group X can be recorded as μ1, and the variance of group Y can be recorded as σ1.

[0124] The optimal decoding threshold is shown in the following formula (5)(6)(7):

[0125]

[0126]

[0127]

[0128] Among them, P err is the error probability, T is the decoding threshold, the optimal decoding threshold is the value of the decoding threshold when the error probability is minimum, P1 is the decoding error rate when the watermark binary is 1, P0 is the decoding error rate when the watermark binary is 0, and P1 = 1-P0, f(x|b e=1) is the probability density when the watermark binary value is 1, f(x|b e =0) is the probability density when the watermark binary value is 0.

[0129] Taking the first derivative of formula (5) yields formula (6), and then taking the second derivative yields formula (7). The optimal threshold T can be calculated based on formula (7). * .

[0130] Optionally, after embedding the watermark into the data to be embedded, for watermark extraction, the data set to be extracted can be grouped according to the provided key, and the optimal threshold is compared with each data element in the data set array. By comparing and extracting the data element that is closest to the optimal threshold in the most bits, the value of the watermark bit embedded in the data element is calculated.

[0131] Another numerical watermark embedding method provided by an embodiment of the present application calculates the optimal decoding threshold by using the data elements in two groups for subsequent watermark extraction.

[0132] In the above Figure 1 Based on the above-mentioned watermark embedding method, an embodiment of the present application also provides a method for implementing text-type watermark embedding. When the data type of the array element is text-type data, in the above S104, the array element is watermarked using the corresponding embedding algorithm according to the data type of the array element in the data set array, including: embedding the watermark into the array element in the data set array according to the symbol modification algorithm.

[0133] Get the data to be embedded for each array element from the dataset array and get the input binary watermark information.

[0134] Determine whether the text of the data to be embedded ends with a symbol, and calculate the total number of text symbols of the data to be embedded, and extract each bit value in the binary watermark information in turn. If the text of the data to be embedded ends with a symbol: if the value is 0 and the total number of text symbols of the data to be embedded is an odd number, or if the value is 1 and the total number of text symbols of the data to be embedded is an even number, delete the symbol of the data to be embedded; if the text of the data to be embedded ends with no symbol: if the value is 0 and the total number of text symbols of the data to be embedded is an odd number, or if the value is 1 and the total number of text symbols of the data to be embedded is an even number, add a "." symbol to the end of the symbol of the data to be embedded.

[0135] According to each bit value of the binary watermark information, the data to be embedded is modified in turn to obtain the modified data, which is then used to replace the original data to be embedded, thereby obtaining an array of data sets after the watermark is embedded.

[0136] Optionally, a space embedding algorithm can be used to embed watermarks into array elements in the dataset array. Each bit value in the binary watermark information is extracted sequentially. If the value is 0, two spaces are added to the front and two spaces are added to the back of the data to be embedded. If the value is 1, four spaces are added to the front and one space is added to the back of the data to be embedded. Spaces are then embedded into the data to be embedded based on each bit value of the binary watermark information. The data after the space embedding is then used to replace the original data to be embedded, thereby obtaining a watermarked dataset array.

[0137] The embodiment of the present application provides a text watermark embedding method, which obtains a data set array after embedding the watermark by symbol modification or space embedding, thereby improving the security of the text data set in the database table.

[0138] In the above Figure 1 Based on the above-mentioned watermark embedding method, an embodiment of the present application also provides another method for implementing text-type watermark embedding. When the data type of the array element is text-type data, in the above S104, the array element is watermarked using the corresponding embedding algorithm according to the data type of the array element in the data set array, including: embedding the watermark into the array element in the data set array according to the part-of-speech inverse number algorithm.

[0139] Get the data to be embedded for each array element from the dataset array and get the input binary watermark information.

[0140] The embedded data is segmented and POS tagged to obtain a POS sequence. The inverse number of each POS sequence is determined. If the inverse number is even, the watermark bit of the POS is marked as 0. If the inverse number is odd, the watermark bit of the POS is marked as 1, thereby obtaining the binary information corresponding to the odd and even numbers of the POS sequence.

[0141] The binary information corresponding to the odd and even numbers of the part-of-speech sequence is compared bit by bit with the binary watermark information. If the binary information of a certain word is inconsistent with the binary watermark information, the word corresponding to the binary watermark information is selected from the vocabulary to replace the certain word.

[0142] The binary information corresponding to the odd and even numbers of the part-of-speech sequence is compared bit by bit with the binary watermark information, and by replacement, the binary information corresponding to the odd and even numbers of the reverse order numbers of the part-of-speech sequence is made to correspond one to one with the binary information of the watermark.

[0143] By replacing words, we can get the dataset array after embedding watermark.

[0144] Optionally, after the part-of-speech inversion number algorithm is used to embed the watermark into the data to be embedded, for the extraction of text data, the character string can be first segmented and the part-of-speech tagged, and then the inversion number can be calculated. The watermark information is calculated based on the correspondence between the parity of the calculation result and the original watermark bit.

[0145] Another text watermark embedding method provided by an embodiment of the present application uses the part-of-speech inverse number to make the parity of the part-of-speech sequence inverse number correspond one-to-one with the binary bit of the watermark, and obtains the data set array after embedding the watermark through word segmentation replacement, thereby improving the security of the text data set in the database table.

[0146] The following describes a watermark embedding device provided by the present application for execution. The specific implementation process and technical effects are described above and will not be repeated below.

[0147] Figure 6 A schematic diagram of a watermark embedding device provided in an embodiment of the present application is shown in FIG. Figure 6 As shown, the watermark embedding device includes:

[0148] The acquisition module 601 is used to acquire a data set of a database table, where the data set includes text data and numerical data.

[0149] The encryption module 602 is configured to encrypt the multiple primary keys of the data set to obtain multiple encrypted primary keys.

[0150] The grouping module 603 is configured to group the data set according to the encryption primary key and a row of data corresponding to the encryption primary key to obtain a data set array.

[0151] The embedding module 604 is configured to embed a watermark into the array elements in the data set array using a corresponding embedding algorithm according to the data type of the array elements.

[0152] Optionally, the encryption module 602 is specifically used to obtain the key and each primary key in the data set; calculate the key and the primary key through a hash function to obtain a hash discrete primary key corresponding to each primary key; calculate the hash discrete primary key and the key through a hash calculation to obtain an authentication value corresponding to the hash discrete primary key; perform modulo subtraction based on the authentication value and the primary key to obtain an encrypted primary key corresponding to each primary key.

[0153] Optionally, the embedding module 604 is specifically used to obtain the data to be embedded from the data set array and obtain the input binary watermark information; calculate the target position of the binary watermark information where the data to be embedded of each array element should be embedded according to the binary watermark information and the subscripts of the array elements in the data set array; embed the data to be embedded of the array element into the target position of the binary watermark information to obtain the data after the watermark is embedded; replace the data element after the watermark is embedded into the data set array to obtain the data set array after the watermark is embedded.

[0154] Optionally, the embedding module 604 is specifically configured to convert each array element to be embedded with a watermark into a binary digit; add a step size to each value in the binary digit to obtain an updated binary digit, wherein each new value in the updated binary digit satisfies a preset condition; and embed the updated binary digit into a target position of the binary watermark information to obtain the watermarked data.

[0155] Optionally, the embedding module 604 is used to divide the data elements in the data set array after the watermark is embedded into two groups according to the binary value at the target position of the binary watermark information; and calculate the optimal decoding threshold based on the data elements in the two groups; wherein, when the binary value at the position of the binary watermark is 0, the data elements in the data set array after the watermark is embedded are one of the groups, and when the binary value at the position of the binary watermark is 1, the data elements in the data set array after the watermark is embedded are the other group.

[0156] Optionally, the embedding module 604 is specifically configured to embed a watermark into array elements in the data set array according to a sign modification algorithm.

[0157] Optionally, the embedding module 604 is specifically configured to embed a watermark into array elements in the data set array according to a part-of-speech inverse number algorithm.

[0158] The above modules can be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), one or more digital singnal processors (DSPs), or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented by scheduling program code through a processing element, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0159] Figure 7 A schematic diagram of a computer device provided in an embodiment of the present application, which may be a computing device or server with computing processing capabilities.

[0160] The computer device includes: a processor 701 , a storage medium 702 , and a bus 703 . The processor 701 and the storage medium 702 are connected via the bus 703 .

[0161] The storage medium 702 is used to store programs, and the processor 701 calls the programs stored in the storage medium 702 to execute the above method embodiment. The specific implementation methods and technical effects are similar and will not be repeated here.

[0162] Optionally, the present invention further provides a program product, such as a computer-readable storage medium, comprising a program, which is used to perform the above method embodiment when executed by a processor.

[0163] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0164] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0165] In addition, the functional units in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or hardware plus software functional units.

[0166] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (English: Read-Only Memory, abbreviated: ROM), a random access memory (English: Random Access Memory, abbreviated: RAM), a magnetic disk or an optical disk, and other media that can store program code.

[0167] The above are only specific embodiments of the present application, but the scope of protection of this application is not limited to them. Any changes or substitutions that can be easily conceived by any person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A watermark embedding method, characterized in that: include: Obtaining a data set from a database table, the data set including text data and numerical data; Get the key and each primary key in the dataset; Calculate the key and the primary key through a hash function to obtain a hash discrete primary key corresponding to each primary key; Perform hash calculation on the hashed discrete primary key and the secret key to obtain an identity verification value corresponding to the hashed discrete primary key; Performing a modulo operation on the authentication value and the primary key to obtain an encryption primary key corresponding to each primary key; The data set is grouped according to the encryption primary key and the row of data corresponding to the encryption primary key, and each record is stored in the data set array as a Map container. Each element of the data set array is in the form of key-value data, where the encryption primary key is used as the key value and the row of data corresponding to the encryption primary key is used as the value value; Embedding a watermark into the array elements using a corresponding embedding algorithm according to the data type of the array elements in the data set array; When the data type of the array element is numerical data; obtaining the data to be embedded from the data set array and obtaining the input binary watermark information; wherein the data to be embedded is at least one column of data in the database table except the primary key; performing calculations based on the length of the binary watermark information and the subscripts of the array elements in the data set array to obtain the target position of the binary watermark information where the data to be embedded of each array element should be embedded; embedding the data to be embedded of the array element into the target position of the binary watermark information to obtain the watermarked data; wherein the binary watermark information corresponding to each array element is the same; replacing the watermarked data into the data set array to obtain the watermarked data set array; When the data type of the array element is text data, a watermark is embedded into the array element in the data set array according to a symbol modification algorithm, a space embedding algorithm, or a part-of-speech inversion algorithm.

2. The method according to claim 1, characterized in that The step of embedding the array element into the target position of the binary watermark information to obtain watermarked data includes: Convert each array element to be embedded with a watermark into a binary number; Adding a step size to each value of the binary digit to obtain an updated binary digit, wherein each new value of the updated binary digit satisfies a preset condition; The updated binary digit is embedded into the target position of the binary watermark information to obtain the watermarked data.

3. The method according to claim 1, characterized in that After replacing the watermarked data element into the data set array to obtain the watermarked data set array, the method further includes: Dividing the data elements in the watermarked data set array into two groups according to the binary value at the target position of the binary watermark information; Calculate and obtain an optimal decoding threshold according to the data elements in the two groups; Among them, when the binary value at the position of the binary watermark is 0, the data element in the data set array after the watermark is embedded corresponding to one group, and when the binary value at the position of the binary watermark is 1, the data element in the data set array after the watermark is embedded corresponding to another group.

4. A watermark embedding device, characterized in that: include: An acquisition module is used to acquire a data set from a database table, wherein the data set includes text data and numerical data; An encryption module is configured to obtain a key and each primary key in the data set; apply a hash function to the key and the primary key to obtain a hashed discrete primary key corresponding to each primary key; apply a hashing function to the hashed discrete primary key and the key to obtain an authentication value corresponding to the hashed discrete primary key; and perform a modulo operation based on the authentication value and the primary key to obtain an encryption primary key corresponding to each primary key. A grouping module is used to group the data set according to the encryption primary key and the row of data corresponding to the encryption primary key, and store each record in the data set array as a Map container. Each element of the data set array is in the form of key-value data, wherein the encryption primary key is used as the key value and the row of data corresponding to the encryption primary key is used as the value value; An embedding module is configured to, when the data type of the array element is numerical data, obtain the data to be embedded from the data set array and obtain the input binary watermark information; wherein the data to be embedded is at least one column of data in the database table other than the primary key; perform calculations based on the length of the binary watermark information and the subscripts of the array elements in the data set array to obtain a target position of the binary watermark information at which the data to be embedded of each array element should be embedded; embed the data to be embedded of the array element into the target position of the binary watermark information to obtain watermarked data; wherein the binary watermark information corresponding to each array element is the same; and replace the watermarked data into the data set array to obtain a watermarked data set array; The embedding module is specifically used to: when the data type of the array element is text data; embed watermarks into the array elements in the data set array according to a symbol modification algorithm, a space embedding algorithm, or a part-of-speech inversion algorithm.

5. A computer device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program executable by the processor, and when the processor executes the computer program, the watermark embedding method according to any one of claims 1 to 3 is implemented.

6. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is read and executed, the watermark embedding method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Reversible database watermarking method and system

    CN113626774A