CN112948776A - Digital watermark adding method and device, electronic equipment and storage medium - Google Patents

Digital watermark adding method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112948776A
CN112948776A CN202110151620.5A CN202110151620A CN112948776A CN 112948776 A CN112948776 A CN 112948776A CN 202110151620 A CN202110151620 A CN 202110151620A CN 112948776 A CN112948776 A CN 112948776A
Authority
CN
China
Prior art keywords
watermark
coding
text information
information
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110151620.5A
Other languages
Chinese (zh)
Inventor
孟卫明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Group Holding Co Ltd
Original Assignee
Hisense Group Holding Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hisense Group Holding Co Ltd filed Critical Hisense Group Holding Co Ltd
Priority to CN202110151620.5A priority Critical patent/CN112948776A/en
Publication of CN112948776A publication Critical patent/CN112948776A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/16Program or content traceability, e.g. by watermarking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/106Enforcing content protection by specific content processing
    • G06F21/1063Personalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/247Thesauruses; Synonyms

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Multimedia (AREA)
  • Artificial Intelligence (AREA)
  • Technology Law (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The application provides a digital watermark adding method, a digital watermark adding device, electronic equipment and a storage medium, which relate to the technical field of computers, and the method comprises the following steps: the method comprises the steps that text information is coded according to any one text information to obtain a coded value of the text information; determining a target coding bit in the watermark coding sequence according to the coding value of the text information; the watermark coding sequence is obtained by coding original watermark information according to a preset coding rule; and if the watermark coding information corresponding to the target coding bit is preset coding information, adding a digital watermark into the text information according to a preset watermark adding mode. The short texts to be modified can be determined from a large number of short texts, and digital watermarks are added by modifying the short texts, so that the copyright protection of the short texts is realized.

Description

Digital watermark adding method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a digital watermark adding method and apparatus, an electronic device, and a storage medium.
Background
Digital Watermarking (Digital Watermarking) refers to the direct embedding of some identification information (i.e. Digital Watermarking) into a Digital carrier (including multimedia, text, software, etc.) or indirect representation (modifying the structure of a specific area), and does not affect the use value of the original carrier and is not easy to be ascertained and modified again. The digital watermark can be identified and recognized by a producer, and the purposes of confirming content creators and purchasers, transmitting secret information or judging whether the carrier is tampered or not and the like can be achieved through the information hidden in the carrier.
At present, the digital watermarking technology for text is generally used for long text in a document, for example, through document structure adjustment, document content replacement, "unimportant text" addition, natural language processing and other technologies, the structure of a specific area in the long text is modified, and the modified content of the specific area is indirectly represented as a digital watermark, so as to achieve the purpose of adding the digital watermark to the text to protect copyright.
However, the above-mentioned digital watermark adding method is not suitable for the case where a large number of short texts are included in a document, because the number of characters of each short text is small, and it is difficult to implement the addition of the entire digital watermark by modifying a certain short text. Therefore, for a large amount of short texts, how to determine the short texts needing to be modified is a problem to be solved.
Disclosure of Invention
The application provides a digital watermark adding method, a digital watermark adding device, electronic equipment and a storage medium, which are used for determining short texts needing to be modified from a large number of short texts and further adding digital watermarks by modifying the short texts so as to realize the copyright protection of the short texts.
The embodiment of the application provides the following specific technical scheme:
in a first aspect, an embodiment of the present application provides a digital watermark adding method, including:
aiming at any one text message, coding the text message to obtain a coded value of the text message;
determining a target coding bit in a watermark coding sequence according to the coding value of the text information; the watermark coding sequence is obtained by coding original watermark information according to a preset coding rule;
and if the watermark coding information corresponding to the target coding bit is preset coding information, adding a digital watermark into the text information according to a preset watermark adding mode.
In the embodiment of the application, for any one of the plurality of text messages, the target coding bit in the watermark coding sequence is determined according to the coding value of the text message, if the watermark coding information of the target coding bit is preset coding information, the text needs to be modified, that is, the digital watermark is added to the text message according to a preset watermark adding mode, so that short texts needing to be modified can be determined from a large number of short texts, and then the digital watermark is added by modifying the short texts, so that the copyright protection of the short texts is realized.
In some exemplary embodiments, said encoding said text information to obtain an encoded value of said text information includes:
and carrying out hash operation on the text information and preset identification information, and taking the obtained hash value as the code value of the text information.
In the embodiment of the application, when the text information is coded, the text information and the preset identification information can be subjected to Hash operation, the preset identification information is added, the obtained Hash value is not easy to crack, and the data security is improved.
In some exemplary embodiments, the watermark encoding sequence is determined by:
respectively acquiring numerical values corresponding to ASCII (American standard code for information interchange) codes of all characters in the character string aiming at the character string corresponding to the original watermark information;
determining onehot codes of the characters based on numerical values corresponding to the ASCII codes of the characters;
and obtaining the watermark coding sequence according to onehot coding of each character.
In the embodiment of the application, onehot coding is carried out on each character according to the numerical value corresponding to the ASCII coding of each character of the original watermark information, and then the watermark coding sequence is determined, so that the secrecy of the original watermark information can be increased, and the influence of the added digital watermark on the text read by a user is reduced.
In some exemplary embodiments, the determining, according to the encoding value of the text information, a target encoding bit in a watermark encoding sequence is:
and performing modulus on the coding value of the text information and the coding bit number in the watermark coding sequence, and taking the modulus numerical value as a target coding bit in the watermark coding sequence.
Through the implementation mode, the target coding bit corresponding to the text information can be conveniently determined according to the coding value corresponding to the text information and the number of the coding bits in the watermark coding sequence.
In some exemplary embodiments, the adding a digital watermark in the text information according to a preset watermarking adding manner includes:
acquiring target words with set attributes in the text information, and searching synonyms of the target words from a preset word library if the synonyms of the target words are searched; the term library comprises terms with set attributes and synonyms corresponding to the terms with the set attributes;
and if the synonym of the target word is found, replacing the target word with the synonym of the target word, or replacing the target word with the synonym of the target word and converting the punctuation marks in the text information into punctuation marks in a target format.
In the above embodiment, for some text messages, if synonyms exist in target words with set attributes in the text messages, digital watermark addition may be performed in a synonym replacement manner, or digital watermark addition may be performed in two manners, namely, synonym replacement and punctuation mark format conversion, which may reduce the influence of added digital watermark on text reading by a user.
In some exemplary embodiments, the adding a digital watermark in the text information according to a preset watermarking adding manner includes:
and if the synonym of the target word is not found, converting the punctuation mark in the text information into the punctuation mark in the target format.
In the above embodiment, if there is no synonym in the target words with set attributes in the text information to which the digital watermark needs to be added, the digital watermark can be added in a manner of punctuation format conversion, so as to reduce the influence of the added digital watermark on the text reading of the user.
In some exemplary embodiments, the adding a digital watermark in the text information according to a preset watermarking adding manner includes:
inserting a set character into a target position of the text information; and/or the presence of a gas in the gas,
and if the text information comprises numerical values, carrying out least significant digit value conversion on the numerical values in the text information.
In the above embodiment, for other text messages, digital watermarking can be performed by inserting set characters, for example, the set characters may be spaces; or digital watermarking is carried out on text information comprising numerical values in a mode of least significant digit value transformation, for example, the least significant digit value transformation can be to add numerical values such as '0' after the lowest bit of decimal points of the numerical values; for text information including numerical values, digital watermarking can also be performed by two modes of inserting set characters and least significant digit value conversion. The digital watermark adding mode can also reduce the influence of the added digital watermark on the text read by the user.
In a second aspect, an embodiment of the present application provides a digital watermarking apparatus, including:
the encoding module is used for encoding the text information aiming at any one text information to obtain an encoding value of the text information;
the determining module is used for determining a target coding bit in the watermark coding sequence according to the coding value of the text information; the watermark coding sequence is obtained by coding original watermark information according to a preset coding rule;
and the adding module is used for adding the digital watermark into the text information according to a preset watermark adding mode if the watermark coding information corresponding to the target coding bit is preset coding information.
In some exemplary embodiments, the encoding module is configured to:
and carrying out hash operation on the text information and preset identification information, and taking the obtained hash value as the code value of the text information.
In some exemplary embodiments, the apparatus further comprises an obtaining module configured to:
respectively acquiring numerical values corresponding to ASCII (American standard code for information interchange) codes of all characters in the character string aiming at the character string corresponding to the original watermark information;
determining onehot codes of the characters based on numerical values corresponding to the ASCII codes of the characters;
and obtaining the watermark coding sequence according to onehot coding of each character.
In some exemplary embodiments, the determining module is configured to:
and performing modulus on the coding value of the text information and the coding bit number in the watermark coding sequence, and taking the modulus numerical value as a target coding bit in the watermark coding sequence.
In some exemplary embodiments, the adding module is configured to:
acquiring target words with set attributes in the text information, and searching synonyms of the target words from a preset word library if the synonyms of the target words are searched; the term library comprises terms with set attributes and synonyms corresponding to the terms with the set attributes;
and if the synonym of the target word is found, replacing the target word with the synonym of the target word, or replacing the target word with the synonym of the target word and converting the punctuation marks in the text information into punctuation marks in a target format.
In some exemplary embodiments, the adding module is configured to:
and if the synonym of the target word is not found, converting the punctuation mark in the text information into the punctuation mark in the target format.
In some exemplary embodiments, the adding module is configured to:
inserting a set character into a target position of the text information; and/or the presence of a gas in the gas,
and if the text information comprises numerical values, carrying out least significant digit value conversion on the numerical values in the text information.
In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, where the memory stores a computer program executable on the processor, and when the computer program is executed by the processor, the processor is caused to implement the method according to any one of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the method of any one of the first aspect.
For technical effects brought by any one implementation manner of the second aspect to the fourth aspect, reference may be made to technical effects brought by a corresponding implementation manner in the first aspect, and details are not described here.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a digital watermarking method provided in an embodiment of the present application;
fig. 2 is a flowchart of a watermark encoding method provided in an embodiment of the present application;
fig. 3 is a flowchart of another digital watermarking method provided in an embodiment of the present application;
fig. 4 is a flowchart of another digital watermarking method provided in an embodiment of the present application;
fig. 5 is a schematic structural diagram of a digital watermarking apparatus provided in an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the description of the present application, it is to be understood that the terms "first", "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present application, "a plurality" means two or more unless otherwise specified.
At present, a digital watermarking technology for texts is generally used for long texts in documents, and in some application scenarios, copyright protection needs to be performed on a large number of short texts by adding digital watermarks. For example, some healthy food material recommendation systems using application software can recommend food material recommendation information and food material nutrition information to a user, each piece of food material recommendation information and each piece of food material nutrition information are usually short, and copyright protection can be performed on the food material recommendation information and the food material nutrition information in the system by adding a digital watermark.
However, the digital watermark adding method for a long text is not suitable for a case where a large number of short texts are included in a document, because the number of characters of each short text is small, it is difficult to realize the addition of a digital watermark by modifying a certain short text. Therefore, for a large amount of short texts, how to determine the short texts needing to be modified is a problem to be solved.
In view of this, embodiments of the present application provide a digital watermark adding method, an apparatus, an electronic device, and a storage medium, where for any one text information of a plurality of text information, a target encoding bit in a watermark encoding sequence is determined according to an encoding value of the text information, and if watermark encoding information of the target encoding bit is preset encoding information, the text needs to be modified, that is, a digital watermark is added to the text information according to a preset watermark adding manner, so that short texts that need to be modified can be determined from a large number of short texts, and then the digital watermark is added by modifying the short texts, so as to implement copyright protection of the short texts.
The digital watermarking method of the present application will be described in detail with reference to the accompanying drawings and specific embodiments.
Referring to fig. 1, an embodiment of the present application provides a digital watermarking method, including:
step S101, aiming at any text information, the text information is coded to obtain the coded value of the text information.
In this embodiment, the text information may be short text information, such as the food material recommendation information, the food material nutrition information, and the like, and before executing step S101, data formatting processing may be performed on each text that needs to be subjected to copyright protection, that is, the text is standardized to obtain the text information. Different processing methods may be employed for different texts. The following describes the data formatting process by taking the food material recommendation information and the food material nutrition information as examples.
A. For the food material suggestion information, the character strings corresponding to the data content to be protected can be spliced, for example, the recommendation subject, the taboo type, the food material name, the taboo margin and the like are used as character strings for splicing, and new field content is generated. Illustratively, the following field contents are available for the diseased food material taboo: the kidney bean suitable for hypertension is rich in protein, mineral substances and dietary fiber.
B. For the food material nutrition information, since the food material may contain a variety of nutrients, such as protein, vitamin a, vitamin C, iron, calcium, etc., for each nutrient, the character strings corresponding to the data content to be protected may be spliced, for example, the name of the food material, the name of the nutrient, the content of the nutrient, the unit identifier, etc. may be subjected to character string splicing, so as to generate a new field content. Illustratively, the generated field content may be "phaseolin 23.4 g".
After the text information is obtained in the above manner, before the digital watermark is added to the text information, a preset encoding manner may be first adopted to encode any one text information, so as to obtain an encoded value of the text information. The preset encoding manner may be hash encoding, and the like, which is not limited in the embodiment of the present application.
Step S102, determining a target coding bit in a watermark coding sequence according to a coding value of text information; the watermark coding sequence is obtained by coding the original watermark information according to a preset coding rule.
The original watermark information may be composed of one or more of english, number, symbol and chinese, and may be encoded into a binary sequence, i.e., a watermark encoding sequence, according to a preset encoding rule, where each encoding bit corresponds to 0 or 1. For example, each character in the character string corresponding to the original watermark information may be encoded into a binary number, and then the binary numbers of each character are spliced to obtain the watermark encoding sequence.
In this step, the encoding value of the text information may be operated according to a preset operation mode, and the target encoding bit in the watermark encoding sequence is determined according to the obtained numerical value.
In one possible implementation, step S102 may be determined by:
and performing modulus on the coding value of the text information and the coding bit number in the watermark coding sequence, and taking the modulus numerical value as a target coding bit in the watermark coding sequence.
For example, the coded value of the text information is a, the number of coded bits in the watermark coding sequence is b, and the remainder obtained by a/b is used as the target coded bit.
In addition, the target coded bit may be multiple, for example, the coded bit corresponding to the modulo value and the next coded bit of the coded bit are used as the target coded bit, which may be specifically set according to needs, and this is not limited in this embodiment of the application.
It should be noted that, in step S102, other manners may also be used, for example, the code value of the text information is a, the number of characters of the original watermark information is c, and the number of bits of the binary code corresponding to each character is d, where a and c are modulo to obtain a value m, then the binary code of the mth character is obtained from the original watermark information, then a and d are modulo to obtain a value n, and the nth bit in the binary code of the mth character is used as the target code bit. The embodiment of the application does not limit the encoding mode of the original watermark information.
Step S103, if the watermark coding information corresponding to the target coding bit is preset coding information, adding a digital watermark into the text information according to a preset watermark adding mode.
For example, the target encoding bit may be an encoding bit, and in this case, the watermark encoding information corresponding to the target encoding bit may be 0 or 1, and the preset encoding information may be 0 or 1; the target encoding bit may also be a plurality of encoding bits, for example, two encoding bits are taken as an example, the watermark encoding information corresponding to the target encoding bit may be 00, 01, 10, or 11, or may also be 1, 2, 3, or 4, and the preset encoding information may be one of 00, 01, 10, or 11, or one of 1, 2, 3, or 4.
In the embodiment of the application, for any one of the plurality of text messages, the target coding bit in the watermark coding sequence is determined according to the coding value of the text message, if the watermark coding information of the target coding bit is preset coding information, the text needs to be modified, that is, the digital watermark is added to the text message according to a preset watermark adding mode, so that short texts needing to be modified can be determined from a large number of short texts, and then the digital watermark is added by modifying the short texts, so that the copyright protection of the short texts is realized.
That is, by splitting and encoding the digital watermark into a plurality of text messages, copyright protection of text data in the text message application is realized. Specifically, the original watermark information is hidden in a plurality of text messages after being encoded, so that the copyright information can be protected under the condition that a user does not perceive the original watermark information.
In some possible embodiments, the encoding of the text information in step S101 to obtain the encoded value of the text information may be implemented as follows:
and performing hash operation on the text information and the preset identification information, and taking the obtained hash value as the coding value of the text information.
The preset identification information may be set as required, for example, a private key of an enterprise. Illustratively, the text message is "hypertensive kidney bean rich in protein, minerals and dietary fibers", and the preset identification message is "i 9Wt × CeLgr9Vkc & 5", and the two are hashed, that is, hash value 4928386159527131548 is obtained (i 9Wt × CeLgr9Vkc &5 ").
In the embodiment, when the text information is coded, the text information and the preset identification information can be subjected to hash operation, and the obtained hash value is not easy to crack by adding the preset identification information, so that the data security is improved.
In some embodiments, in order to increase the secrecy of the original watermark information, the watermark encoding sequence in step S102 may be determined by:
a. and respectively acquiring numerical values corresponding to ASCII codes of all characters in the character strings aiming at the character strings corresponding to the original watermark information.
For example, the original watermark information is Hisense, the corresponding character string is "Hisense", the ASCII code of H is 01001000, the corresponding decimal value is 72, and the values corresponding to the ASCII codes of other characters are not repeated.
b. The onehot code for each character is determined based on the value corresponding to the ASCII code for each character.
For example, after onehot encoding is performed on H in "Hisense", the 72 th bit in the 128-bit code obtained is 1, and the rest bits are 0. The onehot encoding of other characters will not be described in detail.
c. And obtaining a watermark coding sequence according to onehot coding of each character.
In this step, onehot codes of the characters may be sequentially spliced to obtain a watermark coding sequence, for example, a character string includes 7 characters, onehot codes of each character are 128 bits, and the obtained watermark coding sequence is 896 bits.
In a specific implementation, the encoding may be performed on a character-by-character basis with respect to a character string of the original watermark information, and as shown in fig. 2, the watermark encoding sequence may be determined by the following steps:
step S201, acquiring a character string of original watermark information;
step S202, determining a numerical value corresponding to ASCII encoding of a single character in the character string;
step S203, determining onehot code of the character according to the numerical value corresponding to the ASCII code of the character;
step S204, judging whether onehot coding of all characters in the character string is finished or not; if yes, executing step S205, otherwise returning to step S202;
and S205, splicing onehot codes of all characters in sequence to obtain a watermark coding sequence.
According to the method and the device, onehot coding is carried out on each character according to the numerical value corresponding to the ASCII coding of each character of the original watermark information, and then the watermark coding sequence is determined, so that the secrecy of the original watermark information can be increased, and the influence of the added digital watermark on the text read by a user can be reduced.
It should be noted that, in the foregoing embodiment, other encoding manners may also be used to encode the original watermark information to obtain the watermark encoding sequence, which is not limited in this embodiment.
In some possible embodiments, when words and punctuation marks with a certain type of attribute are included in the text information, adding a digital watermark in the text information according to a preset watermark adding manner in step S103 may include the following steps:
(1) acquiring target words with set attributes in the text information, and searching synonyms of the target words from a preset word library if the synonyms of the target words are searched; the term library comprises terms with set attributes and synonyms corresponding to the terms with set attributes.
The target words with the set attributes may be nouns in a certain field, such as disease names, food names, and the like. For example, a word library may be preset for the food material name, where the word library includes the food material name and the alias of the food material name, for example, rape corresponds to shanghai green, tomato corresponds to tomato, and so on.
(2) And if the synonym of the target word is found, replacing the target word with the synonym of the target word, or replacing the target word with the synonym of the target word and converting the punctuation marks in the text information into punctuation marks in the target format. The punctuation mark in the target format may be, for example, a full-angle punctuation mark.
In the above embodiment, for some text messages, if synonyms exist in target words with set attributes in the text messages, digital watermark addition may be performed in a synonym replacement manner, or digital watermark addition may be performed in two manners, namely, synonym replacement and punctuation mark format conversion, which may reduce the influence of added digital watermark on text reading by a user.
Further, if the synonym of the target word is not found, the punctuation mark in the text information is converted into the punctuation mark in the target format.
In the following, text information is taken as food material recommendation information as an example, and an exemplary description is given to the digital watermark adding method according to the embodiment of the present application.
For example, the original watermark information is encoded according to the above steps a-c to obtain a watermark encoding sequence, and as shown in fig. 3, the digital watermark adding method may include the following steps:
step S301, food material suggestion information of formatting processing is obtained.
Step S302, calculating the hash value of the food material suggestion information.
For example, the hash operation is performed on the food material recommendation information and the preset identification information to obtain a hash value of the food material recommendation information.
Step S303, acquiring the watermark code to be embedded.
In this step, a target coding bit in the watermark coding sequence may be determined according to the hash value, and then a watermark code corresponding to the target coding bit is obtained, i.e., the watermark code to be embedded is obtained. For example, when the original watermark information is "Hisense", the watermark encoding sequence has 896 encoding bits, and after the hash value is modulo with the encoding bit number, if 412 is obtained, the watermark encoding corresponding to the 412 th encoding bit is selected.
Step S304, whether the code of the watermark to be embedded is 1, if so, step S305 is executed.
Step S305, searching food material aliases.
Step S306, whether the food material name has an alias or not is judged, and if yes, the step S307 is executed; if not, step S308 is performed.
In step S307, the food item name is replaced with the food item alias.
Step S308, the punctuation marks in the replaced food material suggestion information are full-angle punctuation marks.
In other possible embodiments, the adding of the digital watermark in the text information according to the preset watermark adding manner in step S103 may include one or two of the following manners:
in the first method, a set character is inserted into a target position of text information.
For example, the set character may be a space, or may be another character that does not affect reading of text information, and the target position may be set according to specific situations, for example, a position between a numeric value and a unit, so that an effect of the added digital watermark on reading of text by a user may be reduced.
And secondly, if the text information comprises the numerical value, performing least significant digit value conversion on the numerical value in the text information.
For example, the least significant digit value transformation may add a value such as "0" after the lowest bit of the decimal point of the value, and this way may also reduce the influence of the added digital watermark on the reading of the text by the user.
The following describes an example of the digital watermark adding method according to the embodiment of the present application, taking text information as food material nutrition information as an example.
For example, the original watermark information is encoded according to the above steps a-c to obtain a watermark encoding sequence, and as shown in fig. 4, the digital watermark adding method may include the following steps:
step S401, acquiring the food material nutrition information processed by formatting.
In this step, one piece of food material recommendation information may correspond to a plurality of pieces of food material nutritional information.
Step S402, calculating the hash value of the food material nutrition information item by item.
For example, hash operation is performed on the food material nutrition information and the preset identification information to obtain a hash value of the food material nutrition information.
Step S403, obtain the watermark code to be embedded.
In this step, a target coding bit in the watermark coding sequence may be determined according to the hash value, and then a watermark code corresponding to the target coding bit is obtained, i.e., the watermark code to be embedded is obtained.
Step S404, whether the code of the watermark to be embedded is 1, if yes, step S305 is executed.
Step S405, inserting blank spaces into the food material nutrition information.
The food material nutrition information is shorter than the food material suggestion information, and the modes of punctuation mark format conversion, synonym replacement or numerical value unit case conversion are adopted, so that the food material nutrition information is more obtrusive. Therefore, in the embodiment of the application, a space can be inserted between the numerical value and the unit in the food material nutrition information. For example, the food material nutrition information is "phaseolus vulgaris protein 23.4 g", and the food material nutrition information is "phaseolus vulgaris protein 23.4 g" after inserting a blank space.
And step S406, judging whether all the food material nutrition information is calculated or not, and if not, returning to the step S402.
Based on the same inventive concept, an embodiment of the present application provides a digital watermark adding apparatus, which is shown in fig. 5 and includes:
the encoding module 51 is configured to encode the text information to obtain an encoded value of the text information;
the determining module 52 is configured to determine a target encoding bit in the watermark encoding sequence according to the encoding value of the text information; the watermark coding sequence is obtained by coding original watermark information according to a preset coding rule;
and an adding module 53, configured to add a digital watermark to the text information according to a preset watermark adding manner if the watermark encoding information corresponding to the target encoding bit is preset encoding information.
In some exemplary embodiments, the encoding module 51 may be further configured to:
and performing hash operation on the text information and the preset identification information, and taking the obtained hash value as the coding value of the text information.
In some exemplary embodiments, the apparatus may further include an obtaining module configured to:
respectively acquiring numerical values corresponding to ASCII (American standard code for information interchange) codes of all characters in the character strings aiming at the character strings corresponding to the original watermark information;
determining onehot codes of the characters based on numerical values corresponding to the ASCII codes of the characters;
and obtaining a watermark coding sequence according to onehot coding of each character.
In some exemplary embodiments, the determining module may be further configured to:
and performing modulus on the coding value of the text information and the coding bit number in the watermark coding sequence, and taking the modulus numerical value as a target coding bit in the watermark coding sequence.
In some exemplary embodiments, the adding module may be further configured to:
acquiring target words with set attributes in the text information, and searching synonyms of the target words from a preset word library if the synonyms of the target words are searched; the term library comprises terms with set attributes and synonyms corresponding to the terms with set attributes.
And if the synonym of the target word is found, replacing the target word with the synonym of the target word, or replacing the target word with the synonym of the target word and converting the punctuation marks in the text information into punctuation marks in the target format.
In some exemplary embodiments, the adding module may be further configured to:
and if the synonym of the target word is not found, converting the punctuation mark in the text information into the punctuation mark in the target format.
In some exemplary embodiments, the adding module may be further configured to:
inserting a set character at a target position of the text information; and/or the presence of a gas in the gas,
and if the text information comprises the numerical value, performing least significant digit value conversion on the numerical value in the text information.
Because the principle of the device for solving the problems is similar to the digital watermark adding method, the implementation of the device can refer to the implementation of the method, and repeated details are not repeated.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, and on the basis of the foregoing embodiments, the embodiment of the present disclosure further provides an electronic device, where the computing device may specifically be a desktop computer, a portable computer, a smart phone, a tablet computer, a Personal Digital Assistant (PDA), and the like. As shown in fig. 6, includes: the system comprises a processor 61, a communication interface 63, a memory 62 and a communication bus 64, wherein the processor 61, the communication interface 63 and the memory 62 are communicated with each other through the communication bus 64;
the memory 62 has stored therein a computer program which, when executed by the processor 61, causes the processor 61 to perform the steps of:
the method comprises the steps that text information is coded according to any one text information to obtain a coded value of the text information;
determining a target coding bit in the watermark coding sequence according to the coding value of the text information; the watermark coding sequence is obtained by coding original watermark information according to a preset coding rule;
and if the watermark coding information corresponding to the target coding bit is preset coding information, adding a digital watermark into the text information according to a preset watermark adding mode.
In some exemplary embodiments, the processor 61 may also be configured to:
and performing hash operation on the text information and the preset identification information, and taking the obtained hash value as the coding value of the text information.
In some exemplary embodiments, the processor 61 may also be configured to:
respectively acquiring numerical values corresponding to ASCII (American standard code for information interchange) codes of all characters in the character strings aiming at the character strings corresponding to the original watermark information;
determining onehot codes of the characters based on numerical values corresponding to the ASCII codes of the characters;
and obtaining a watermark coding sequence according to onehot coding of each character.
In some exemplary embodiments, the processor 61 may also be configured to:
and performing modulus on the coding value of the text information and the coding bit number in the watermark coding sequence, and taking the modulus numerical value as a target coding bit in the watermark coding sequence.
In some exemplary embodiments, the processor 61 may also be configured to:
acquiring target words with set attributes in the text information, and searching synonyms of the target words from a preset word library if the synonyms of the target words are searched; the term library comprises terms with set attributes and synonyms corresponding to the terms with set attributes.
And if the synonym of the target word is found, replacing the target word with the synonym of the target word, or replacing the target word with the synonym of the target word and converting the punctuation marks in the text information into punctuation marks in the target format.
In some exemplary embodiments, the processor 61 may also be configured to:
and if the synonym of the target word is not found, converting the punctuation mark in the text information into the punctuation mark in the target format.
In some exemplary embodiments, the processor 61 may also be configured to:
inserting a set character at a target position of the text information; and/or the presence of a gas in the gas,
and if the text information comprises the numerical value, performing least significant digit value conversion on the numerical value in the text information.
Because the principle of the electronic device for solving the problem is similar to the digital watermark adding method, the implementation of the electronic device can refer to the implementation of the method, and repeated details are not repeated.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface 63 is used for communication between the above-described electronic apparatus and other apparatuses.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a central processing unit, a Network Processor (NP), and the like; but may also be a Digital instruction processor (DSP), an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
The embodiment of the application provides a computer-readable storage medium, which stores computer-executable instructions for causing a computer to execute any one of the digital watermarking methods of the above embodiments.
The computer readable storage medium in the above embodiments may be any available medium or data storage device that can be accessed by a processor in an electronic device, including but not limited to magnetic memory such as floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc., optical memory such as CDs, DVDs, BDs, HVDs, etc., and semiconductor memory such as ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), Solid State Disks (SSDs), etc.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A digital watermarking method, comprising:
aiming at any one text message, coding the text message to obtain a coded value of the text message;
determining a target coding bit in a watermark coding sequence according to the coding value of the text information; the watermark coding sequence is obtained by coding original watermark information according to a preset coding rule;
and if the watermark coding information corresponding to the target coding bit is preset coding information, adding a digital watermark into the text information according to a preset watermark adding mode.
2. The method of claim 1, wherein said encoding the text information to obtain the encoded value of the text information comprises:
and carrying out hash operation on the text information and preset identification information, and taking the obtained hash value as the code value of the text information.
3. The method of claim 1, wherein the watermark encoding sequence is determined by:
respectively acquiring numerical values corresponding to ASCII (American standard code for information interchange) codes of all characters in the character string aiming at the character string corresponding to the original watermark information;
determining onehot codes of the characters based on numerical values corresponding to the ASCII codes of the characters;
and obtaining the watermark coding sequence according to onehot coding of each character.
4. The method according to claim 3, wherein the target encoding bit in the watermark encoding sequence is determined according to the encoding value of the text information:
and performing modulus on the coding value of the text information and the coding bit number in the watermark coding sequence, and taking the modulus numerical value as a target coding bit in the watermark coding sequence.
5. The method according to any one of claims 1 to 4, wherein the adding a digital watermark in the text information according to a preset watermark adding mode comprises:
acquiring target words with set attributes in the text information, and searching synonyms of the target words from a preset word library if the synonyms of the target words are searched; the term library comprises terms with set attributes and synonyms corresponding to the terms with the set attributes;
and if the synonym of the target word is found, replacing the target word with the synonym of the target word, or replacing the target word with the synonym of the target word and converting the punctuation marks in the text information into punctuation marks in a target format.
6. The method according to claim 5, wherein the adding digital watermark to the text information according to a preset watermark adding manner includes:
and if the synonym of the target word is not found, converting the punctuation mark in the text information into the punctuation mark in the target format.
7. The method according to any one of claims 1 to 4, wherein the adding a digital watermark in the text information according to a preset watermark adding mode comprises:
inserting a set character into a target position of the text information; and/or the presence of a gas in the gas,
and if the text information comprises numerical values, carrying out least significant digit value conversion on the numerical values in the text information.
8. A digital watermarking apparatus, comprising:
the encoding module is used for encoding the text information aiming at any one text information to obtain an encoding value of the text information;
the determining module is used for determining a target coding bit in the watermark coding sequence according to the coding value of the text information; the watermark coding sequence is obtained by coding original watermark information according to a preset coding rule;
and the adding module is used for adding the digital watermark into the text information according to a preset watermark adding mode if the watermark coding information corresponding to the target coding bit is preset coding information.
9. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program operable on the processor, the computer program, when executed by the processor, causing the processor to carry out the method of any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored therein, the computer program characterized by: the computer program, when executed by a processor, implements the method of any of claims 1 to 7.
CN202110151620.5A 2021-02-03 2021-02-03 Digital watermark adding method and device, electronic equipment and storage medium Pending CN112948776A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110151620.5A CN112948776A (en) 2021-02-03 2021-02-03 Digital watermark adding method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110151620.5A CN112948776A (en) 2021-02-03 2021-02-03 Digital watermark adding method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112948776A true CN112948776A (en) 2021-06-11

Family

ID=76243508

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110151620.5A Pending CN112948776A (en) 2021-02-03 2021-02-03 Digital watermark adding method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112948776A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113688601A (en) * 2021-10-26 2021-11-23 北京凯睿数加科技有限公司 Watermark generation method and device based on form, electronic equipment and computer medium
CN115712909A (en) * 2022-11-07 2023-02-24 中电科大数据研究院有限公司 Text watermark embedding method, tracing method and system based on block chain
CN116541808A (en) * 2023-07-06 2023-08-04 杭州美创科技股份有限公司 Data watermark tracing method, device, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1700205A (en) * 2005-06-24 2005-11-23 清华大学 Method for embedding and extracting watermark in English texts
JP2008211716A (en) * 2007-02-28 2008-09-11 Kyocera Mita Corp Image processing apparatus, image forming apparatus, image processing method and program
CN101365098A (en) * 2007-08-08 2009-02-11 北京视博数字电视科技有限公司 Digital program right management method and digital right management system
CN102547297A (en) * 2012-02-28 2012-07-04 中国传媒大学 MPEG2 (Moving Picture Experts Group 2) video watermarking realization method based on DC (Discrete Cosine) coefficient
CN102682248A (en) * 2012-05-15 2012-09-19 西北大学 Watermark embedding and extracting method for ultrashort Chinese text
US20150228045A1 (en) * 2013-09-23 2015-08-13 Infosys Limited Methods for embedding and extracting a watermark in a text document and devices thereof
CN110322386A (en) * 2018-03-30 2019-10-11 中移(苏州)软件技术有限公司 A kind of insertion of digital text watermarking and detection method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1700205A (en) * 2005-06-24 2005-11-23 清华大学 Method for embedding and extracting watermark in English texts
JP2008211716A (en) * 2007-02-28 2008-09-11 Kyocera Mita Corp Image processing apparatus, image forming apparatus, image processing method and program
CN101365098A (en) * 2007-08-08 2009-02-11 北京视博数字电视科技有限公司 Digital program right management method and digital right management system
CN102547297A (en) * 2012-02-28 2012-07-04 中国传媒大学 MPEG2 (Moving Picture Experts Group 2) video watermarking realization method based on DC (Discrete Cosine) coefficient
CN102682248A (en) * 2012-05-15 2012-09-19 西北大学 Watermark embedding and extracting method for ultrashort Chinese text
US20150228045A1 (en) * 2013-09-23 2015-08-13 Infosys Limited Methods for embedding and extracting a watermark in a text document and devices thereof
CN110322386A (en) * 2018-03-30 2019-10-11 中移(苏州)软件技术有限公司 A kind of insertion of digital text watermarking and detection method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113688601A (en) * 2021-10-26 2021-11-23 北京凯睿数加科技有限公司 Watermark generation method and device based on form, electronic equipment and computer medium
CN115712909A (en) * 2022-11-07 2023-02-24 中电科大数据研究院有限公司 Text watermark embedding method, tracing method and system based on block chain
CN115712909B (en) * 2022-11-07 2023-08-18 中电科大数据研究院有限公司 Text watermark embedding method, tracing method and system based on blockchain
CN116541808A (en) * 2023-07-06 2023-08-04 杭州美创科技股份有限公司 Data watermark tracing method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN112948776A (en) Digital watermark adding method and device, electronic equipment and storage medium
CN107330306B (en) Text watermark embedding and extracting method and device, electronic equipment and storage medium
Taleby Ahvanooey et al. A comparative analysis of information hiding techniques for copyright protection of text documents
Roy et al. A novel approach to format based text steganography
Zhang et al. A novel robust text watermarking for word document
Taleby Ahvanooey et al. An innovative technique for web text watermarking (AITW)
CN103543980A (en) Digital data processing method and device
CN114356919A (en) Watermark embedding method, tracing method and device for structured database
CN103927164A (en) Method and system for confusing scripts
WO2024066271A1 (en) Database watermark embedding method and apparatus, database watermark tracing method and apparatus, and electronic device
CN114036561A (en) Information hiding method, information acquiring method, information hiding device, information acquiring device, storage medium and electronic equipment
CN103530574A (en) Method for inserting and extracting hidden information based on English PDF document
Govada et al. Text steganography with multi level shielding
Rafat et al. Secure digital steganography for ASCII text documents
CN109800547B (en) Method for quickly embedding and extracting information for WORD document protection and distribution tracking
CN111382398B (en) Method, device and equipment for information processing, hidden information analysis and embedding
CN107491423B (en) Chinese document gene quantization and characterization method based on numerical value-character string mixed coding
JP2009198816A (en) Information concealing system, device, and method
Öztürk et al. A character based steganography using masked language modeling
Xin et al. An improved tamper detection and location scheme for DOCX format documents
US20150326750A1 (en) Data hiding method via revision records on a collaboration platform
CN116235169A (en) Digital watermarking of text data
Xiang et al. A word-frequency-preserving steganographic method based on synonym substitution
CN110197054B (en) MusicXML format file watermark embedding and extracting method, device and storage medium
CN117034220B (en) Digital watermark processing method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination