Material encryption method, device, equipment, storage medium and program product

By generating an encrypted string based on device information and determining the pixel coordinates and pattern of the material for encryption processing, the problem of low reliability of material encryption is solved and the encryption efficiency and credibility of the material are improved.

CN118821165BActive Publication Date: 2025-09-05CHINA MOBILE FINANCIAL TECHNOLOGY CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410217646.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-27
Publication Date
2025-09-05
Estimated Expiration
2044-02-27

AI Technical Summary

Technical Problem

The existing material encryption method has low reliability and cannot effectively ensure the credibility of the material, making the material easy to be tampered with and forged.

Method used

Generate an encryption string based on the device information of the material supplier, determine the pixel coordinates and encryption mode of the material to be encrypted, and implement encryption through pixel processing.

Benefits of technology

It improves the efficiency and difficulty of material encryption, avoids tampering and falsification caused by material cracking, and ensures the credibility of the material.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118821165B_ABST
    Figure CN118821165B_ABST
Patent Text Reader

Abstract

The present invention discloses a material encryption method, device, equipment, storage medium and program product. The method generates an encryption string based on device information of a material supply end, determines the coordinates of the to-be-encrypted pixel points and the encryption mode of the to-be-encrypted material provided by the material supply end according to the encryption string, and processes the pixel points corresponding to the coordinates of the to-be-encrypted pixel points based on the encryption mode to complete the encryption processing of the to-be-encrypted material. Since the present invention generates an encryption string based on the device information of the material supply end, thereby ensuring the uniqueness and validity of the string, determines the coordinates of the to-be-encrypted pixel points and the encryption mode of the to-be-encrypted material according to the encryption string, and processes the pixel points corresponding to the coordinates of the to-be-encrypted pixel points based on the encryption mode, thereby effectively improving the material encryption efficiency, effectively improving the difficulty of encryption cracking, avoiding the problem of material forgery and tampering caused by encryption cracking, and ensuring the credibility of material encryption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of encryption technology, and in particular to a material encryption method, device, equipment, storage medium and program product. Background Art

[0002] Currently, watermarking is used to encrypt images, videos and other materials to ensure the authenticity of the materials. Therefore, the encryption reliability is low, and watermarking alone cannot be used to prove credibility. In other words, the current material encryption method cannot effectively ensure the reliability of the materials, resulting in the materials being easily tampered with and forged. Summary of the Invention

[0003] The main purpose of the present invention is to provide a material encryption method, device, equipment, storage medium and program product, aiming to solve the technical problem that the existing technology has low encryption reliability, cannot ensure the credibility of the encrypted material, and makes the material easy to be tampered with and forged.

[0004] To achieve the above object, the present invention provides a material encryption method, which includes the following steps:

[0005] Generate an encrypted string based on the device information of the material supplier;

[0006] Determining the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the encrypted character string;

[0007] The pixel points corresponding to the coordinates of the pixel points to be encrypted are processed based on the encryption mode to complete the encryption processing of the material to be encrypted.

[0008] Optionally, determining the coordinates of pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the encrypted character string includes:

[0009] Generate random numbers based on a preset generation strategy;

[0010] Determining whether the encrypted string needs to be segmented according to the random number;

[0011] If the encrypted string needs to be segmented, at least one segmentation mark is generated based on the random number, and the encrypted string is segmented based on the segmentation mark, and the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier are determined according to the segmentation result;

[0012] If the encrypted string does not need to be segmented, the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier are determined according to the characters in the encrypted string and the character sequence corresponding to the characters.

[0013] Optionally, segmenting the encrypted character string based on the segmentation corner mark and determining the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the segmentation result includes:

[0014] When the random number is a first value, segmenting the encrypted character string into a first character segment and a second character segment based on the segmentation superscript;

[0015] Determine the horizontal coordinate of the pixel point according to the first character segment, and determine the vertical coordinate of the pixel point according to the second character segment;

[0016] Determining the coordinates of the pixels to be encrypted of the material to be encrypted provided by the material supplier based on the horizontal coordinates and the vertical coordinates of the pixels;

[0017] Perform an AND operation on a first operation character in the first character segment and a second operation character in the second character segment;

[0018] An encryption mode of the material to be encrypted is determined based on the AND operation result.

[0019] Optionally, segmenting the encrypted character string based on the segmentation corner mark and determining the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the segmentation result includes:

[0020] When the random number is not less than a second value, dividing the encrypted character string into a plurality of initial character segments based on the segmentation corner mark;

[0021] Sort and combine the multiple initial character segments to obtain multiple target character segments, wherein the multiple target character segments include a horizontal axis character segment, a vertical axis character segment, and an encryption mode character segment;

[0022] Determine the horizontal coordinate of the pixel point according to the horizontal coordinate character segment, and determine the vertical coordinate of the pixel point according to the vertical coordinate character segment;

[0023] Determining the coordinates of the pixels to be encrypted of the material to be encrypted provided by the material supplier based on the horizontal coordinates and the vertical coordinates of the pixels;

[0024] Performing an AND operation based on the characters in the encryption mode character segment;

[0025] An encryption mode of the material to be encrypted is determined based on the AND operation result.

[0026] Optionally, determining the coordinates of pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the encrypted character string includes:

[0027] Determining the coordinates of pixels to be encrypted of the material to be encrypted provided by the material supplier according to the encrypted character string;

[0028] Traversing each adjacent pixel point in the material to be encrypted based on the coordinates of the pixel point to be encrypted, and obtaining the RGB color value of each adjacent pixel point;

[0029] Determine an average color value based on the RGB color values ​​of each adjacent pixel;

[0030] An encryption mode is determined based on the average color value and the encrypted character string.

[0031] Optionally, determining the coordinates of pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the encrypted character string includes:

[0032] Determining the coordinates of pixels to be encrypted of the material to be encrypted provided by the material supplier according to the encrypted character string;

[0033] Traverse each pixel in the material to be encrypted and obtain the RGB color value of each pixel;

[0034] Constructing an initial color value set based on the RGB color values;

[0035] Subtracting the preset color value set from the initial color value set to obtain a target color value set;

[0036] An encryption mode is determined based on the target color value set and the encrypted string.

[0037] In addition, to achieve the above-mentioned purpose, the present invention further provides a material encryption device, the material encryption device comprising:

[0038] A string generation module is used to generate an encrypted string based on the device information of the material supplier;

[0039] A string parsing module, configured to determine, based on the encrypted string, the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier;

[0040] The pixel encryption module is used to process the pixel points corresponding to the coordinates of the pixel points to be encrypted based on the encryption mode to complete the encryption processing of the material to be encrypted.

[0041] In addition, to achieve the above-mentioned purpose, the present invention also proposes a material encryption device, which includes: a memory, a processor, and a material encryption program stored in the memory and executable on the processor, wherein the material encryption program is configured to implement the steps of the material encryption method described above.

[0042] In addition, to achieve the above-mentioned purpose, the present invention further proposes a storage medium, on which a material encryption program is stored. When the material encryption program is executed by a processor, the steps of the material encryption method described above are implemented.

[0043] In addition, to achieve the above-mentioned object, the present invention further provides a computer program product, which includes a material encryption program. When the material encryption program is executed by a processor, the steps of the material encryption method described above are implemented.

[0044] The present invention generates an encryption string based on device information of a material supply end, determines the coordinates of the to-be-encrypted pixel points and the encryption mode of the to-be-encrypted material provided by the material supply end according to the encryption string, and processes the pixel points corresponding to the coordinates of the to-be-encrypted pixel points based on the encryption mode to complete the encryption processing of the to-be-encrypted material; since the present invention generates an encryption string based on device information of the material supply end, thereby ensuring the uniqueness and validity of the string, determines the coordinates of the to-be-encrypted pixel points and the encryption mode of the to-be-encrypted material according to the encryption string, and processes the pixel points corresponding to the coordinates of the to-be-encrypted pixel points based on the encryption mode, thereby effectively improving the material encryption efficiency, effectively improving the difficulty of encryption cracking, avoiding the problem of material falsification and tampering caused by encryption cracking, and ensuring the credibility of material encryption. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a structural diagram of a material encryption device in a hardware operating environment involved in an embodiment of the present invention;

[0046] Figure 2 This is a flow chart of a first embodiment of a material encryption method according to the present invention;

[0047] Figure 3 This is a flow chart of a second embodiment of the material encryption method of the present invention;

[0048] Figure 4 This is a schematic diagram of the material pixel encryption process in the second embodiment of the material encryption method of the present invention;

[0049] Figure 5 This is a flow chart of a third embodiment of the material encryption method of the present invention;

[0050] Figure 6 This is a schematic diagram of adjacent pixels in the third embodiment of the material encryption method of the present invention;

[0051] Figure 7 This is a structural block diagram of the first embodiment of the material encryption device of the present invention.

[0052] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION

[0053] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0054] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of a material encryption device in a hardware operating environment according to an embodiment of the present invention.

[0055] like Figure 1 As shown, the material encryption device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to implement communication between these components. The user interface 1003 may include a display screen and an input unit such as a keyboard. Optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a wireless fidelity (WI-FI) interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk storage device. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0056] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the material encryption device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0057] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a material encryption program.

[0058] exist Figure 1 In the material encryption device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the material encryption device of the present invention can be set in the material encryption device, and the material encryption device calls the material encryption program stored in the memory 1005 through the processor 1001 and executes the material encryption method provided by the embodiment of the present invention.

[0059] The embodiment of the present invention provides a material encryption method, referring to Figure 2 , Figure 2 FIG. 1 is a flow chart of a first embodiment of a material encryption method according to the present invention.

[0060] In this embodiment, the material encryption method includes the following steps:

[0061] Step S10: Generate an encrypted string based on the device information of the material supplier.

[0062] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, mobile phone, etc., or an electronic device capable of performing the above functions. The following uses a material encryption device as an example to illustrate this embodiment and the following embodiments.

[0063] It is understood that the material supplier may be a user who provides the original material, such as a material supplier, and the material may be an image and / or video. The device information may be relevant information of the material supplier, for example, the device information may include a timestamp, a user ID, GPS location coordinates, and other information.

[0064] It should be understood that, in this embodiment, a digital string based on encryption can be generated based on a combination of a timestamp, a user account ID (user ID), and GPS coordinates as a unique digital string.

[0065] It should be noted that in this embodiment, in order to effectively and uniquely distinguish different combinations of device model, time, account, and geographic location, timestamp, user account ID userId, and GPS coordinates are selected as the unique digital string combination. The material encryption device allows the same account to log in to the same device at the same time.

[0066] It can be understood that this embodiment generates an encrypted string based on device information, thereby achieving uniqueness assurance. For example: at the same time, the same account can only be logged in and used under the same device. At this time, the address must be the same address, so the unique digital string can be guaranteed; at the same time, different accounts, at the same place, due to the different userIds, the unique digital string can be guaranteed; at the same time, different accounts, at different places, due to the different userIds and GPS coordinates, the unique digital string can be guaranteed; at different times, the same account, at the same place, due to the different timestamps, the unique digital string can be guaranteed; at different times, the same account, at different places, due to the different userIds and GPS coordinates, the unique digital string can be guaranteed; at different times, different accounts, at the same place, due to the different userIds and timestamps, the unique digital string can be guaranteed; at different times, different accounts, at different places, due to the different userIds, GPS coordinates and timestamps, the unique digital string can be guaranteed.

[0067] In a specific implementation, the combined structure of the encrypted string can be: timestamp (read to nanoseconds) + userId (the length of userId of different users is different, for example, the length of 1 digit (1-9), 2 digits (10-99), 3 digits (100-999), 4 digits (1000-9999), 5 digits (10000-99999), etc.) + longitude of GPS coordinates (the decimal point can be removed, for example, 121.47187138 is written as 12147187138 here) + latitude of GPS coordinates (the decimal point is removed, for example, 31.2327951763 is written as 312327951763 here).

[0068] Step S20: determining the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the encrypted character string.

[0069] It should be noted that the material to be encrypted can be a picture or video to be encrypted, for example, the material to be encrypted can be a traceability picture and / or traceability video that needs to be encrypted, and the material supplier can be a supplier of the traceability material. Pictures and videos are effective traceability methods, but the pictures and videos uploaded by merchants themselves have the disadvantages of being easy to falsify and having high detection costs. Therefore, it is often necessary to provide certain traceability technical means to prevent the falsification of pictures and videos. Therefore, this embodiment encrypts the material to ensure the reliability and credibility of the traceability material.

[0070] It is understood that the pixel to be encrypted may be a pixel to be encrypted in a frame of the material to be encrypted, for example, the pixel to be encrypted may be a pixel in the first frame of the material to be encrypted. The encryption mode may be a mode for encrypting the pixel to be encrypted, for example, the RGB color value of the pixel to be encrypted may be adjusted for encryption.

[0071] It should be understood that this embodiment can determine the coordinates of the pixels to be encrypted of the material to be encrypted provided by the material supplier according to the encrypted character string, and determine the pixels to be encrypted in the material to be encrypted based on the coordinates of the pixels to be encrypted.

[0072] In some embodiments, the material encryption device can encrypt the first frame image of the material to be encrypted, thereby using the first frame image as the image frame to be encrypted of the material to be encrypted, and determining the coordinates of the pixels to be encrypted and the encryption mode in the image frame to be encrypted based on the encrypted string.

[0073] Step S30: Processing the pixel points corresponding to the coordinates of the pixel points to be encrypted based on the encryption mode to complete the encryption processing of the material to be encrypted.

[0074] It can be understood that the material encryption device determines the encrypted color value of the pixel to be encrypted based on the encryption mode, and adjusts the color value of the pixel corresponding to the coordinate of the pixel to be encrypted in the encrypted material based on the encrypted color value to complete the encryption processing of the material to be encrypted.

[0075] In a specific implementation, the material encryption device adds the encryption pattern to the frame image to be encrypted (for example, the first frame image) of the material to be encrypted based on the coordinates of the pixel points to be encrypted.

[0076] In some embodiments, the material encryption device may add a timestamp, user account ID, and location coordinates to the dark watermark encrypted ciphertext of the material to be encrypted in order to verify the source of the material after it is uploaded to the service segment.

[0077] This embodiment generates an encryption string based on the device information of the material supply end, determines the coordinates of the to-be-encrypted pixel points and the encryption mode of the to-be-encrypted material provided by the material supply end according to the encryption string, and processes the pixel points corresponding to the coordinates of the to-be-encrypted pixel points based on the encryption mode to complete the encryption processing of the to-be-encrypted material; since this embodiment generates an encryption string based on the device information of the material supply end, thereby ensuring the uniqueness and validity of the string, determines the coordinates of the to-be-encrypted pixel points and the encryption mode of the to-be-encrypted material according to the encryption string, and processes the pixel points corresponding to the coordinates of the to-be-encrypted pixel points based on the encryption mode, thereby effectively improving the material encryption efficiency, effectively improving the difficulty of encryption cracking, avoiding the problem of material falsification and tampering caused by encryption cracking, and ensuring the credibility of material encryption.

[0078] refer to Figure 3 , Figure 3 FIG. 1 is a flow chart of a second embodiment of a material encryption method according to the present invention.

[0079] Based on the above first embodiment, in this embodiment, step S20 further includes:

[0080] Step S21: Generate a random number based on a preset generation strategy.

[0081] It should be noted that the material encryption device may generate a random number based on a preset generation strategy, for example, a random number N within 10, and the material encryption device may determine whether the encrypted string needs to be segmented based on the random number.

[0082] Step S22: Determine whether the encrypted string needs to be segmented according to the random number.

[0083] It is understandable that the material encryption device can generate N data with a size between (0 and the length of the encrypted string) according to the random number N as subscripts for segmenting the encrypted string.

[0084] It should be understood that when the random number N=0, the encrypted string itself is not segmented; if N=1, the encrypted string is segmented into two segments, marked as the first character segment and the second character segment; if N≥2, the encrypted string is segmented into three or more character segments.

[0085] Step S23: If the encrypted string needs to be segmented, at least one segmentation mark is generated based on the random number, and the encrypted string is segmented based on the segmentation mark. The coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier are determined according to the segmentation result.

[0086] It should be noted that when the random number is not 0, it is determined that the encrypted string needs to be split. The material encryption device can generate N data with a size between (0, encrypted string length) as split corner marks for splitting the encrypted string based on the random number N, and split the encrypted string based on the split corner marks. According to the splitting results, the coordinates of the encrypted pixel points and the encryption mode of the material to be encrypted provided by the material supplier are determined.

[0087] Furthermore, when the random number is the first value, in order to accurately determine the pixel to be encrypted and the encryption mode, step S23 may include:

[0088] Step S231: When the random number is a first value, segmenting the encrypted character string into a first character segment and a second character segment based on the segmentation superscript;

[0089] Step S232: determining the horizontal coordinate of the pixel point according to the first character segment, and determining the vertical coordinate of the pixel point according to the second character segment;

[0090] Step S233: determining the coordinates of the pixels to be encrypted of the material to be encrypted provided by the material supplier based on the horizontal and vertical coordinates of the pixels;

[0091] Step S234: performing an AND operation on the first operation character in the first character segment and the second operation character in the second character segment;

[0092] Step S235: Determine the encryption mode of the material to be encrypted based on the AND operation result.

[0093] It is understandable that the first value may be 1. When the random number N=1, the encrypted string is divided into two segments, marked as the first character segment and the second character segment. In this case, the first character segment and the second character segment are grouped into three digits each.

[0094] In each group of numbers, the first two digits of the first character segment are the horizontal coordinate X of the device resolution, and the first two digits of the second character segment are the vertical coordinate Y of the device resolution. At this time, (X, Y) is the coordinate value of the encrypted pixel point. The third digit of the first character segment and the third digit of the second character segment are ANDed. If the result is an odd number, the pixel with coordinates (X, Y) is set to white, that is, 0; if the result is an even number, the encryption mode is determined based on a random color that does not exist in the encrypted frame image of the material to be encrypted.

[0095] Furthermore, when the random number is not less than the second value, in order to accurately determine the pixel to be encrypted and the encryption mode, step S23 may include:

[0096] When the random number is not less than a second value, dividing the encrypted character string into a plurality of initial character segments based on the segmentation corner mark;

[0097] Sort and combine the multiple initial character segments to obtain multiple target character segments, wherein the multiple target character segments include a horizontal axis character segment, a vertical axis character segment, and an encryption mode character segment;

[0098] Determine the horizontal coordinate of the pixel point according to the horizontal coordinate character segment, and determine the vertical coordinate of the pixel point according to the vertical coordinate character segment;

[0099] Determining the coordinates of the pixels to be encrypted of the material to be encrypted provided by the material supplier based on the horizontal coordinates and the vertical coordinates of the pixels;

[0100] Performing an AND operation based on the characters in the encryption mode character segment;

[0101] An encryption mode of the material to be encrypted is determined based on the AND operation result.

[0102] It should be noted that the second value can be 2, that is, when the random number N ≥ 2, that is, the digital string is divided into 3 or more segments, identified as initial character segments such as segment A, segment B, segment C, and segment D, then the data segments need to be sorted and then combined into 3 new segments of similar length, such as segment A, segment B, and segment C;

[0103] In the three-segment string of numbers, every two digits in segment a (i.e., the horizontal coordinate character segment) are the horizontal coordinate X of the device resolution, and every two digits in segment b (i.e., the vertical coordinate character segment) are the vertical coordinate Y of the device resolution. At this time, (X, Y) is the coordinate value of the encrypted pixel point. Every two digits in segment c (i.e., the encryption mode character segment) are ANDed. If the result is an odd number, the pixel at the coordinate (X, Y) is set to white, i.e., 0; if the result is an even number, the encryption mode is determined based on a random color that does not exist in the encrypted frame image of the material to be encrypted.

[0104] In a specific implementation, in order to further enhance the discreteness and randomness of the (X, Y) coordinates on the two-dimensional screen of the device, the coordinate and encryption mode determination process of pixel encryption can also be as follows:

[0105] If the number of segments N is greater than or equal to 2 and is an odd number, the segments are combined into three new segments of similar length, such as segment a, segment b, and segment c. A number is sequentially taken from each segment to form a set of arrays (a, b, c), (d, e, f), etc., where the third number in each group is used to represent the offset value of each set of horizontal coordinates. If the third number is odd, the pixel at the (X, Y) coordinate is set to white, that is, 0. If the result is even, the encryption mode is determined based on a random color that does not exist in the encrypted frame image of the encrypted material.

[0106] If the number of segments N is ≥ 2 and is even, group them into four new segments of similar length, such as a, b, c, and d. Sequentially take one number from each segment to form an array: A group of four numbers (a, b, c, d), (e, f, g, h), and so on. The third and fourth numbers in each group represent the offset values ​​of the horizontal and vertical coordinates of the group, respectively. AND the third and fourth numbers, resulting in z. If z is odd, set the pixel at the (X, Y) coordinate to white (0). If z is even, determine the encryption mode based on a random color not present in the encrypted frame image of the encrypted material.

[0107] The above calculation results can be represented by a three-dimensional array, such as (x, y, z). Where (x, y) is the coordinate value of the encrypted pixel point at the mobile phone screen resolution, and z is the encryption mode. If z = 1, the pixel at the (X, Y) coordinate is set to a specific color, i.e. 0; if z = 0, the encryption mode is determined based on a random color that does not exist in the encrypted frame image of the encrypted material.

[0108] Step S24: If the encrypted string does not need to be segmented, the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier are determined according to the characters in the encrypted string and the character sequence corresponding to the characters.

[0109] It should be noted that when the random number N = 0, the encrypted string itself is not split. In this case, the string is grouped into groups of 5 digits, where the first 2 digits of each group are the horizontal coordinate X of the device resolution, and the middle 2 digits of each group are the vertical coordinate Y of the device resolution. In this case, (X, Y) are the coordinates of the encrypted pixel point, and the 5th digit of each group is the encryption mode. If the 5th digit is an odd number, the pixel at the coordinate (X, Y) is set to white, i.e. 0; if the 5th digit is an even number, the encryption mode is determined based on a random color that does not exist in the encrypted frame image of the encrypted material.

[0110] It is understandable that, referring to Figure 4 , Figure 4 This is a schematic diagram of the material pixel encryption process. The material encryption device generates an encrypted string (that is, an encrypted basic digital string based on device information) and a random number. The number of segments of the encrypted string is determined based on the random number. Based on the number of segments, it is determined whether the encrypted string needs to be segmented. Based on the judgment result, encrypted pixels are generated and added to the material to be encrypted to complete the material encryption.

[0111] This embodiment generates a random number based on a preset generation strategy, and determines whether the encrypted string needs to be segmented based on the random number. If the encrypted string needs to be segmented, at least one segmentation superscript is generated based on the random number, and the encrypted string is segmented based on the segmentation superscript. The coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier are determined based on the segmentation results. If the encrypted string does not need to be segmented, the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier are determined based on the characters in the encrypted string and the character sequence corresponding to the characters. Since this embodiment adopts random and local encryption for pixel encryption, it can further enhance the encryption effect of the traceability material while ensuring that the visualization of the traceability material is not disturbed, and provide technical guarantees for the credibility of the chain.

[0112] refer to Figure 5 , Figure 5 FIG. 4 is a flow chart of a third embodiment of a material encryption method according to the present invention.

[0113] Based on the above embodiments, in this embodiment, in step S20, the method further includes:

[0114] Step S201: determining the coordinates of pixels to be encrypted of the material to be encrypted provided by the material supplier according to the encrypted character string.

[0115] It is understandable that the material encryption device determines the three-dimensional array identifier based on the encrypted character string, and extracts the coordinates of the pixel points to be encrypted based on the three-dimensional array identifier.

[0116] Step S202: traverse adjacent pixels in the material to be encrypted that are adjacent to the pixel to be encrypted based on the coordinates of the pixel to be encrypted, and obtain RGB color values ​​of the adjacent pixels.

[0117] It should be noted that the adjacent pixel points may be pixel points in the material to be encrypted that are adjacent to the pixel point to be encrypted.

[0118] It should be understood that referring to Figure 6 , Figure 6 As a schematic diagram of adjacent pixels, the material encryption device traverses the color values ​​corresponding to the adjacent coordinates around the (x, y) coordinate in the three-dimensional array identifier (x, y, z) mentioned above, that is, there are 8 coordinates, namely (x-1, y-1), (x, y-1), (x+1, y-1), (x-1, y), (x, y+1), (x+1, y-1), (x+1, y1), (x+1, y+1), and obtains the RGB color values ​​of the pixels corresponding to the above 8 coordinates.

[0119] Step S203: determining an average color value according to the RGB color values ​​of the adjacent pixels.

[0120] It is understandable that the material encryption device selects the RGB color values ​​of the adjacent pixels and performs average calculation to obtain a new average color value.

[0121] Step S204: Determine an encryption mode based on the average color value and the encrypted character string.

[0122] It is understandable that if the random number N is greater than or equal to 2, that is, the digital string is divided into three or more segments, identified as initial character segments such as segment A, segment B, segment C, and segment D, then the data segments need to be sorted and then combined into three new segments of similar length, such as segment A, segment B, and segment C;

[0123] In the three-segment string of numbers, every two digits in segment a (i.e., the horizontal coordinate character segment) are the horizontal coordinate X of the device resolution, and every two digits in segment b (i.e., the vertical coordinate character segment) are the vertical coordinate Y of the device resolution. At this time, (X, Y) is the coordinate value of the encrypted pixel point. Every two digits in segment c (i.e., the encryption mode character segment) are ANDed. If the result is an odd number, the pixel at the coordinate (X, Y) is set to white, i.e., 0; if the result is an even number, the average color value is used as the encryption mode.

[0124] Furthermore, in order to effectively perform random color encryption on the pixels to be encrypted, the above step S20 may include:

[0125] Determining the coordinates of pixels to be encrypted of the material to be encrypted provided by the material supplier according to the encrypted character string;

[0126] Traverse each pixel in the material to be encrypted and obtain the RGB color value of each pixel;

[0127] Constructing an initial color value set based on the RGB color values;

[0128] Subtracting the preset color value set from the initial color value set to obtain a target color value set;

[0129] An encryption mode is determined based on the target color value set and the encrypted string.

[0130] It is understandable that the material encryption device traverses each pixel in the image frame to be encrypted of the material to be encrypted, identifies the RGB color value of the pixel, and records the RGB color value of each pixel in an initial color value set.

[0131] It should be understood that, during the color value addition process, if the RGB color value does not exist in the initial color value set, it is directly added to the initial color value set; if the RGB color value exists in the initial color value set, it is not repeatedly added;

[0132] It can be understood that the material encryption device subtracts the RGB set of all colors (i.e., the preset color value set) from the initial color value set to obtain a target color value set. The RGB color values ​​contained in the target color value set are colors that do not exist in the current photo; randomly selecting a color in the target color value set is the encryption mode.

[0133] It should be noted that when the random number N = 0, the encrypted string itself is not split. In this case, the string is grouped into groups of 5 digits, where the first 2 digits of each group are the horizontal coordinate X of the device resolution, and the middle 2 digits of each group are the vertical coordinate Y of the device resolution. In this case, (X, Y) are the encrypted pixel coordinates, and the 5th digit of each group is the encryption mode. If the 5th digit is an odd number, the pixel at the coordinate (X, Y) is set to white, i.e. 0; if the 5th digit is an even number, a color randomly selected from the target color value set is the encryption mode.

[0134] When the random number N=1, the encrypted string is divided into two segments, marked as the first character segment and the second character segment; at this time, every 3 numbers in the first character segment and the second character segment form a group; in each group of numbers, the first 2 numbers of the first character segment are the horizontal coordinate X of the device resolution, and the first 2 numbers of the second character segment are the vertical coordinate Y of the device resolution. At this time, (X, Y) is the coordinate value of the encrypted pixel point, and the third number of the first character segment is ANDed with the third number of the second character segment. If the result is an odd number, the pixel with coordinates (X, Y) is set to white, that is, 0; if the result is an even number, a color is randomly selected from the target color value set, which is the encryption mode.

[0135] When the random number N ≥ 2, that is, the digital string is divided into more than 3 segments, marked as initial character segments such as segment A, segment B, segment C, and segment D, the data segments need to be sorted and combined into 3 new segments of similar length, such as segment a, segment b, and segment c; in the 3-segment digital string, every 2 digits in segment a (i.e., the horizontal coordinate character segment) are the horizontal coordinate X of the device resolution, and every 2 digits in segment b (i.e., the vertical coordinate character segment) are the vertical coordinate Y of the device resolution. At this time, (X, Y) are the coordinate values ​​of the encrypted pixel point, and every 2 digits in segment c (i.e., the encryption mode character segment) are ANDed. If the result is an odd number, the pixel at the coordinate (X, Y) is set to white, i.e., 0; if the result is an even number, a color is randomly selected from the target color value set, which is the encryption mode.

[0136] This embodiment determines the coordinates of the pixels to be encrypted of the material to be encrypted provided by the material supplier based on the encrypted character string, traverses each adjacent pixel in the material to be encrypted based on the coordinates of the pixels to be encrypted, obtains the RGB color values ​​of each adjacent pixel, determines the average color value based on the RGB color values ​​of each adjacent pixel, and determines the encryption mode based on the average color value and the encrypted character string, thereby achieving random color encryption of the material, effectively improving the encryption security, and reducing the verification pass rate of counterfeit materials.

[0137] In addition, an embodiment of the present invention further provides a storage medium, on which a material encryption program is stored. When the material encryption program is executed by a processor, the steps of the material encryption method described above are implemented.

[0138] In addition, an embodiment of the present invention further provides a computer program product, including a material encryption program, which implements the steps of the material encryption method described above when executed by a processor.

[0139] The specific implementation of the computer program product of the present invention is basically the same as the embodiments of the above-mentioned material encryption method, and will not be repeated here.

[0140] Reference Figure 7 , Figure 7This is a structural block diagram of the first embodiment of the material encryption device of the present invention.

[0141] like Figure 7 As shown, the material encryption device proposed in the embodiment of the present invention includes:

[0142] The character string generation module 10 is used to generate an encrypted character string based on the device information of the material supply end;

[0143] The string parsing module 20 is used to determine the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the encrypted string;

[0144] The pixel encryption module 30 is configured to process the pixel points corresponding to the coordinates of the pixel points to be encrypted based on the encryption mode, so as to complete the encryption process of the material to be encrypted.

[0145] This embodiment generates an encryption string based on the device information of the material supply end, determines the coordinates of the to-be-encrypted pixel points and the encryption mode of the to-be-encrypted material provided by the material supply end according to the encryption string, and processes the pixel points corresponding to the coordinates of the to-be-encrypted pixel points based on the encryption mode to complete the encryption processing of the to-be-encrypted material; since this embodiment generates an encryption string based on the device information of the material supply end, thereby ensuring the uniqueness and validity of the string, determines the coordinates of the to-be-encrypted pixel points and the encryption mode of the to-be-encrypted material according to the encryption string, and processes the pixel points corresponding to the coordinates of the to-be-encrypted pixel points based on the encryption mode, thereby effectively improving the material encryption efficiency, effectively improving the difficulty of encryption cracking, avoiding the problem of material falsification and tampering caused by encryption cracking, and ensuring the credibility of material encryption.

[0146] Other embodiments or specific implementations of the material encryption device of the present invention can refer to the above-mentioned method embodiments and will not be described in detail here.

[0147] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.

[0148] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.

[0149] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as read-only memory / random access memory, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0150] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A material encryption method, characterized in that: The material encryption method includes: Generate an encrypted string based on the device information of the material supplier; Determining the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the encrypted character string; Processing the pixel points corresponding to the coordinates of the pixel points to be encrypted based on the encryption mode to complete encryption processing of the material to be encrypted; The step of determining the coordinates of pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the encrypted character string includes: Generate random numbers based on a preset generation strategy; Determining whether the encrypted string needs to be segmented according to the random number; If the encrypted string needs to be segmented, at least one segmentation mark is generated based on the random number, and the encrypted string is segmented based on the segmentation mark, and the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier are determined according to the segmentation result; If the encrypted string does not need to be segmented, the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier are determined according to the characters in the encrypted string and the character sequence corresponding to the characters.

2. The material encryption method according to claim 1, wherein: The segmenting of the encrypted character string based on the segmentation corner mark, and determining the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the segmentation result, includes: When the random number is a first value, segmenting the encrypted character string into a first character segment and a second character segment based on the segmentation superscript; Determine the horizontal coordinate of the pixel point according to the first character segment, and determine the vertical coordinate of the pixel point according to the second character segment; Determining the coordinates of the pixels to be encrypted of the material to be encrypted provided by the material supplier based on the horizontal coordinates and the vertical coordinates of the pixels; Perform an AND operation on a first operation character in the first character segment and a second operation character in the second character segment; An encryption mode of the material to be encrypted is determined based on the AND operation result.

3. The material encryption method according to claim 1, wherein: The segmenting of the encrypted character string based on the segmentation corner mark, and determining the coordinates of the pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the segmentation result, includes: When the random number is not less than a second value, dividing the encrypted character string into a plurality of initial character segments based on the segmentation corner mark; Sort and combine the multiple initial character segments to obtain multiple target character segments, wherein the multiple target character segments include a horizontal axis character segment, a vertical axis character segment, and an encryption mode character segment; Determine the horizontal coordinate of the pixel point according to the horizontal coordinate character segment, and determine the vertical coordinate of the pixel point according to the vertical coordinate character segment; Determining the coordinates of the pixels to be encrypted of the material to be encrypted provided by the material supplier based on the horizontal coordinates and the vertical coordinates of the pixels; Performing an AND operation based on the characters in the encryption mode character segment; An encryption mode of the material to be encrypted is determined based on the AND operation result.

4. The material encryption method according to claim 1, wherein: The step of determining the coordinates of pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the encrypted character string includes: Determining the coordinates of pixels to be encrypted of the material to be encrypted provided by the material supplier according to the encrypted character string; Traversing each adjacent pixel point in the material to be encrypted based on the coordinates of the pixel point to be encrypted, and obtaining the RGB color value of each adjacent pixel point; Determine an average color value based on the RGB color values ​​of each adjacent pixel; An encryption mode is determined based on the average color value and the encrypted character string.

5. The material encryption method according to claim 1, wherein: The step of determining the coordinates of pixels to be encrypted and the encryption mode of the material to be encrypted provided by the material supplier according to the encrypted character string includes: Determining the coordinates of pixels to be encrypted of the material to be encrypted provided by the material supplier according to the encrypted character string; Traverse each pixel in the material to be encrypted and obtain the RGB color value of each pixel; Constructing an initial color value set based on the RGB color values; Subtracting the preset color value set from the initial color value set to obtain a target color value set; An encryption mode is determined based on the target color value set and the encrypted string.

6. A material encryption device, characterized in that: The material encryption device includes: A string generation module is used to generate an encrypted string based on the device information of the material supplier; a string parsing module for determining, based on the encrypted string, pixel coordinates and an encryption mode of the material to be encrypted provided by the material supplier, the string parsing module further for generating a random number based on a preset generation strategy; determining, based on the random number, whether it is necessary to segment the encrypted string; if it is necessary to segment the encrypted string, generating at least one segmentation superscript based on the random number, segmenting the encrypted string based on the segmentation superscript, and determining, based on the segmentation result, pixel coordinates and an encryption mode of the material to be encrypted provided by the material supplier; if it is not necessary to segment the encrypted string, determining pixel coordinates and an encryption mode of the material to be encrypted provided by the material supplier based on each character in the encrypted string and the character sequence corresponding to each character; The pixel encryption module is used to process the pixel points corresponding to the coordinates of the pixel points to be encrypted based on the encryption mode to complete the encryption processing of the material to be encrypted.

7. A material encryption device, characterized in that: The material encryption device includes: a memory, a processor, and a material encryption program stored in the memory and executable on the processor, wherein the material encryption program is configured to implement the material encryption method according to any one of claims 1 to 5.

8. A storage medium, characterized in that: The storage medium stores a material encryption program, and when the material encryption program is executed by the processor, the material encryption method according to any one of claims 1 to 5 is implemented.

9. A computer program product, characterized in that The computer program product includes a material encryption program, and when the material encryption program is executed by a processor, the steps of the material encryption method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Artificial intelligence data encryption storage method and system

    CN117521113A