Image encryption method and device, image decryption method and device
By performing barcode image encryption and steganography algorithm processing on the image, the problem of difficulty in image copyright protection is solved, the effect of accurately obtaining copyright information after the image is stolen is achieved, and the reliability of copyright maintenance is improved.
Patent Information
- Application Number
- CN202110903090.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-06
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2041-08-06
AI Technical Summary
It is difficult to effectively protect image copyright with existing technology, especially after the image is stolen, it is difficult to accurately obtain copyright information, and traditional watermarking methods are difficult to repair after compression or rewriting.
The barcode image corresponding to the target information is used for encryption, the image steganography algorithm is used to first encrypt the image to be encrypted, and the target information is obtained by repairing the damaged barcode image during decryption to ensure the reliability of the copyright information.
Even if the image is compressed or rewritten to introduce noise, it can still effectively repair the barcode image and accurately obtain copyright information, improving the reliability and protection effect of image copyright maintenance.
Smart Images

Figure CN113553608B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer vision technology, and in particular to an image encryption method and device, an image decryption method and device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the development of Internet technology, image resources are widely spread in Internet technology, and the copyright protection of images is very important. If an image is stolen, it will cause immeasurable losses to the company that owns the copyright of the image. In related technologies, copyright protection is performed by adding copyright information to the image through watermarking.
[0003] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention
[0004] The present disclosure provides an image encryption method and device, an image decryption method and device, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] According to one aspect of the present disclosure, there is provided an image encryption method, comprising: acquiring a barcode image corresponding to target information; and based on the barcode image, performing a first encryption on an image data block of the image to be encrypted using an image steganography algorithm.
[0006] According to another aspect of the present disclosure, there is provided an image decryption method, comprising: decrypting an image data block of an encrypted image to obtain a barcode image for encryption; repairing the barcode image; and acquiring first target information based on the repaired barcode image.
[0007] According to another aspect of the present disclosure, an image encryption device is also provided, including: a first acquisition unit, configured to acquire a barcode image corresponding to target information; and a first encryption unit, configured to perform a first encryption on an image data block of the image to be encrypted using an image steganography algorithm based on the barcode image.
[0008] According to another aspect of the present disclosure, there is also provided an image decryption device, comprising: a first decryption unit, configured to decrypt an image data block of an encrypted image to obtain a barcode image for encryption; an image repair unit, configured to repair the barcode image; and a first acquisition unit, configured to acquire first target information based on the repaired barcode image.
[0009] According to another aspect of the present disclosure, an electronic device is also provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program, and the computer program implements the above method when executed by the at least one processor.
[0010] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing a computer program is also provided, wherein the computer program implements the above method when executed by a processor.
[0011] According to another aspect of the present disclosure, a computer program product is further provided, comprising a computer program, wherein the computer program implements the above method when executed by a processor.
[0012] According to one or more embodiments of the present disclosure, the barcode image corresponding to the target information is used to encrypt the image to be encrypted. Even if the encrypted image introduces noise after compression or rewriting, the damaged barcode image can still be effectively repaired, so that the target information can be accurately obtained based on the repaired barcode image. The use of the technical solution of the present disclosure for image copyright maintenance can improve the reliability of image copyright maintenance.
[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0015] Figure 1 An exemplary flow chart of an image encryption method according to some embodiments of the present disclosure is shown;
[0016] Figure 2 An exemplary flow chart of obtaining a barcode image corresponding to target information in an image encryption method according to some embodiments of the present disclosure is shown;
[0017] Figure 3 An example of a barcode image used for encryption in an image encryption method according to some embodiments of the present disclosure is shown;
[0018] Figure 4An example of an image to be encrypted in an image encryption method according to some embodiments of the present disclosure is shown;
[0019] Figure 5 An example of a barcode image obtained by decryption in an image decryption method according to some embodiments of the present disclosure is shown;
[0020] Figure 6 An exemplary flow chart of performing a first encryption on an image data block of an image to be encrypted using an image steganography algorithm based on a barcode image in an image encryption method according to some embodiments of the present disclosure is shown;
[0021] Figure 7 An exemplary flow chart of performing second encryption on an image to be encrypted in an image encryption method according to some embodiments of the present disclosure is shown;
[0022] Figure 8 An exemplary flow chart of obtaining encrypted data corresponding to target information in an image encryption method according to some embodiments of the present disclosure is shown;
[0023] Fig. 9 A schematic diagram showing a target image corresponding to target information in an image encryption method according to some embodiments of the present disclosure;
[0024] Fig.10 An exemplary flow chart of an image decryption method according to some embodiments of the present disclosure is shown;
[0025] Fig.11 An exemplary flow chart of performing a second decryption on an encrypted image in an image decryption method according to some embodiments of the present disclosure is shown;
[0026] Fig.12 An exemplary flow chart of decrypting an image data block of an encrypted image in an image decryption method according to some embodiments of the present disclosure is shown;
[0027] Fig.13 An exemplary flow chart of repairing a barcode image in an image decryption method according to some embodiments of the present disclosure is shown;
[0028] Fig.14 An exemplary block diagram of an image encryption device according to some embodiments of the present disclosure is shown;
[0029] Fig.15 An exemplary block diagram showing an image decryption device according to some embodiments of the present disclosure; and
[0030] Fig.16 A structural block diagram of an exemplary electronic device that can be used to implement some embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0031] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0032] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.
[0033] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.
[0034] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0035] According to one aspect of the present disclosure, a method for encrypting an image is provided. Figure 1 , an image encryption method according to some embodiments of the present invention is exemplarily described. The image encryption method 100 includes:
[0036] Step S110: obtaining a barcode image corresponding to the target information; and
[0037] Step S120: Based on the barcode image, an image data block of the image to be encrypted is first encrypted using an image steganography algorithm.
[0038] According to the method disclosed in the present invention, the barcode image corresponding to the target information is used to encrypt the image to be encrypted. Even if the encrypted image introduces noise after compression or rewriting, the lossy barcode image obtained by decryption can still be effectively repaired, so that the target information used for encryption can be accurately obtained based on the repaired barcode image.
[0039] The use of the technical solution of the present disclosure for image copyright maintenance (the target information may be copyright information) can improve the reliability of image copyright maintenance. For example, in the video game development stage, the game developer encrypts the image in the video game so that the barcode image corresponding to the copyright information is embedded in the image in the video game. When the game resources of the video game are stolen, even if the stolen image introduces noise through compression or rewriting, the barcode image obtained by decrypting the video game image can still be effectively repaired, and the copyright information can be obtained based on the repaired barcode image to determine that the stolen image is rewritten based on the image of the game developer of the game, thereby achieving the effect of pursuing the stolen game resources, improving the reliability of copyright maintenance of the game video, and achieving the purpose of protecting the game resources.
[0040] At the same time, when a barcode image is used to encrypt an image, when the image is tampered with and causes the barcode image to be partially modified, it does not affect the width of the black and white bars of the barcode, and the information corresponding to the barcode can still be read more easily through the partially modified barcode image. Therefore, compared to images encrypted with other data (such as other images or texts), the encrypted image according to the present disclosure can obtain valid copyright information based on the repaired barcode image after decryption.
[0041] The target information includes any copyright information that can be represented by a barcode image, for example, information including a corporate logo or corporate name.
[0042] In some embodiments, the target information is text information including a corporate logo. In other embodiments, the target information is image information including a corporate logo, etc. In other embodiments, the target information is symbol information including a corporate logo, etc. The target information may also be a combination of any number of information in different formats, which is not limited here.
[0043] In some embodiments, the target information is text information, such as Figure 2 As shown, step S110, obtaining a barcode image corresponding to the target information includes:
[0044] Step S210: converting the target information into binary information; and
[0045] Step S220: Generate a barcode image corresponding to the binary information.
[0046] In the above scheme, the target information is set as text information, and the corporate logo or corporate name can be used as the target information to encrypt the image. When the encrypted image is decrypted, the target information obtained is the copyright information of the enterprise, making copyright maintenance more direct and clear, and effectively protecting the copyright of the image. At the same time, the binary information of the target information is converted into a barcode image, and the barcode image is used for encryption to obtain an encrypted image, so that after decrypting the encrypted image, the binary information corresponding to the barcode image can be obtained, and the binary information can be easily converted into a barcode, making image copyright protection easy to implement and having high reliability.
[0047] In some embodiments, in step S210, encoding the target information into binary information includes encoding the target information to form a binary digital string or digital matrix; in step S220, corresponding black and white stripes are formed according to each number in the binary digital string or digital matrix, thereby forming a barcode corresponding to the target information.
[0048] According to some embodiments, based on the correspondence between the preset numbers and the widths of the black and white stripes, each number in the binary number string or the number matrix is represented by white stripes and black stripes of different widths to form a barcode image. Exemplarily, the white stripes and black stripes of the barcode can be composed of unit width 1 and unit width 2, the unit width 1 of the black stripes can represent 0, the unit width 2 of the black stripes can represent 1, the unit width 1 of the white stripes can represent 2, and the unit width 2 of the white stripes can represent 4. Based on the above settings, each number in the binary number string or the number matrix can be represented by black stripes and white stripes of different widths. It should be noted that this is only an example, and it is not limited that the white stripes and black stripes of the barcode must be composed of unit width 1 and unit width 2. For example, the white stripes and black stripes of the barcode can also be composed of only unit width 1.
[0049] See also Figure 3 , which exemplarily illustrates a barcode image corresponding to binary information based on target information “Game_copyright”.
[0050] In some embodiments, the stripes of the barcode in the barcode image extend from one side of the barcode image to another opposite side, and the size of the barcode image is the same as the size of the image to be encrypted.
[0051] By setting the barcode stripes to extend from one side of the barcode image to the other opposite side, and setting the size of the barcode image and the size of the image to be encrypted to be the same, even if noise is introduced into the encrypted image due to compression or rewriting operations, the distribution of the barcode stripes can be well preserved, so that the barcode image can be effectively repaired, and the target information corresponding to the barcode image can be accurately obtained, so that the reliability of copyright maintenance of the encrypted image can be further improved.
[0052] In one example of the present disclosure, Figure 3 300 pairs of barcode images in Figure 4 The image to be encrypted 400 in is encrypted, and the encrypted image is decrypted to obtain Figure 5 Since the barcode 301 in the barcode image 300 extends from the upper end to the lower end of the barcode image 300, the size of the barcode image is the same as the size of the image to be encrypted 400. In the barcode image 500, the stripes 501 extend from the upper end to the lower end of the barcode image 500. Among them, in the area between the stripes 501, although the image is compressed and lossy, the distribution of the barcode stripes can still be well preserved, so that the target information corresponding to the barcode can be accurately obtained. It should be noted that Figure 4 The process of encrypting the image 400 to be encrypted is to encrypt the original image of the image 400 to be encrypted. Figure 4 The mosaic parts shown in the figure do not represent encrypted content.
[0053] It can be understood that setting the barcode image such that the barcode stripes extend from one side of the barcode image to another opposite side and the size of the barcode image is the same as the size of the image to be encrypted is merely exemplary, and those skilled in the art should understand that, for example, the barcode image can also be set to include two barcodes arranged and spaced along the extension direction, a plurality of barcodes distributed in a matrix, etc., and the effect of the present disclosure can still be achieved.
[0054] In some embodiments, Figure 6 As shown, step S120, based on the barcode image, using the image steganography algorithm to perform a first encryption on the image data block to be encrypted includes:
[0055] Step S610: Obtaining a binary representation corresponding to the barcode image, wherein the binary representation includes a plurality of numerical values, and each numerical value in the plurality of numerical values corresponds one-to-one to each pixel in a plurality of pixels of the barcode image;
[0056] Step S620: Obtaining binary codes of pixel values of at least a portion of pixels in the image to be encrypted; and
[0057] Step S630: for each pixel in the at least a portion of pixels, modify the least significant bit of the binary code of the pixel value of the pixel to a numerical value corresponding to the pixel in the binary representation.
[0058] In the above scheme, the smallest bit of the binary code of the pixel of the image to be encrypted is modified to the value in the binary representation corresponding to the barcode image. Since the smallest bit does not affect the display of the image, the display effect of the encrypted image does not change. At the same time, in the process of decrypting the encrypted image, the target information can be obtained through the value of the smallest bit, making the encryption and decryption process simple.
[0059] In some embodiments, in step S610, a corresponding binary representation is obtained based on the grayscale value of each pixel position of the barcode image, for example, the grayscale value of white corresponds to 1, and the grayscale value of black corresponds to 2. The multiple values included in the binary representation may be, for example, but not limited to, distributed in a matrix.
[0060] It should be noted that, in the present embodiment, modifying the smallest bit of the binary code of the pixel value of the pixel of the image to be encrypted into a numerical value corresponding to the pixel in the binary distribution is merely exemplary, and those skilled in the art should understand that one or more other bits of the binary code of the pixel value of the pixel of the image to be encrypted that do not affect the image display may also be modified into a numerical value corresponding to the pixel in the binary representation, and the effect of the present disclosure can still be achieved.
[0061] In some embodiments, Figure 7 As shown, the method 100 further includes:
[0062] Step S710: Obtaining encrypted data corresponding to the target information; and
[0063] Step S720: writing the encrypted data into the text data block of the image to be encrypted, and performing a second encryption.
[0064] In the above scheme, after the barcode image is embedded into the image to be encrypted by using the image steganography algorithm and the first encryption is performed, the encrypted data corresponding to the target information is written into the text data block to perform the second encryption on the image to be encrypted, so that the image to be encrypted can be doubly encrypted. When the encrypted image is tampered with, on the one hand, the barcode image embedded by the first encryption can be decrypted to verify that the image is an image carrying the target information, and on the other hand, the encrypted data written by the second encryption can be decrypted to verify that the image is an image carrying the target information, so that the image can be doubly protected, further improving the reliability of copyright protection of the encrypted image. At the same time, since the text data block does not affect the display of the image, it will not affect the display effect of the image to be encrypted after encryption.
[0065] In some embodiments, the encrypted data may be, but is not limited to, binary information corresponding to the target information.
[0066] By setting the encrypted data as binary information corresponding to the target information, the barcode image corresponding to the target information can be obtained based on its binary information. After the encrypted image after the first encryption and the second encryption is decrypted, by determining whether the barcode image is consistent with the encrypted data, cross-verification of the encrypted image can be achieved, further improving the reliability of copyright protection of the encrypted image.
[0067] It should be understood that setting the encrypted data as binary information corresponding to the target information is merely exemplary, and those skilled in the art should understand that the encrypted data may also be octal, decimal, hexadecimal information, etc., without limitation.
[0068] In other embodiments, the encrypted data may also be obtained based on an image associated with the target information. In this case, Figure 8 As shown, step S710, obtaining the encrypted data corresponding to the target information includes:
[0069] Step S810: Acquire a target image corresponding to the target information; and
[0070] Step S820: Encode the target image and convert it into encrypted data in binary format.
[0071] By encoding the target image corresponding to the target information into encrypted data in binary format, the encrypted data in binary format is consistent with the binary format of the text information data block in the image, so that the encrypted data can be directly added to the text information data block of the image to be encrypted to perform a second encryption on the image to be encrypted. At the same time, the encrypted data in binary format occupies a small storage space, so that after the encrypted image to be encrypted is used, the storage space occupied by the encrypted image data obtained will not be significantly increased due to the writing of the encrypted data, saving storage space.
[0072] For example, taking the target information "Game_copyright" as an example, the process of obtaining the encrypted data corresponding to the target information includes: obtaining the target image 900 corresponding to the target information, such as Fig. 9 As shown; the target image is encoded in UTF-8 and converted into a bit string in binary format [71 97 109 101 95 99 111 112 121 114 105 103 104 116].
[0073] After the encrypted data is obtained, in step S720, the encrypted data is written into the text data of the image to be encrypted. Fig. 9 The encrypted data obtained by using the target image 900 in the image 900 is taken as an example for explanation. In step S720, the text information data block of the image to be encrypted in PNG format is first obtained, wherein the PNG image is stored in binary format, and its text information data block uses the binary bit string [74 45 58 74] as a message header, and the bit string [74 45 58 74 71 97109 101 95 99 111 112 121 114 105 103 104 116] in binary format converted from the target image is embedded into the text data block using the binary bit string [74 45 58 74] as a message header to form a bit string [74 45 58 74 71 97109 101 95 99 111 112 121 114 105 103 104 116], thereby writing the encrypted data into the text data block of the image to be encrypted. Here, the specific process of encryption using the technical solution of the present invention is explained by taking the PNG image as an example, and the encryption method of the present invention is not limited to being applicable only to PNG images.
[0074] It should be understood that converting the target image into encrypted data in binary format is merely exemplary, and those skilled in the art can use encrypted data in other adaptive formats according to the formats of each data block of the image to be encrypted and still achieve the effects of the present disclosure.
[0075] According to another aspect of the present disclosure, an image decryption method is also provided.
[0076] See also Fig.10 According to an embodiment of the present disclosure, an image decryption method 1000 includes:
[0077] Step S1010: decrypting the encrypted image data block to obtain a barcode image for encryption;
[0078] Step S1020: repairing the barcode image; and
[0079] Step S1030: Acquire first target information based on the repaired barcode image.
[0080] The encrypted image is decrypted to obtain a barcode image for encryption, the decrypted image is repaired, and the first target information is acquired based on the repaired barcode image, so as to identify the copyright information of the encrypted image.
[0081] In some embodiments, Fig.11As shown, step S1010, decrypting the image data block of the encrypted image to obtain the barcode image for encryption includes:
[0082] Step S1110: decrypting the image data block of the encrypted image to obtain a binary representation; and Step S1120: acquiring the barcode image based on the binary representation.
[0083] By decrypting the image data block of the encrypted image to obtain a binary representation, the barcode image used when the encrypted image is encrypted using an image steganography algorithm can be obtained based on the binary representation, thereby obtaining a barcode image used for encryption.
[0084] In some embodiments, Fig.12 As shown, step S1020, repairing the barcode image includes:
[0085] Step S1210: determining a plurality of black stripe regions of the barcode image by a classification algorithm; and
[0086] Step S1220: modify the pixel value of the pixel between two adjacent black stripe areas to 255.
[0087] The above repair method determines the black stripes of the barcode through a classification algorithm, and modifies the pixel values of the pixels between the black stripe areas to 255, thereby obtaining the white stripes of the barcode, and then obtaining the repaired barcode image. It should be noted that the method for repairing the barcode image is not limited to the above method. For example, the white stripe area of the barcode can also be directly determined through a classification algorithm, and the values of all pixels in the white stripe area can be modified to 255. Figure 5 , shows a barcode image 500 decrypted in an image decryption method according to an embodiment of the present disclosure, which includes black stripes 501. The color of the noise area 502 between the black stripes 501 is changed to white, and the restored barcode image is as follows: Figure 3 As shown, it can be seen that the decryption method according to the present disclosure can obtain a barcode image containing a clearly identifiable barcode.
[0088] In some embodiments, Fig.13 As shown, the method 1000 further includes performing a second decryption on the encrypted image, specifically comprising:
[0089] Step S1310: obtaining the text data block of the encrypted image;
[0090] Step S1320: Obtaining encrypted data based on the text data block;
[0091] Step S1330: Acquire second target information based on the encrypted data; and
[0092] Step S1340: Perform cross-validation based on the first target information and the second target information.
[0093] In the above scheme, after the barcode image is obtained through decryption, the encrypted image is further decrypted for the second time to obtain the second target information corresponding to the encrypted data in the encrypted text data block to verify that the image carries the target information, so that the target information obtained by the encrypted data and the target information obtained by decrypting the barcode image can be cross-verified, further improving the reliability of image copyright maintenance.
[0094] According to another aspect of the present disclosure, an image encryption device is also provided. Fig.14 As shown, the device 1400 may include: a first acquisition unit 1410, configured to acquire a barcode image corresponding to target information; a first encryption unit 1420, configured to perform a first encryption on an image data block of the encrypted image using an image steganography algorithm based on the barcode image.
[0095] According to another aspect of the present disclosure, an image decryption device is also provided. Fig.15 As shown, the device 1500 may include: a first decryption unit 1510, configured to decrypt the image data block of the encrypted image to obtain a barcode image for encryption; an image repair unit 1520, configured to repair the barcode image; and a first acquisition unit 1530, configured to acquire first target information based on the repaired barcode image.
[0096] According to another aspect of the present disclosure, an electronic device is also provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program, and the computer program implements the above method when executed by the at least one processor.
[0097] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing a computer program is also provided, wherein the computer program implements the above method when executed by a processor.
[0098] According to another aspect of the present disclosure, a computer program product is further provided, comprising a computer program, wherein the computer program implements the above method when executed by a processor.
[0099] See also Fig.16, a block diagram of an electronic device 1600 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device can be a computer device of different types, such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0100] like Fig.16 As shown, the electronic device 1600 may include at least one processor 1610 , a working memory 1620 , an input unit 1640 , a display unit 1650 , a speaker 1660 , a storage unit 1670 , a communication unit 1680 , and other output units 1690 , which can communicate with each other via a system bus 1630 .
[0101] Processor 1610 may be a single processing unit or multiple processing units, all of which may include a single or multiple computing units or multiple cores. Processor 1610 may be implemented as one or more microprocessors, microcomputers, microcontrollers, digital signal processors, central processing units, state machines, logic circuits, and / or any device that manipulates signals based on operating instructions. Processor 1610 may be configured to obtain and execute computer-readable instructions stored in working memory 1620, storage unit 1670, or other computer-readable media, such as program codes of operating system 1620a, program codes of application programs 1620b, and the like.
[0102] The working memory 1620 and the storage unit 1670 are examples of computer-readable storage media for storing instructions that are executed by the processor 1610 to implement the various functions described above. The working memory 1620 may include both volatile memory and non-volatile memory (e.g., RAM, ROM, etc.). In addition, the storage unit 1670 may include a hard disk drive, a solid-state drive, a removable medium, including external and removable drives, a memory card, a flash memory, a floppy disk, an optical disk (e.g., a CD, a DVD), a storage array, a network attached storage, a storage area network, etc. The working memory 1620 and the storage unit 1670 may all be collectively referred to herein as memory or computer-readable storage media, and may be a non-transitory medium capable of storing computer-readable, processor-executable program instructions as computer program code, which may be executed by the processor 1610 as a specific machine configured to implement the operations and functions described in the examples herein.
[0103] The input unit 1640 may be any type of device capable of inputting information to the electronic device 1600. The input unit 1640 may receive input digital or character information and generate key signal input related to user settings and / or function control of the electronic device, and may include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone and / or a remote controller. The output unit may be any type of device capable of presenting information, and may include but is not limited to a display unit 1650, a speaker 1660, and other output units 1690, which may include but are not limited to video / audio output terminals, vibrators and / or printers. The communication unit 1680 allows the electronic device 1600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, such as a Bluetooth™ device, a 1302.11 device, a WiFi device, a WiMax device, a cellular communication device and / or the like.
[0104] The application 1620b in the working register 1620 can be loaded to execute the various methods and processes described above, such as Figure 1 Steps S110-S120 in . For example, in some embodiments, the image encryption method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1670. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1600 via the storage unit 1670 and / or the communication unit 1680. When the computer program is loaded and executed by the processor 1610, one or more steps of the image encryption method described above may be performed. Alternatively, in other embodiments, the processor 1610 may be configured to perform the image encryption method in any other appropriate manner (e.g., by means of firmware).
[0105] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0106] The program code for implementing the method 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, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0107] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A 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, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0108] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0109] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communications network). Examples of communications networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0110] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0111] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0112] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.
Claims
1. An image encryption method, include: Obtaining a barcode image corresponding to the target information; Based on the barcode image, using an image steganography algorithm to perform a first encryption on an image data block of the image to be encrypted; Acquire encrypted data corresponding to the target information, wherein the encrypted data is binary information corresponding to the target information, the barcode image is a barcode corresponding to the encrypted data, and the barcode image corresponding to the target information and the encrypted data corresponding to the target information are used for cross-verification during image decryption; as well as The encrypted data is written into the text data block of the image to be encrypted to perform a second encryption.
2. The method according to claim 1, in, Obtaining the encrypted data corresponding to the target information includes: Acquiring a target image corresponding to the target information; and The target image is encoded and converted into encrypted data in binary format.
3. The method according to any one of claims 1 to 2, in, Based on the barcode image, performing a first encryption on the image data block of the image to be encrypted using an image steganography algorithm comprises: Obtaining a binary representation corresponding to the barcode image, the binary representation comprising a plurality of numerical values, each numerical value in the plurality of numerical values corresponding one-to-one to each pixel in a plurality of pixels of the barcode image; For at least a portion of pixels in the image to be encrypted, obtaining a binary code of a pixel value of each pixel in the at least a portion of pixels; and For each pixel in the at least a portion of pixels, the least significant bit of the binary encoding of the pixel value of the pixel is modified to a numerical value corresponding to the pixel in the binary representation.
4. The method according to any one of claims 1 to 2, in, The barcode stripes in the barcode image extend from one side of the barcode image to another opposite side, and the size of the barcode image is the same as that of the image to be encrypted.
5. An image decryption method, include: Decrypting the image data block of the encrypted image to obtain a barcode image for encryption; Repairing the barcode image; Acquiring first target information based on the repaired barcode image; Obtaining a text data block of the encrypted image; Acquire encrypted data based on the text data block; acquiring second target information based on the encrypted data; as well as Cross-validation is performed based on the first target information and the second target information.
6. The method according to claim 5, in, Decrypting the encrypted image data block to obtain the barcode image for encryption includes: decrypting the image data block of the encrypted image to obtain a binary representation; and The barcode image is acquired based on the binary representation.
7. The method according to claim 5 or 6, in, Repairing the barcode image includes: Determining the plurality of black stripe regions of the barcode image by a classification algorithm; and The pixel values of the pixels between two adjacent black stripes are modified to 255.
8. An image encryption device, include: a first acquisition unit configured to acquire a barcode image corresponding to the target information, and acquire encrypted data corresponding to the target information, wherein the encrypted data is binary information corresponding to the target information, the barcode image is a barcode corresponding to the encrypted data, and the barcode image corresponding to the target information and the encrypted data corresponding to the target information are used for cross-verification during image decryption; and The first encryption unit is configured to perform a first encryption on the image data block of the image to be encrypted based on the barcode image using an image steganography algorithm, and write the encrypted data into the text data block of the image to be encrypted for a second encryption.
9. An image decryption device, include: A first decryption unit is configured to decrypt the image data block of the encrypted image to obtain a barcode image for encryption; An image repair unit, configured to repair the barcode image; as well as A first acquisition unit is configured to acquire first target information based on the repaired barcode image and acquire a text data block of the encrypted image; The first decryption unit is also configured to obtain encrypted data based on the text data block, obtain second target information based on the encrypted data, and perform cross-verification based on the first target information and the second target information.
10. An electronic device, include: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores a computer program, which, when executed by the at least one processor, implements the method according to any one of claims 1 to 7.
11. A non-transitory computer-readable storage medium storing a computer program, in, The computer program implements the method according to any one of claims 1 to 7 when executed by a processor.
12. A computer program product comprising a computer program, in, The computer program implements the method according to any one of claims 1 to 7 when executed by a processor.
