A method for embedding and extracting traceable watermarks based on text information
Through the traceability watermark embedding method based on text information, using the steganographic algorithm and (7,4) Hamming code, combined with the number of strokes and font type of the text, a unique font replacement rule is designed to solve the problems of insufficient invisibility and robustness in existing watermarking technology, realize the invisible embedding and efficient extraction of watermarks, and be able to trace the source of the leak.
Patent Information
- Application Number
- CN202210693843.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-19
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-06-19
AI Technical Summary
In the existing traceability watermark technology, ordinary visible watermarks are easy to erase, and conventional invisible watermarks have poor robustness and concealment, which cannot meet the actual application needs.
A traceable watermark embedding method based on text information is adopted, and the target font is replaced with a fusion font using a steganographic algorithm. Combined with the information hiding method of (7,4) Hamming code, the number of strokes and font type of the text are used as carriers to design unique font replacement rules to achieve invisible embedding and extraction of watermarks.
The generated watermark is invisible to the human eye, and after sensitive information is photographed, screenshoted, or recorded, the watermark information can be extracted through the leaked media to track and locate the source of the leak, improving embedding efficiency and security.
Smart Images

Figure CN115114597B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information security technology, and in particular relates to a text information-based traceability watermark embedding and extraction method. Background Art
[0002] Traceable watermarks can track the leakage of sensitive information. Ordinary visible watermarks are easy to erase and tamper with. Conventional invisible watermarks have poor robustness and concealment, cannot meet the needs of actual applications, and need to be improved. Summary of the Invention
[0003] The purpose of the present invention is to provide a method for embedding and extracting a traceability watermark based on text information, which can ensure that the traceability watermark is invisible and meet the requirements of concealment and robustness.
[0004] In order to achieve the above object, the solution of the present invention is:
[0005] A traceable watermark embedding method based on text information adopts a steganographic algorithm to replace the target font with a fused font to obtain a secret carrier.
[0006] The above-mentioned steganographic algorithm may adopt an information hiding method based on (7, 4) Hamming code, an LSB algorithm, an information hiding method based on matrix coding, or an information hiding method based on STC coding.
[0007] The specific steps include:
[0008] Step A1: select a font as the target font, and then collect n styles of fusion fonts as candidate replacement fonts for the target font, where n=2 α -1, α is the codeword width of the information carried by each word, and its value is an integer not less than 1;
[0009] Step A2: Assume that the watermark information is L4-bit binary data M, Indicates font, x0 is the target font, x j Indicates the jth fusion font, j = 1, 2, ..., 2 α -1;
[0010] Step A3, assuming that there are L0 words in the carrier data, if Then continue to perform subsequent operations, otherwise it will return a prompt message indicating insufficient capacity;
[0011] Step A4: extract the number of strokes of each word in the first L1 words and record it as SN i , where i = 0, 1, ..., L1-1, L1 = L0-L0%7, % represents the remainder operation;
[0012] Step A5, calculate the information represented by each word in the carrier, denoted as R, The details are as follows:
[0013] r i =SN i %(2 α ),i=0,1,...,L1-1
[0014] Step A6, convert each element in R into an α-bit binary sequence, denoted as C, L2=α*L1,c j The values of are as follows:
[0015]
[0016] where j = 0, 1, ..., L2-1, β=α-j%α, Indicates rounding down;
[0017] Step A7: Divide C into L3 sub-blocks, each with 7 bits of data, represented by a row vector and recorded as D k , k=0,1,...,L3-1,
[0018] Step A8: amplify the watermark information M into 3L3 bits of data as the information to be embedded, denoted as M', where M' is the After splicing M pieces of data, take the result of the first 3L3 data. Indicates rounding up;
[0019] Step A9: Divide M' into L3 sub-blocks, each with 3 bits of data. Each sub-block is represented by a row vector and is denoted as m k , k=0,1,...,L3-1;
[0020] Step A10, calculate D k In the modified position, if The carrier data does not need to be modified, and D k '=D k Otherwise, d k The position where D appears in the check matrix H is used as the index k The result of negating the corresponding element in is recorded as D k ', increase the value of k and repeat the above operation until all the watermark information is embedded in the carrier, d k The specific calculation is as follows:
[0021]
[0022] in To replace the matrix and vector multiplication operation after the addition operation with the modulo 2 sum operation, is the XOR operation, m k is the kth group of information to be embedded, m k =[z k0 ,z k1 ,z k2 ],z i ={0,1}, i=0,1,2, H is the check matrix, the specific form is as follows:
[0023]
[0024] Step A11, use D k 'Replace the corresponding D in C k Get the secret data C';
[0025] Step A12: Divide C' into L2 sub-blocks, each with α bits of data, and convert the data of each sub-block into a corresponding decimal number, recorded as r i ', use r i 'Replace the corresponding r in R i Get R';
[0026] Step A13, replace the font according to R' and R, if r i '=r i , then keep the original font unchanged, if r i '≠r i , then replace font x0 with font where λ i =(r i '-r i +2 α )%2 α , thus obtaining the secret carrier.
[0027] A text-based traceability watermark extraction method extracts watermark information according to the font type and the number of strokes of the secret carrier data.
[0028] The specific steps include:
[0029] Step B1: Assume that the secret carrier contains L0' characters, extract the number of strokes and font type of each character in the first L1' characters and record them as SN i ' and y i , where y i ∈X, is the same font set consisting of the target font and the fused font as in the embedding process, i = 0, 1, ..., L1′-1, L1′ = L0′-L0′%7, % represents the remainder operation;
[0030] Step B2: Calculate the information represented by the number of strokes of each character in the secret carrier data, denoted as R'. The details are as follows:
[0031] r i '=SN i '%(2 α ),i=0,1,...,L1'-1
[0032] Step B3, calculate the information R carried by the secret carrier based on the information represented by the number of strokes and the font type. r i =(r i '+λ i )%(2 α ), i=0,1,...,L1'-1,λ i The values of are as follows:
[0033]
[0034] Step B4, convert each element in R into an α-bit binary sequence, denoted as C′, L2′=α*L1′,c j The values of ′ are as follows:
[0035]
[0036] where j = 0, 1, ..., L2′-1, β=α-j%α, Indicates rounding down;
[0037] Step B5: Divide C' into L3' sub-blocks, each with 7 bits of data, represented by a row vector and recorded as D k ′,k=0,1,...,L3′-1,
[0038] Step B6, calculate D k The watermark information in ′ is represented by a row vector and is recorded as m k ', and record its set as m k The specific calculation method of ' is as follows:
[0039]
[0040] where m k =[z k0 ,z k1 ,z k2 ],z i ∈{0,1}, i=0,1,2;
[0041] Step B7, divide the first 3L3′-3L3′%L4 bits of data of M′ into L5 sub-blocks, each sub-block has L4 bits of data, represented by row vectors, and recorded as ξ hi ∈M′,h=0,1,...,L5-1,
[0042] Step B8, use wk h Construct the matrix M″, count the frequency of occurrence of each element value in each column vector of the matrix M″, and record the element with the highest frequency as ξ g ′, the row vector composed of the elements with the highest frequency in each column is the watermark information proposed and is recorded as WK. The specific form of M″ is as follows:
[0043]
[0044] When the same watermark is embedded cyclically, the font type of the word before the embedded position of each repeated watermark information is changed to Has the same characteristics as the fonts in Fusion Font Library X, but
[0045] After adopting the above scheme, the present invention has the following beneficial effects:
[0046] (1) This paper combines fusion fonts and steganography based on (7,4) Hamming code to propose a new invisible watermark tracing technology. The watermark generated by this method is invisible to the human eye. After sensitive information is photographed, screenshoted, or recorded, the watermark information can be extracted through the leaking media to track and locate the source of the leak.
[0047] (2) The present invention uses the number of strokes of a character as the carrier for embedding the traceability watermark. Different characters of the same font type represent different carrier information. Compared with the solution of directly replacing the font (in which different characters of the same font type represent the same carrier information), the carrier data is more diverse. On this basis, the steganography based on the (7,4) Hamming code is used to significantly improve the embedding efficiency and reduce the amount of modification to the carrier when embedding information.
[0048] (3) The present invention has designed a unique font type replacement method, which means that the secret carrier of the same information can correspond to different font types. This destroys the statistical significance of the font type in the secret carrier data after embedding the watermark to a certain extent, and enhances the security of the watermark information. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a flow chart of watermark embedding in the present invention;
[0050] Figure 2 It is a flow chart of watermark extraction in the present invention;
[0051] Figure 3 This is a schematic diagram of the corresponding relationship between the information represented by the text and its font type when α=2. DETAILED DESCRIPTION
[0052] The technical solutions and beneficial effects of the present invention will be described in detail below with reference to the accompanying drawings.
[0053] The present invention provides a traceability watermark method based on text information, wherein the text information is the number of strokes and font type of the text, and mainly includes two parts: embedding and extracting the watermark. The method mainly uses a fusion font (Tian Y.zi2zi: Master Chinese calligraphy with conditional adversarial networks, 2017 [J]. Retrieved Jun, 2017, 3: 2017.;He K, Zhang X, Ren S, et al. Deep residual learning for image recognition [C]. Proceedings of the IEEE conference on computer vision and pattern recognition. 2016: 770-778.) to replace the target font to embed the traceability watermark, and adopts a steganography technology based on (7,4) Hamming code (CAO Zekun, Cao Zekun, YIN Zhaoxia, et al. Large-capacity information hiding algorithm based on (7,4) Hamming code [C]. National Information Hiding and Multimedia Information Security Academic Conference. Communications Branch of the Chinese Institute of Electronics; Beijing Institute of Electronic Technology Applications, 2015.) to improve the efficiency of watermark embedding; extract watermark information according to the font type and the number of strokes of the secret carrier data.
[0054] Cooperate Figure 1 and Figure 2 As shown in Figure 2, the specific steps of watermark embedding and extraction are as follows:
[0055] 1. Watermark embedding
[0056] 1) Select a font as the target font, and then collect n styles of fusion fonts as candidate replacement fonts for the target font. The fusion font must be slightly different from the target font but highly similar to it, ensuring that the human eye cannot distinguish the difference between the two. However, the specific types of the target font and the candidate replacement fonts can be identified by the machine learning algorithm, where n = 2 α -1, α is the codeword width of the information carried by each word, and its value is an integer not less than 1. The specific value can be set according to actual needs;
[0057] 2) Assume that the watermark information is L4-bit binary data M, use Indicates font, x0 is the target font, that is, the font of the original text, x j Indicates the jth fusion font, j = 1, 2, ..., 2 α -1;
[0058] 3) Assume that there are L0 words in the carrier data, if Then continue to perform subsequent operations, otherwise it will return a prompt message indicating insufficient capacity;
[0059] 4) Extract the number of strokes of each word in the first L1 words and record it as SN i , where i = 0, 1, ..., L1-1, L1 = L0-L0%7, % represents the remainder operation;
[0060] 5) Calculate the information represented by each word in the carrier, denoted as R, The details are as follows:
[0061] r i =SN i %(2 α ),i=0,1,...,L1-1
[0062] 6) Convert each element in R into an α-bit binary sequence, denoted as C, L2=α*L1,c j The values of are as follows:
[0063]
[0064] where j = 0, 1, ..., L2-1, β=α-j%α, Indicates rounding down.
[0065] 7) Divide C into L3 sub-blocks, each with 7 bits of data, represented by a row vector and recorded as D k , k=0,1,...,L3-1,
[0066] 8) Expand the watermark information M into 3L3 bits of data as the information to be embedded and record it as M'. After splicing M pieces, take the result of the first 3L3 data. Indicates rounding up;
[0067] 9) Divide M' into L3 sub-blocks, each with 3 bits of data. Each sub-block is represented by a row vector and is denoted as m k , k=0,1,...,L3-1;
[0068] 10) Calculate D k In the modified position, if The carrier data does not need to be modified, and D k '=D k Otherwise, d k The position where D appears in the check matrix H is used as the index k The result of negating the corresponding element in is recorded as D k ', increase the value of k and repeat the above operation until all the watermark information is embedded in the carrier, d k The specific calculation is as follows:
[0069]
[0070] in To replace the matrix and vector multiplication operation after the addition operation with the modulo 2 sum operation, is the XOR operation, m k is the kth group of information to be embedded, m k =[z k0 ,z k1 ,z k2 ],z i ={0,1}, i=0,1,2, H is the check matrix, the specific form is as follows:
[0071]
[0072] 11) Use D k 'Replace the corresponding D in C k Get the secret data C';
[0073] 12) Divide C' into L2 sub-blocks, each with α bits of data, and convert the data of each sub-block into the corresponding decimal number, recorded as r i ', use r i 'Replace the corresponding r in R i Get R';
[0074] 13) Replace the font based on R' and R. If r i '=r i , then keep the original font unchanged, if r i '≠r i , then replace font x0 with font where λ i =(r i '-r i +2 α )%2 α .
[0075] 2. Watermark extraction
[0076] 1) Extract text information from the secret carrier. Assume that the secret carrier contains L0' characters. Extract the number of strokes and font type of each character in the first L1' characters and record them as SN i ' and y i , where y i ∈X, is the same font set consisting of the target font and the fused font as in the embedding process, i = 0, 1, ..., L1′-1, L1′ = L0′-L0′%7, % represents the remainder operation;
[0077] 2) Calculate the information represented by the number of strokes of each character in the secret carrier data, denoted as R', The details are as follows:
[0078] r i '=SN i '%(2 α ),i=0,1,...,L1'-1
[0079] 3) Calculate the information R carried by the secret carrier based on the information represented by the number of strokes and the font type. r i =(r i '+λ i )%(2 α ), i=0,1,...,L1'-1,λ i The values of are as follows:
[0080]
[0081] 4) Convert each element in R into an α-bit binary sequence, denoted as C′, L2′=α*L1′,c j The values of ′ are as follows:
[0082]
[0083] where j = 0, 1, ..., L2′-1, β=α-j%α, Indicates rounding down.
[0084] 5) Divide C′ into L3′ sub-blocks, each with 7 bits of data, represented by a row vector and recorded as D k ′,k=0,1,...,L3′-1,
[0085] 6) Calculate D k The watermark information in ′ is represented by a row vector and is recorded as m k ', and record its set as mk The specific calculation method of ' is as follows:
[0086]
[0087] where m k =[z k0 ,z k1 ,z k2 ],z i ∈{0,1}, i=0,1,2;
[0088] 7) Divide the first 3L3′-3L3′%L4 bits of data of M′ into L5 sub-blocks, each sub-block has L4 bits of data, represented by row vectors, and recorded as ξ hi ∈M′,h=0,1,...,L5-1,
[0089] 8) Use wk h Construct the matrix M″, count the frequency of occurrence of each element value in each column vector of the matrix M″, and record the element with the highest frequency as ξ g ′, the row vector composed of the elements with the highest frequency in each column is the watermark information proposed and is recorded as WK. The specific form of M″ is as follows:
[0090]
[0091] When cyclically embedding the same watermark, the font type of the word before the embedded position of each repeated watermark information can be changed to Has the same characteristics as the fonts in Fusion Font Library X, but
[0092] Figure 3 A schematic diagram showing the corresponding relationship between the information represented by the text and its font type when α=2 is shown.
[0093] It should be noted that the steganography based on (7, 4) Hamming code used in the embedding and extraction process of watermark information in the method proposed in the present invention can be replaced by other suitable steganography algorithms as needed, such as LSB algorithm, information hiding method based on matrix coding, information hiding method based on STC coding, etc.
[0094] In summary, the present invention provides a traceability watermark embedding and extraction method based on text information. It uses the number of strokes and font type of the text as a carrier, designs a unique font replacement rule, and embeds the watermark by replacing the target font with a fusion font that is highly similar to the target font. This method can not only ensure that the traceability watermark is invisible, but also meet the requirements of concealment and robustness. When sensitive information is photographed, screenshoted, or recorded, the watermark information can be extracted through the leaking media to track and locate the source of the leak.
[0095] The above embodiments are only for illustrating the technical idea of the present invention and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the present invention.
Claims
1. A method for embedding a traceable watermark based on text information, characterized by: Using the steganographic algorithm, the target font is replaced with the fusion font to obtain the secret carrier; The steganographic algorithm may adopt an information hiding method based on (7, 4) Hamming code, an LSB algorithm, an information hiding method based on matrix coding, or an information hiding method based on STC coding; The embedding method comprises the following steps: Step A1: select a font as the target font, and then collect n styles of fusion fonts as candidate replacement fonts for the target font, where n=2 α -1, α is the codeword width of the information carried by each word, and its value is an integer not less than 1; Step A2: Assume that the watermark information is L4-bit binary data M, Indicates font, x0 is the target font, x j Indicates the jth fusion font, j = 1, 2, ..., 2 α -1; Step A3, assuming that there are L0 words in the carrier data, if Then continue to perform subsequent operations, otherwise it will return a prompt message indicating insufficient capacity; Step A4: extract the number of strokes of each word in the first L1 words and record it as SN i , where i = 0, 1, ..., L1-1, L1 = L0-L0%7, % represents the remainder operation; Step A5, calculate the information represented by each word in the carrier, denoted as R, The details are as follows: r i =SN i %(2 α ),i=0,1,...,L1-1 Step A6, convert each element in R into an α-bit binary sequence, denoted as C, L2=α*L1,c j The values of are as follows: where j = 0, 1, ..., L2-1, β=α-j%α, Indicates rounding down; Step A7: Divide C into L3 sub-blocks, each with 7 bits of data, represented by a row vector and recorded as D k , k=0,1,...,L3-1, Step A8: amplify the watermark information M into 3L3 bits of data as the information to be embedded, denoted as M', where M' is the After splicing M pieces, take the result of the first 3L3 data. Indicates rounding up; Step A9: Divide M' into L3 sub-blocks, each with 3 bits of data. Each sub-block is represented by a row vector and is denoted as m k , k=0,1,...,L3-1; Step A10, calculate D k In the modified position, if The carrier data does not need to be modified, and D k '=D k Otherwise, d k The position where D appears in the check matrix H is used as the index k The result of negating the corresponding element in is recorded as D k ', increase the value of k and repeat the above operation until all the watermark information is embedded in the carrier; Step A11, use D k 'Replace the corresponding D in C k Get the secret data C'; Step A12: Divide C' into L2 sub-blocks, each with α bits of data, and convert the data of each sub-block into a corresponding decimal number, recorded as r i ', use r i 'Replace the corresponding r in R i Get R'; Step A13, replace the font according to R' and R, if r i '=r i , then keep the original font unchanged, if r i '≠r i , then replace font x0 with font where λ i =(r i '-r i +2 α )%2 α , thus obtaining the secret carrier.
2. The text-based traceability watermark embedding method according to claim 1, characterized in that: In the step A10, d k The specific calculation is as follows: in To replace the matrix and vector multiplication operation after the addition operation with the modulo 2 sum operation, is the XOR operation, m k is the kth group of information to be embedded, m k =[z k0 ,z k1 ,z k2 ],z i ={0,1}, i=0,1,2, H is the check matrix, the specific form is as follows:
3. A method for extracting a traceable watermark based on text information, characterized by: The steps include: Step B1: Assume that the secret carrier contains L0' characters, extract the number of strokes and font type of each character in the first L1' characters and record them as SN i ' and y i , where y i ∈X, is the same font set consisting of the target font and the fused font as in the embedding process, i = 0, 1, ..., L1′-1, L1′ = L0′-L0′%7, % represents the remainder operation; Step B2: Calculate the information represented by the number of strokes of each character in the secret carrier data, denoted as R'. The details are as follows: r i '=SN i '%(2 α ),i=0,1,...,L1'-1 Step B3, calculate the information R carried by the secret carrier based on the information represented by the number of strokes and the font type. r i =(r i '+λ i )%(2 α ), i=0,1,...,L1'-1,λ i The values of are as follows: Step B4, convert each element in R into an α-bit binary sequence, denoted as C′, L2′=α*L1′,c j The values of ′ are as follows: where j = 0, 1, ..., L2′-1, β=α-j%α, Indicates rounding down; Step B5: Divide C' into L3' sub-blocks, each with 7 bits of data, represented by a row vector and recorded as D k ′,k=0,1,...,L3′-1, Step B6, calculate D k The watermark information in ′ is represented by a row vector and is recorded as m k ', and record its set as m k The specific calculation method of ' is as follows: where m k = [z k0 , z k1 , z k2 , z i ∈ {0, 1}, i = 0, 1, 2; Step B7, divide the first 3L3′-3L3′%L4 bits of data of M′ into L5 sub-blocks, each sub-block has L4 bits of data, represented by row vectors, and recorded as ξ hi ∈M′,h=0,1,...,L5-1, Step B8, use wk h Construct the matrix M″, count the frequency of occurrence of each element value in each column vector of the matrix M″, and record the element with the highest frequency as ξ g ′, the row vector composed of the elements with the highest frequency in each column is the watermark information proposed and is recorded as WK. The specific form of M″ is as follows: When the same watermark is embedded in a loop, the font type of the word before the embedded position of each repeated watermark information is changed to Has the same characteristics as the fonts in Fusion Font Library X, but
Citation Information
Patent Citations
Method for embedding and detecting cryptical code
CN103258314A
Inlaying method and device of digital watermarks in text documents
CN103500296A
Song ci poetry text message hiding technology based on hybrid encryption
CN106254074A