CN111815723B - Data encryption method and device - Google Patents

Data encryption method and device Download PDF

Info

Publication number
CN111815723B
CN111815723B CN202010649317.3A CN202010649317A CN111815723B CN 111815723 B CN111815723 B CN 111815723B CN 202010649317 A CN202010649317 A CN 202010649317A CN 111815723 B CN111815723 B CN 111815723B
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.)
Active
Application number
CN202010649317.3A
Other languages
Chinese (zh)
Other versions
CN111815723A (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

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Storage Device Security (AREA)

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; storing data to be encrypted into 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 less noticeable and have higher 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, and the data may relate to privacy of enterprises, individuals and the like, and encryption processing is required.
One implementation of encryption processing is by hiding data, both of which require solving two problems: data hiding and data decryption. The data hiding may mean hiding the encrypted data in the picture; data decryption may refer to reading data from a hidden picture. The main problem in the prior art is that encryption and decryption are performed in the same picture, so that no matter how designed, cracking is difficult to prevent. Meanwhile, in order to increase the difficulty of cracking, a large number of encryption algorithms are added into a general algorithm, and the process can achieve the aim of safety in a certain program, but can bring the problems of hidden performance and efficiency caused by large calculation amount.
Disclosure of Invention
According to embodiments of the present disclosure, a data encryption method, apparatus, electronic device, and computer-readable storage medium are provided.
In a first aspect of the present disclosure, a data encryption method is provided. The method comprises the following steps:
acquiring an original picture and recording a URL;
storing data to be encrypted into at least one color 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.
Aspects and any possible implementation manner as described above, further provide an implementation manner, where the saving the data to be encrypted to at least one color channel in a pixel 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.
In the aspect and any possible implementation manner described above, there is further provided an implementation manner, where determining, according to the data amount and a color code corresponding to the at least one color channel, a superposition manner of the data amount includes:
if the color code is less than or equal to 255- (2) n -1) determining that the superposition of said data amounts is a direct superposition;
if the color code is more than 255- (2) n -1) determining that the superposition of the data amounts is an indirect superposition based on the difference between the color code and the data amounts; wherein n is the binary bit number corresponding to the data quantity.
Aspects and any one of the possible implementations as described above, further providing an implementation, the method further including:
acquiring the width pixel number and the height pixel number of the original picture;
acquiring the maximum data amount of the data to be encrypted which can be saved 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 data to be encrypted.
In the aspect and any possible implementation manner described above, there is further provided an implementation manner, where the obtaining, according to the number of width pixels and the number of height pixels, a maximum data amount of data to be encrypted that can be saved in the original picture includes:
the maximum data amount is calculated according to the following formula:
volume=Width*Height*3/8–C;
wherein volume is the maximum data amount, width is the Width pixel number, height is the Height pixel number, and C is a constant for recording data.
In a second aspect of the present 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 the 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 comprises:
the acquisition unit is used for acquiring the original picture and recording the URL;
a storage unit, configured to store data to be encrypted in at least one color channel in a pixel of the original picture, to obtain a 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 comprises:
the acquisition module is used for acquiring the 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 acquire 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 and a processor, the memory having stored thereon a computer program, the processor implementing the method as described above when executing the computer program.
In a sixth aspect of the present disclosure, a computer readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, implements the method described above.
It should be understood that what is described in this summary is not intended to limit the critical or essential features of the embodiments of the disclosure nor to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The above and other features, advantages and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. In the drawings, wherein like or similar reference numerals denote like or similar elements, in which:
FIG. 1 illustrates a flow chart of a data encryption method according to an embodiment of the present disclosure;
FIG. 2 illustrates a flow chart of a data decryption method according to another embodiment of the present disclosure;
fig. 3 (a) to 3 (c) show flowcharts of a data encryption and decryption method according to another embodiment of the present disclosure;
fig. 4 shows a block diagram of a data encryption device according to an embodiment of the present disclosure;
fig. 5 shows a block diagram of a data decryption apparatus 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
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are some embodiments of the present disclosure, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments in this disclosure without inventive faculty, are intended to be within the scope of this disclosure.
In addition, the term "and/or" herein is merely an association relationship describing an association object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
In the disclosure, an original picture can be obtained, and the URL is recorded, so that the picture carrying the data to be encrypted can be obtained by storing the data to be encrypted into a channel in a pixel of the original picture, and then the encrypted URL is added into the picture, so that the encrypted data is not easy to perceive and has higher safety, and the method has the following beneficial effects:
1) When the picture added with the encrypted URL is compared with the original picture, no difference is seen by naked eyes.
2) The mathematical evidence shows that the data to be encrypted cannot be read out reversely only through the bitmap information of the picture, and the data to be encrypted has extremely high cracking resistance.
3) Because the calculation process of the technology is simple, the data encryption and decryption can be performed at high speed based on the original picture.
4) The hidden data amount is large, and a PNG picture of about 1.8MB of 1080P can hide data of about 2.2MB 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, the data encryption method provided by the embodiment of the present invention includes the following steps:
s101: and acquiring the original picture and recording the URL.
In some embodiments, the original picture is taken and a uniform resource locator (Uniform Resource Locator, simply "URL") is recorded. The method may be performed in the terminal 1 and the original picture may be understood as a picture in which the encrypted data has not been saved. The specific ways of obtaining the original picture may include:
the original picture is obtained through the URL, randomly obtained through surfing the internet, or obtained from local. For the way of randomly acquiring the original picture by surfing the internet: the URL may be directly recorded; for the way the original picture is taken locally: the network may then be uploaded and the URL recorded.
S102: and storing the data to be encrypted into 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 saved to a channel in a pixel of the original picture, so as to obtain a picture carrying the data to be encrypted. The data to be encrypted may be in the form of letters, numbers, character strings, etc., and is not particularly limited. The picture may be a color picture or a gray-scale picture, and in the embodiment of the present invention, taking an RGB color picture as an example, the data to be encrypted may be stored in an RGB channel. The channel in the pixel of the original picture may be at least one color channel in the pixel of the original picture, i.e. at least one of RGB.
For example, the string "Hello" is converted into an array of bytes, "72 101 108 108 111", and then each byte is converted into a binary data stream: "1001000110010111011001101100110111110000010101111101111111001011011001100100", and then saves at least one bit of these data streams to at least one of the RGB in each pixel.
It will be appreciated that the picture at this point is a picture carrying the data stream described above, such that the picture is not the same picture 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. The encrypted URL may be specifically added to the field end of the picture, and the data amount occupied by the encrypted URL is recorded by the identification field at the field end, for example, the data amount occupies 50 bytes. It should be noted that, after adding the encrypted URL 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 in the pixel of the original picture includes:
in some embodiments, the data to be encrypted is saved to at least one color channel in a pixel of the original picture. Reference is made to the above description and will not be repeated. Reference is made to the above description and will not be repeated.
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 pixels of the original picture, so that the encrypted data is not easy to perceive and has higher security.
On the basis of the above embodiment, the storing the data to be encrypted in at least one color channel in a pixel of the original picture includes:
in some embodiments, determining an amount of data to be saved in the at least one color channel; taking the R channel in RGB as an example, the amount of data to be saved in R is 1 bit, i.e., 0 or 1.
In some embodiments, determining a superposition manner of the data amount according to the data amount and a color code corresponding to the at least one color channel; the number interval of the color code corresponding to at least one color channel is 0-255, that is, a specific number of the number interval, and the superposition mode of the data quantity may include direct superposition, that is, superposition, for example, the original color code is 250, if the data quantity is 1 bit, when the data quantity is 0, the superposition is 250; when 1, the superposition is followed by 251.
The overlapping manner of the data amounts may include indirect overlapping, which is indirect overlapping based on a difference between the color code and the data amounts, that is, subtractive overlapping, for example, the original color code is 255, if the data amount is 1 bit, when it is 0, the overlapping is 255; when 1, 254 (255-1) is superimposed.
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 mode, 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 foregoing embodiment, the determining, according to the data amount and the color code corresponding to the at least one color channel, a superposition manner of the data amount includes:
in some embodiments, if the color code is less than or equal to 255- (2) n -1) determining that the superposition of said data amounts is a direct superposition; for example, when n is 1, 0 or 1 may be taken, and 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, and then is 253 or 254; for example, when n is 2, it is possible to take 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, and directly superimposed is 251, 252, 253 or 254.
If the color code is more than 255- (2) n -1) determining the manner of superposition of the data amounts to be based on the difference between the color code and the data amountsIs a direct superposition of (2); wherein n is the binary bit number corresponding to the data quantity. Referring to the above example, when n is 1, 0 or 1 may be taken, and if the color code is greater than 254, the overlapping manner of the data amounts is indirect overlapping, for example, the color code 255, and 255 or 254 is obtained after the indirect overlapping; for example, when n is 2, it is possible to take 0, 1, 2 or 3, and if the color code is greater than 252, the data amount is superimposed indirectly, for example, the color code 253, and then the data amount is superimposed indirectly, for example, 253, 252, 251 or 250.
In summary, the superposition mode is implemented by not triggering a calculation exceeding 255, i.e. if exceeding, adopting an indirect superposition mode, and if not exceeding, adopting a direct superposition mode.
According to the data encryption method provided by the embodiment of the invention, the applicability of the method is further improved by determining that the superposition mode of the data quantity is direct superposition or indirect superposition.
On the basis of the above embodiment, the method further includes:
in some embodiments, a width pixel count and a height pixel count of the original picture are obtained; for example, the number of width pixels is 90 pixels and the number of height pixels is 120 pixels.
Specifically, according to the width pixel number and the height pixel number, the maximum data amount of the data to be encrypted which can be stored in the original picture is obtained; it will be appreciated 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 is; the smaller the width pixel number and the height pixel number values, the smaller the maximum data amount.
In some embodiments, it is determined whether the original picture is available based on a comparison of the maximum amount of data and the amount of data to be encrypted. Further, if the maximum data amount is greater than or equal to the amount of data to be encrypted, indicating that the original picture is available, i.e. performing subsequent method steps using the original picture; if the maximum data size is smaller than the data size to be encrypted, the original picture is not available, and the original picture can be re-acquired.
The data encryption method provided by the embodiment of the invention can further determine whether the original picture is available or not, and improves 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 amount of the data to be encrypted that can be saved in the original picture includes:
in some embodiments, the maximum data amount is calculated according to the following formula:
volume=Width*Height*3/8–C;
wherein volume is the maximum data amount, width is the Width pixel number, height is the Height pixel number, and C is a constant for recording data. Here, the Width and Height default data measurement units are bytes, and therefore, the bytes need to be converted into bits, that is, divided by 8, rgb has three components of R, G and B, if all used, each pixel corresponds to 3, C is some information with constant being attached, and a specific length is specified as needed, and at least 32 bits (4 bytes) are needed for recording the data length.
According to the data encryption method provided by the embodiment of the invention, the use efficiency of the method is further improved by reasonably calculating the maximum data volume.
The following describes the data encryption process in detail as follows:
step 1, loading an original picture:
in the embodiment of the invention, the original picture can be acquired through the URL, the original picture can be acquired randomly through surfing the internet, or the original picture can be acquired locally, and the purpose of recording the URL is to enable the original picture to be in a publicly accessible state, so that the decryption process only needs to use the URL.
Step 2, converting the data to be encrypted:
converting the data to be encrypted into a serialized binary data stream, for example:
the string "Hello" is converted into an array of bytes, "72 101 108 108 111", and then each byte is converted into a binary data stream: "1001000110010111011001101100110111110000010101111101111111001011011001100100".
Step 3, encrypting the pixel color channel:
at least one color channel in a pixel of the original picture is hidden with data to be encrypted. 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. Taking the red channel R as an example and taking the case where 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, only the following two cases need to be judged for its value:
1) When R <255, the superposition can be performed directly, with the value of V superimposed directly on R.
2) When r=255, since R is already the maximum value at this time, if the data V to be encrypted is 1, it becomes 0, so the manner of data superposition is R-V, with the exception of 255 (when v=0) or 254 (when v=1).
And so on, the binary data stream is all saved to the original picture. The maximum data size of the data to be encrypted which can be stored in the original picture is related to the pixel number of the original picture as follows, and the specific formula is as follows:
volume=Width*Height*3/8–C,
wherein volume is the maximum data size, width is the Width pixel number, height is the Height pixel number, and C is a constant for recording data, and specific length is specified as required, and at least 32 bits (4 bytes) are required for recording data length. For example, with a 1-bit data per channel setting, a 1080P original picture may store approximately 0.74MB of data. If the bit length is set to 2 or 3, the corresponding stored data is 1.48MB and 2.22MB. According to practical experience, the bit length is reasonably selected to be 2.
Step 4, generating pictures:
after the data to be encrypted is added into the channel, the picture carrying the data to be encrypted can be saved locally. The file type may be in a lossless format, including BMP, PNG, and the like, for example. The file name is not required.
Step 5, encrypting the URL:
finally, common algorithms such as AES can be used for encrypting the URL, and then the encrypted URL is added 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 flowchart of a data decryption method according to another embodiment of the present disclosure, as shown in fig. 2, the method including 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 may be performed in a terminal 2, and the terminal 2 may receive a 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 can be decomposed into an encrypted URL and a picture carrying data to be encrypted, and referring to the description, the encrypted URL is obtained through the identification field to be 50 bytes, and 50 bytes are intercepted from the field end of the picture to decrypt, so that the decrypted URL is obtained. And decrypting the encrypted URL to obtain the decrypted URL and a picture carrying the 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 is compared with the picture, and the data to be encrypted is obtained according to a comparison result. The original picture and the picture carrying the data to be encrypted can be compared by adopting a color comparison algorithm, wherein the difference is a color code corresponding to the data to be encrypted, and the method steps are adopted, for example:
"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 according to the superposition mode, the process of storing the data to be encrypted to the at least one color channel in reverse order is processed, and all the data quantities to be stored of all the obtained color channels are the data to be encrypted, for example, 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, the data to be encrypted is obtained according to the comparison result, and the data decryption can be realized rapidly and conveniently.
Fig. 3 (a) -3 (c) are flowcharts illustrating a data encryption and decryption method according to another embodiment of the present disclosure, as shown in fig. 3 (a), the "magnolia poem" in fig. 3 (a) is data to be encrypted, an original picture is obtained according to the "input picture URL" in fig. 3 (a), and the "information 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 of out.
As shown in fig. 3 (c), in order to decrypt, the above-mentioned picture named out. Png is only required to be input, so that the previously hidden data to be encrypted, i.e. the magnolia poem, can be analyzed.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present disclosure is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present disclosure. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all alternative embodiments, and that the acts and modules referred to are not necessarily required by the present disclosure.
The foregoing is a description of embodiments of the method, and the following further describes embodiments of the present disclosure through examples of apparatus.
Fig. 4 shows a block diagram of a data encryption apparatus according to an embodiment of the present disclosure, as shown in fig. 4, an apparatus 400 includes: an acquisition unit 410, a saving unit 420, and an adding unit 430, wherein:
the acquiring unit 410 is configured to acquire an original picture and record a URL; the storage unit 420 is configured to store data to be encrypted in 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.
According to the data encryption device 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.
Fig. 5 shows a block diagram of a data decryption apparatus according to an embodiment of the present disclosure, as shown in fig. 5, an apparatus 500 includes: an acquisition module 510, a parsing module 520, and a comparison 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 parsing module 520 is configured to parse the picture to be decrypted to obtain the decrypted URL and the picture; the comparing module 530 is configured to obtain the original picture based on the URL, compare the original picture with the picture, and obtain the data to be encrypted according to a comparison result.
According to the data decryption device 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, the data to be encrypted is obtained according to the comparison result, and the data decryption can be realized rapidly and conveniently.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the described modules may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again.
Fig. 6 illustrates a block diagram of an exemplary electronic device capable of implementing embodiments of the disclosure, as shown in fig. 6, the 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 required for the operation of the device 600 can also be stored. The CPU601, ROM602, and RAM603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Various components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, mouse, etc.; 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.
Processing unit 601 performs the various methods and processes described above, such as methods 100 and 200. For example, in some embodiments, methods 100 and 200 may be implemented as a computer software program tangibly embodied on 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 of the 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 in any other suitable manner (e.g., by means of firmware).
The functions described above herein 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), etc.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code 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 code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. 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. The 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.
Moreover, although 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. In 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 limiting the scope of the present 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 example forms of implementing the claims.

Claims (9)

1. A data encryption method, comprising:
acquiring an original picture and recording a URL;
storing data to be encrypted into at least one color channel in a pixel of the original picture to obtain a picture carrying the data to be encrypted;
adding the encrypted URL to the picture; wherein,
the storing the data to be encrypted in at least one color channel in the pixel 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;
according to the superposition mode, the data to be encrypted are stored to the at least one color channel;
the adding the encrypted URL to the picture includes:
and adding the encrypted URL to the field tail of the picture, and recording the data volume occupied by the encrypted URL through the identification field at the field tail.
2. The method according to claim 1, wherein determining the superposition of the data amounts according to the data amounts and the color codes corresponding to the at least one color channel comprises:
if the color code is less than or equal toDetermining that the superposition mode of the data quantity is direct superposition;
if the color code is greater thanDetermining that the superposition mode of the data quantity is indirect superposition based on the difference value between the color code and the data quantity; wherein n is the binary bit number corresponding to the data quantity.
3. The method according to claim 1, wherein the method further comprises:
acquiring the width pixel number and the height pixel number of the original picture;
acquiring the maximum data amount of the data to be encrypted which can be saved 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 data to be encrypted.
4. A method according to claim 3, wherein said obtaining the maximum amount of data that can be saved to the data to be encrypted in the original picture based on the number of width pixels and the number of height pixels comprises:
the maximum data amount is calculated according to the following formula:
volume= Width * Height * 3 / 8 – C;
wherein volume is the maximum data amount, width is the Width pixel number, height is the Height pixel number, and C is a constant for recording data.
5. A method of decrypting data based on the method of any of claims 1 to 4, 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 the 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.
6. A data encryption apparatus, comprising:
the acquisition unit is used for acquiring the original picture and recording the URL;
a storage unit, configured to store data to be encrypted in at least one color channel in a pixel of the original picture, to obtain a picture carrying the data to be encrypted; wherein,
the storing the data to be encrypted in at least one color channel in the pixel 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;
according to the superposition mode, the data to be encrypted are stored to the at least one color channel;
an adding unit, configured to add the encrypted URL to the picture; wherein,
the adding the encrypted URL to the picture includes:
and adding the encrypted URL to the field tail of the picture, and recording the data volume occupied by the encrypted URL through the identification field at the field tail.
7. A data decrypting apparatus for decrypting an encrypted picture obtained by the method according to any one of claims 1 to 4, comprising:
the acquisition module is used for acquiring the 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 acquire 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.
8. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program, characterized in that the processor, when executing the computer program, implements the method according to any of claims 1 to 5.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed, implements the method according to any one of claims 1 to 5.
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 CN111815723A (en) 2020-10-23
CN111815723B true 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)

Families Citing this family (1)

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

Citations (6)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170011203A1 (en) * 2015-07-06 2017-01-12 Microsoft Technology Licensing, Llc Encrypting data within a host image

Patent Citations (6)

* 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
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

Also Published As

Publication number Publication date
CN111815723A (en) 2020-10-23

Similar Documents

Publication Publication Date Title
EP3756130B1 (en) Image hidden information detector
Jang et al. Partial image encryption using format-preserving encryption in image processing systems for Internet of things environment
US20170085373A1 (en) Polymorphic encryption key matrices
CN111865591B (en) Symmetric encryption method, decryption method, device, equipment and storage medium
Yang et al. Implementation of encryption algorithm and wireless image transmission system on FPGA
CN111815723B (en) Data encryption method and device
US9813762B2 (en) Creating hash values indicative of differences in images
CN109919823A (en) A kind of watermark generation method and device
CN112699400B (en) Image information security processing method and device
CN110634096A (en) Self-adaptive multi-mode information hiding method and device
CN113014373B (en) Data encryption method, device, equipment and medium in homomorphic calculation
CN112434094A (en) Database connection method and device based on encryption algorithm and computer equipment
CN110971581B (en) Encrypted data processing method and device
CN116405482A (en) Log file transmission method, system, terminal and storage medium
CN114915464A (en) Image encryption method and image decryption method based on special matrix operation
CN115757535A (en) Data query method, data storage method and device and electronic equipment
CN114666624A (en) Video file encryption and decryption method
CN113645025A (en) Data encryption storage method, storage device, user equipment and storage medium
CN111339504A (en) Vector watermark processing method, device, equipment and storage medium
CN106570410B (en) Data encryption method, data decryption method, device and system
CN115643348B (en) Method and device for certifiable safety natural steganography based on reversible image processing network
CN114221816B (en) Flow detection method, device, equipment and storage medium
CN113872753B (en) Encryption transmission method and device based on SHA256 sequence form data
CN113283215B (en) Data confusion method and device based on UTF-32 coding
CN114095203A (en) Data encryption interaction method and device and readable medium

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