Watermark adding method, watermark extracting method, device, equipment, storage medium and program product
By inserting watermark fragments into the information replacement bits of the timestamp to generate the marked original data, the problem of poor watermark security is solved, and high-security and recognizable watermark addition and extraction are achieved.
Patent Information
- Application Number
- CN202410994311.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-07-23
AI Technical Summary
Existing watermark technologies have poor security, are easily tampered with or deleted, lose their encryption function, and lack industrial applicability.
The encrypted digest is determined by extracting enhanced watermark elements from the original data and comparing them with pre-set original watermark elements. The data is then fragmented based on timestamps, and watermark fragments are inserted into the information replacement bits of the timestamps to generate the tagged original data.
It improves the security of watermarks, prevents malicious forgery and tampering, ensures data security and identifiability, and minimizes data loss and makes it less susceptible to damage.
Smart Images

Figure CN118981778B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data security technology, and in particular to a watermark addition method, watermark extraction method, apparatus, device, storage medium, and program product. Background Technology
[0002] With the rapid development of communication, computer and network technologies, high-speed transmission, processing and storage of digital images have become a reality. However, due to network security issues, how to manage and prevent illegal data copying has gradually become a concern. Data security is also a key focus for enterprises and even countries.
[0003] However, common methods for adding watermarks to data are either too complex to implement and lack industrial practicality, or the watermarks are easily tampered with or deleted, rendering the watermarks used for encryption ineffective and resulting in poor watermark security. Summary of the Invention
[0004] This application provides a watermark addition method, a watermark extraction method, an apparatus, a device, a storage medium, and a program product to solve the problem of poor watermark security in the prior art.
[0005] Firstly, this application provides a watermark addition method, including:
[0006] In response to a processing instruction, at least one enhanced watermark element is extracted from the original data corresponding to the processing instruction;
[0007] Based on the enhanced watermark element and at least one pre-set original watermark element, a ciphertext digest is determined.
[0008] Based on at least one timestamp contained in the original data, the encrypted digest is fragmented to obtain at least one watermark fragment;
[0009] The watermark fragments are inserted into the information replacement bits of each timestamp to generate the marked original data.
[0010] In one embodiment, determining the encrypted digest based on the enhanced watermark element and at least one pre-set original watermark element includes:
[0011] At least one of the enhanced watermark elements and at least one of the original watermark elements are individually encrypted;
[0012] The encrypted digest is determined based on the encrypted enhanced watermark elements and the encrypted original watermark elements.
[0013] In one embodiment, determining the ciphertext digest based on the encrypted enhanced watermark element and the encrypted original watermark element includes:
[0014] The encrypted enhanced watermark element and the encrypted original watermark element are randomly combined to obtain the ciphertext digest;
[0015] Alternatively, any encrypted enhanced watermark element may be used as the ciphertext digest;
[0016] Alternatively, any encrypted original watermark element can be used as the ciphertext digest.
[0017] In one embodiment, the timestamp includes precision information;
[0018] Before segmenting the ciphertext digest based on at least one timestamp contained in the original data to obtain at least one watermarked segment, the method further includes:
[0019] Based on the precision information, the information replacement bits are determined;
[0020] The step of segmenting the ciphertext digest based on at least one timestamp contained in the original data to obtain at least one watermarked segment includes:
[0021] Based on the information replacement bits, the ciphertext digest is segmented to obtain the watermark segment.
[0022] In one embodiment, determining the information replacement bit based on the precision information includes:
[0023] Based on the precision information, the first preset precision bit of the timestamp is used as the information replacement bit.
[0024] In one embodiment, the step of segmenting the ciphertext digest based on the information replacement bits to obtain the watermark segment includes:
[0025] Obtain the character length corresponding to the ciphertext digest;
[0026] The number of fragments is determined based on the number of bits corresponding to the information replacement bits and the character length;
[0027] Based on the number of segments, the character length is segmented to obtain the watermark segments.
[0028] In one embodiment, the step of determining the number of fragments based on the number of bits corresponding to the information replacement bits and the character length is performed using the following formula to obtain the number of fragments:
[0029]
[0030] Where k represents the number of fragments; n represents the character length; m represents the number of bits; and n mod m represents the remainder when the character length is divided by the number of fragments.
[0031] In one embodiment, inserting the watermark fragment into the information replacement bits of each of the timestamps to generate the marked original data includes:
[0032] For each timestamp, the watermark fragments corresponding to the ciphertext digest are randomly inserted into the information replacement bits of the timestamp to generate the marked original data.
[0033] In one embodiment, the step of dividing the character length into segments based on the number of segments to obtain the watermark segments further includes:
[0034] According to the segmentation order of each watermark segment, obtain the sorting information corresponding to each watermark segment;
[0035] The step of inserting the watermark fragment into the information replacement bits of each timestamp to generate the marked original data further includes:
[0036] Based on the accuracy information, the information marker bits of each timestamp are determined;
[0037] In the information marker bits, sorting information corresponding to each watermark fragment in the information replacement bits is inserted.
[0038] In one embodiment, determining the information marker bits for each timestamp based on the precision information includes:
[0039] Based on the precision information, the second preset precision bit of the timestamp is used as the information replacement bit.
[0040] In one embodiment, inserting the watermark fragment into the information replacement bits of each of the timestamps to generate the marked original data includes:
[0041] For each timestamp, the watermark fragments corresponding to the ciphertext digest are randomly inserted into the information replacement bits of the timestamp, and the sorting information corresponding to each watermark fragment is inserted into the information marker bits of the timestamp to generate the marked original data.
[0042] Secondly, this application also provides a watermark extraction method, including:
[0043] In response to an extraction command, the data to be processed corresponding to the extraction command is obtained; the data to be processed is the original data after marking, processed according to the watermarking method in any of the above embodiments.
[0044] Extract the watermark fragments carried by each timestamp from the data to be processed;
[0045] By splicing the watermark fragments, a ciphertext digest is obtained;
[0046] Decrypt the ciphertext digest to obtain at least one of the original watermark element and the enhanced watermark element corresponding to the ciphertext digest.
[0047] Thirdly, this application also provides a watermark adding device, comprising:
[0048] The first extraction module is used to extract at least one enhanced watermark element from the original data corresponding to the processing instruction in response to the processing instruction.
[0049] The determination module is used to determine the encrypted digest based on the enhanced watermark element and at least one pre-set original watermark element;
[0050] The fragmentation module is used to fragment the ciphertext digest based on at least one timestamp contained in the original data to obtain at least one watermark fragment.
[0051] The marking module is used to insert the watermark fragments into the information replacement bits of each timestamp to generate the marked original data.
[0052] Fourthly, this application also provides a watermark extraction device, comprising:
[0053] The acquisition module is used to acquire the data to be processed corresponding to the extraction command in response to the extraction command; the data to be processed is the original data after marking obtained by the watermarking method in any of the above embodiments.
[0054] The second extraction module is used to extract watermark fragments carried by each timestamp from the timestamps contained in the data to be processed.
[0055] The splicing module is used to splice the watermark fragments to obtain the encrypted digest;
[0056] The decryption module is used to decrypt the ciphertext digest to obtain at least one of the original watermark element and the enhanced watermark element corresponding to the ciphertext digest.
[0057] Fifthly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the watermark addition method or watermark extraction method described in any of the above embodiments.
[0058] Sixthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the watermark addition method or watermark extraction method described in any of the above embodiments.
[0059] Seventhly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the watermark addition method or watermark extraction method described in any of the above embodiments.
[0060] The aforementioned watermarking methods, watermark extraction methods, devices, equipment, storage media, and program products can generate multiple specially designed enhanced watermark elements based on the original data, on the basis of pre-set original watermark elements. This ensures that the final generated ciphertext digest reflects the characteristics of the original data, guaranteeing the ciphertext digest's uniqueness and recognizability. Furthermore, it can use the timestamp in the original data as the object for marking the watermark, removing primary key dependencies without destroying the content of the original data. By writing the watermark into the timestamp, the watermark and the original data are forcibly bound, effectively preventing the ciphertext digest from being maliciously forged and tampered with. This improves the security protection capability of the original data during its use, and features high security performance, minimal data loss, and resistance to damage. Attached Figure Description
[0061] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0062] Figure 1 This is a diagram illustrating the application environment of a watermarking method in one embodiment.
[0063] Figure 2 This is a flowchart illustrating a watermark addition method in one embodiment;
[0064] Figure 3 This is a flowchart illustrating the watermark addition method in another embodiment;
[0065] Figure 4 This is a flowchart illustrating the watermark addition method in yet another embodiment;
[0066] Figure 5 This is a flowchart illustrating a watermark extraction method in one embodiment;
[0067] Figure 6 This is a schematic diagram of the watermark adding device in one embodiment;
[0068] Figure 7 This is a schematic diagram of the watermark extraction device in one embodiment;
[0069] Figure 8 This is an internal structural diagram of a computer device in one embodiment.
[0070] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation
[0071] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0072] The watermarking method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 and server 104 can communicate via a network.
[0073] For example, the watermarking method is applied to terminal 102. Upon receiving a processing instruction, terminal 102 can extract at least one enhanced watermark element from the original data corresponding to the processing instruction; then, it retrieves at least one pre-set original watermark element from the data storage system of server 104, and determines the ciphertext digest based on the enhanced watermark element and the original watermark element; and based on at least one timestamp contained in the original data, it segments the ciphertext digest to obtain at least one watermarked segment; and inserts the watermarked segment into the information replacement bits of each timestamp to generate the marked original data. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Terminal 102 and server 104 can be directly or indirectly connected via wired or wireless communication, such as through a network connection.
[0074] For example, the watermarking method is applied to server 104. When terminal 102 receives a processing instruction, it sends the instruction to server 104. Server 104 extracts at least one enhanced watermark element from the original data corresponding to the processing instruction. Subsequently, server 104 retrieves at least one pre-set original watermark element from the data storage system and determines the ciphertext digest based on the enhanced watermark element and the original watermark element. Based on at least one timestamp contained in the original data, the ciphertext digest is fragmented to obtain at least one watermark fragment. The watermark fragment is inserted into the information replacement bits of each timestamp to generate the marked original data. It is understood that the data storage system can be an independent storage device, or the data storage system can be located on server 104, or the data storage system can be located on another terminal.
[0075] It should be noted that the network communication between terminal 102 and server 104 is applicable to different network standards, such as Global System for Mobile communication (GSM), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division-Synchronous Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE) systems, and future 5G network standards. Optionally, the above communication system can be a system in the scenario of Ultra-Reliable and Low Latency Communications (URLLC) transmission in 5G communication systems.
[0076] Therefore, optionally, the aforementioned base station can be a base station (BTS) and / or base station controller in GSM or CDMA, a base station (NodeB, NB) and / or radio network controller (RNC) in WCDMA, an evolved Node B (eNB or eNodeB) in LTE, a relay station or access point, or a base station (gNB) in future 5G networks, etc., which are not limited herein.
[0077] In one embodiment, a watermarking method is provided. This embodiment illustrates the application of this watermarking method to a terminal. It is understood that this method can also be applied to a server, and can also be applied to a system including a terminal and a server, and implemented through the interaction between the terminal and the server. Figure 2 As shown, the watermark addition method includes:
[0078] Step 202: In response to the processing instruction, extract at least one enhanced watermark element from the original data corresponding to the processing instruction.
[0079] Processing instructions refer to instructions that mark specific data so that subsequent data traceability and identification can be achieved.
[0080] As an example, the processing instruction could be issued by a worker through a fixed component on the terminal's human-computer interaction interface. This fixed component could be a pre-built page or mini-program; in this case, adding a watermark to the raw data is manually triggered. Alternatively, the processing instruction could be automatically generated synchronously upon receiving a data extraction instruction from a worker through the terminal's human-computer interaction interface. This data extraction instruction refers to instructions related to copying, forwarding, or other data usage of the raw data stored in a specific database; in this case, adding a watermark to the raw data is automatically triggered when the data is used. Or, the processing instruction could be automatically generated when new raw data is detected being stored in a specific database; in this case, adding a watermark to the raw data is automatically triggered when the raw data is stored in the specific database.
[0081] Specifically, the method for generating enhanced watermark elements can be as follows: when the original data is a text document, randomly extract text of a preset length from the original data. This text can be continuous or discontinuous, and each character contained in this text is used as an enhanced watermark element. The data type of the enhanced watermark element changes accordingly based on the data type of the original data and remains consistent with the data type of the original data.
[0082] Step 204: Determine the encrypted digest based on the enhanced watermark element and at least one pre-set original watermark element.
[0083] The original watermark elements are pre-stored in the server's data storage system. The original watermark elements can be various types of data, such as text (including letters, numbers, symbols, etc.), images (which can be bitmap or vector graphics), and numbers (which can be numeric data, such as dates, serial numbers, etc.).
[0084] The ciphertext digest is used to label the original data. The ciphertext digest can be obtained by splicing and combining enhanced watermark elements and original watermark elements, or it can be obtained by randomly selecting enhanced watermark elements and original watermark elements.
[0085] Step 206: Based on at least one timestamp contained in the original data, the encrypted digest is fragmented to obtain at least one watermark fragment.
[0086] A timestamp is a specific time value, typically indicating how much time has passed since a particular event occurred. In computer science, timestamps are usually a set of numbers. For example, a timestamp can be represented as YYYY-MM-DD-HH-MM-ss, where YYYY represents the year, MM represents the month, DD represents the day, HH represents the hour, MM represents the minute, and ss represents the second. Alternatively, a timestamp can be represented as YYYY-MM-DD-HH-MM-ss-SSS, where SSS represents milliseconds. In this case, each digit of the timestamp is represented as a decimal number.
[0087] Fragmenting a ciphertext digest can be understood as dividing the text corresponding to the ciphertext digest and the binary representation of the text into fragments.
[0088] Step 208: Insert watermark fragments into the information replacement bits of each timestamp to generate the marked original data.
[0089] The information replacement bit refers to the specific location in the timestamp used to store the watermark fragment. For example, when the timestamp is represented by YYYY-MM-DD-HH-MM-ss-SSS, the information replacement bit can be at least one of YYYY, MM, DD, HH, MM, ss, and SSS. In this embodiment, the watermark fragment is used to cover and replace the original time-related information in the timestamp. The watermark is marked in the timestamp by using the time representation content of the relatively ambiguous timestamp.
[0090] As an example, the terminal can generate a ciphertext digest in step 204, and fragment the ciphertext digest according to the information replacement bits of the timestamp. Then, the watermark fragments formed by the fragmented ciphertext digests are randomly inserted into any information replacement bit of each timestamp. It can be understood that the terminal only uses one ciphertext digest to mark the original data, and each timestamp in the original data contains all the watermark fragments corresponding to the ciphertext digest. The number of all the watermark fragments corresponding to the ciphertext digest carried in the original data is the same as the number of timestamps.
[0091] In the above watermarking method, the terminal can generate multiple specially designed enhanced watermark elements based on the original data, on the basis of the pre-set original watermark elements, so that the final generated ciphertext digest can reflect the characteristics of the original data, ensuring the specialness and recognizability of the ciphertext digest. Furthermore, it can use the timestamp in the original data as the object to mark the watermark, remove the primary key dependency without destroying the content of the original data, and forcibly bind the watermark and the original data by writing the watermark into the timestamp, thereby effectively preventing the ciphertext digest from being maliciously forged and tampered with, improving the security protection capability of the original data during use, and having the characteristics of high security performance, small data loss and not easily destroyed.
[0092] In some alternative embodiments, step 204 includes:
[0093] Encrypt at least one enhanced watermark element and at least one original watermark element separately;
[0094] The encrypted digest is determined based on the encrypted enhanced watermark elements and the encrypted original watermark elements.
[0095] It should be noted that the terminal is equipped with a processing module and an encryption module. The processing module can respond to processing instructions and obtain at least one enhanced watermark element from the original data. Then, it sends the enhanced watermark element to the encryption module. The encryption module can obtain at least one original watermark element from the server's data storage system and encrypt at least one enhanced watermark element and at least one original watermark element separately. By encrypting each watermark element individually, the security of the ciphertext digest is ensured, and the generated ciphertext digest is prevented from being tampered with.
[0096] The encryption module can encrypt both the enhanced and original watermark elements separately using encryption algorithms. Common encryption algorithms include symmetric and asymmetric algorithms. Symmetric encryption uses the same key for both encryption and decryption. Common symmetric encryption algorithms include Advanced Encryption Standard (AES) and Data Encryption Standard (DES). When encrypting the enhanced and original watermark elements, a key can be generated first, and then used to encrypt both the enhanced and original watermark elements. Only terminals or servers with that key can decrypt the encrypted enhanced and original watermark elements. Asymmetric encryption uses a public and private key pair. The public key is used to encrypt the data, and the private key is used to decrypt it. Common asymmetric encryption algorithms include RSA. When encrypting the enhanced and original watermark elements, the encryption module can use a pre-stored public key to encrypt both the enhanced and original watermark elements. Only terminals or servers with the corresponding private key can decrypt the encrypted enhanced and original watermark elements.
[0097] As an example, the terminal can randomly combine the encrypted enhanced watermark element and the encrypted original watermark element to obtain the ciphertext digest; or use any one of the encrypted enhanced watermark elements as the ciphertext digest; or use any one of the encrypted original watermark elements as the ciphertext digest. The ciphertext digest can be represented in hexadecimal.
[0098] like Figure 3 As shown, in some optional embodiments, the timestamp includes precision information;
[0099] Before step 206, the following are also included:
[0100] Step 205: Determine the information replacement bits based on the precision information;
[0101] Step 206 includes:
[0102] Based on the information replacement bits, the ciphertext digest is segmented to obtain watermarked segments.
[0103] The timestamp precision information indicates the specific accuracy of the timestamp. For example, timestamp precision can include: Second Precision: timestamp accurate to the second; Millisecond Precision: timestamp accurate to the millisecond; Microsecond Precision: timestamp accurate to the microsecond; Nanosecond Precision: timestamp accurate to the nanosecond; Picosecond Precision: timestamp accurate to the picosecond, etc.
[0104] Based on the timestamp precision information, the terminal can determine whether the timestamp is represented in the form of YYYY-MM-DD-HH-MM-ss, YYYY-MM-DD-HH-MM-ss-SSS, or other forms. Furthermore, based on the timestamp representation, it can determine whether the information replacement bits are at least one of YYYY, MM, DD, HH, MM, ss, SSS, or microseconds and picoseconds.
[0105] As an example, the terminal can use the first preset precision bit of the timestamp as the information replacement bit based on the precision information. The first preset precision bit can be, for example, the highest precision bit. When the timestamp is represented as YYYY-MM-DD-HH-MM-ss, the first preset precision bit can be the ss bit; when the timestamp is represented as YYYY-MM-DD-HH-MM-ss-SSS, the first preset precision bit can be the SSS bit.
[0106] By using the first preset precision bit as the information replacement bit, the watermark fragment can be marked in the timestamp by modifying the content that has the least impact on the time information. This achieves the goal of binding the watermark fragment to the original data at the cost of minimally blurring the content of the timestamp.
[0107] like Figure 4 As shown, in some optional embodiments, step 206 includes:
[0108] Step 2062: Obtain the character length corresponding to the ciphertext digest;
[0109] Step 2064: Determine the number of fragments based on the number of bits corresponding to the information replacement bits and the character length;
[0110] Step 2066: Based on the number of segments, divide the character length into segments to obtain watermark segments.
[0111] Step 2064 can be processed using the following formula to obtain the number of fragments:
[0112]
[0113] Where k represents the number of fragments; n represents the character length; m represents the number of bits; and n mod m represents the remainder when the character length is divided by the number of fragments.
[0114] In this embodiment, when the character length of the ciphertext digest is divisible by the number of bits of the information substitution bits, the number of fragments is the quotient between the character length of the ciphertext digest and the number of bits of the information substitution bits; when the character length of the ciphertext digest is not divisible by the number of bits of the information substitution bits, the number of fragments is the quotient between the character length of the ciphertext digest and the number of bits of the information substitution bits plus one.
[0115] In some alternative embodiments, step 208 includes:
[0116] For each timestamp, the watermark fragments corresponding to the ciphertext digest are randomly inserted into the information replacement bits of the timestamp to generate the marked original data.
[0117] As an example, when the terminal uses the highest precision bit among the timestamps as the first preset precision bit, it can further divide the ciphertext digest into fragments according to the number of bits of the highest precision bit in the timestamp, to obtain at least one watermark fragment. Then, the terminal randomly inserts the k watermark fragments into any bit in the highest precision bit of each timestamp, so as to replace the data originally stored in the highest precision bit of the timestamp with the k watermark fragments.
[0118] In some optional embodiments, step 2066 further includes:
[0119] According to the segmentation order of each watermark segment, obtain the sorting information corresponding to each watermark segment;
[0120] Step 208 also includes:
[0121] Based on the precision information, the information marker bits for each timestamp are determined;
[0122] Insert sorting information corresponding to each watermark fragment in the information replacement bit into the information marker bit.
[0123] The sorting information corresponding to the watermark fragments is used to identify the specific location of information in different parts of the ciphertext digest.
[0124] The information marker bit refers to the position in the timestamp used to store the sorting information corresponding to the watermark fragments. When the timestamp is represented using YYYY-MM-DD-HH-MM-ss-SSS, the information marker bit can be at least one of YYYY, MM, DD, HH, MM, ss, and SSS. As an example, when the information replacement bit is the SSS bit, the information marker bit can be the SS bit. The information replacement bit and the information marker bit are both in the timestamp, and their positions do not conflict with each other. In this embodiment, the sorting information corresponding to the watermark fragments is used to cover and replace the original time-related information in the timestamp. By using a relatively ambiguous time representation of the timestamp, the sorting information corresponding to the watermark fragments is marked in the timestamp.
[0125] As an example, when the terminal determines that the number of fragments is 60 according to the character length of the ciphertext digest and the number of bits of the information replacement bits, the terminal divides the ciphertext digest into 60 equal parts and sorts the 60 watermark fragments in the order of division to obtain sorting numbers from 0 to 59, which are used as sorting information for the 60 watermark fragments that are divided in sequence.
[0126] The terminal can use the second preset precision bit of the timestamp as an information marker bit based on the precision information. The second preset precision bit can be, for example, the second highest precision bit in the timestamp. When the timestamp is represented as YYYY-MM-DD-HH-MM-ss, the first preset precision bit can be the ss bit and the second preset precision bit can be the HH bit. When the timestamp is represented as YYYY-MM-DD-HH-MM-ss-SSS, the first preset precision bit can be the SSS bit and the second preset precision bit can be the ss bit.
[0127] By using the second preset precision bit as the information marker bit, the sorting information of the watermark fragments can be marked in the timestamp by modifying the content with the least impact on the time information. This identifies the sorting information of the watermark fragments inserted in the timestamp, thereby binding the sorting information of the watermark fragments into the original data at the cost of a small degree of obfuscation of the timestamp content, so that the watermark fragments can be spliced and restored based on the sorting information in the future.
[0128] In some alternative embodiments, step 208 includes:
[0129] For each timestamp, the watermark fragments corresponding to the ciphertext digest are randomly inserted into the information replacement bits of the timestamp, and the sorting information corresponding to each watermark fragment is inserted into the information marker bits of the timestamp to generate the marked original data.
[0130] As an example, when the terminal uses the highest precision bit among the timestamps as the first preset precision bit and the second highest precision bit among the timestamps as the second preset precision bit, it can further segment the ciphertext digest according to the number of bits of the highest precision bit among the timestamps to obtain at least one watermarked bit. Then, the terminal randomly inserts the k watermarked bits into any bit in the highest precision bit of each timestamp to replace the data originally stored in the highest precision bit of the timestamp with the k watermarked bits. Furthermore, the sorting information corresponding to each watermarked bit is inserted into the second highest precision bit of the timestamp to obtain at least one timestamp after watermarking. The original data carrying the watermarked timestamp is the original data after marking.
[0131] It should be noted that when the raw data contains multiple timestamps, the precision of each timestamp may be the same or different. If the precision of all timestamps is the same, after the terminal uses the first preset precision bit of the first timestamp as the information replacement bit and the second preset precision bit as the information marker bit, it can directly use the precision bits corresponding to other timestamps as the information replacement bits and information marker bits without further confirmation. For example, when all timestamps in the raw data are represented as YYYY-MM-DD-HH-MM-ss-SSS, the first preset precision bit of the first timestamp is the highest precision bit (SSS bit), and the second preset precision bit of the first timestamp is the second highest precision bit (SS bit). Therefore, when marking other timestamps, the terminal does not need to separately confirm the information replacement bits and information marker bits; it can directly use the SSS bits of other timestamps as the information replacement bits and the SS bits of other timestamps as the information marker bits. This simplifies the data processing process and speeds up the marking of the raw data.
[0132] When the precision of different timestamps is different, the terminal, based on the precision information of the first timestamp, uses the first preset precision bit as the information replacement bit and the second preset precision bit as the information marker bit. Then, it can determine the information replacement bits and information marker bits for other timestamps according to the order of the precision bits corresponding to the first and second preset precision bits in the first timestamp. For example, when all timestamps in the original data are represented as YYYY-MM-DD-HH-MM-ss-SSS, the first preset precision bit of the first timestamp is the highest precision bit, i.e., the SSS bit, and the second preset precision bit of the first timestamp is the second highest precision bit, i.e., the SS bit. Therefore, when the terminal marks other timestamps, it can similarly use the highest precision bit as the information replacement bit and the second highest precision bit as the information marker bit. For instance, when the second timestamp is represented as YYYY-MM-DD-HH-MM-ss, the information replacement bit of the second timestamp is also the highest precision bit, i.e., the SS bit, and the information marker bit of the second timestamp is also the second highest precision bit, i.e., the MM bit.
[0133] The aforementioned watermarking process can generate multiple specially designed enhanced watermark elements based on the original data, building upon pre-set original watermark elements. This ensures that the final encrypted digest reflects the characteristics of the original data, guaranteeing its uniqueness and recognizability. Furthermore, it allows for the encryption of individual original and enhanced watermark elements through separate modules, ensuring the security of the encryption process and improving the stability of the final encrypted digest. Additionally, it uses the timestamps in the original data as watermark markers, removing primary key dependencies without compromising the original data content. By writing the watermarks after data segmentation and the sorting information corresponding to each segment into the timestamps, the watermarks and original data are forcibly bound. This not only effectively prevents malicious forgery and tampering of the encrypted digest but also facilitates subsequent watermark extraction and restoration, thereby enhancing the security of the original data during its use. The system features high security, minimal data loss, and resistance to damage.
[0134] like Figure 5 As shown, based on the same inventive concept, this application also provides a watermark extraction method. It is understood that this watermark extraction method can also be applied to the aforementioned terminal 102, server 104, and the system including terminal 102 and server 104. Alternatively, this watermark extraction method can also be applied to other terminals and servers, and implemented through interaction between other terminals and servers and the aforementioned terminal 102 and server 104. The watermark extraction method includes:
[0135] Step 502: In response to the extraction command, obtain the data to be processed corresponding to the extraction command; the data to be processed is the original data after marking obtained by the watermarking method in any of the above embodiments;
[0136] Step 504: Extract the watermark fragments carried by each timestamp from the timestamps contained in the data to be processed;
[0137] Step 506: Segment the watermark fragments to obtain the encrypted digest;
[0138] Step 508: Decrypt the ciphertext digest to obtain at least one of the original watermark element and the enhanced watermark element corresponding to the ciphertext digest.
[0139] Extraction instructions refer to instructions that extract watermarks from specific data.
[0140] The data volume refers to the quantity or size of the data to be processed for watermark extraction. The data volume can also refer to the number of rows, columns, etc.
[0141] As an example, when the timestamps in the tagged original data contain sorting information of watermark fragments, the terminal can extract the sorting information corresponding to each watermark fragment in the second preset precision bit of the timestamp while extracting the watermark fragments in the first preset precision bit of the timestamp in step 504. Subsequently, in step 506, the terminal can arrange and splice each watermark fragment in sequence according to the sorting information of each watermark fragment to obtain the encrypted digest.
[0142] The decryption process in step 506 corresponds to the encryption process of the enhanced watermark element and the original watermark element in step 204. When the watermark extraction method in this embodiment is applied to other terminals and servers, and the enhanced watermark element and the original watermark element are encrypted using a symmetric encryption algorithm in step 204, the decryption process in step 506 may include: issuing an acquisition command to terminal 102 or server 104 to obtain the key corresponding to the symmetric encryption algorithm, and then using the key to decrypt the ciphertext digest carried by the data to be extracted, to obtain at least one of the original watermark element and the enhanced watermark element corresponding to the ciphertext digest.
[0143] Alternatively, when the watermark extraction method in this embodiment is applied to other terminals and servers, and when an asymmetric encryption algorithm is used to encrypt the enhanced watermark element and the original watermark element in step 204, the decryption process in step 506 may include: issuing an acquisition command to terminal 102 or server 104 to obtain the private key corresponding to the asymmetric encryption algorithm, and then using the private key to decrypt the ciphertext digest carried by the data to be extracted, to obtain at least one of the original watermark element and the enhanced watermark element corresponding to the ciphertext digest.
[0144] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0145] Based on the same inventive concept, this application also provides a watermark adding device for implementing the watermark adding method described above, and a watermark extraction device for implementing the watermark extraction method described above. The solutions provided by these watermark adding and extraction devices are similar to the solutions described in the watermark adding and extraction methods above. Therefore, the specific limitations of one or more watermark adding and extraction device embodiments provided below can be found in the limitations of the watermark adding and extraction methods described above, and will not be repeated here.
[0146] In one embodiment, such as Figure 6 As shown, a watermark adding device 600 is provided, comprising:
[0147] The first extraction module 602 is used to extract at least one enhanced watermark element from the original data corresponding to the processing instruction in response to the processing instruction.
[0148] The determination module 604 is used to determine the encrypted digest based on the enhanced watermark element and at least one pre-set original watermark element;
[0149] The fragmentation module 606 is used to fragment the ciphertext digest based on at least one timestamp contained in the original data to obtain at least one watermark fragment.
[0150] The marking module 608 is used to insert watermark fragments into the information replacement bits of each timestamp to generate the marked raw data.
[0151] In some optional embodiments, the determining module 604 is further configured to:
[0152] Encrypt at least one enhanced watermark element and at least one original watermark element separately;
[0153] The encrypted digest is determined based on the encrypted enhanced watermark elements and the encrypted original watermark elements.
[0154] In some optional embodiments, the determining module 604 is further configured to:
[0155] The encrypted enhanced watermark element and the encrypted original watermark element are randomly combined to obtain the ciphertext digest;
[0156] Alternatively, any encrypted enhanced watermark element can be used as the ciphertext digest;
[0157] Alternatively, any encrypted original watermark element can be used as the ciphertext digest.
[0158] In some optional embodiments, the timestamp includes precision information;
[0159] The sharding module 606 is also configured as follows:
[0160] Based on the precision information, determine the information replacement bits;
[0161] Based on the information replacement bits, the ciphertext digest is segmented to obtain watermarked segments.
[0162] In some optional embodiments, the fragmentation module 606 is also configured to:
[0163] Based on the precision information, the first preset precision bit of the timestamp is used as the information replacement bit.
[0164] In some optional embodiments, the fragmentation module 606 is also configured to:
[0165] Get the character length corresponding to the ciphertext digest;
[0166] The number of fragments is determined based on the number of bits corresponding to the information replacement bits and the character length;
[0167] Based on the number of segments, the character length is segmented to obtain watermark segments.
[0168] In some optional embodiments, the fragmentation module 606 is also configured to process the number of uses using the following formula:
[0169]
[0170] Where k represents the number of fragments; n represents the character length; m represents the number of bits; and n mod m represents the remainder when the character length is divided by the number of fragments.
[0171] In some optional embodiments, the marking module 608 is further configured to:
[0172] For each timestamp, the watermark fragments corresponding to the ciphertext digest are randomly inserted into the information replacement bits of the timestamp to generate the marked original data.
[0173] In some optional embodiments, the fragmentation module 606 is also configured to:
[0174] According to the segmentation order of each watermark segment, obtain the sorting information corresponding to each watermark segment;
[0175] The tag module 608 is also configured as follows:
[0176] Based on the precision information, the information marker bits for each timestamp are determined;
[0177] Insert sorting information corresponding to each watermark fragment in the information replacement bit into the information marker bit.
[0178] In some optional embodiments, the fragmentation module 606 is also configured to:
[0179] Based on the precision information, the second preset precision bit of the timestamp is used as the information replacement bit.
[0180] In some optional embodiments, the marking module 608 is further configured to:
[0181] For each timestamp, the watermark fragments corresponding to the ciphertext digest are randomly inserted into the information replacement bits of the timestamp, and the sorting information corresponding to each watermark fragment is inserted into the information marker bits of the timestamp to generate the marked original data.
[0182] In one embodiment, such as Figure 7 As shown, a watermark extraction device 700 is provided, comprising:
[0183] The acquisition module 702 is used to acquire the data to be processed corresponding to the extraction command in response to the extraction command; the data to be processed is the original data after marking obtained by the watermarking method in any of the above embodiments;
[0184] The second extraction module 704 is used to extract watermark fragments carried by each timestamp from the timestamps contained in the data to be processed.
[0185] The splicing module 706 is used to splice watermark fragments to obtain a ciphertext digest;
[0186] The decryption module 708 is used to decrypt the ciphertext digest to obtain at least one of the original watermark element and the enhanced watermark element corresponding to the ciphertext digest.
[0187] Each module in the above-mentioned device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0188] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a watermarking method or a watermark extraction method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0189] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0190] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the watermark addition method or watermark extraction method of any of the above embodiments.
[0191] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the watermark addition method or watermark extraction method of any of the above embodiments.
[0192] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0193] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0194] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for adding a watermark, characterized in that, include: In response to a processing instruction, at least one enhanced watermark element is extracted from the original data corresponding to the processing instruction; Based on the enhanced watermark element and at least one pre-set original watermark element, a ciphertext digest is determined. Based on at least one timestamp contained in the original data, the encrypted digest is fragmented to obtain at least one watermark fragment; Insert the watermark fragment into the information replacement bits of each timestamp to generate the marked original data; The timestamp contains precision information; Before segmenting the ciphertext digest based on at least one timestamp contained in the original data to obtain at least one watermarked segment, the method further includes: Based on the precision information, the information replacement bits are determined; The step of segmenting the ciphertext digest based on at least one timestamp contained in the original data to obtain at least one watermarked segment includes: Based on the information replacement bits, the ciphertext digest is segmented to obtain the watermark segment.
2. The method according to claim 1, characterized in that, The step of determining the encrypted digest based on the enhanced watermark element and at least one pre-set original watermark element includes: At least one of the enhanced watermark elements and at least one of the original watermark elements are individually encrypted; The encrypted digest is determined based on the encrypted enhanced watermark elements and the encrypted original watermark elements.
3. The method according to claim 2, characterized in that, The process of determining the ciphertext digest based on the encrypted enhanced watermark elements and the encrypted original watermark elements includes: The encrypted enhanced watermark element and the encrypted original watermark element are randomly combined to obtain the ciphertext digest; Alternatively, any encrypted enhanced watermark element may be used as the ciphertext digest; Alternatively, any encrypted original watermark element can be used as the ciphertext digest.
4. The method according to claim 1, characterized in that, Determining the information replacement bit based on the precision information includes: Based on the precision information, the first preset precision bit of the timestamp is used as the information replacement bit.
5. The method according to claim 1, characterized in that, The step of segmenting the ciphertext digest based on the information replacement bits to obtain the watermarked segments includes: Obtain the character length corresponding to the ciphertext digest; The number of fragments is determined based on the number of bits corresponding to the information replacement bits and the character length; Based on the number of segments, the character length is segmented to obtain the watermark segments.
6. The method according to claim 5, characterized in that, The step of determining the number of fragments based on the number of bits corresponding to the information replacement bits and the character length is performed using the following formula to obtain the number of fragments: Where k represents the number of fragments; n represents the character length; m represents the number of bits; and n mod m represents the remainder when the character length is divided by the number of fragments.
7. The method according to claim 1, characterized in that, The step of inserting the watermark fragment into the information replacement bits of each timestamp to generate the marked original data includes: For each timestamp, the watermark fragments corresponding to the ciphertext digest are randomly inserted into the information replacement bits of the timestamp to generate the marked original data.
8. The method according to claim 5, characterized in that, The step of dividing the character length into segments based on the number of segments to obtain the watermark segments further includes: According to the segmentation order of each watermark segment, obtain the sorting information corresponding to each watermark segment; The step of inserting the watermark fragment into the information replacement bits of each timestamp to generate the marked original data further includes: Based on the accuracy information, the information marker bits of each timestamp are determined; In the information marker bits, sorting information corresponding to each watermark fragment in the information replacement bits is inserted.
9. The method according to claim 8, characterized in that, The step of determining the information marker bits for each timestamp based on the precision information includes: Based on the precision information, the second preset precision bit of the timestamp is used as the information replacement bit.
10. The method according to claim 8, characterized in that, The step of inserting the watermark fragment into the information replacement bits of each timestamp to generate the marked original data includes: For each timestamp, the watermark fragments corresponding to the ciphertext digest are randomly inserted into the information replacement bits of the timestamp, and the sorting information corresponding to each watermark fragment is inserted into the information marker bits of the timestamp to generate the marked original data.
11. A watermark extraction method, characterized in that, include: In response to an extraction command, the data to be processed corresponding to the extraction command is obtained; The data to be processed is the original data after marking obtained by the watermarking method according to any one of claims 1-10; Extract the watermark fragments carried by each timestamp from the data to be processed; By splicing the watermark fragments, a ciphertext digest is obtained; Decrypt the ciphertext digest to obtain at least one of the original watermark element and the enhanced watermark element corresponding to the ciphertext digest.
12. A watermark adding device, characterized in that, include: The first extraction module is used to extract at least one enhanced watermark element from the original data corresponding to the processing instruction in response to the processing instruction. The determination module is used to determine the encrypted digest based on the enhanced watermark element and at least one pre-set original watermark element; The fragmentation module is used to fragment the ciphertext digest based on at least one timestamp contained in the original data to obtain at least one watermark fragment. The marking module is used to insert the watermark fragments into the information replacement bits of each timestamp to generate the marked original data; The timestamp contains precision information; The sharding module is also configured to: Based on the precision information, the information replacement bits are determined; Based on the information replacement bits, the ciphertext digest is segmented to obtain the watermark segment.
13. A watermark extraction device, characterized in that, include: The acquisition module is used to acquire the data to be processed corresponding to the extraction command in response to the extraction command; The data to be processed is the original data after marking obtained by the watermarking method according to any one of claims 1-10; The second extraction module is used to extract watermark fragments carried by each timestamp from the timestamps contained in the data to be processed. The splicing module is used to splice the watermark fragments to obtain the encrypted digest; The decryption module is used to decrypt the ciphertext digest to obtain at least one of the original watermark element and the enhanced watermark element corresponding to the ciphertext digest.
14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the watermark addition method according to any one of claims 1 to 10 or the watermark extraction method according to claim 11.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the watermark addition method according to any one of claims 1 to 10 or the watermark extraction method according to claim 11.
16. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the watermark addition method according to any one of claims 1 to 10 or the watermark extraction method according to claim 11.
Citation Information
Patent Citations
Watermark embedding and detecting method and device
CN110457873A
Text encryption method and device, electronic equipment and storage medium
CN115828281A