Watermarking method, apparatus, and storage medium
Patent Information
- Application Number
- CN202211447083.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-18
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2042-11-18
AI Technical Summary
[0004]本申请提供一种水印加注方法、装置及存储介质,能够解决现有技术中加注水印溯源通用性较差的问题,有益于提升水印加注对于不同文件的通用性
Smart Images

Figure CN115828192B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of watermarking technology, and in particular to a watermarking method, apparatus and storage medium. Background Technology
[0002] With the surge in data volume in modern society, data sharing and exchange have become one of the most frequent scenarios for data flow, highlighting data security issues and making accountability a top priority.
[0003] Current solutions for ensuring data security are relatively customized and cannot meet the security needs of various scenarios. Furthermore, the aforementioned technical solutions have poor versatility when applied to customized data watermarking and traceability scenarios. Summary of the Invention
[0004] This application provides a watermarking method, apparatus, and storage medium, which can solve the problem of poor universality of watermarking traceability in the prior art and is beneficial to improving the universality of watermarking for different documents.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] In a first aspect, this application provides a watermarking method, which includes: determining the file type of the target file; the file type of the target file includes structured files and unstructured files; determining the target watermark according to the file type of the target file; and watermarking the target file according to the target watermark.
[0007] The above solution offers at least the following advantages: Based on the above technical solution, the watermarking method provided in this application first determines the file type of the target file, including structured files and unstructured files. Then, based on the file type of the target file, the target watermark is determined. Since the watermarking method provided in this application can determine the target watermark corresponding to different target files based on different file types, and then affix the target watermark to the corresponding target file, the watermarking method provided in this application can improve the universality of watermarking for different files.
[0008] In conjunction with the first aspect above, in one possible implementation, the method further includes: if the target file is a structured file, determining the data type of at least one set of data in the target file; generating a random field corresponding to the data type based on the data type of the at least one set of data; and using the generated random field as the target watermark.
[0009] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: inserting the target watermark at the end of the random field.
[0010] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: generating N random numbers, where N is greater than or equal to 1, when the target file is a structured file; using the N random numbers to represent the time value of the date data in the target unit; and using the N random numbers as the target watermark.
[0011] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: obtaining date data from the target file; and sequentially replacing the time value of the date data in the target unit based on N random numbers.
[0012] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: if the target file is a structured file, obtaining the target watermark in response to the first operation; the first operation is a user-triggered operation on the target watermark.
[0013] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: determining target data of a target type in the target file; the data length of the target data being greater than or equal to a preset length; and inserting the target watermark into one or more ends of the target data.
[0014] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: if the target file is a non-structured file, obtaining the target watermark in response to a second operation; the second operation is a user-triggered operation on the target watermark.
[0015] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: inserting the target watermark into a random position in the metadata of the target file when the unstructured file is a document file; and inserting the target watermark into a random position in the target file when the unstructured file is a non-document file.
[0016] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: when the non-structured file is a document file, generating a target watermark image based on the target watermark; and adding the target watermark image to the background image of the target file.
[0017] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: converting the target watermark into a numeric string; converting the numeric string into an encrypted watermark according to a mapping relationship; the mapping relationship being the correspondence between the numbers in the numeric string and the characters in the encrypted watermark; and the characters in the encrypted watermark being invisible characters.
[0018] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: acquiring multiple files to be processed; and determining the target file from the multiple files to be processed by polling or prioritizing.
[0019] Secondly, this application provides a watermarking device, which includes: a processing unit for determining the file type of a target file; the file type of the target file includes structured files and unstructured files; a watermark generation unit for determining a target watermark based on the file type of the target file; and a watermarking unit for watermarking the target file based on the target watermark.
[0020] In conjunction with the second aspect above, in one possible implementation, the processing unit is further configured to determine the data type of at least one set of data in the target file when the target file is a structured file; the watermark generation unit is further configured to generate a random field of the corresponding data type based on the data type of the at least one set of data; and the watermark generation unit is further configured to use the generated random field as the target watermark.
[0021] In conjunction with the second aspect mentioned above, in one possible implementation, the watermarking unit is also used to insert the target watermark into the end of the random field.
[0022] In conjunction with the second aspect above, in one possible implementation, the processing unit is further configured to generate N random numbers, where N is greater than or equal to 1, when the target file is a structured file; the N random numbers are used to represent the time value of the date data in the target unit; the watermark generation unit is further configured to use the N random numbers as the target watermark.
[0023] In conjunction with the second aspect above, in one possible implementation, the acquisition unit is used to acquire date data in the target file; the watermarking unit is also used to replace the time value of the date data in the target unit sequentially based on N random numbers.
[0024] In conjunction with the second aspect above, in one possible implementation, the watermark generation unit is further configured to acquire the target watermark in response to the first operation when the target file is a structured file.
[0025] In conjunction with the second aspect above, in one possible implementation, the processing unit is further configured to determine target data of a target type in the target file; the data length of the target data is greater than or equal to a preset length; the watermarking unit is further configured to insert the target watermark into one or more ends of the target data.
[0026] In conjunction with the second aspect above, in one possible implementation, the watermark generation unit is further configured to acquire the target watermark in response to the second operation when the target file is a non-structured file.
[0027] In conjunction with the second aspect above, in one possible implementation, the watermarking unit is further configured to insert the target watermark into a random position in the metadata of the target file when the non-structured file is a document file; the watermarking unit is further configured to insert the target watermark into a random position in the target file when the non-structured file is a non-document file.
[0028] In conjunction with the second aspect above, in one possible implementation, the watermark generation unit is further used to generate a target watermark image based on the target watermark when the non-structured file is a document file; the watermark annotation unit is further used to annotate the target watermark image into the background image of the target file.
[0029] In conjunction with the second aspect above, in one possible implementation, the watermark encryption unit is used to convert the target watermark into a numeric string; the watermark encryption unit is also used to convert the numeric string into an encrypted watermark according to a mapping relationship; the mapping relationship is the correspondence between the numbers in the numeric string and the characters in the encrypted watermark; the characters in the encrypted watermark are invisible characters.
[0030] In conjunction with the second aspect above, in one possible implementation, the acquisition unit is further configured to acquire multiple files to be processed; the processing unit is further configured to determine the target file from the multiple files to be processed by polling or prioritization.
[0031] Thirdly, this application provides a watermarking apparatus, which includes: a processor and a communication interface; the communication interface and the processor are coupled, and the processor is used to run computer programs or instructions to implement the watermarking method as described in the first aspect and any possible implementation of the first aspect.
[0032] Fourthly, this application provides a computer-readable storage medium storing instructions that, when executed on a terminal, cause the terminal to perform the watermarking method as described in the first aspect and any possible implementation thereof.
[0033] Fifthly, this application provides a computer program product containing instructions that, when run on a watermarking device, cause the watermarking device to perform the watermarking method as described in the first aspect and any possible implementation thereof.
[0034] In a sixth aspect, this application provides a chip including a processor and a communication interface coupled to the processor. The processor is used to run computer programs or instructions to implement the watermarking method as described in the first aspect and any possible implementation thereof.
[0035] Specifically, the chip provided in this application also includes a memory for storing computer programs or instructions.
[0036] It should be noted that the aforementioned computer instructions may be stored, in whole or in part, on a computer-readable storage medium. This computer-readable storage medium may be packaged together with the processor of the device, or it may be packaged separately from the processor of the device; this application does not impose any limitation on this.
[0037] In a seventh aspect, this application provides a watermarking system, comprising: a watermark generating device and a watermarking device, wherein the watermark generating device and the watermarking device are used to perform the watermarking method as described in the first aspect and any possible implementation thereof.
[0038] The descriptions of aspects two through seven in this application can be referenced to the detailed description of aspect one; and the beneficial effects of the descriptions of aspects two through seven can be referenced to the analysis of the beneficial effects of aspect one, which will not be repeated here.
[0039] In this application, the name of the aforementioned watermarking device does not limit the device or functional module itself. In actual implementation, these devices or functional modules may appear under other names. As long as the function of each device or functional module is similar to that of this application, it falls within the scope of the claims of this application and its equivalents.
[0040] These or other aspects of this application will become more readily apparent in the following description. Attached Figure Description
[0041] Figure 1 This application provides a schematic diagram of a data sharing and exchange method.
[0042] Figure 2 This application provides a schematic diagram of the architecture of a watermarking system.
[0043] Figure 3 A schematic diagram illustrating the integration of a watermarking system with an enterprise OA system, as provided in this application embodiment;
[0044] Figure 4 A flowchart illustrating a watermarking method provided in this application embodiment;
[0045] Figure 5 A flowchart illustrating another watermarking method provided in this application embodiment;
[0046] Figure 6 A flowchart illustrating another watermarking method provided in this application embodiment;
[0047] Figure 7A flowchart illustrating another watermarking method provided in this application embodiment;
[0048] Figure 8 A flowchart illustrating another watermarking method provided in this application embodiment;
[0049] Figure 9 A flowchart illustrating another watermarking method provided in this application embodiment;
[0050] Figure 10 A flowchart illustrating another watermarking method provided in this application embodiment;
[0051] Figure 11 A flowchart illustrating another watermarking method provided in this application embodiment;
[0052] Figure 12 A flowchart illustrating another watermarking method provided in this application embodiment;
[0053] Figure 13 A flowchart illustrating another watermarking method provided in this application embodiment;
[0054] Figure 14 A flowchart illustrating another watermarking method provided in this application embodiment;
[0055] Figure 15 A flowchart illustrating another watermarking method provided in this application embodiment;
[0056] Figure 16 A schematic diagram illustrating another watermarking method provided in an embodiment of this application;
[0057] Figure 17 A schematic diagram illustrating another watermarking method provided in an embodiment of this application;
[0058] Figure 18 This is a schematic diagram of the structure of a watermarking device provided in an embodiment of this application;
[0059] Figure 19 This is a schematic diagram of another watermarking device provided in an embodiment of this application. Detailed Implementation
[0060] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0061] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0062] The terms "first" and "second," etc., used in the specification and drawings of this application are used to distinguish different objects or to distinguish different treatments of the same object, rather than to describe a specific order of objects.
[0063] Furthermore, the terms "comprising" and "having," and any variations thereof, used in the description of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.
[0064] It should be noted that in the embodiments of this application, the words "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the words "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0065] In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0066] The following explanations of the terms used in the embodiments of this application are provided to facilitate the reader's understanding.
[0067] (1) Metadata
[0068] Metadata, also known as intermediary data or relay data, is data that describes data. It mainly describes the attributes of data and is used to support functions such as indicating storage location, historical data, resource lookup, and file records.
[0069] With the surge in data volume in modern society, such as Figure 1 As shown, Company A and Company B can share and exchange data. Furthermore, Company A, outsourced personnel, departments, and branch offices can all share and exchange data with each other. This demonstrates that data sharing and exchange is one of the most frequent scenarios for data flow, highlighting data security issues and making accountability paramount. While numerous methods exist to ensure data security, many data security measures are relatively customized and cannot meet the security needs of all scenarios, leaving the possibility of data leakage still present.
[0070] However, most existing technologies are for data-customized watermarking and traceability scenarios, which have poor versatility and low processing efficiency when dealing with a large number of files.
[0071] Based on this, this application discloses a watermarking method. First, the watermarking device determines the file type of the target file, including structured files and unstructured files. Then, the watermarking device determines the target watermark according to the file type of the target file. Since the watermarking method provided in this application can determine the target watermark corresponding to different target files based on different file types, and then affix the target watermark to the corresponding target file, the watermarking method provided in this application can improve the universality of watermarking for different files.
[0072] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0073] Figure 2 This is an architecture diagram of a watermarking system 20 provided in an embodiment of this application. Figure 1 As shown, the watermarking system 20 includes: a watermark generation unit 201, a watermark encryption unit 202, and a watermarking unit 203.
[0074] The watermark generation unit 201, watermark encryption unit 202, and watermark annotation unit 203 can be one or more, depending on the specific requirements. Figure 2 Only one is shown in the image.
[0075] The watermark generation unit 201, the watermark encryption unit 202, and the watermark annotation unit 203 are connected via a communication link. This communication link can be a wired communication link or a wireless communication link, and this application does not limit it in this regard.
[0076] The aforementioned watermark generation unit 201, watermark encryption unit 202, and watermark annotation unit 203 include:
[0077] The processor can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program in this application.
[0078] A transceiver can be any type of transceiver used to communicate with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area network (WLAN), etc.
[0079] Memory can be read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, random access memory (RAM) or other types of dynamic storage devices capable of storing information and instructions, electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed discs, laser discs, optical discs, universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory can exist independently and be connected to the processor via communication lines. Memory can also be integrated with the processor.
[0080] The watermark generation unit 201 acquires the target file, analyzes the content of the target file, and determines the target watermark.
[0081] The watermark encryption unit 202 encrypts the target watermark to obtain an encrypted watermark.
[0082] The watermarking unit 203 adds a watermark to the target file.
[0083] In one possible implementation, the watermark generation unit 201 receives the target file from the database and analyzes the content of the target file; the watermark encryption unit 202 encrypts the received target watermark; and then the watermark injection unit 203 embeds the encrypted watermark into the target file to complete the watermark injection.
[0084] Another possible implementation involves the watermarking system 20, based on the CentOS 7 operating system, the Java object-oriented programming language, the Spring Boot framework, a MySQL database, a RemoteDictionary Server (Redis) storage system, and an operation page generated by Vue.js. It integrates the watermark generation unit 201, the watermark encryption unit 202, and the watermarking unit 203 into the Vue.js-generated operation page. The watermarking system 20 uses the open-source application container engine (Docker) to encapsulate the watermarking unit 203 within an image, achieving virtualization and providing a service port.
[0085] Another possible implementation involves the watermarking system 20 receiving a target file and categorizing it into small and large files based on its size. If the target file is small, the system performs a full write operation, storing the file in its Redis storage system and then watermarking it within Redis. If the target file is large, the system uses Java's zero-copy memory functionality to read and copy the file, avoiding storage in memory and improving input / output efficiency. Furthermore, the system uses Java's cursor functionality to locate the watermark insertion point, eliminating the need for input / output steps during watermarking and significantly enhancing efficiency.
[0086] In another possible implementation, the watermark generation unit 201 in the watermarking system 20 acquires the target file and analyzes its content. If the target file contains sensitive data, the watermarking system 20 counts the sensitive data and records it in the watermarking log.
[0087] Another possible implementation, such as Figure 3 As shown, the watermarking system can be integrated with an enterprise OA system. A data request is submitted, the target file is uploaded to an FTP server (File Transfer Protocol Server), and the process is transmitted to the property management platform to determine if the target file is confidential. If the target file is confidential, the watermarking system 20 is invoked to encrypt the file with a watermark, and the encrypted file is uploaded to the FTP server. If the target file is not confidential, the security administrator is notified for manual processing. The security administrator scans the target file for sensitive data. If the non-confidential target file contains sensitive data, the security administrator returns the work order through the interface, confirming that the target file cannot be downloaded. If the non-confidential target file does not contain sensitive data, the data download function is provided, and the download log is recorded.
[0088] It should be noted that the various embodiments of this application can be referenced or learned from each other. For example, the same or similar steps, method embodiments, system embodiments and device embodiments can be referenced from each other without limitation.
[0089] Figure 4 This is a flowchart illustrating a watermarking method provided in an embodiment of this application. Figure 4 As shown, the method includes the following steps:
[0090] S401, The watermarking device determines the file type of the target file.
[0091] The target file types include structured files and unstructured files.
[0092] Structured data, as we understand it, refers to information that can be represented using data or a unified structure, such as numbers and symbols. Structured data is row-based data, stored in a database, and can be logically expressed using a two-dimensional table structure. Structured data includes: names, ID numbers, dates, amounts, phone numbers, addresses, and names. Data in structured files is structured data. Unstructured data, on the other hand, refers to data with irregular or incomplete structures, lacking a predefined data model, and cannot be logically expressed using a two-dimensional database table structure. Unstructured data includes all formats of office documents, text, images, various reports, system logs, images, audio, and video information. Data in unstructured files is unstructured data.
[0093] In one possible implementation, the watermarking device acquires a target file and analyzes the structure of the data within the target file. If the data in the target file has a two-dimensional table structure, the watermarking device determines that the target file is a structured file. If the data in the target file has a non-two-dimensional table structure, the watermarking device determines that the target file is an unstructured file.
[0094] For example, if the target file contains data in a two-dimensional table structure consisting of information such as name, ID number, date, amount, phone number, address, and title, the watermarking device determines the target file to be a structured file. However, if the target file is an office document, since the data structure in an office document is not a two-dimensional table structure, the watermarking device determines the target file to be a non-structured file.
[0095] S402. The watermarking device determines the target watermark based on the file type of the target file.
[0096] For example, when the target file is a structured file, the watermarking device uses different algorithms to transform the data in the structured file into the target watermark, based on the data in the structured file. When the target file is an unstructured file, the watermarking device obtains information from user input and determines that the target watermark is the information input by the user.
[0097] One possible implementation is that the watermarking device determines the target watermark, configures the target watermark as an ID, and saves the ID in the memory of the watermarking device.
[0098] For example, taking the target watermark as the string "watermarking device", the watermarking device configures "watermarking device" as ID=5 and saves ID=5 in the watermarking device's memory. In this way, ID=5 can replace "watermarking device" as the target watermark.
[0099] S403. The watermarking device adds a watermark to the target document according to the target watermark.
[0100] For example, after the watermarking device transforms data in a structured file into the target watermark using different algorithms, the device obtains the position of the data in the structured file that has become the target watermark as the watermarking position and applies the target watermark to that position. After determining that the target watermark is user-inputted information, when the unstructured file is a character file, the device selects a random position within the character file as the watermarking position and applies the target watermark there. When the unstructured file is a non-character file such as audio, video, or images, the device selects the end of the file as the watermarking position and applies the target watermark there.
[0101] Based on the above technical solution, the watermarking method provided in this application first determines the file type of the target file, including structured files and unstructured files. Then, based on the file type of the target file, the target watermark is determined. Since the watermarking method provided in this application can determine the target watermark corresponding to different target files based on different file types, and then affix the target watermark to the corresponding target file, the watermarking method provided in this application can improve the universality of watermarking for different files.
[0102] As one possible embodiment of this application, combined with Figure 4 ,like Figure 5 As shown, the above S402 can also be implemented by the following S501-S503.
[0103] S501, when the target file is a structured file, the watermarking device determines the data type of at least one set of data in the target file.
[0104] For example, a structured file may include multiple sets of data such as name, ID number, date, amount, phone number, address, and name. The watermarking device can determine the data type of at least one set of data from the structured file, including name, ID number, date, amount, phone number, and address.
[0105] S502, The watermarking device generates a random field of the corresponding data type based on the data type of at least one set of data.
[0106] For example, taking the data data in the target file as including name, ID number, date, amount, phone number, and address as an example, the watermarking device generates a row of data with the same data data type as the data in the target file. For instance, if one row of data in the target file is Zhang San, 1301200008274565, 20220809, 500, 16856788865, No. 14, XX Street, Longgang District, Shenzhen, the generated data could be Li Si, 1403200207295668, 20091102, 1000, 18845698345, No. 50, XX Street, Chaoyang District, Beijing.
[0107] S503, The watermarking device uses the generated random field as the target watermark.
[0108] For example, taking the generated data as Li Si, 1403200207295668, 20091102, 1000, 18845698345, and No. 50, XX Street, Chaoyang District, Beijing as an example, the watermarking device selects 18845698345 as the target watermark.
[0109] Based on the above technical solution, the watermarking device determines the data type of at least one set of data in the target file. Since the watermarking device generates a random field corresponding to the data type and uses this random field as the target watermark, the target watermark and the random field have the same data type. Therefore, the above technical solution ensures the privacy of the target watermark and can generate the target watermark quickly.
[0110] As one possible embodiment of this application, combined with Figure 5 ,like Figure 6 As shown, the above S403 can also be implemented by the following S601.
[0111] S601, The watermarking device inserts the target watermark into the end of a random field.
[0112] For example, let's take the watermarking device selecting 18845698345 as the target watermark. The watermarking device inserts 18845698345 into the end of 18845698345.
[0113] Based on the above technical solution, the target watermark is inserted at the end of the random field, ensuring the data's resistance to damage.
[0114] As one possible embodiment of this application, combined with Figure 4 ,like Figure 7 As shown, the above S402 can also be implemented by the following S701-S702.
[0115] S701, the watermarking device generates N random numbers when the target file is a structure file.
[0116] Where N is greater than or equal to 1, and N random numbers are used to represent the time value of the date data in the target unit.
[0117] It should be noted that when the date data is in the format of 2022-10-20 16:38:27, 2022102016:38:27, or 2022 / 10 / 20 16:38:27, the watermarking device converts the date data into a unified format using a timestamp. For example, 2022-10-20 16:38:27 is converted to 1666255107000 using a timestamp. Here, 000 represents the milliseconds.
[0118] For example, taking the date data 1666255107000 as an example, the watermarking device randomly generates 20 random numbers 777, 181, ..., 888 based on the millisecond bit 000.
[0119] S702, The watermarking device uses N random numbers as the target watermark.
[0120] For example, the watermarking device uses 20 random numbers 777, 181, ..., 888 as the target watermark.
[0121] Based on the above technical solution, the watermarking device uses N random numbers as the target watermark. Since the target watermark is N random numbers randomly generated by the watermarking device, the randomness of the target watermark is guaranteed.
[0122] As one possible embodiment of this application, combined with Figure 7 ,like Figure 8 As shown, the above S403 can also be implemented by the following S801-S802.
[0123] S801, The watermarking device acquires the date data in the target file.
[0124] For example, the watermarking device acquires date data from the target file. If the date data in the target file is in the format of 2022-10-20 16:38:27, 20221020 16:38:27, or 2022 / 10 / 20 16:38:27, the watermarking device converts the date data in the target file in the format of 2022-10-20 16:38:27, 20221020 16:38:27, or 2022 / 10 / 20 16:38:27 into date data in the format 1666255107000 using a timestamp.
[0125] S802, the watermarking device replaces the time value of the date data in the target unit sequentially based on N random numbers.
[0126] For example, consider a watermarking device that uses 20 random numbers 777, 181, ..., 888 as the target watermark. The watermarking device takes the date data in the target file and cycles through it, replacing the milliseconds of the date data in the target file with 20 random numbers 777, 181, ..., 888 in a period of 20 data points.
[0127] In one possible implementation, when tracing the source of annotated files, the watermarking device sequentially reads the millisecond bits of the date data and selects the date data with the highest weight as the tracing result.
[0128] For example, the watermarking device acquires date data whose time value in the target unit begins with "777" and ends with "888". The watermarking device selects the date data with the highest weight as the tracing result.
[0129] Based on the above technical solution, the watermarking device uses N random numbers as the target watermark and replaces the time value of the date data in the target unit with the target watermark, thereby completing the watermarking. Since changing the time value of the date data in the target unit has a minimal impact on the date data itself, the target file's resistance to damage is ensured.
[0130] As one possible embodiment of this application, combined with Figure 4 ,like Figure 9 As shown, the above S402 can also be implemented by the following S901.
[0131] S901, when the target file is a structure file, the watermarking device acquires the target watermark in response to the first operation.
[0132] The first operation is the user's triggering action on the target watermark.
[0133] For example, taking the first operation as obtaining the string "Zhang San" and the target watermark as "Zhang San" as an example. When the target file is a structured file, the watermarking device obtains the string "Zhang San" as the target watermark. The first operation can be performed by the user inputting the string "Zhang San," or by the user selecting the string "Zhang San," etc. In response to the first operation, the watermarking device uses the string "Zhang San" as the target watermark. The string "Zhang San" obtained in the first operation can also be the string "Li Si," etc. This application does not limit the specific content of the string used to obtain the target watermark in the first operation.
[0134] Based on the above technical solution, the watermarking device obtains the string input by the user as the target watermark. Since the user can customize the target watermark, this technical solution significantly speeds up the acquisition of the target watermark and improves the user experience.
[0135] As one possible embodiment of this application, combined with Figure 9 ,like Figure 10 As shown, the above S403 can also be implemented by the following S1001-S1002.
[0136] S1001, The watermarking device determines the target data of the target type in the target file.
[0137] The target data has a length greater than or equal to a preset length.
[0138] For example, taking a target file with a preset length of 20 bytes and data types such as name, ID number, date, amount, phone number, and address, the watermarking device determines that the target type is an address of 20 bytes or more. The watermarking device determines that the target data is data of address type 20 bytes or more in the target file.
[0139] S1002, The watermarking device inserts a target watermark into one or more ends of the target data.
[0140] For example, the watermarking device can extract the target data proportionally for watermarking. Taking the target watermark as "Zhang San," the target data as address type data of at least 20 bytes in the target file, and the target data in the target file having 10,000 columns as an example, 100 data items are randomly selected from the target data. The watermarking device inserts "Zhang San" into the end of these 100 data items.
[0141] Based on the above technical solution, the watermarking device determines the target data to be data of a target type whose length in the target file is greater than or equal to a preset length. Therefore, this technical solution can avoid damaging target type data that does not reach the preset length. Furthermore, the watermarking device inserts the target watermark into one or more ends of the target data; thus, this technical solution ensures the data's resistance to damage.
[0142] As one possible embodiment of this application, combined with Figure 4 ,like Figure 11 As shown, the above S402 can also be implemented by the following S1101.
[0143] S1101, when the target file is a non-structured file, the watermarking device acquires the target watermark in response to the second operation.
[0144] The second operation is the user's triggering action on the target watermark.
[0145] For example, taking the second operation as obtaining the string "Zhang San" and the target watermark as "Zhang San" as an example. When the target file is a structured file, the watermarking device obtains the string "Zhang San" as the target watermark. The second operation can be performed by the user inputting the string "Zhang San," or by the user selecting the string "Zhang San," etc. In response to the second operation, the watermarking device uses the string "Zhang San" as the target watermark. The string "Zhang San" obtained in the second operation can also be the string "Li Si," etc. This application does not limit the specific content of the string used to obtain the target watermark in the second operation.
[0146] Based on the above technical solution, the watermarking device obtains the string input by the user as the target watermark. Since the user can customize the target watermark, this technical solution significantly speeds up the acquisition of the target watermark and improves the user experience.
[0147] As one possible embodiment of this application, combined with Figure 11 ,like Figure 12 As shown, the above S403 can also be implemented by the following S1201-S1202.
[0148] S1201. When the non-structured file is a document file, the watermarking device inserts the target watermark into a random position in the metadata of the target file.
[0149] For example, taking the second operation as obtaining the string "Zhang San" and the target watermark as the string "Zhang San", in the case of a non-structured file being a document file, the watermarking device inserts the string "Zhang San" into a random position in the metadata of the target file.
[0150] S1202. When the non-structured file is a non-document file, the watermarking device inserts the target watermark into a random position in the target file.
[0151] For example, taking the second operation as obtaining the string "Zhang San", the target watermark as the string "Zhang San", and the non-document file as a system log file as an example, in the case that the non-document file is a system log file, the watermarking device inserts the string "Zhang San" into a random position in the target file.
[0152] For example, taking the second operation as obtaining the string "Zhang San", the target watermark as the string "Zhang San", and the non-document type file as an image, audio, or video file, "Zhang San" is represented as 1101010111000101 1100100011111101. The image, audio, and video files are represented in binary. The watermarking device adds 11010101110001011100100011111101 to the end of the binary-represented image, audio, and video files.
[0153] Based on the above technical solution, the watermark tracing device can add watermarks to unstructured documents, system files, image files, audio files, and video files, thus improving the versatility of the watermarking device.
[0154] As one possible embodiment of this application, combined with Figure 12 ,like Figure 13 As shown, the above method also includes the following S1301-S1302.
[0155] S1301. When the non-structured file is a document file, the watermarking device generates a target watermark image based on the target watermark.
[0156] The target watermark image is used to represent information about the data provider and / or user, so that users can quickly identify the provider of the document file, greatly improving the user experience.
[0157] For example, taking the target watermark as the string "Zhang San" as an example. In the case of a non-structured file being a document file, the watermarking device generates a target watermark image with the display content "Zhang San" based on the string "Zhang San".
[0158] S1302, The watermarking device adds the target watermark image to the background image of the target file.
[0159] For example, taking an image with the content "Zhang San" as the target watermark image, the watermarking device adds the image with the content "Zhang San" to the background image of the document file, which can achieve the purpose of prompting "Zhang San".
[0160] Based on the above technical solution, the watermarking device adds the target watermark image to the background image of document files. Therefore, it achieves the goal of allowing users to quickly identify the information displayed by the target watermark, greatly improving the user experience.
[0161] As one possible embodiment of this application, combined with Figure 4 ,like Figure 14 As shown, the above method also includes the following S1401-S1402.
[0162] S1401, The watermarking device converts the target watermark into a digital string.
[0163] One possible implementation is that the watermarking device converts the target watermark into a binary number string.
[0164] For example, taking the target watermark as the string "Zhang San", the watermarking device converts "Zhang San" into 1101010111000101 1100100011111101.
[0165] S1402, The watermarking device converts the numeric string into an encrypted watermark according to the mapping relationship.
[0166] The mapping relationship is the correspondence between the numbers in the numeric string and the characters in the encrypted watermark; the characters in the encrypted watermark are invisible characters.
[0167] One possible implementation is that the watermarking device converts a binary string of numbers into invisible characters.
[0168] For example, consider the binary numeric string 11010101110001011100100011111101. The watermarking device converts 11010101110001011100100011111101 into Unicode characters such as \u200B. These Unicode characters, such as \u200B, are not displayed.
[0169] Based on the above technical solution, the watermarking device converts the target watermark into a digital string and utilizes the property of non-displaying characters such as \u200B and Unicode characters to achieve the purpose of encrypting and hiding the watermark, which is beneficial to the privacy and confidentiality of watermarking.
[0170] As one possible embodiment of this application, combined with Figure 4 ,like Figure 15 As shown, the above method also includes the following S1501-S1502.
[0171] S1501, The watermarking device acquires multiple files to be processed.
[0172] For example, the watermarking device retrieves multiple files to be processed from a source database. The source database can be a MySQL database, an Oracle database, an HDFS dataset, etc.
[0173] S1502, the watermarking device determines the target file from multiple pending files by polling or prioritizing.
[0174] One possible implementation, such as Figure 16 As shown, the watermarking device adds a watermark to the target file and outputs the watermarked target file to the destination database. The destination database can be a MySQL database, an Oracle database, or an HDFS dataset, etc.
[0175] For example, let's take a MySQL database as the source database and an Oracle database as the destination database. Both MySQL and Oracle databases must follow the File Transfer Protocol (FTP) when transferring files to improve file sharing.
[0176] Another possible implementation, such as Figure 17 As shown, the watermarking device determines the target file by polling multiple files to be processed based on their weights. The watermarking device can be applied to multiple watermarking servers. The multiple files to be processed are then processed sequentially by watermarking server 1, watermarking server 2, watermarking server 3, etc., according to their weights from largest to smallest.
[0177] Based on the above technical solution, the database contains multiple files to be processed. The watermarking device determines the target file based on its weight priority. After watermarking the target file, the watermarked target file can be output to this database or to another database. Therefore, compared with the low processing efficiency of existing technologies when processing a large number of files, the above technical solution can greatly speed up the processing of multiple files to be processed and realize the conversion between multiple data sources.
[0178] This application embodiment can divide the watermarking device into functional modules or functional units according to the above method example. For example, each function can be divided into a separate functional module or functional unit, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or in software functional modules or functional units. The module or unit division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0179] like Figure 18 The diagram shown is a structural schematic of a watermarking device provided in an embodiment of this application. The device includes:
[0180] Processing unit 1801 is used to determine the file type of the target file; the file type of the target file includes structured files and unstructured files.
[0181] The watermark generation unit 1802 is used to determine the target watermark based on the file type of the target file.
[0182] The watermarking unit 1803 is used to watermark the target document according to the target watermark.
[0183] Optionally, the processing unit 1801 is further configured to determine the data type of at least one set of data in the target file when the target file is a structured file.
[0184] The watermark generation unit 1802 is also used to generate a random field of the corresponding data type based on the data type of at least one set of data.
[0185] The watermark generation unit 1802 is also used to use the generated random field as the target watermark.
[0186] The watermarking unit 1803 is also used to insert the target watermark into the end of a random field.
[0187] The processing unit 1801 is also used to generate N random numbers, where N is greater than or equal to 1, when the target file is a structure file; the N random numbers are used to represent the time value of the date data in the target unit.
[0188] The watermark generation unit 1802 is also used to use N random numbers as target watermarks.
[0189] Optionally, the watermarking device also includes an acquisition unit 1804 for acquiring date data in the target file.
[0190] The watermarking unit 1803 is also used to replace the time value of the date data in the target unit sequentially based on N random numbers.
[0191] The watermark generation unit 1802 is also used to obtain the target watermark in response to a first operation when the target file is a structured file; the first operation is a user-triggered operation on the target watermark.
[0192] The processing unit 1801 is also used to determine the target data of the target type in the target file; the data length of the target data is greater than or equal to a preset length.
[0193] The watermarking unit 1803 is also used to insert a target watermark into one or more ends of the target data.
[0194] The watermark generation unit 1802 is also used to obtain the target watermark in response to a second operation when the target file is a non-structured file; the second operation is a user-triggered operation on the target watermark.
[0195] The watermarking unit 1803 is also used to insert the target watermark into a random position in the metadata of the target file when the non-structured file is a document file.
[0196] The watermarking unit 1803 is also used to insert the target watermark at a random position in the target file when the non-structured file is a non-document file.
[0197] The watermark generation unit 1802 is also used to generate a target watermark image based on the target watermark when the non-structured file is a document file.
[0198] The watermarking unit 1803 is also used to add the target watermark image to the background image of the target file.
[0199] Optionally, the watermarking device also includes a watermark encryption unit 1805 for converting the target watermark into a digital string.
[0200] The watermark encryption unit 1805 is also used to convert a numeric string into an encrypted watermark according to a mapping relationship; the mapping relationship is the correspondence between the numbers in the numeric string and the characters in the encrypted watermark; the characters in the encrypted watermark are invisible characters.
[0201] Acquisition unit 1804 is also used to acquire multiple files to be processed.
[0202] The processing unit 1801 is also configured to determine the target file from multiple files to be processed by means of polling or priority.
[0203] In one possible implementation, the watermarking device may further include a storage unit 1806. Figure 18 (shown in dashed box) The storage unit 1806 stores a program or instruction. When the processing unit 1801 executes the program or instruction, the watermarking device can perform the watermarking method described in the above method embodiment.
[0204] When implemented in hardware, the acquisition unit 1804 in this embodiment can be integrated onto the communication interface, and the processing unit 1801 can be integrated onto the processor. Specific implementation methods are as follows: Figure 19 As shown.
[0205] Figure 19A schematic diagram of another possible structure of the watermarking device involved in the above embodiments is shown. The watermarking device includes a processor 1901 and a communication interface 1902. The processor 1901 is used to control and manage the operation of the watermarking device, for example, executing the steps performed by the processing unit 1801, and / or performing other processes of the technology described herein. The communication interface 1902 is used to support communication between the watermarking device and other network entities, for example, executing the steps performed by the acquisition unit 1804. The watermarking device may also include a memory 1903 and a bus 1904, the memory 1903 being used to store the program code and data of the watermarking device.
[0206] The memory 1903 may be a memory in a watermarking device, and the memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk or solid-state drive; the memory may also include a combination of the above types of memory.
[0207] The processor 1901 described above can implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0208] The 1904 bus can be an Extended Industry Standard Architecture (EISA) bus, etc. The 1904 bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 19 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0209] Figure 19 The watermarking device in the middle can also be a chip. The chip includes one or more processors 1901 and a communication interface 1902.
[0210] In some embodiments, the chip further includes a memory 1903, which may include read-only memory and random access memory, and provides operation instructions and data to the processor 1901. A portion of the memory 1903 may also include non-volatile random access memory (NVRAM).
[0211] In some implementations, memory 1903 stores elements such as execution modules or data structures, or subsets thereof, or extended sets thereof.
[0212] In this embodiment of the application, the corresponding operation is executed by calling the operation instructions stored in the memory 1903 (the operation instructions can be stored in the operating system).
[0213] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0214] This application provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the watermarking method described in the above method embodiments.
[0215] This application also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the watermarking method in the method flow shown in the above method embodiments.
[0216] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections having one or more wires; portable computer disks; hard disks; random access memory (RAM); read-only memory (ROM); erasable programmable read-only memory (EPROM); registers; hard disks; optical fibers; portable compact disc read-only memory (CD-ROM); optical storage devices; magnetic storage devices; or any suitable combination thereof; or any other form of computer-readable storage medium known in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may reside in an application-specific integrated circuit (ASIC). In the embodiments of this application, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0217] Since the watermarking device, computer-readable storage medium, and computer program product in the embodiments of this application can be applied to the above method, the technical effects that can be obtained can also be referred to the above method embodiments. The embodiments of this application will not be repeated here.
[0218] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0219] The units described as separate components may or may not be physically separate. 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 the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0220] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0221] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for adding watermarks, characterized in that, The method includes: Get multiple files to be processed; Based on the data size of the multiple files to be processed, the multiple files to be processed are divided into small files and large files; The target file is determined from the plurality of files to be processed; If the target file is the small file, then the target file is written in its entirety to the storage system, and a watermark is added to the target file in the storage system; If the target file is a large file, then the zero-copy memory function is invoked to read and copy the target file, and the cursor function is invoked to locate the watermarking position of the target file; the watermarking includes: Determine the file type of the target file; the file type of the target file includes structured files and unstructured files; The target watermark is determined based on the file type of the target file; Watermark the target file according to the target watermark.
2. The method according to claim 1, characterized in that, The step of determining the target watermark based on the file type of the target file includes: If the target file is a structured file, determine the data type of at least one set of data in the target file; Generate a random field of the corresponding data type based on the data type of the at least one set of data; The generated random field is used as the target watermark.
3. The method according to claim 2, characterized in that, The step of watermarking the target document according to the target watermark includes: The target watermark is inserted at the end of the random field.
4. The method according to claim 1, characterized in that, The step of determining the target watermark based on the file type of the target file includes: If the target file is a structured file, generate N random numbers, where N is greater than or equal to 1; these N random numbers are used to represent the time value of the date data in the target unit. The N random numbers are used as the target watermark.
5. The method according to claim 4, characterized in that, The step of watermarking the target document according to the target watermark includes: Retrieve date data from the target file; Based on the N random numbers, the time value of the date data in the target unit is replaced sequentially.
6. The method according to claim 1, characterized in that, The step of determining the target watermark based on the file type of the target file includes: If the target file is a structured file, the target watermark is obtained in response to a first operation; the first operation is a user-triggered operation on the target watermark.
7. The method according to claim 6, characterized in that, The step of watermarking the target document according to the target watermark includes: The target data of the target type in the target file is determined; the data length of the target data is greater than or equal to a preset length; The target watermark is inserted into one or more ends of the target data.
8. The method according to claim 1, characterized in that, The unstructured files include document files and non-document files; determining the target watermark based on the file type of the target file includes: If the target file is a non-structured file, the target watermark is obtained in response to a second operation; the second operation is a user-triggered operation on the target watermark.
9. The method according to claim 8, characterized in that, The step of watermarking the target document according to the target watermark includes: In the case where the unstructured file is a document file, the target watermark is inserted into a random position in the metadata of the target file; If the non-structured file is a non-document file, the target watermark will be inserted at a random position in the target file.
10. The method according to claim 9, characterized in that, The method further includes: If the unstructured file is a document file, a target watermark image is generated based on the target watermark. The target watermark image is added to the background image of the target file.
11. The method according to any one of claims 1 to 10, characterized in that, The method further includes: Convert the target watermark into a numeric string; The numeric string is converted into an encrypted watermark according to the mapping relationship; the mapping relationship is the correspondence between the numbers in the numeric string and the characters in the encrypted watermark; the characters in the encrypted watermark are invisible characters.
12. A watermark application device, characterized in that, The device includes: The acquisition unit is used to acquire multiple files to be processed. The processing unit is configured to divide the plurality of files to be processed into small files and large files according to the data size of the plurality of files to be processed; and to determine the target file from the plurality of files to be processed. The watermark generation unit is used to write the entire target file into the storage system and add a watermark to the target file in the storage system if the target file is a small file; if the target file is a large file, it calls the memory zero-copy function to read and copy the target file and calls the cursor function to locate the watermark addition position of the target file. The processing unit is further configured to determine the file type of the target file; the file type of the target file includes structured files and unstructured files; The watermark generation unit is further configured to determine the target watermark based on the file type of the target file; A watermarking unit is used to add a watermark to the target document according to the target watermark.
13. The apparatus according to claim 12, characterized in that, The processing unit is further configured to determine the data type of at least one set of data in the target file when the file type of the target file is a structured file; The watermark generation unit is also used to generate a random field of a corresponding data type based on the data type of the at least one set of data; The watermark generation unit is further configured to use the generated random field as the target watermark.
14. The apparatus according to claim 13, characterized in that, The watermarking unit is also used to insert the target watermark into the end of the random field.
15. The apparatus according to claim 12, characterized in that, The processing unit is further configured to generate N random numbers, where N is greater than or equal to 1, when the target file is a structured file; the N random numbers are used to represent the time value of the date data in the target unit. The watermark generation unit is also used to use the N random numbers as the target watermark.
16. The apparatus according to claim 15, characterized in that, It also includes an acquisition unit; The acquisition unit is used to acquire date data from the target file; The watermarking unit is also used to replace the time value of the date data in the target unit sequentially based on the N random numbers.
17. The apparatus according to claim 12, characterized in that, The watermark generation unit is further configured to acquire the target watermark in response to a first operation when the target file is a structured file; the first operation is a user-triggered operation on the target watermark.
18. The apparatus according to claim 17, characterized in that, The processing unit is further configured to determine target data of the target type in the target file; the data length of the target data is greater than or equal to a preset length; The watermarking unit is also used to insert the target watermark into one or more ends of the target data.
19. The apparatus according to claim 12, characterized in that, The watermark generation unit is further configured to acquire the target watermark in response to a second operation when the target file is a non-structured file; the second operation is a user-triggered operation on the target watermark.
20. The apparatus according to claim 19, characterized in that, The watermarking unit is also used to insert the target watermark into a random position in the metadata of the target file when the unstructured file is a document file; The watermarking unit is also used to insert the target watermark into a random position in the target file when the non-structured file is a non-document file.
21. The apparatus according to claim 20, characterized in that, The watermark generation unit is further configured to generate a target watermark image based on the target watermark when the unstructured file is a document file. The watermarking unit is also used to add the target watermark image to the background image of the target file.
22. The apparatus according to any one of claims 12 to 21, characterized in that, It also includes a watermark encryption unit; The watermark encryption unit is used to convert the target watermark into a digital string; The watermark encryption unit is further configured to convert the numeric string into an encrypted watermark according to a mapping relationship; the mapping relationship is the correspondence between the numbers in the numeric string and the characters in the encrypted watermark; the characters in the encrypted watermark are invisible characters.
23. A watermark application device, characterized in that, include: A processor and a communication interface; the communication interface is coupled to the processor, the processor being used to run computer programs or instructions to implement the watermarking method as described in any one of claims 1-11.
24. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed by a computer, perform the watermarking method as described in any one of claims 1-11.
Citation Information
Patent Citations
File processing method and device, equipment and storage medium
CN112417390A
CAD (Computer Aided Design) data watermark embedding method, CAD data watermark tracing method and electronic equipment
CN114298882A