CN111815723A - Data encryption method and device - Google Patents

Data encryption method and device Download PDF

Info

Publication number
CN111815723A
CN111815723A CN202010649317.3A CN202010649317A CN111815723A CN 111815723 A CN111815723 A CN 111815723A CN 202010649317 A CN202010649317 A CN 202010649317A CN 111815723 A CN111815723 A CN 111815723A
Authority
CN
China
Prior art keywords
data
picture
encrypted
url
original picture
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010649317.3A
Other languages
Chinese (zh)
Other versions
CN111815723B (en
Inventor
郝伟
沈传宝
刘加瑞
何志伟
孙磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Huayuan Information Technology Co Ltd
Original Assignee
Beijing Huayuan Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Huayuan Information Technology Co Ltd filed Critical Beijing Huayuan Information Technology Co Ltd
Priority to CN202010649317.3A priority Critical patent/CN111815723B/en
Publication of CN111815723A publication Critical patent/CN111815723A/en
Application granted granted Critical
Publication of CN111815723B publication Critical patent/CN111815723B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/44Secrecy systems

Abstract

The embodiment of the disclosure provides a data encryption method and device. The method comprises the following steps: acquiring an original picture and recording a URL (uniform resource locator); storing data to be encrypted to a channel in a pixel of the original picture to obtain a picture carrying the data to be encrypted; and adding the encrypted URL to the picture. In this way, the encrypted data can be made imperceptible and have high security.

Description

Data encryption method and device
Technical Field
Embodiments of the present disclosure relate generally to the field of data processing technology, and more particularly, to a data encryption method and apparatus.
Background
With the development of information technology, a large amount of data is generated, which may involve privacy of enterprises, individuals, and the like, and it is urgently necessary to perform encryption processing.
One way to implement encryption is by hiding data, which both needs to solve two problems: data hiding and data decryption. Data hiding may refer to hiding encrypted data in a picture; data decryption may refer to the interpretation of data from a hidden picture. The main problem of the prior art is that encryption and decryption are performed in the same picture, so that cracking is difficult to prevent no matter how the design is. Meanwhile, in order to increase the difficulty of cracking, a large number of encryption algorithms are added into a general algorithm, and although the process can achieve the purpose of safety on a certain program, the hidden performance and efficiency problems caused by large calculation amount can be caused.
Disclosure of Invention
According to an embodiment of the disclosure, a data encryption method, an apparatus, an electronic device and a computer-readable storage medium are provided.
In a first aspect of the disclosure, a data encryption method is provided. The method comprises the following steps:
acquiring an original picture and recording a URL (uniform resource locator);
storing data to be encrypted to at least one color channel in pixels of the original picture to obtain a picture carrying the data to be encrypted;
and adding the encrypted URL to the picture.
The above aspect and any possible implementation manner further provide an implementation manner, where saving data to be encrypted to at least one color channel in pixels of the original picture includes:
determining an amount of data to be saved in the at least one color channel;
determining a superposition mode of the data volume according to the data volume and the color code corresponding to the at least one color channel;
and storing the data to be encrypted to the at least one color channel according to the superposition mode.
The foregoing aspect and any possible implementation manner further provide an implementation manner, where the determining a superposition manner of the data volume according to the data volume and the color code corresponding to the at least one color channel includes:
if the color code is less than or equal to 255- (2)n-1), determining the data volume to be directly superimposed;
if the color code is larger than 255- (2)n-1), determining the data amount to be superimposed in an indirect manner based on the difference between the color code and the data amount; wherein n is the binary digit number corresponding to the data volume.
The above-described aspects and any possible implementations further provide an implementation, and the method further includes:
acquiring the width pixel number and the height pixel number of the original picture;
acquiring the maximum data volume of the data to be encrypted which can be stored in the original picture according to the width pixel number and the height pixel number;
and determining whether the original picture is available according to the comparison result of the maximum data volume and the number of the data to be encrypted.
The above aspect and any possible implementation manner further provide an implementation manner, where the obtaining, according to the number of width pixels and the number of height pixels, a maximum data size that can be saved to data to be encrypted in the original picture includes:
calculating the maximum data amount according to the following formula:
volume=Width*Height*3/8–C;
wherein volume is the maximum data size, Width is the number of Width pixels, Height is the number of Height pixels, and C is a constant of recording data.
In a second aspect of the disclosure, a data decryption method is provided. The method comprises the following steps:
acquiring a picture to be decrypted; the picture to be decrypted is obtained by adding the encrypted URL to the picture;
analyzing the picture to be decrypted to obtain a decrypted URL and the picture;
and acquiring the original picture based on the URL, comparing the original picture with the picture, and acquiring the data to be encrypted according to a comparison result.
In a third aspect of the present disclosure, a data encryption apparatus is provided. The device includes:
the acquisition unit is used for acquiring an original picture and recording a URL (uniform resource locator);
the storage unit is used for storing data to be encrypted to at least one color channel in the pixels of the original picture to obtain the picture carrying the data to be encrypted;
and the adding unit is used for adding the encrypted URL to the picture.
In a fourth aspect of the present disclosure, a data decryption apparatus is provided. The device includes:
the acquisition module is used for acquiring a picture to be decrypted; the picture to be decrypted is obtained by adding the encrypted URL to the picture;
the analysis module is used for analyzing the picture to be decrypted so as to obtain the decrypted URL and the picture;
and the comparison module is used for acquiring the original picture based on the URL, comparing the original picture with the picture and acquiring the data to be encrypted according to a comparison result.
In a fifth aspect of the present disclosure, an electronic device is provided. The electronic device includes: a memory having a computer program stored thereon and a processor implementing the method as described above when executing the computer program.
In a sixth aspect of the disclosure, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, realizes the above-mentioned method.
It should be understood that the statements herein reciting aspects are not intended to limit the critical or essential features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. In the drawings, like or similar reference characters designate like or similar elements, and wherein:
FIG. 1 shows a flow diagram of a data encryption method according to an embodiment of the present disclosure;
FIG. 2 shows a flow diagram of a data decryption method according to another embodiment of the present disclosure;
3(a) -3 (c) show flow charts of data encryption and decryption methods according to another embodiment of the present disclosure;
FIG. 4 shows a block diagram of a data encryption apparatus according to an embodiment of the present disclosure;
FIG. 5 shows a block diagram of a data decryption device according to an embodiment of the present disclosure;
FIG. 6 illustrates a block diagram of an exemplary electronic device capable of implementing embodiments of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
In addition, the term "and/or" herein is only one kind of association relationship describing an associated object, and means that there may be three kinds of relationships, for example, a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
In this disclosure, can be through acquireing original picture to record URL, treat the passageway that the encryption data was preserved to the pixel of original picture, obtain carrying the picture that waits to encrypt the data, add the URL after will encrypting to above-mentioned picture again, can make the data after the encryption be difficult for being perceived, and have higher security, have following beneficial effect:
1) the picture to which the encrypted URL is added is completely indistinguishable to the naked eye when compared to the original picture.
2) Mathematically, it can be proved that theoretical cracking possibility does not exist only through the bitmap information of the picture, that is, the data to be encrypted cannot be reversely read, so that the method has extremely high cracking resistance.
3) Because the technology has simple calculation process, the data encryption and decryption can be carried out at high speed based on the original picture.
4) The amount of hidden data is large, and about 2.2MB of data can be hidden in a 1080P PNG picture of about 1.8MB without significantly changing the data capacity.
Fig. 1 shows a flowchart of a data encryption method according to an embodiment of the present disclosure, and as shown in fig. 1, a data encryption method provided by an embodiment of the present invention includes the following steps:
s101: and acquiring an original picture and recording the URL.
In some embodiments, an original picture is obtained and a Uniform Resource Locator (URL) is recorded. The method may be performed in the terminal 1, the original picture being understood as a picture in which no encrypted data has been stored. The specific manner of acquiring the original picture may include:
the original picture is obtained through the URL, randomly through surfing the internet, or locally. For the mode of randomly obtaining the original picture through surfing the internet: the URL can be directly recorded; for the way of obtaining the original picture locally: the network can then be uploaded and the URL recorded.
S102: and storing the data to be encrypted to a channel in the pixel of the original picture to obtain the picture carrying the data to be encrypted.
In some embodiments, the data to be encrypted is stored in a channel in a pixel of the original picture, so as to obtain the picture carrying the data to be encrypted. The data to be encrypted may be in the form of letters, numbers, and character strings, and is not particularly limited. In the embodiment of the present invention, RGB color pictures are taken as an example, and data to be encrypted may be stored in an RGB channel. The channel in the pixels of the original picture may be at least one color channel, i.e. at least one of RGB, in the pixels of the original picture.
For example, the string "Hello" is converted to an array of bytes, which is "72101108108111", and each byte is then converted to a binary stream: "1001000110010111011001101100110111110000010101111101111111001011011001100100" and saving at least one bit of the data stream to at least one of the RGB in each pixel.
It can be understood that the picture is a picture carrying the data stream, so that the picture is not the same as the original picture and is not easily perceived.
S103: and adding the encrypted URL to the picture.
In some embodiments, the encrypted URL is added to the picture. The algorithm for encrypting the URL is not particularly limited, and an algorithm such as AES may be used. Specifically, the encrypted URL may be added to the end of the field of the picture, and the data size occupied by the encrypted URL is recorded by using an identification field at the end of the field, for example, 50 bytes are occupied. It should be noted that after the encrypted URL is added to the picture, the picture to be decrypted is obtained, and the whole process of data encryption is realized.
According to the data encryption method provided by the embodiment of the invention, the original picture is obtained, the URL is recorded, the data to be encrypted is stored in the channel in the pixel of the original picture, the picture carrying the data to be encrypted is obtained, and the encrypted URL is added into the picture, so that the encrypted data is not easy to perceive and has higher safety.
On the basis of the above embodiment, the channel for storing the data to be encrypted to the pixels of the original picture includes:
in some embodiments, data to be encrypted is saved to at least one color channel in pixels of the original picture. Reference is made to the above description and no further description is made. Reference is made to the above description and no further description is made.
According to the data encryption method provided by the embodiment of the invention, the data to be encrypted is stored in at least one color channel in the pixel of the original picture, so that the encrypted data is further not easy to perceive and has higher safety.
On the basis of the above embodiment, the saving of the data to be encrypted to at least one color channel in the pixels of the original picture includes:
in some embodiments, the amount of data to be saved at the at least one color channel is determined; taking the R channel in RGB as an example, the amount of data to be stored in R is 1 bit, i.e. 0 or 1.
In some embodiments, determining a superposition mode of the data volume according to the data volume and a color code corresponding to the at least one color channel; the numerical value interval of the color code corresponding to at least one color channel is 0-255, namely a specific numerical value of the numerical value interval, and the data amount superposition mode can comprise direct superposition, namely superposition, for example, the original color code is 250, and if the data amount is 1 bit, the data amount is 250 after superposition; when 1, the overlay is followed by 251.
The data amount superposition mode may include indirect superposition, which is based on the indirect superposition of the difference between the color code and the data amount, i.e. subtractive superposition, for example, if the original color code is 255, if the data amount is 1 bit, when the data amount is 0, the data amount is 255 after superposition; when 1, the superposition is 254 (255-1).
In some embodiments, the data to be encrypted is saved to the at least one color channel according to the superposition manner. Referring to the above example, for the direct overlay method, the R channel after storing the data to be encrypted is 250 or 251.
For the indirect superposition mode, the R channel after storing the data to be encrypted is 255 or 254.
According to the data encryption method provided by the embodiment of the invention, the data to be encrypted is stored in at least one color channel in different superposition modes, so that the applicability of the method is further improved.
On the basis of the above embodiment, the determining a superposition manner of the data volume according to the data volume and the color code corresponding to the at least one color channel includes:
in some embodiments, if the color code is less than or equal to 255- (2)n-1), determining the data volume to be directly superimposed; for example, when n is 1, it may be 0 or 1, if the color code is less than or equal to 254, the data amount is directly superimposed, for example, the color code 253 is directly superimposed to be 253 or 254; for example, when n is 2, it may be 0, 1, 2, or 3, and if the color code is less than or equal to 252, the data amount is directly superimposed, for example, the color code 251 is directly superimposed, and then the data amount is 251, 252, 253, or 254.
If the color code is larger than 255- (2)n-1), determining the data amount to be superimposed in an indirect manner based on the difference between the color code and the data amount; wherein n is the binary digit number corresponding to the data volume. Referring to the above example, when n is 1, i.e. 0 or 1 can be taken, if the color code is greater than 254, the data amount is superimposed indirectly, e.g. 255 or 254; for example, when n is 2, it may be 0, 1, 2, or 3, and if the color code is greater than 252, the data amount is indirectly superimposed, for example, the color code 253, and then 253, 252, 251, or 250 is obtained after the indirect superimposition.
In summary, the principle of implementing the superposition mode is that the calculation exceeding 255 is not triggered, that is, if the calculation exceeds 255, an indirect superposition mode is adopted, and if the calculation does not exceed 255, a direct superposition mode is adopted.
The data encryption method provided by the embodiment of the invention further improves the applicability of the method by determining the superposition mode of the data volume to be direct superposition or indirect superposition.
On the basis of the above embodiment, the method further includes:
in some embodiments, obtaining the number of width pixels and the number of height pixels of the original picture; for example, the number of pixels is 90 pixels in width and 120 pixels in height.
Specifically, the maximum data size of the data to be encrypted, which can be stored in the original picture, is obtained according to the number of width pixels and the number of height pixels; it is understood that the maximum data amount is positively correlated with the number of width pixels and the number of height pixels, i.e. the larger the number of width pixels and the number of height pixels, the larger the maximum data amount; the smaller the number of width pixels and the smaller the number of height pixels, the smaller the maximum data amount.
In some embodiments, it is determined whether the original picture is available according to the comparison result of the maximum data amount and the amount of the data to be encrypted. Further, if the maximum data amount is greater than or equal to the number of the data to be encrypted, it indicates that the original picture is available, that is, the original picture can be used to execute the subsequent method steps; if the maximum data volume is less than the number of the data to be encrypted, the original picture is not available, and the original picture can be obtained again.
The data encryption method provided by the embodiment of the invention can further determine whether the original picture is available, and improve the use efficiency of the method.
On the basis of the above embodiment, the obtaining, according to the number of width pixels and the number of height pixels, the maximum data size that can be stored in the original picture to be encrypted includes:
in some embodiments, the maximum amount of data is calculated according to the following formula:
volume=Width*Height*3/8–C;
wherein volume is the maximum data size, Width is the number of Width pixels, Height is the number of Height pixels, and C is a constant of recording data. It should be noted that, here, the Width and Height default data measurement unit is a byte, therefore, the byte needs to be converted into bits, i.e. divided by 8, there are R, G and B components for RGB, if all are used, there are 3 corresponding to each pixel, C is some additional information with constant, the specific length is specified according to the need, and at least 32 bits (4 bytes) are needed for recording the data length.
The data encryption method provided by the embodiment of the invention further improves the use efficiency of the method by reasonably calculating the maximum data volume.
The following describes the data encryption process specifically as follows:
step 1, loading an original picture:
in the embodiment of the invention, the original picture can be acquired through the URL, randomly acquired through surfing the internet or locally acquired, and the URL is recorded to ensure that the original picture is in a publicly accessible state, so that the decryption process only needs to use the URL.
And step 2, converting data to be encrypted:
converting the data to be encrypted into a serialized binary data stream, for example:
the character string "Hello" is converted into a byte array, which is "72101108108111", and then each byte is converted into a binary data stream: "1001000110010111011001101100110111110000010101111101111111001011011001100100".
And 3, encrypting a pixel color channel:
hiding data to be encrypted in at least one color channel in pixels of an original picture. Since the original picture has three channels of RGB per pixel, each channel can take a value of 0-255, so each channel can store certain data. Take the red channel R as an example, and take the case that the data V to be encrypted is 1-bit data as an example. When a 1-bit 0 or 1 needs to be stored in this channel, it only needs to be determined that there are two cases:
1) when R <255, the superposition may be performed directly, with the value of V superimposed directly on R.
2) When R is 255, since R is already the maximum value, if the data V to be encrypted is 1, it becomes 0, so the data is superimposed in R-V, which is taken up to 255 (when V is 0) or 254 (when V is 1).
And by analogy, all the binary data streams are stored in the original picture. The following correlation exists between the maximum data size of the data to be encrypted which can be stored in the original picture and the number of pixels of the original picture, and the specific formula is as follows:
volume=Width*Height*3/8–C,
wherein, volume is the maximum data volume, Width is the Width pixel number, Height is the Height pixel number, and C is a constant of the recording data, the specific length is specified according to the requirement, and at least 32 bits (4 bytes) are required for recording the data length. For example, with a setting of 1-bit data per channel, an original picture of 1080P can store about 0.74MB of data. If the bit length is set to 2 or 3, the corresponding stored data is 1.48MB and 2.22 MB. According to practical experience, it is reasonable to select the bit length to be 2.
And 4, generating a picture:
after the data to be encrypted is added into the channel, the picture carrying the data to be encrypted can be stored locally. The file type may be in lossless format, including, for example, BMP, PNG, and the like. File names are not required.
Step 5, URL encryption:
and finally, encrypting the URL by using common algorithms such as AES (advanced encryption standard) and the like, and adding the encrypted URL into the picture carrying the data to be encrypted to obtain the picture to be decrypted, so that the whole data encryption process can be completed.
Fig. 2 shows a flow chart of a data decryption method according to another embodiment of the present disclosure, as shown in fig. 2, the method comprising the steps of:
s201: acquiring a picture to be decrypted; the picture to be decrypted is obtained by adding the encrypted URL to the picture.
In some embodiments, a picture to be decrypted is obtained; the picture to be decrypted is obtained by adding the encrypted URL to the picture. The method can be executed in the terminal 2, and the terminal 2 can receive the picture to be decrypted from the terminal 1.
S202: and analyzing the picture to be decrypted to obtain the decrypted URL and the picture.
In some embodiments, the picture to be decrypted is parsed to obtain the decrypted URL and the picture. Further, the picture to be decrypted may be decomposed into an encrypted URL and a picture carrying data to be encrypted, with reference to the above description, the encrypted URL obtained by identifying the field is 50 bytes, and 50 bytes are intercepted from the end of the field of the picture for decryption, so as to obtain the decrypted URL. And decrypting the encrypted URL to obtain the decrypted URL and a picture carrying data to be encrypted, namely the picture.
S203: and acquiring the original picture based on the URL, comparing the original picture with the picture, and acquiring the data to be encrypted according to a comparison result.
Specifically, the original picture is obtained based on the URL, the original picture and the picture are compared, and the data to be encrypted is obtained according to the comparison result. Comparing the original picture with the picture carrying the data to be encrypted by adopting a color comparison algorithm, wherein the difference is a color code corresponding to the data to be encrypted, and adopting the steps of the method, such as:
"determining an amount of data to be saved in the at least one color channel;
determining a superposition mode of the data volume according to the data volume and the color code corresponding to the at least one color channel;
and storing the data to be encrypted to the at least one color channel according to the superposition mode in a process with an opposite sequence, wherein all the obtained data volumes to be stored by all the color channels are the data to be encrypted, such as the character string 'Hello'.
According to the data decryption method provided by the embodiment of the invention, the picture to be decrypted is obtained, the picture to be decrypted is analyzed to obtain the decrypted URL and the picture, the original picture is obtained based on the URL, the original picture is compared with the picture, and the data to be encrypted is obtained according to the comparison result, so that the data decryption can be realized quickly and conveniently.
Fig. 3(a) -3 (c) show flowcharts of a data encryption and decryption method according to another embodiment of the present disclosure, and as shown in fig. 3(a), a "magnolia poem" in fig. 3(a) is data to be encrypted, an original picture is obtained according to an "input picture URL" in fig. 3(a), and "information that needs to be encrypted" in fig. 3(a) corresponds to the data to be encrypted, that is, the data to be encrypted is hidden according to the original picture.
As shown in fig. 3(b), after the hiding operation is performed, a picture out.png is generated, i.e. the picture to be decrypted.
As shown in fig. 3(c), for the decryption process, the previously hidden data to be encrypted, that is, the magnolia poem, can be parsed by inputting the picture named out.
It is noted that while for simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present disclosure is not limited by the order of acts, as some steps may, in accordance with the present disclosure, occur in other orders and concurrently. Further, those skilled in the art should also appreciate that the embodiments described in the specification are exemplary embodiments and that acts and modules referred to are not necessarily required by the disclosure.
The above is a description of embodiments of the method, and the embodiments of the apparatus are further described below.
Fig. 4 shows a block diagram of a data encryption apparatus according to an embodiment of the present disclosure, and as shown in fig. 4, the apparatus 400 includes: an obtaining unit 410, a saving unit 420 and an adding unit 430, wherein:
the obtaining unit 410 is configured to obtain an original picture and record a URL; the saving unit 420 is configured to save data to be encrypted to a channel in a pixel of the original picture, so as to obtain a picture carrying the data to be encrypted; the adding unit 430 is configured to add the encrypted URL to the picture.
The data encryption device provided by the embodiment of the invention obtains the original picture, records the URL, stores the data to be encrypted into the channel in the pixel of the original picture to obtain the picture carrying the data to be encrypted, and adds the encrypted URL into the picture, so that the encrypted data is not easy to perceive and has higher safety.
Fig. 5 shows a block diagram of a data decryption apparatus according to an embodiment of the present disclosure, and as shown in fig. 5, the apparatus 500 includes: an obtaining module 510, a parsing module 520, and a comparing module 530, wherein:
the obtaining module 510 is configured to obtain a picture to be decrypted; the picture to be decrypted is obtained by adding the encrypted URL to the picture; the analyzing module 520 is configured to analyze the picture to be decrypted to obtain a decrypted URL and the picture; the comparing module 530 is configured to obtain the original picture based on the URL, compare the original picture and the picture, and obtain the data to be encrypted according to a comparison result.
The data decryption device provided by the embodiment of the invention can quickly and conveniently realize data decryption by acquiring the picture to be decrypted, analyzing the picture to be decrypted to acquire the decrypted URL and the picture, acquiring the original picture based on the URL, comparing the original picture with the picture, and acquiring the data to be encrypted according to the comparison result.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the described module may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
Fig. 6 shows a block diagram of an exemplary electronic device capable of implementing embodiments of the disclosure, and as shown in fig. 6, device 600 includes a Central Processing Unit (CPU)601 that may perform various suitable actions and processes in accordance with computer program instructions stored in a Read Only Memory (ROM)602 or loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the device 600 can also be stored. The CPU601, ROM602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
A number of components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, a mouse, or the like; an output unit 607 such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processing unit 601 performs the various methods and processes described above, such as the methods 100 and 200. For example, in some embodiments, methods 100 and 200 may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM602 and/or the communication unit 609. When the computer program is loaded into RAM603 and executed by CPU601, one or more steps of methods 100 and 200 described above may be performed. Alternatively, in other embodiments, CPU601 may be configured to perform methods 100 and 200 by any other suitable means (e.g., by way of firmware).
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a load programmable logic device (CPLD), and the like.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
Further, while operations are depicted in a particular order, this should be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed, to achieve desirable results. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single implementation. Conversely, various features that are described in the context of a single implementation can also be implemented in multiple implementations separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (10)

1. A method for data encryption, comprising:
acquiring an original picture and recording a URL (uniform resource locator);
storing data to be encrypted to at least one color channel in pixels of the original picture to obtain a picture carrying the data to be encrypted;
and adding the encrypted URL to the picture.
2. The method of claim 1, wherein saving the data to be encrypted to at least one color channel in the pixels of the original picture comprises:
determining an amount of data to be saved in the at least one color channel;
determining a superposition mode of the data volume according to the data volume and the color code corresponding to the at least one color channel;
and storing the data to be encrypted to the at least one color channel according to the superposition mode.
3. The method according to claim 2, wherein the determining the superposition manner of the data volume according to the data volume and the color code corresponding to the at least one color channel comprises:
if the color code is less than or equal to 255- (2)n-1), determining the data volume to be directly superimposed;
if the color code is larger than 255- (2)n-1), determining the data amount to be superimposed in an indirect manner based on the difference between the color code and the data amount; wherein n is the binary digit number corresponding to the data volume.
4. The method of claim 1, further comprising:
acquiring the width pixel number and the height pixel number of the original picture;
acquiring the maximum data volume of the data to be encrypted which can be stored in the original picture according to the width pixel number and the height pixel number;
and determining whether the original picture is available according to the comparison result of the maximum data volume and the number of the data to be encrypted.
5. The method according to claim 4, wherein the obtaining the maximum data size that can be saved to the data to be encrypted in the original picture according to the number of width pixels and the number of height pixels comprises:
calculating the maximum data amount according to the following formula:
volume=Width*Height*3/8–C;
wherein volume is the maximum data size, Width is the number of Width pixels, Height is the number of Height pixels, and C is a constant of recording data.
6. A method for decrypting data based on the method of any one of claims 1 to 5, comprising:
acquiring a picture to be decrypted; the picture to be decrypted is obtained by adding the encrypted URL to the picture;
analyzing the picture to be decrypted to obtain a decrypted URL and the picture;
and acquiring the original picture based on the URL, comparing the original picture with the picture, and acquiring the data to be encrypted according to a comparison result.
7. A data encryption apparatus, comprising:
the acquisition unit is used for acquiring an original picture and recording a URL (uniform resource locator);
the storage unit is used for storing data to be encrypted to at least one color channel in the pixels of the original picture to obtain the picture carrying the data to be encrypted;
and the adding unit is used for adding the encrypted URL to the picture.
8. A data decryption apparatus, comprising:
the acquisition module is used for acquiring a picture to be decrypted; the picture to be decrypted is obtained by adding the encrypted URL to the picture;
the analysis module is used for analyzing the picture to be decrypted so as to obtain the decrypted URL and the picture;
and the comparison module is used for acquiring the original picture based on the URL, comparing the original picture with the picture and acquiring the data to be encrypted according to a comparison result.
9. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program, wherein the processor, when executing the computer program, implements the method of any of claims 1 to 6.
10. A computer-readable storage medium, on which a computer program is stored, which, when executed, implements the method of any one of claims 1 to 6.
CN202010649317.3A 2020-07-08 2020-07-08 Data encryption method and device Active CN111815723B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010649317.3A CN111815723B (en) 2020-07-08 2020-07-08 Data encryption method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010649317.3A CN111815723B (en) 2020-07-08 2020-07-08 Data encryption method and device

Publications (2)

Publication Number Publication Date
CN111815723A true CN111815723A (en) 2020-10-23
CN111815723B CN111815723B (en) 2024-04-12

Family

ID=72843117

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010649317.3A Active CN111815723B (en) 2020-07-08 2020-07-08 Data encryption method and device

Country Status (1)

Country Link
CN (1) CN111815723B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113190857A (en) * 2021-04-09 2021-07-30 作业帮教育科技(北京)有限公司 Picture processing method and device, electronic equipment and computer readable medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103220551A (en) * 2013-03-12 2013-07-24 重庆市科学技术研究院 Digital resource encryption and decryption system and method based on image processing
US20170011203A1 (en) * 2015-07-06 2017-01-12 Microsoft Technology Licensing, Llc Encrypting data within a host image
CN107302706A (en) * 2017-06-21 2017-10-27 北京奇艺世纪科技有限公司 Image anti-stealing link method, device and electronic equipment
CN109033863A (en) * 2018-08-17 2018-12-18 广州视源电子科技股份有限公司 The encryption and decryption method and device of picture
CN110009703A (en) * 2019-03-18 2019-07-12 西南大学 A kind of image encryption based on chaos system, decryption method and equipment
CN110875903A (en) * 2018-08-31 2020-03-10 阿里巴巴集团控股有限公司 Security defense method and device
CN111192187A (en) * 2018-08-27 2020-05-22 优信数享(北京)信息技术有限公司 Decryption method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103220551A (en) * 2013-03-12 2013-07-24 重庆市科学技术研究院 Digital resource encryption and decryption system and method based on image processing
US20170011203A1 (en) * 2015-07-06 2017-01-12 Microsoft Technology Licensing, Llc Encrypting data within a host image
CN107302706A (en) * 2017-06-21 2017-10-27 北京奇艺世纪科技有限公司 Image anti-stealing link method, device and electronic equipment
CN109033863A (en) * 2018-08-17 2018-12-18 广州视源电子科技股份有限公司 The encryption and decryption method and device of picture
CN111192187A (en) * 2018-08-27 2020-05-22 优信数享(北京)信息技术有限公司 Decryption method and system
CN110875903A (en) * 2018-08-31 2020-03-10 阿里巴巴集团控股有限公司 Security defense method and device
CN110009703A (en) * 2019-03-18 2019-07-12 西南大学 A kind of image encryption based on chaos system, decryption method and equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113190857A (en) * 2021-04-09 2021-07-30 作业帮教育科技(北京)有限公司 Picture processing method and device, electronic equipment and computer readable medium

Also Published As

Publication number Publication date
CN111815723B (en) 2024-04-12

Similar Documents

Publication Publication Date Title
CN109474619B (en) Data encryption reporting method and device and data decryption method and device
Zhao et al. TPE2: Three-pixel exact thumbnail-preserving image encryption
CN112104570B (en) Traffic classification method, traffic classification device, computer equipment and storage medium
CN107786331B (en) Data processing method, device, system and computer readable storage medium
Jan et al. Double layer security using crypto-stego techniques: a comprehensive review
Jang et al. Partial image encryption using format-preserving encryption in image processing systems for Internet of things environment
CN115002293B (en) Privacy confidentiality method, system and storage medium based on thumbnail format reservation
CN109919823A (en) A kind of watermark generation method and device
CN110634096B (en) Self-adaptive multi-mode information hiding method and device
CN111815723B (en) Data encryption method and device
CN113382029A (en) File data processing method and device
CN111445377A (en) Audio processing method, device and storage medium
CN112699400B (en) Image information security processing method and device
CN113285945B (en) Communication security monitoring method, device, equipment and storage medium
CN112434094B (en) Database connection method and device based on encryption algorithm and computer equipment
CN111865591B (en) Symmetric encryption method, decryption method, device, equipment and storage medium
Banday et al. Securing medical images via a texture and chaotic key framework
CN116405482A (en) Log file transmission method, system, terminal and storage medium
CN115757535A (en) Data query method, data storage method and device and electronic equipment
CN115114667A (en) Privacy information processing and classifying method and device for security chip
CN114915464A (en) Image encryption method and image decryption method based on special matrix operation
CN114666624A (en) Video file encryption and decryption method
CN110971581B (en) Encrypted data processing method and device
CN113645025A (en) Data encryption storage method, storage device, user equipment and storage medium
CN106570410B (en) Data encryption method, data decryption method, device and system

Legal Events

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