CN109257520A - A kind of image ciphering method, verification method, device, equipment and medium - Google Patents

A kind of image ciphering method, verification method, device, equipment and medium Download PDF

Info

Publication number
CN109257520A
CN109257520A CN201811340732.XA CN201811340732A CN109257520A CN 109257520 A CN109257520 A CN 109257520A CN 201811340732 A CN201811340732 A CN 201811340732A CN 109257520 A CN109257520 A CN 109257520A
Authority
CN
China
Prior art keywords
picture
data
xor operation
unit
result
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.)
Pending
Application number
CN201811340732.XA
Other languages
Chinese (zh)
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 Feixun Digital Technology Co Ltd
Kyland Technology Co Ltd
Original Assignee
Beijing Feixun Digital Technology Co Ltd
Kyland 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 Feixun Digital Technology Co Ltd, Kyland Technology Co Ltd filed Critical Beijing Feixun Digital Technology Co Ltd
Priority to CN201811340732.XA priority Critical patent/CN109257520A/en
Publication of CN109257520A publication Critical patent/CN109257520A/en
Pending legal-status Critical Current

Links

Classifications

    • 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)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)
  • Facsimile Transmission Control (AREA)

Abstract

The embodiment of the invention discloses a kind of image ciphering method, verification method, device, equipment and media, the image ciphering method includes: for the image data in picture, XOR operation is carried out according to setting two unit datas of sequential selection, then result and other unit data are subjected to XOR operation;The final result of XOR operation is stored in the file header of picture, the picture verification method includes: the final result that XOR operation is obtained from the file header of picture;For the image data in picture, XOR operation is carried out according to setting two unit datas of sequential selection, then result and other unit data are subjected to XOR operation, obtain image data XOR operation result;Compare the final result of XOR operation with image data XOR operation as a result, if than more consistent, picture authenticity verification passes through.The technical solution of the embodiment of the present invention can be in the case where not influencing picture opening browsing, and whether verifying picture occurred to distort, so that it is determined that the authenticity of picture.

Description

A kind of image ciphering method, verification method, device, equipment and medium
Technical field
The present embodiments relate to image data processing technique more particularly to a kind of image ciphering methods, verification method, dress It sets, equipment and medium.
Background technique
When the photo violating the regulations of traffic monitoring electronic eyes shooting at present, the evidence photograph of public security acquisition serve as legal argument, all Need to be ensured of the original photo not being modified.
Accordingly, it is desirable to provide a kind of authenticity for being able to verify that the original images such as photo, prevent from transmitting or storing In the process by the scheme of malice distorted.In particular, being required to still be able in the case where not influencing picture opening browsing Whether verifying picture occurred to distort, to learn whether picture can become the technical solution of legal effective legal argument.
Summary of the invention
The embodiment of the present invention provides a kind of image ciphering method, verification method, device, equipment and medium, to realize to figure The encryption of piece, and it is able to verify that whether picture is tampered, and do not influence the normal opening browsing of picture.
In a first aspect, the embodiment of the invention provides a kind of image ciphering methods, comprising:
For the image data in picture, as unit of setting data length, according to setting two units of sequential selection XOR operation is carried out according to progress XOR operation, then by result and other unit data;
The final result of the XOR operation is stored in the file header of the picture.
Second aspect, the embodiment of the invention also provides a kind of picture verification methods, comprising:
The final result of XOR operation is obtained from the file header of picture;
For the image data in picture, as unit of setting data length, according to setting two units of sequential selection XOR operation is carried out according to progress XOR operation, then by result and other unit data, obtains described image data XOR operation knot Fruit;
The final result of the XOR operation is compared with described image data XOR operation result, if comparing one It causes, then picture authenticity verification passes through.
The third aspect, the embodiment of the invention provides a kind of image ciphering devices, comprising:
Cryptographic calculation module, the image data for being directed in picture are suitable according to setting as unit of setting data length Sequence selects two unit datas to carry out XOR operation, then result and other unit data are carried out XOR operation;
As a result memory module, for the final result of the XOR operation to be stored in the file header of the picture.
Fourth aspect, the embodiment of the invention provides a kind of pictures to verify device, comprising:
As a result module is obtained, for obtaining the final result of XOR operation from the file header of picture;
Computing module is verified, the image data for being directed in picture is suitable according to setting as unit of setting data length Sequence selects two unit datas to carry out XOR operation, then result and other unit data are carried out XOR operation, obtains the figure As data XOR operation result;
As a result comparison module, for by the final result of the XOR operation and described image data XOR operation result into Row compares, if picture authenticity verification passes through than more consistent.
5th aspect, the embodiment of the invention provides a kind of computer equipments, comprising:
One or more processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processing Device realizes the image ciphering method or picture verification method as described in any in the embodiment of the present invention.
6th aspect, the embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computer Program realizes image ciphering method or picture verifying as described in any in the embodiment of the present invention when program is executed by processor Method.
The embodiment of the invention provides a kind of image ciphering method, verification method, device, equipment and media, by being directed to Image data in picture carries out exclusive or fortune according to setting two unit datas of sequential selection as unit of setting data length It calculates, and result and other unit data is subjected to XOR operation, the final result of XOR operation is finally stored in the text of picture In part head, the cryptographic operation to picture is realized, by obtaining the final result of XOR operation from the file header of picture, for figure Image data in piece carries out XOR operation according to setting two unit datas of sequential selection as unit of setting data length, And result and other unit data are subjected to XOR operation, image data XOR operation is obtained as a result, finally by XOR operation Final result is compared with image data XOR operation result, verifies the authenticity of picture, realizes the verification operation to picture, It solves in the prior art, after image ciphering and when whether verifying picture occurred to distort, picture cannot be opened and be browsed The problem of, it realizes in the case where not influencing picture opening browsing, still is able to whether verifying picture occurred to distort, thus Determine the effect of picture authenticity.
Detailed description of the invention
Fig. 1 is a kind of flow chart for image ciphering method that the embodiment of the present invention one provides;
Fig. 2 is a kind of flow chart of image ciphering method provided by Embodiment 2 of the present invention;
Fig. 3 is a kind of flow chart for picture verification method that the embodiment of the present invention three provides;
Fig. 4 is a kind of flow chart for picture verification method that the embodiment of the present invention four provides;
Fig. 5 is a kind of structural schematic diagram for image ciphering device that the embodiment of the present invention five provides;
Fig. 6 is a kind of structural schematic diagram for picture verifying device that the embodiment of the present invention six provides;
Fig. 7 is a kind of structural schematic diagram for computer equipment that the embodiment of the present invention seven provides.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to just Only the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Embodiment one
Fig. 1 is the flow chart of a kind of image ciphering method that the embodiment of the present invention one provides, and the present embodiment is applicable to pair Picture carries out the case where cryptographic operation, and this method can be executed by image ciphering device provided in an embodiment of the present invention, the dress Setting can be used the mode of software and/or hardware and realizes, and generally can integrate in various general purpose computing devices, such as Fig. 1 institute Show, the image ciphering method of the present embodiment specifically comprises the following steps:
Step 110, for the image data in picture, as unit of setting data length, according to setting sequential selection two A unit data carries out XOR operation, then result and other unit data are carried out XOR operation.
Wherein, image data is the data for recordable picture raw information, and the information in image data is once modified, The display of picture will be impacted, for example, the picture height and width information, picture in modification image data are being shown When length-width ratio and display size will change.Setting data length is a data length preset value, in general, in picture In file, data are recorded with bytewise, and setting data length is including but not limited to single byte, in multibyte and byte Position.Setting sequence is a preset order of operation, and the data that setting sequence is related to can be all image datas, be also possible to Part image data, the sequence that the direction of setting sequence is stored including but not limited to data, the opposite sequence and more of data storage A parallel sequence of data segment.
In the present embodiment, for the data of the recordable picture raw information in image data, according to setting sequential selection Two unit datas carry out XOR operation, then result and other unit data are carried out XOR operation, have reached to data encryption Purpose, and the result of XOR operation can be one, be also possible to multiple.
The benefit being arranged in this way is: XOR operation is as transferable operation, according to setting sequence, by two initial lists The XOR operation result of position data carries out XOR operation with unit data thereafter again, and so on, cipher mode is simply easy to It realizes.
The final result of XOR operation is stored in the file header of picture by step 120.
Wherein, the file header of picture is for storage and the associated message part of picture raw information, for example, label picture The initial position of file and the version information of recordable picture.There are also reserved field in the file header of picture, can be used for storing with The relevant inessential related information of picture file, for example, in JPEG (Joint Photographic Experts Group, connection Close motion picture expert group version) in the picture of format, there are SOI (Start Of Image, picture starting) flag code and APP0 in file header (Application 0, application program retain label 0) flag code, there is reserved field position in APP0 flag code.
In the present embodiment, according to the specific format of picture file head, the final result of XOR operation is stored in file In head, since the file header of picture is not to be related to the original of picture for storage and the associated message part of picture raw information Information data, that is to say, that the original of picture can't be influenced by not including image data so adding new data in file header Beginning information, to ensure that picture still is able to not influence its visuality by normal browsing after encryption.
The embodiment of the invention provides a kind of image ciphering methods, by the image data being directed in picture, to set number It is unit according to length, carries out XOR operation according to two unit datas of setting sequential selection, and by result and other unit data XOR operation is carried out, finally the final result of XOR operation is stored in the file header of picture, realizes that the encryption to picture is grasped Make, solve in the prior art, after to image ciphering, picture cannot be opened the problem of browsing, picture can not influenced In the case where opening browsing, the cryptographic operation to picture is realized.
Optionally, data length is set as byte, and setting sequence is the data storing order in image data.
Wherein, set data length as single byte, setting sequence be image data in memory, according to storage address The sequence of sequence.
In this optional technical solution, the particular content of setting data length and setting sequence is provided, due to scheming In piece file, data are usually to be stored with bytewise, byte are arranged in operational data unit, position data are arranged in order of operation Storage order is easily achieved cryptographic calculation, improves its operability.
Optionally, picture is compressed format picture or unpacked format picture.
Wherein, the image information in unpacked format picture is stored in the form of two-dimensional array, unpacked format Including but not limited to BMP format picture, compressed format picture refers to the two-dimensional array in unpacked format picture picture It is transformed to the statistically picture after the data acquisition system of onrelevant, that is to say, that in the image data of compressed format picture In, storage is by the data acquisition system after the conversion of original two pixel arrays, and compressed format picture is including but not limited to JPEG lattice Formula picture, PNG format image and GIF format picture.
Picture can be compressed format picture in this optional technical solution, is also possible to unpacked format picture, guarantees It is directed to compressed format picture and unpacked format picture, the encryption method in the present embodiment all has realizability.
Embodiment two
Fig. 2 is a kind of flow chart of image ciphering method provided by Embodiment 2 of the present invention, and the present embodiment is implemented upper one It further refines, provides for the image data in picture, as unit of setting data length, according to setting on the basis of example Two unit datas of sequential selection carry out XOR operation, then result and other unit data are carried out to the specific implementation of XOR operation Step.A kind of image ciphering method provided by Embodiment 2 of the present invention is illustrated below with reference to Fig. 2, comprising the following steps:
Step 210, for the image data in picture, as unit of setting data length, extract the according to setting sequence One unit data, as current operation data.
Current operation data are carried out step-by-step exclusive or with the next unit data extracted according to setting sequence by step 220 Operation.
The result of XOR operation is updated to current operation data by step 230, and returns to execution and next unit data The operation for carrying out step-by-step XOR operation, until the last one unit data of image data.
In the present embodiment, using the transferability of XOR operation, first unit data in image data is made For current operation data, step-by-step XOR operation is carried out with second unit data, then using operation result as current operation data, Step-by-step XOR operation is carried out with third unit data, and so on, until the last one unit data of image data.
In a specific example, for JEPG format picture, unit data is single byte, and setting sequence is image The storage order of data, by the result of first character section in image data and second byte step-by-step exclusive or and third byte into Row XOR operation, then operation result and the 4th byte are subjected to XOR operation, and so on, until into image data Until EOF (end of image, picture terminate) flag code.
The final result of XOR operation is stored in the file header of picture by step 240.
The technical solution of the present embodiment has carried out careful explanation on the basis of a upper embodiment, will be in picture Image data carries out XOR operation according to setting two unit datas of sequential selection, then will knot as unit of setting data length Fruit and other unit data carry out XOR operation and are further refined as specific implementation steps, pass through the transmitting using XOR operation Property, using first unit data in image data as current operation data, recycle current operation data and next unit Data step-by-step exclusive or, and using operation result as the step of operational data, until image data terminates, to reach to picture number According to the purpose using XOR operation encryption, provide a kind of easy to operate, it is easy to accomplish the method to image encryption.
Optionally, for the image data in picture, as unit of setting data length, according to setting sequential selection two Unit data carries out XOR operation, then will be before result and other unit data progress XOR operation, further includes:
If picture is the jpeg format of compressed format, JPEG picture file is read in into byte arrays;
By bytes match, picture start mark code and pictorial information flag code are got rid of, remainder bytes are as picture number According to;
Wherein, the final result of XOR operation is stored in the reserved field in the file header of JPEG picture file.
In this optional technical solution, all data in JPEG picture file are read using byte arrays, recycle word It saves matched mode and removes picture start mark code and pictorial information flag code therein, so that it is determined that image data.
Wherein, in JPEG picture file, all flag codes are started with 0XFF, are exactly in 0XFF for different flag codes Different bytes is added afterwards, for example, the beginning of picture starting SOI flag code is 0xFF 0xD8, pictorial information APP0 flag code Beginning is 0xFF 0xE0, and (beginning of Define Quantization Table, definition quantization list notation code are 0xFF to DQT The beginning that 0xDB and picture terminate flag code EOF is 0xFF0xD9, and bytes match is exactly that different marks are matched in byte arrays The beginning byte for remembering code, so that it is determined that the position of flag code.
The reason of being arranged in this way is: in JPEG picture file, picture start mark code SOI and pictorial information flag code Stored in APP0 be with the associated information of picture file, rather than information related with picture pixels array in picture file, and The purpose of encryption is that pixel array information in protection picture, so removal picture start mark code SOI and pictorial information mark Remember code APP0, using remainder bytes as image data, for carrying out XOR operation, and start mark code SOI and pictorial information mark Note code APP0 belongs to picture file head, wherein including reserved field, for storing the final result of XOR operation.
In a specific example, table 1 is the picture starting SOI flag code of JPEG picture file, this is one general Format, table 2 are the detailed datas of pictorial information flag code APP0 in a JPEG picture file, and JPEG picture file is read in word Joint number group finds the beginning byte 0xFF of picture start mark code SOI and pictorial information flag code APP0 by matched bytes After 0xD8 and 0xFF 0xE0, corresponding picture start mark code SOI and pictorial information flag code APP0 are extracted, will be remained Remaining data are as image data, wherein last position of pictorial information flag code APP0 is reserved in this specific example Field can be used for storing the final result of XOR operation.
Table 1
Mark structure Byte number
0xFF 1
0xD8 1
Table 2
This optional technical solution, provides the method for image data in determining JPEG picture file, by removing JPEG Picture start mark code and pictorial information flag code in picture file, using remainder bytes as image data, thus only to The relevant data of image raw information are encrypted, and the efficiency to JPEG picture encryption is improved.
Optionally, if picture is the BMP format of unpacked format, image data includes: message bit pattern head data, face Color information data and graph data;The final result of XOR operation is stored in the reserved field in the file header of BMP picture file In.
Wherein, BMP is a kind of image file format unrelated with hardware device, using bit mapping storage format, in addition to figure Other than picture depth is optional, other any compressions are not used, therefore, the occupied space of BMP file is very big, the image of BMP file Depth optional lbit, 4bit, 8bit and 24bit, when BMP file storage data, the scanning mode of image be by from left to right, from Under to upper sequence.
BMP picture file includes file header, message bit pattern head data, color information data and graph data, file header packet Containing 14 bytes, and there are 4 bytes to can be used as reserved field, message bit pattern head data, color information data and graph data For storing the initial data of BMP picture file, that is, two-dimensional array data, showed in these data and picture Each pixel is corresponding.
This optional technical solution, by message bit pattern head data, color information data and the figure number in BMP picture file According to as image data, the final result of XOR operation is stored in the reserved field in the file header of BMP picture file, together Sample improves the efficiency to BMP image ciphering.
Embodiment three
Fig. 3 is the flow chart of a kind of picture verification method that the embodiment of the present invention three provides, and the present embodiment is applicable to pair The case where picture carries out verification operation is encrypted, this method can be executed by picture provided in an embodiment of the present invention verifying device, The mode that software and/or hardware can be used in the device is realized, and generally can integrate in various general purpose computing devices, is such as schemed Shown in 3, the picture verification method of the present embodiment specifically comprises the following steps:
Step 310, the final result that XOR operation is obtained from the file header of picture.
In the present embodiment, from encrypted picture obtain XOR operation final result, as verifying picture whether The comparison basis being tampered.
Step 320, for the image data in picture, as unit of setting data length, according to setting sequential selection two A unit data carries out XOR operation, then result and other unit data are carried out XOR operation, obtains image data exclusive or fortune Calculate result.
The final result of XOR operation is compared by step 330 with image data XOR operation result, and knot is compared in judgement Whether fruit is consistent, if the final result of XOR operation is consistent with image data XOR operation result, executes step 340.
The reason of being arranged in this way is: according to the operation method to image ciphering, obtaining image data in current crypto picture XOR operation as a result, since the cryptographic operation to picture does not change image data, so, if image is not tampered with, The XOR operation result of image data should be with the XOR operation that obtains from encrypted picture most in current crypto picture The fruit that terminates is identical, in this, as the standard for judging whether picture is tampered.
In the present embodiment, since the cryptographic operation to picture does not change image data, so being carried out to picture When verification operation, picture is still that can be browsed.
Step 340, picture authenticity verification pass through.
Wherein, picture authenticity verification judges whether picture is tampered, and if the verification passes, then illustrates in image data Data be not tampered with, if verifying does not pass through, illustrate that the data in image data are tampered, which does not have true Reality.
The embodiment of the invention provides a kind of picture verification methods, by obtaining XOR operation from the file header of picture Final result, for the image data in picture, as unit of setting data length, according to setting two units of sequential selection XOR operation is carried out according to progress XOR operation, and by result and other unit data, obtains image data XOR operation as a result, most The final result of XOR operation is compared with image data XOR operation result afterwards, verifies the authenticity of picture, realization pair The verification operation of picture solves in the prior art, when whether verifying picture occurred to distort, cannot open picture and browse The problem of, it realizes in the case where not influencing picture opening browsing, still is able to whether verifying picture occurred to distort, thus Determine the effect of picture authenticity.
Optionally, data length is set as byte, and setting sequence is the data storing order in image data.
In this optional technical solution, the particular content of setting data length and setting sequence is provided, due to scheming In piece file, data are usually to be stored with bytewise, byte are arranged in operational data unit, position data are arranged in order of operation Storage order is easily achieved verifying operation, improves its operability.
Optionally, picture is compressed format picture or unpacked format picture.
Picture can be compressed format picture in this optional technical solution, is also possible to unpacked format picture, guarantees It is directed to compressed format picture and unpacked format picture, the verification method in the present embodiment all has realizability.
Example IV
Fig. 4 is a kind of flow chart for picture verification method that the embodiment of the present invention four provides, and the present embodiment is implemented upper one It further refines, provides for the image data in picture, as unit of setting data length, according to setting on the basis of example Two unit datas of sequential selection carry out XOR operation, then result and other unit data are carried out XOR operation, obtain described The specific implementation step of image data XOR operation result.A kind of picture that the embodiment of the present invention four is provided below with reference to Fig. 4 Verification method is illustrated, comprising the following steps:
Step 410, the final result that XOR operation is obtained from the file header of picture.
Step 420, for the image data in picture, as unit of setting data length, extract the according to setting sequence One unit data, as current operation data.
Current operation data are carried out step-by-step exclusive or with the next unit data extracted according to setting sequence by step 430 Operation.
The result of XOR operation is updated to current operation data by step 440, and returns to execution and next unit data The operation for carrying out step-by-step XOR operation, until the last one unit data of image data.
In the present embodiment, the method for XOR operation is carried out to encrypted picture and is used when encrypting to picture XOR operation method is identical.
The final result of XOR operation is compared by step 450 with image data XOR operation result, and knot is compared in judgement Whether fruit is consistent, if the final result of XOR operation is consistent with image data XOR operation result, executes step 460.
Step 460, picture authenticity verification pass through.
The technical solution of the present embodiment has carried out careful explanation on the basis of a upper embodiment, will be in picture Image data selects two sequence unit datas according to setting selective top-down and carries out XOR operation, then will knot as unit of setting data length Fruit and other unit data carry out XOR operation, obtain described image data XOR operation result and are further refined as specific reality Step is applied, by the transitivity using XOR operation, using first unit data in image data as current operation data, Current operation data and next unit data step-by-step exclusive or are recycled, and operation result is used as the step of operational data, up to Image data terminates, to achieve the purpose that verify image data using XOR operation, provide it is a kind of easy to operate, The method to image authentication being easily achieved.
Optionally, for the image data in picture, as unit of setting data length, according to setting sequential selection two Unit data carries out XOR operation, then result and other unit data are carried out XOR operation, obtains described image data exclusive or Before operation result, further includes:
If picture is the jpeg format of compressed format, JPEG picture file is read in into byte arrays;
By bytes match, picture start mark code and pictorial information flag code are got rid of, remainder bytes are as picture number According to;
Wherein, the final result of XOR operation is stored in the reserved field in the file header of JPEG picture file.
This optional technical solution, provides the method for image data in determining JPEG picture file, by removing JPEG Picture start mark code and pictorial information flag code in picture file, using remainder bytes as image data, thus only to The relevant data of image raw information are encrypted, and the efficiency to JPEG picture encryption is improved.
Optionally, if picture is the BMP format of unpacked format, image data includes: message bit pattern head data, face Color information data and graph data;The final result of XOR operation is stored in the reserved field in the file header of BMP picture file In.
This optional technical solution, by message bit pattern head data, color information data and the figure number in BMP picture file According to as image data, the final result of XOR operation is stored in the reserved field in the file header of BMP picture file, together Sample improves the efficiency to BMP image ciphering.
Embodiment five
Fig. 5 is a kind of structural schematic diagram for image ciphering device that the embodiment of the present invention five provides, as shown in figure 5, described Image ciphering device includes: cryptographic calculation module 510 and result memory module 520, in which:
Cryptographic calculation module 510, for for the image data in picture, as unit of setting data length, according to setting Determine two unit datas of sequential selection and carry out XOR operation, then result and other unit data are subjected to XOR operation;
As a result memory module 520, for the final result of XOR operation to be stored in the file header of picture.
The embodiment of the invention provides a kind of image ciphering devices, by the image data being directed in picture, to set number It is unit according to length, carries out XOR operation according to two unit datas of setting sequential selection, and by result and other unit data XOR operation is carried out, finally the final result of XOR operation is stored in the file header of picture, realizes that the encryption to picture is grasped Make, solve in the prior art, after to image ciphering, picture cannot be opened the problem of browsing, picture can not influenced In the case where opening browsing, the cryptographic operation to picture is realized.
Optionally, data length is set as byte, and setting sequence is the data storing order in image data.
Optionally, picture is compressed format picture or unpacked format picture.
Optionally, cryptographic calculation module 510, comprising:
Encryption data extraction unit, for for the image data in picture, as unit of setting data length, according to setting Fixed sequence extracts first unit data, as current operation data;
Encryption data arithmetic element, for by current operation data and according to next unit data of setting sequence extraction Carry out step-by-step XOR operation;
Encryption data updating unit, for the result of XOR operation to be updated to current operation data, and return execution with Next unit data carries out the operation of step-by-step XOR operation, until the last one unit data of image data.
Optionally, before cryptographic calculation module 510, further includes:
JPEG picture file reads in module, if for picture being the jpeg format of compressed format, by JPEG picture text Part reads in byte arrays;
JPEG image data confirmation module, for getting rid of picture start mark code and pictorial information by bytes match Flag code, remainder bytes are as image data;
Wherein, the final result of XOR operation is stored in the reserved field in the file header of JPEG picture file.
Optionally, before cryptographic calculation module 510, further includes:
BMP image data confirmation module, if being the BMP format of unpacked format, described image data for picture It include: message bit pattern head data, color information data and graph data;The final result of XOR operation is stored in BMP picture text In reserved field in the file header of part.
Image ciphering method provided by any embodiment of the invention can be performed in above-mentioned image ciphering device, has the side of execution The corresponding functional module of method and beneficial effect.
Embodiment six
Fig. 6 is the structural schematic diagram that a kind of picture that the embodiment of the present invention six provides verifies device, as shown in fig. 6, described Picture verifying device includes: that result obtains module 610, verifying computing module 620 and result comparison module 630, in which:
As a result module 610 is obtained, for obtaining the final result of XOR operation from the file header of picture;
Computing module 620 is verified, for for the image data in picture, as unit of setting data length, according to setting Determine two unit datas of sequential selection and carry out XOR operation, then result and other unit data are subjected to XOR operation, obtains figure As data XOR operation result;
As a result comparison module 630, for by the final result of the XOR operation and described image data XOR operation knot Fruit is compared, if picture authenticity verification passes through than more consistent.
The embodiment of the invention provides a kind of pictures to verify device, by the image data being directed in picture, to set number It is unit according to length, carries out XOR operation according to two unit datas of setting sequential selection, and by result and other unit data XOR operation is carried out, obtains image data XOR operation as a result, the final result of XOR operation to be finally stored in the text of picture In part head, the cryptographic operation to picture is realized, solve in the prior art, it, cannot when whether verifying picture occurred to distort Picture is opened into the problem of browsing, realizes in the case where not influencing picture opening browsing, whether still is able to verifying picture Occurred to distort, so that it is determined that the effect of picture authenticity.
Optionally, data length is set as byte, and setting sequence is the data storing order in image data.
Optionally, picture is compressed format picture or unpacked format picture.
Optionally, computing module 620 is verified, comprising:
Verify data extraction unit, for for the image data in picture, as unit of setting data length, according to setting Fixed sequence extracts first unit data, as current operation data;
Verify data arithmetic element, for by current operation data and according to next unit data of setting sequence extraction Carry out step-by-step XOR operation;
Verify data updating unit, for the result of XOR operation to be updated to current operation data, and return execution with Next unit data carries out the operation of step-by-step XOR operation, until the last one unit data of image data.
Optionally, before verifying computing module 620, further includes:
JPEG picture file reads in module, if for picture being the jpeg format of compressed format, by JPEG picture text Part reads in byte arrays;
JPEG image data confirmation module, for getting rid of picture start mark code and pictorial information by bytes match Flag code, remainder bytes are as image data;
Wherein, the final result of XOR operation is stored in the reserved field in the file header of JPEG picture file.
Optionally, before verifying computing module 620, further includes:
BMP image data confirmation module, if being the BMP format of unpacked format, described image data for picture It include: message bit pattern head data, color information data and graph data;The final result of XOR operation is stored in BMP picture text In reserved field in the file header of part.
Picture verification method provided by any embodiment of the invention can be performed in above-mentioned picture verifying device, has the side of execution The corresponding functional module of method and beneficial effect.
Embodiment seven
Fig. 7 is a kind of structural schematic diagram for computer equipment that the embodiment of the present invention seven provides, as shown in fig. 7, the equipment Including processor 70 and memory 71;The quantity of processor 70 can be one or more in computer equipment, with one in Fig. 7 For processor 70;Processor 70 in equipment can be connected with memory 71 by bus or other modes, to pass through in Fig. 7 For bus connection.
Memory 71 is used as a kind of computer readable storage medium, can be used for storing software program, journey can be performed in computer Sequence and module, such as the image ciphering method or the corresponding program instruction/module of picture verification method in the embodiment of the present invention (for example, the cryptographic calculation module 510 and result memory module 520 or picture in image ciphering device are verified in device As a result module 610, verifying computing module 620 and result comparison module 630 are obtained).Processor 70 is stored in by operation Software program, instruction and module in reservoir 71 are realized thereby executing the various function application and data processing of equipment Above-mentioned image ciphering method or picture verification method.
Memory 71 can mainly include storing program area and storage data area, wherein storing program area can store operation system Application program needed for system, at least one function;Storage data area, which can be stored, uses created data etc. according to terminal.This Outside, memory 71 may include high-speed random access memory, can also include nonvolatile memory, for example, at least a magnetic Disk storage device, flush memory device or other non-volatile solid state memory parts.In some instances, memory 71 can be further Including the memory remotely located relative to processor 70, these remote memories can pass through network connection to equipment.It is above-mentioned The example of network includes but is not limited to internet, intranet, local area network, mobile radio communication and combinations thereof.
Embodiment eight
The embodiment of the present invention eight also provides a kind of storage medium comprising computer executable instructions, and the computer can be held Row instruction by computer processor when being executed for executing image ciphering method or picture verification method.
The image ciphering method includes:
For the image data in picture, as unit of setting data length, according to setting two units of sequential selection XOR operation is carried out according to progress XOR operation, then by result and other unit data;
The final result of XOR operation is stored in the file header of picture.
The picture verification method includes:
The final result of XOR operation is obtained from the file header of picture;
For the image data in picture, as unit of setting data length, according to setting two units of sequential selection XOR operation is carried out according to progress XOR operation, then by result and other unit data, obtains image data XOR operation result;
The final result of XOR operation is compared with image data XOR operation result, if schemed than more consistent Piece authenticity verification passes through.
It certainly, include the storage medium of computer executable instructions provided by the embodiment of the present invention, computer can be held The method operation that row instruction is not limited to the described above, can also be performed image ciphering method provided by any embodiment of the invention Or the relevant operation in picture verification method.
By the description above with respect to embodiment, it is apparent to those skilled in the art that, the present invention It can be realized by software and required common hardware, naturally it is also possible to which by hardware realization, but in many cases, the former is more Good embodiment.Based on this understanding, technical solution of the present invention substantially in other words contributes to the prior art Part can be embodied in the form of software products, which can store in computer readable storage medium In, floppy disk, read-only memory (Read-Only Memory, ROM), random access memory (Random such as computer Access Memory, RAM), flash memory (FLASH), hard disk or CD etc., including some instructions are with so that a computer is set Standby (can be personal computer, server or the network equipment etc.) executes method described in each embodiment of the present invention.
It is worth noting that, included is each in the embodiment of above-mentioned image ciphering device or picture verifying device Unit and module are only divided according to the functional logic, but are not limited to the above division, as long as can be realized corresponding Function;In addition, the specific name of each functional unit is also only for convenience of distinguishing each other, it is not intended to restrict the invention Protection scope.
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation, It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.

Claims (10)

1. a kind of image ciphering method characterized by comprising
For the image data in picture, as unit of setting data length, according to setting two unit datas of sequential selection into Row XOR operation, then result and other unit data are subjected to XOR operation;
The final result of the XOR operation is stored in the file header of the picture.
2. any method according to claim 1, which is characterized in that for the image data in picture, to set data Length is unit, carries out XOR operation according to two unit datas of setting sequential selection, then by result and other unit data into Row XOR operation includes: as unit of setting data length, to extract first according to setting sequence for the image data in picture A unit data, as current operation data;
Current operation data are subjected to step-by-step XOR operation with the next unit data extracted according to setting sequence;
The result of XOR operation is updated to current operation data, and returns to execution and carries out step-by-step exclusive or with next unit data The operation of operation, until the last one unit data of image data.
3. according to the method described in claim 2, it is characterized in that, for the image data in picture, to set data length For unit, XOR operation is carried out according to setting two unit datas of sequential selection, then result and the progress of other unit data is different Or before operation, further includes:
If picture is the jpeg format of compressed format, JPEG picture file is read in into byte arrays;
By bytes match, picture start mark code and pictorial information flag code are got rid of, remainder bytes are as described image number According to;
Wherein, the final result of the XOR operation is stored in the reserved field in the file header of JPEG picture file.
4. a kind of picture verification method characterized by comprising
The final result of XOR operation is obtained from the file header of picture;
For the image data in picture, as unit of setting data length, according to setting two unit datas of sequential selection into Row XOR operation, then result and other unit data are subjected to XOR operation, obtain described image data XOR operation result;
The final result of the XOR operation is compared with described image data XOR operation result, if than more consistent, Then picture authenticity verification passes through.
5. according to any method of claim 4, which is characterized in that for the image data in picture, to set data Length is unit, carries out XOR operation according to two unit datas of setting sequential selection, then by result and other unit data into Row XOR operation, obtaining described image data XOR operation result includes:
For the image data in picture, as unit of setting data length, first unit data is extracted according to setting sequence, As current operation data;
Current operation data are subjected to step-by-step XOR operation with the next unit data extracted according to setting sequence;
The result of XOR operation is updated to current operation data, and returns to execution and carries out step-by-step exclusive or with next unit data The operation of operation, until the last one unit data of image data.
6. according to the method described in claim 5, it is characterized in that, for the image data in picture, to set data length For unit, XOR operation is carried out according to setting two unit datas of sequential selection, then result and the progress of other unit data is different Or operation, before obtaining described image data XOR operation result, further includes:
If picture is the jpeg format of compressed format, JPEG picture file is read in into byte arrays;
By bytes match, picture start mark code and pictorial information flag code are got rid of, remainder bytes are as described image number According to;
Wherein, the final result of the XOR operation is stored in the reserved field in the file header of JPEG picture file.
7. a kind of image ciphering device characterized by comprising
Cryptographic calculation module, for as unit of setting data length, being selected according to setting sequence for the image data in picture It selects two unit datas and carries out XOR operation, then result and other unit data are subjected to XOR operation;
As a result memory module, for the final result of the XOR operation to be stored in the file header of the picture.
8. a kind of picture verifies device characterized by comprising
As a result module is obtained, for obtaining the final result of XOR operation from the file header of picture;
Computing module is verified, for as unit of setting data length, selecting according to setting sequence for the image data in picture It selects two unit datas and carries out XOR operation, then result and other unit data are subjected to XOR operation, obtain described image number According to XOR operation result;
As a result comparison module, for comparing the final result of the XOR operation and described image data XOR operation result Compared with if picture authenticity verification passes through than more consistent.
9. a kind of computer equipment, which is characterized in that the computer equipment includes:
One or more processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processors are real Now such as image ciphering method as claimed in any one of claims 1-3 or the picture authentication as described in any in claim 4-6 Method.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor Such as image ciphering method as claimed in any one of claims 1-3 or the figure as described in any in claim 4-6 are realized when execution Piece verification method.
CN201811340732.XA 2018-11-12 2018-11-12 A kind of image ciphering method, verification method, device, equipment and medium Pending CN109257520A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811340732.XA CN109257520A (en) 2018-11-12 2018-11-12 A kind of image ciphering method, verification method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811340732.XA CN109257520A (en) 2018-11-12 2018-11-12 A kind of image ciphering method, verification method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN109257520A true CN109257520A (en) 2019-01-22

Family

ID=65044435

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811340732.XA Pending CN109257520A (en) 2018-11-12 2018-11-12 A kind of image ciphering method, verification method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN109257520A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1741435A (en) * 2004-08-24 2006-03-01 华为技术有限公司 Method for recovering drop-out data unit
CN102625025A (en) * 2012-03-26 2012-08-01 中山大学 Encryption/decryption method and system based on image transmission
CN106776305A (en) * 2016-12-05 2017-05-31 乐视控股(北京)有限公司 The method of testing and system of picture processing cloud platform
US20170289390A1 (en) * 2016-03-31 2017-10-05 Megachips Corporation Encryption device, computer-readable recording medium, and encryption method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1741435A (en) * 2004-08-24 2006-03-01 华为技术有限公司 Method for recovering drop-out data unit
CN102625025A (en) * 2012-03-26 2012-08-01 中山大学 Encryption/decryption method and system based on image transmission
US20170289390A1 (en) * 2016-03-31 2017-10-05 Megachips Corporation Encryption device, computer-readable recording medium, and encryption method
CN106776305A (en) * 2016-12-05 2017-05-31 乐视控股(北京)有限公司 The method of testing and system of picture processing cloud platform

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
周坤: "渔船监控终端的设计与实现", 《信息科技辑》 *

Similar Documents

Publication Publication Date Title
US11010855B2 (en) Method and apparatus for protecting digital photos from alteration
CN103279693B (en) A kind of file encrypting method
Artz Digital steganography: hiding data within data
CN109195007B (en) Video generation method, device, server and computer readable storage medium
CN105706118B (en) The method for generating two-dimensional bar code, the device for generating two-dimensional bar code, the method for reading two-dimensional bar code, device, two-dimensional bar code and the program for reading two-dimensional bar code
US10749682B2 (en) Anti-counterfeit method
CN101627620B (en) Electronic document encryption system, decoding system, and method
US8854692B2 (en) Printing device and printing method generating watermark information
CN109150903A (en) A kind of account management method, device, storage medium and terminal device
CN104517045B (en) Digital document guard method and system
CN103646375A (en) Method for authenticating primitiveness of picture photographed by intelligent mobile terminal
EP3537319A1 (en) Tamper protection and video source identification for video processing pipeline
CN106709853A (en) Image retrieval method and system
CN107516045A (en) Document protection method and device
CN104899499A (en) Internet image search based Web verification code generation method
CN101364251A (en) Method of transmitting drm content
US20150124969A1 (en) Method and Device for Obtaining a Security Key
US10354353B2 (en) Digital video content security authentication method and system
CN109785222A (en) A method of the information for webpage is quickly embedded in and extracts
CN106557510A (en) A kind of implementation method of geographic information services delivery system
CN109257520A (en) A kind of image ciphering method, verification method, device, equipment and medium
Cao et al. Using image sensor PUF as root of trust for birthmarking of perceptual image hash
CN115861020A (en) Image processing method and device
CN108563396B (en) Safe cloud object storage method
CN109698863A (en) A kind of method, apparatus, equipment and the storage medium of determining HTTP message safety

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20190122

RJ01 Rejection of invention patent application after publication