[go: up one dir, main page]

CN109068021A - A kind of encryption and decryption method and system - Google Patents

A kind of encryption and decryption method and system Download PDF

Info

Publication number
CN109068021A
CN109068021A CN201810982109.8A CN201810982109A CN109068021A CN 109068021 A CN109068021 A CN 109068021A CN 201810982109 A CN201810982109 A CN 201810982109A CN 109068021 A CN109068021 A CN 109068021A
Authority
CN
China
Prior art keywords
array
encryption
key
encrypted
pixels
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810982109.8A
Other languages
Chinese (zh)
Other versions
CN109068021B (en
Inventor
刘冬青
崔顶峰
巩仔明
邱慧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Information Technology Co Ltd
Original Assignee
Beijing Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Information Technology Co Ltd filed Critical Beijing Information Technology Co Ltd
Priority to CN201810982109.8A priority Critical patent/CN109068021B/en
Priority to CN201911102778.2A priority patent/CN111192187B/en
Publication of CN109068021A publication Critical patent/CN109068021A/en
Application granted granted Critical
Publication of CN109068021B publication Critical patent/CN109068021B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Technology Law (AREA)
  • Multimedia (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • Storage Device Security (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
  • Facsimile Transmission Control (AREA)

Abstract

The invention discloses a kind of encryption and decryption method and system, the encryption method includes establishing the array of pixels of picture to be encrypted;The array of pixels of the picture to be encrypted is divided into one or more grid arrays;Identical encryption information is added in the grid array, obtains encrypted array of pixels;According to encrypted array of pixels, encrypted picture is configured.It is stolen that picture can have not only been prevented using the encryption and decryption method, but also did not influenced picture presentation.

Description

A kind of encryption and decryption method and system
Technical field
The invention belongs to picture process field, in particular to a kind of encryption and decryption method and system.
Background technique
With the promotion of intellectual property right consciousness, people increasingly pay attention to the copyright of the personal production, for example, shooting photo, draw The image etc. of system.When picture is shown on common platform, author, which only desires to these pictures being shared with everybody, to be seen, but is had People do not obtain author authorization in the case where illegal download, usurp these pictures, speculate.
The method for preventing picture stolen existing at present mainly adds watermark to picture, but watermark not only influences beauty Sight is also easily removed, and if when a part that others only cuts picture carries out in use, having no idea to prove picture All rights reserved.
Summary of the invention
The technical problem to be solved in the present invention is that having overcome the deficiencies of the prior art and provide a kind of encryption and decryption method And system, it is stolen that the encryption and decryption method can not only prevent picture, but also does not influence picture presentation.
In view of this, the purpose of the present invention is to provide a kind of encryption methods, using following technical scheme: a kind of encryption side Method, the encryption method include,
Establish the array of pixels of picture to be encrypted;
The array of pixels of the picture to be encrypted is divided into one or more grid arrays;
Identical encryption information is added in the grid array, obtains encrypted array of pixels;
According to encrypted array of pixels, encrypted picture is configured.
Further, the encryption method further includes predetermined encryption information and encryption rule, wherein
The encryption information includes one or combination in head key, encryption key and tail portion key;
The encryption rule include Encryption Algorithm, encryption key addition manner, one in encryption information processing mode or It is multiple.
Further, the Encryption Algorithm includes at least,
Encryption element in the head key, encryption key or tail portion key is added to pixel array to be encrypted, Enable front three element in encrypted pixel array and value units numerical value equal with encryption element.
Further, the encryption key addition manner includes at least,
Determine first encryption element first position in grid array to be encrypted in encryption key;
Encryption element since first position, in the grid array addition encryption key to be encrypted.
Further, the encryption information processing mode includes at least,
Determine the encrypted characters string of head key, encryption key or tail portion key;
The encrypted characters string of head key, encryption key or tail portion key is switched into number according to preset rules;
The number is switched to encrypt array.
Further, the preset rules, which are included at least, switchs to number for encrypted characters string by dictionary table.
Further, the array of pixels includes line number group, and the pixel array formed with four numbers is the pixel The minimum unit of array.
Further, the step of array of pixels by the picture to be encrypted is divided into one or more grid arrays packet It includes,
Obtain encryption information;
According to the encryption information, it is determined to that the height and the width of the unit grids array of the encryption information are added;
According to the unit grids array height and the width, the picture pixels array to be encrypted is divided into one or more A grid array.
Further, the encryption method further includes,
The height of the grid array or width are not equal to the unit grids array height or width if it exists, to described Grid array adds blank pixel point array.
Further, identical encryption information is added in the grid array, obtains the step of encrypted array of pixels Suddenly include,
Determine head key, encryption key and the tail portion key in the encryption information;
Head position is reserved from the grid array, and head key is added in head position;
Using the head position as reference point, encryption key is added in the grid array;
Tail position is determined in the grid array, and tail portion key is added in tail position.
Further, the encryption method further includes removal blank pixel point array:
According to the width and height of picture to be encrypted, the length of pixel array set in line number group in array of pixels is enabled after encryption Equal to the width of picture to be encrypted, the length of the pixel array set of array of pixels in a column direction after encrypting is enabled to be equal to be encrypted The height of picture;
Interception width and the high array of pixels in picture to be encrypted, to remove blank pixel point array.
Another object of the present invention, which also resides in, provides a kind of decryption method, and the decryption method includes,
Establish the array of pixels to be decrypted of picture to be decrypted;
The head position and/or tail position in array of pixels to be decrypted are obtained, and according to head position and/or tail portion position It sets, determines unit grids array;
According to head position and/or tail position, encryption key is extracted in the unit grids array;
The encryption key that will acquire is compared with predetermined encryption key.
Further, the decryption method further includes,
Extract the units numerical value of pixel array front three element and value all in the array of pixels to be decrypted;
The units numerical value of the default head position and/or default tail position that extract simultaneously is handled, and is obtained wait solve The head key and/or tail portion key of close picture;
The head key and/or tail portion key that will acquire are compared with default head key and/or tail portion key, are determined Head position and/or tail position, and determine unit grids array.
Another object of the present invention, which also resides in, provides a kind of encryption system, and the encryption system includes,
Array of pixels establishes module, for establishing the array of pixels of picture to be encrypted;
Array of pixels processing module, for the array of pixels of the picture to be encrypted to be divided into one or more grid numbers Group;
Encrypting module obtains encrypted pixel number for identical encryption information to be added in the grid array Group;
Configuration module, for configuring encrypted picture according to encrypted array of pixels.
Further, the encryption system further includes,
Presetting module is used for predetermined encryption information and encryption rule.
Another object of the present invention, which also resides in, provides a kind of decryption system, and the decryption system includes,
Array of pixels establishes module, for establishing the array of pixels to be decrypted of picture to be decrypted;
Module is obtained, for identification the head position and/or tail position in array of pixels to be decrypted, and according to head position It sets and/or tail position, determines unit grids array;
Extraction module, for it is close to extract encryption in the unit grids array according to head position and/or tail position Key;
Comparison module, the encryption key for will acquire are compared with predetermined encryption key.
Another object of the present invention, which also resides in, provides a kind of encryption system, the system comprises at least one processor and At least one processor;
The memory storage executes the computer program of encryption method described above, and the processor calls in memory The computer program to execute encryption method described above.
Another object of the present invention, which also resides in, provides a kind of decryption system, the system comprises at least one processor and At least one processor;
The memory storage executes the computer program of decryption method described above, and the processor calls in memory The computer program to execute decryption method described above.
Encryption and decryption method of the invention makes the encryption information of picture to be encrypted be evenly distributed on picture, and perfect Encryption rule makes the encryption information that picture is added not will lead to picture distortion to be encrypted, to not influence the exhibition of encryption picture still Show, further, is cut even if having encrypted picture, encryption information can still be decrypted according to part picture, thus of the invention Encryption and decryption method can be effectively prevented picture and be stolen, and improve the safety that picture uses.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification It obtains it is clear that understand through the implementation of the invention.The objectives and other advantages of the invention can be by specification, right Pointed structure is achieved and obtained in claim and attached drawing.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is this hair Bright some embodiments for those of ordinary skill in the art without creative efforts, can be with root Other attached drawings are obtained according to these attached drawings.
Fig. 1 shows one of embodiment of the present invention encryption method flow diagram;
Fig. 2 shows one of embodiment of the present invention grid array schematic diagrames;
Fig. 3 shows the array of pixels schematic diagram that one of embodiment of the present invention is divided into grid;
Fig. 4 shows one of embodiment of the present invention and illustrates by the encryption information process flow of encryption information of character string Figure;
Fig. 5 shows encryption information arrangement schematic diagram in one of embodiment of the present invention grid array to be encrypted;
Fig. 6 shows one of embodiment of the present invention decryption method flow diagram;
Fig. 7 shows the structural schematic diagram of one of embodiment of the present invention encryption system;
Fig. 8 shows the structural schematic diagram of one of embodiment of the present invention decryption system;
Fig. 9 shows the structural schematic diagram of another encryption system in the embodiment of the present invention;
Figure 10 shows the structural schematic diagram of another decryption system in the embodiment of the present invention.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical solution in the embodiment of the present invention clearly and completely illustrated, it is clear that described embodiment is A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art Every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
As shown in Figure 1, a kind of encryption method is described in the embodiment of the present invention, firstly, establishing the pixel of picture to be encrypted Array, secondly, the array of pixels of the picture to be encrypted is divided into one or more grid arrays, then, in the grid Identical encryption information is added in array, obtains encrypted array of pixels, finally, being matched according to encrypted array of pixels Set encrypted picture.To achieve the purpose that prevent picture stolen to image ciphering.
Specifically, a picture has a large amount of Pixel Information, a pixel includes RGB color value and Alpha transparency Value (also makees channel value), wherein the RGB represents Red (red) Green (green) Blue (blue), and R parameter value, G parameter The range of value, B parameter value and Alpha transparence value is 0 to 255, so that the Pixel Information of a picture is by very much Number composition, therefore, the Pixel Information of a picture is considered as the one-dimension array being made of many numbers;It is to be added to establish One pixel is considered as being made of RGB color value and four numbers of Alpha transparence value by the array of pixels of close picture One-dimension array, so that the original pixels array of the picture to be encrypted is using the one-dimension array of a pixel as the two dimension of unit Array, while and record the height and width of the picture to be encrypted, further, the pixel array further includes one or more The line number group being made of pixel array.Preferably, the one-dimension array of a pixel is denoted as pixel array.Further Ground according to encryption information is determined to that the height and the width of the unit grids array of the encryption information are added;Further according to described The picture pixels array to be encrypted is divided into one or more grid arrays by unit grids array height and the width.It is described Pixel array in grid array is a part of the picture pixels array to be encrypted.As illustratively shown in Fig. 2 The data format of grid array, as can be known from Fig. 2, the grid array are that the pixel array of every row forms the row of grid array Array shows only the one part of pixel point array in grid array in Fig. 2.Preferably, the picture to be encrypted can be seen as The two-dimensional array of one or more grid array compositions, and to the grid array for meeting grid when encrypting picture progress grid division In have sufficient amount pixel array satisfaction all encryption information can be added, to should consider simultaneously in grid division The length of encryption information and the size of original pixels array.
The encryption method further includes addition blank pixel point array, according to the unit grids array height and width Degree, during the picture pixels array to be encrypted is divided into one or more grid arrays, as shown in figure 3, will encryption Picture is divided into multiple grids, in Fig. 3 all grids with unit grids X height and width having the same, but by picture point At there are the pictures to be encrypted to be unsatisfactory for the case where dividing all grids equally when identical grid, then need by adding blank picture Vegetarian refreshments array makes the grid that picture to be encrypted is bisected into identical height and width, in Fig. 3, original a height of H of the encryption picture, Width is W, but when dividing grid equally, Partial Mesh is imperfect, so that being added to partial blank pixel array makes picture to be encrypted The grid of division is all the same.The purpose of addition blank pixel point array is when avoiding that encryption information is written in each grid Grid array is imperfect to lead to write error.Preferably, the picture in grid array that the array of pixels of picture to be encrypted is divided into Vegetarian refreshments array sum is identical as pixel array sum in unit grids array.It is further preferred that when equal part grid, if it exists When cannot divide grid equally, blank pixel points can also be added according to the pixel array sum in unit grids array Group.
The encryption method further includes predetermined encryption information and encryption rule, wherein the encryption information includes that head is close One in key, encryption key and tail portion key or combination;The encryption rule includes Encryption Algorithm, encryption key addition side One or more of formula, encryption information processing mode.Specifically, head key, encryption key in the encryption information or Tail portion key is usually the encrypted characters string being made of multiple characters, then needs encrypted characters string according to preset encryption information Processing mode is handled, and the encryption information processing mode, which can be, is converted to corresponding number for encrypted characters string, then will Number is converted to encryption array, then the final encryption element using in encryption array encrypts grid array.Specifically, such as Shown in Fig. 4, using encryption key be character string 123abc and preset rules use dictionary table as exemplary illustration, first in Fig. 4 It first needs encrypted characters string 123abc being converted to corresponding number, encrypted characters string is converted to according to dictionary table by corresponding number Word are as follows: 010203101112, then further, number is converted into encryption array, the encryption array be [0,1,0,2,0,3, 1,0,1,1,1,2], so that the element in the encryption array is all encryption elements.Preferably, the encryption information can be with It is the combination of one or more encryption elements in user's choosing.
Further specifically, being added head key, encryption key or the tail portion key in the encryption information to described Identical Encryption Algorithm can be used when in grid array, the Encryption Algorithm includes at least the head key, encryption key Or the encryption element in the key of tail portion is added to pixel array to be encrypted, enables first three bit in encrypted pixel array Element and value units numerical value is equal with encryption element.Specific Encryption Algorithm step can be with are as follows: firstly, determination will encrypt picture Vegetarian refreshments array and encryption element;Secondly, first three element carries out add operation in the encrypted pixel point array, front three is obtained Then the encryption element and the units numerical value are subtracted each other, obtain difference between the two by the units numerical value of element and value Value;Finally, by the difference according to addition rule and one or more progress in front three element in the pixel array Operation show that encrypted pixel array, the encrypted pixel array meet front three element and are added, obtained And value units numerical value be equal to encryption element.Wherein, the difference is transported with the front three element in pixel array When calculation, the operation result of the either element in the front three element still needs to meet within 0-255, therefore, by the difference According to addition rule and one or more progress operations in front three element in the pixel array, encrypted picture is obtained The step of vegetarian refreshments array, further includes, if there are elements less than 0 in encrypted pixel array, then by the element less than 0 When carrying out being greater than 255 there are element in add operation or encrypted pixel array with 10, then it will be greater than 255 element again Subtraction is carried out with 10.Preferably, the Encryption Algorithm is not limited to only enable front three element in encrypted pixel array And value units numerical value with encryption element it is equal, be also possible to the either element in pixel array in front three element After units numerical value is equal with encryption element or encryption in pixel array nibble element and value units numerical value with plus Situations such as close element is equal.
Further specifically, the addition rule to the difference illustrates, it is integrated into including at least by difference Tool there are three the array form of element, herein difference only one, to be integrated into tool using 0 numerical value and difference, there are three elements One-dimension array;Such as difference is 4, then can be integrated into [4,0,0], but be not limited to [4,0,0], can also [0,4,0] etc., so It is added respectively with the front three element in pixel array again afterwards, obtains encrypted pixel array, such as pixel Array is [21,31,65,255], then array after being added is [25,31,65,255].Further, in the Encryption Algorithm Addition rule, which can also be, splits the difference, i.e., difference is split as one or more addition element;Then it will tear open The addition digital convergence divided is that there are three the one-dimension arrays of element for tool;Because of the addition number after splitting and need and picture to be encrypted The front three element of vegetarian refreshments array is added, and when the difference is split, the element after fractionation is up to 3.Preferably, The numerical difference is divided equally as far as possible, can not only guarantee the quality of picture, but also does not influence the displaying of picture.Preferably, described to add Close algorithm has nonuniqueness, but first three bit digital for meeting encrypted pixel array is added the result units value obtained Equal to encryption number.
With pixel array be [23,34,45,255], encryption element is 6 to illustrate, firstly, pixel number The front three element of group carries out phase added elements, and units numerical value obtain and value is 2;Secondly, by the encryption element and institute State units numerical value to subtract each other, show that difference between the two is 4, then need by 4 be added to pixel array [23,34,45, 255] it in the front three element in, then, to be divided into exemplary illustration using to numerical difference progress is third, then 4 can tear open It is divided into 2,1,1;Be again [2,1,1] by 2,1,1 composition addition arrays, finally attach element in addend group [2,1,1] respectively with Front three element in pixel array is added, and show that encrypted pixel array is [25,35,46,255].It is preferred that Ground, 2,1,1 three bit elements composition add array when be not limited to [2,1,1], the sequence of three bits element be also possible to [1,2,1], [1,1,2] etc..Therefore, the addition array has nonuniqueness.
Similarly, be [1,23,3,255] with pixel array, encryption element is 1 to illustrate, firstly, pixel The front three element of array carries out phase added elements, and units numerical value obtain and value is 7;Secondly, by the encryption element with The units numerical value subtracts each other, and show that difference between the two is -6, then need by -6 be added to pixel array [1,23,3, It 255], then, then -6 can be divided into exemplary illustration using carrying out trisection to the numerical difference in the front three element in To be split as -2, -2, -2;Again will -2, -2, -2 composition addition arrays be [- 2, -2, -2], finally attach addend group [- 2, -2, - 2] element in is added with the front three element in pixel array respectively, obtain encrypted pixel array be [- 1, 21,1,255].There are elements -1 for the encrypted pixel array less than 0, then carries out add operations for -1 and 10, final to add Pixel array after close is [9,21,1,255].When there is the case where being greater than 255 in the element after the encryption in pixel array, The element and 10 that then will be greater than 255 carry out subtraction, and specifically no longer citing repeats.
The trisection fractionation of the difference, which can be, first divides exactly difference with 3, and records decile value and residual value, secondly, will Residual value is divided exactly with 2, and records decile value and residual value, is then divided exactly the residual value after dividing exactly with 2 with 1, and record decile value;Finally By the corresponding addition of decile value three times, three addition element are obtained, by taking difference 4 as an example, are then first divided exactly with 3, obtaining decile value is 1, residual value 1, the then addition element after dividing exactly with 3 is 1,1,1;Then continue that residual value and 2 are divided exactly to obtain decile value to be 0, residual value It is addition element after 1, then residual value and 2 are divided exactly is 0,0,0;Then, continue to divide exactly the residual value after dividing exactly with 2 and 1 Decile value is 1, and residual value is 0 (can not again equal part), then the addition element after dividing exactly with 1 is 1,0,0;The then addition after operation three times Element carries out adding up to 2,1,1, so that last addition array is [2,1,1], in short, the addition array does not have uniquely Property.Preferably, the algorithm for pixel array being added in the difference is not unique.
The addition rule of the difference is a part in Encryption Algorithm, so that above-mentioned example explanation is also to calculate encryption Method carries out exemplary partial explanation.
Further specifically, identical encryption letter is added in all grid arrays that picture to be encrypted etc. point obtains Breath, during obtaining encrypted grid array, need to mark off head position, encrypted location and tail from the grid array Portion position, firstly, reserving head position in the grid array of the grid, and close for head to be added in the head position Key.Wherein, the head position occupies one or more pixel arrays, and one or more of pixel arrays can be It is continuous and/or discontinuous.Therefore, the head key can be the encryption number that one or more encryption elements are composed Group.Preferably, the head position at least occupies 9 pixel arrays.It is illustrated with Fig. 5, the head position Positioned at the upper left corner of the grid array, the pixel array that the head position occupies is 9, and the arrangement used for Since the pixel array of first, the upper left corner of unit grids, first three pixel number of first three rows line number group is successively occupied Group, wherein the encryption array that the head key uses is [1,2,3,4,5,6,7,8,9], then respectively by encrypt in array 9 Head position is added in a encryption element.The arrangement of the head position and the head key be not unique, can be according to institute The length for stating head key determines the position of pixel array and pixel array that the head position accounts for, can also root The length of head key is determined according to head position.But head position and/or head key can not be too simple, such as head Position only takes up 4 pixel arrays, then head key is only there are four element is encrypted, then there may be encrypted to have 4 in picture The neighbor pixel array of a unencryption decryption when, the content extracted is identical as head key, thus head position and/or Head key is too simple, so that head position is difficult to determining probability and increases, then influences closed quality, brings to decryption tired It is difficult.
Secondly, encryption key is added according to encryption key addition manner using head position as reference point in grid array, Specifically: determine first encryption element first position in grid array to be encrypted in encryption key, since first position, The encryption element in encryption key is successively added in the grid array to be encrypted, further specifically, the encryption key Addition manner do not limit to a kind of mode, can be use the encryption key addition manner with from first encryption element Encrypted location starts, and adds an encryption element every n pixel array in the line number group of the grid array, and in institute Stating in grid array is successively encrypted every n every trade array, wherein n >=0.Using Fig. 5 as exemplary illustration, first in Fig. 5 The position of a encryption element is first pixel array after the head position the first row of the grid array.In Fig. 5 Encryption key uses character string 123abc, then encrypting array is [0,1,0,2,0,3,1,0,1,1,1,2], thus the encryption number Element in group is successively according to since first encrypts the position of element, every two in the line number group of the grid array Pixel array adds an encryption element, and in the grid array be every two every trade arrays to the grid array into Row encryption.Since grid array limitation exposition encrypts element in Fig. 5.The encryption key addition manner makes picture neither Distortion also plays and prevents picture stolen.Preferably, the line number group of the grid array is regarded as X-axis, the grid The columns group of array regards Y-axis as, then the addition manner of the encryption key is the X-axis since first encrypts the position of element It is to add an encryption element every n pixel, Y-axis is successively encrypted every n every trade array, wherein n >=0.
Finally, determining tail position in the grid array, and add in tail position after encryption key addition Enter tail portion key, it is preferable that the tail portion key is after the encryption key, using the end as the encryption key Mark, and when tail portion key is added, the addition manner according to the encryption key is added.Therefore tail portion key is added The tail position of pixel array composition grid array.Further, the tail position can be one or more pixels Array, the tail portion key can be one or more encryption elements, wherein can be the tail position and determine the tail portion The length of key is also possible to pixel array number and its arrangement that the tail portion key determines that the tail position occupies Mode.Using Fig. 5 as exemplary illustration, the tail portion key is using character string " & ", and the character string " & " is in dictionary table Corresponding number is " 56 ", then the tail portion key array is [5,6], and the cipher mode used is from first encryption element Position start, add an encryption elements every two pixel arrays in the line number group of the grid array, and in institute State in grid array is successively encrypted every two every trade arrays.Preferably, to the grid array encrypted when It waits, the tail portion key as end mark is added in the encryption key, then it is when adding encryption key, the encryption is close Key and tail portion key sequentially add in grid, for example, encryption key uses the character string 123abc& of tail key, wherein tail Portion's key is &.It is further preferred that the tail position addition manner is not limited to the addition manner using encryption key, it can also To be in the last one or the multiple pixel arrays for being directly added into the grid array, but the tail position one is positioned at institute It states in the pixel array in encryption key after pixel array shared by the last one encryption element.
In the present embodiment, the encryption method further includes removal blank pixel point array, i.e., will add in above-mentioned encryption method The blank pixel point array added is removed from encrypted picture, firstly, enabling encryption according to the width and height of original image to be encrypted The length of pixel array set is equal to the width of original image to be encrypted in line number group in array of pixels afterwards, enables pixel number after encryption The length of group pixel array set in a column direction is equal to the height of original image to be encrypted, finally, finally intercept out it is wide and The high array of pixels in original image to be encrypted eliminates extra blank pixel point array.With Fig. 3 for exemplary theory Bright, after the original image addition blank pixel point array to be encrypted, the high H and width W of the original image to be encrypted are had occurred Change, then after the completion of the original image to be encrypted encryption, each grid joined identical head key, encryption key with And tail portion key, then the array of pixels after the image ciphering to be encrypted is an encrypted new two-dimensional array, then enables encryption Array of pixels afterwards is equal to the width of original image to be encrypted, and all pixels point in the Y-axis direction in the length of X-axis uplink array The length of the set of array is equal to the height of original image to be encrypted, is then intercepted again, that is, removes extra blank pixel point Array.
As shown in fig. 6, describing a kind of decryption method in the embodiment of the present invention, the decryption method includes, firstly, establishing The array of pixels to be decrypted of picture to be decrypted, secondly, traversal it is described decryption picture array of pixels to be decrypted, search and obtain to The head position and/or tail position in array of pixels are decrypted, and any unit is determined according to head position and/or tail position Grid array;Then, according to head position or tail position, the encryption element in the unit grids array is parsed;Finally, Calculated encryption element is switched into encryption key, and is compared with predetermined encryption key, if the two is consistent, decrypts picture For our original picture, to achieve the purpose that anti-theft picture.Specifically, the original image prime number for establishing decryption picture Group is identical as principle and/or method that the above-mentioned array of pixels for establishing picture to be encrypted uses, herein without repeating.Work as traversal When the array of pixels of the picture to be decrypted, firstly, head position and/or tail position are reversely searched using Encryption Algorithm, from And determine a unit grids array, specifically, extract pixel array all in the array of pixels to be decrypted first three The units numerical value of bit element and value;The units numerical value of the default head position and/or default tail position that extract is gone forward side by side Row processing, obtains the head key and/or tail portion key of picture to be decrypted;The head key and/or tail portion key that will acquire with Default head key and/or default tail portion key are compared, and determine one or more head position and/or tail position, and Determine one or more unit grids array.After determining one or more unit grids arrays, choose one of those or Multiple unit grids arrays with head position or tail position are reference in the one or more unit grids arrays selected Point reversely extracts the units numerical value of the respective pixel point array according to encryption key addition manner, then will extract Then encryption array is reversely switched to encrypt close by all units numerical value composition encryption arrays according to encryption information processing mode Key, the encryption key that finally will acquire are compared with predetermined encryption key.
Decrypting process is illustrated by taking Fig. 5 as an example, as shown in Figure 5, the encryption information of the picture with Fig. 5 grid array And encryption rule are as follows: head position uses the arrangement of 3x3 in the upper left corner of grid, and key corresponding array in head is [1,2,3,4,5,6,7,8,9];The encryption key be character string 123abc, then corresponding encryption array for [0,1,0,2,0, 3,1,0,1,1,1,2], and first of encryption key for grid array the first row head position after first pixel Array;The tail position is " ", corresponds to tail portion key array as [5,6], and the addition manner of tail portion key and encryption key It is identical.It, then can be with when traversing the original pixels array of the picture when to which the picture with Fig. 5 grid being decrypted The units numerical value of picture to be decrypted all pixel array front threes and value is obtained, with first three rows line number group in Fig. 5 grid All pixels point array and value units value for, then be 1,2,3,0,2,2,1,2,2,0;4,5,6,2,2,2,2,2,2, 2;7,8,9,2,2,2,2,2,2,2;So that the units numerical value for obtaining the pixel array of the position 3x3 in the grid upper left corner is 1, 2,3,4,5,6,7,8,9, then meet the head position and head key of encryption rule described above, it is determined that go out head position, The acquisition modes of similar tail position will not be described in great detail.When taking the available one or more head positions of a picture And/or tail position is chosen described in the extraction of any unit grid array so as to obtain one or more unit grids arrays Element is encrypted, during the extraction process, then extracting rule is consistent with encryption rule, after head position determines in Fig. 5, that is, determines list Position grid array, according to encryption key addition manner reversely from first after the grid array the first row head position Pixel array starts, every two pixel arrays in the line number group of the grid array, and in the grid array It is successively to extract units numerical value every two every trade arrays, completes all encryption elements until extracting, and/or extract tail portion Terminate to extract after the encryption element of key, then, by the encryption element composition encryption array of all encryption keys extracted, so Afterwards, encryption key is converted according to encryption rule by encryption array, so that by the encryption key decrypted and adding for picture be added Key is compared, specifically, all encryption numbers to be finally translated into the processing mode of encryption key in decrypting process With in ciphering process handle encryption key process be inverse process, in Fig. 5, will encryption array be [0,1,0,2,0,3,1, 0,1,1,1,2] switch to number 010203101112, it is character string that number, which is further switched to encryption key, according to dictionary table 123abc。
In the present embodiment, the encryption information can be carried out with encryption rule it is customized, but one encryption picture plus Confidential information and encryption rule have uniqueness, and the decryption method is also to uniquely determine according to encryption information and encryption rule, After being encrypted to picture, even if picture is cut into sub-fraction, we are still it can be concluded that encrypted characters string, reaches Prevent stolen purpose.
In the present embodiment, the array of pixels of picture is also considered as the one-dimension array being made of tri- color values of RGB, then and one The encryption and decryption method of picture and method described above similarly, are then no longer repeated.
Based on the above method, a kind of encryption system is provided to being also adapted to property of the embodiment of the present invention, such as Fig. 7 institute Show, the encryption system successively includes realizing that the array of pixels of data connection establishes module, array of pixels processing module, encryption mould Block, configuration module, wherein the array of pixels establishes module for establishing the array of pixels of picture to be encrypted;The array of pixels Processing module is used to the array of pixels of the picture to be encrypted being divided into one or more grid arrays;The encrypting module is used In identical encryption information is added in the grid array, encrypted array of pixels is obtained;The configuration module is used for According to encrypted array of pixels, encrypted picture is configured.Specifically, the array of pixels establish module be also used to so as to Encrypted pixel array includes line number group, and take the pixel array that four numbers form as the minimum unit of the array of pixels; The unit grids that the array of pixels processing module is also used to be determined to that the encryption information is added according to the encryption information The height and the width of array, and it is also used to add blank pixel point array;The encrypting module is also used to determine the encryption letter Head key, encryption key and tail portion key in breath, and picture to be encrypted is encrypted according to encryption rule;It is described to match Set module be also used to remove encrypted the blank pixel point array that picture adds in ciphering process.
The encryption system further includes for predetermined encryption information and encryption rule presetting module.Specifically, described default The preset encryption information of module includes one or combination in head key, encryption key and tail portion key;The encryption rule Including one or more of Encryption Algorithm, encryption key addition manner, encryption information processing mode.
Based on the above method, a kind of encryption system is provided to being also adapted to property of the embodiment of the present invention, such as Fig. 8 institute Show, the decryption system includes realizing that the array of pixels of data connection establishes module, obtains module, extraction module and compares mould Block;Wherein, the array of pixels establishes module for establishing the array of pixels to be decrypted of picture to be decrypted;The acquisition module is used Head position and/or tail position in identification array of pixels to be decrypted, and according to head position and/or tail position, really Order position grid array;The extraction module is used for according to head position and/or tail position, in the unit grids array Extract encryption key;
The encryption key that the comparison module is used to will acquire is compared with predetermined encryption key.
Based on the above method, a kind of encryption system is provided to being also adapted to property of the embodiment of the present invention, such as Fig. 9 institute Show, the system comprises at least one processor and at least one processors;The memory storage executes described above add The computer program of decryption method, the processor call the computer program in memory to execute encryption described above Method.
Based on the above method, a kind of decryption system is provided to being also adapted to property of the embodiment of the present invention, such as Figure 10 institute Show, the system comprises at least one processor and at least one processors;The memory storage executes solution described above The computer program of decryption method, the processor call the computer program in memory to execute decryption described above Method.
Although the present invention is described in detail referring to the foregoing embodiments, those skilled in the art should manage Solution: it is still possible to modify the technical solutions described in the foregoing embodiments, or to part of technical characteristic into Row equivalent replacement;And these are modified or replaceed, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution The spirit and scope of scheme.

Claims (18)

1. a kind of encryption method, it is characterised in that: the encryption method includes,
Establish the array of pixels of picture to be encrypted;
The array of pixels of the picture to be encrypted is divided into one or more grid arrays;
Identical encryption information is added in the grid array, obtains encrypted array of pixels;
According to encrypted array of pixels, encrypted picture is configured.
2. encryption method according to claim 1, it is characterised in that: the encryption method further include predetermined encryption information with Encryption rule, wherein
The encryption information includes one or combination in head key, encryption key and tail portion key;
The encryption rule includes one or more of Encryption Algorithm, encryption key addition manner, encryption information processing mode.
3. encryption method according to claim 2, it is characterised in that: the Encryption Algorithm includes at least,
Encryption element in the head key, encryption key or tail portion key is added to pixel array to be encrypted, enables and adding In pixel array after close front three element and value units numerical value with encryption element it is equal.
4. encryption method according to claim 2, it is characterised in that: the encryption key addition manner includes at least,
Determine first encryption element first position in grid array to be encrypted in encryption key;
Encryption element since first position, in the grid array addition encryption key to be encrypted.
5. encryption method according to claim 2, it is characterised in that: the encryption information processing mode includes at least,
Determine the encrypted characters string of head key, encryption key or tail portion key;
The encrypted characters string of head key, encryption key or tail portion key is switched into number according to preset rules;
The number is switched to encrypt array.
6. encryption method according to claim 5, it is characterised in that: the preset rules are included at least will by dictionary table Encrypted characters string switchs to number.
7. -6 any encryption method according to claim 1, it is characterised in that: the array of pixels includes line number group, and It take the pixel array that four numbers form as the minimum unit of the array of pixels.
8. encryption method according to claim 1, it is characterised in that: the array of pixels etc. by the picture to be encrypted The step of being divided into one or more grid arrays include,
Obtain encryption information;
According to the encryption information, it is determined to that the height and the width of the unit grids array of the encryption information are added;
According to the height and the width of the unit grids array, the picture pixels array to be encrypted is divided into one or more Grid array.
9. encryption method according to claim 1 or 8, it is characterised in that: the encryption method further includes,
The height of the grid array or width are not equal to the height or width of the unit grids array if it exists, to the net Lattice array adds blank pixel point array.
10. encryption method according to claim 1, it is characterised in that: identical add is added in the grid array Confidential information, the step of obtaining encrypted array of pixels include,
Determine head key, encryption key and the tail portion key in the encryption information;
Head position is reserved from the grid array, and head key is added in head position;
Using the head position as reference point, encryption key is added in the grid array;
Tail position is determined in the grid array, and tail portion key is added in tail position.
11. encryption method according to claim 9, it is characterised in that: the encryption method further includes removal blank pixel Point array:
According to the width and height of picture to be encrypted, the length of pixel array set is equal in line number group in array of pixels after order encryption The width of picture to be encrypted enables the length of the pixel array set of array of pixels in a column direction after encrypting be equal to picture to be encrypted Height;
Interception width and the high array of pixels in picture to be encrypted, to remove blank pixel point array.
12. a kind of decryption method, it is characterised in that: the decryption method includes,
Establish the array of pixels to be decrypted of picture to be decrypted;
Obtain the head position and/or tail position in array of pixels to be decrypted, and according to head position and/or tail position, Determine unit grids array;
According to head position and/or tail position, encryption key is extracted in the unit grids array;
The encryption key that will acquire is compared with predetermined encryption key.
13. decryption method according to claim 12, it is characterised in that: the decryption method further includes,
Extract the units numerical value of pixel array front three element and value all in the array of pixels to be decrypted;
The units numerical value of the default head position and/or default tail position that extract simultaneously is handled, and figure to be decrypted is obtained The head key and/or tail portion key of piece;
The head key and/or tail portion key that will acquire are compared with default head key and/or tail portion key, determine head Position and/or tail position, and determine unit grids array.
14. a kind of encryption system, it is characterised in that: the encryption system includes,
Array of pixels establishes module, for establishing the array of pixels of picture to be encrypted;
Array of pixels processing module, for the array of pixels of the picture to be encrypted to be divided into one or more grid arrays;
Encrypting module obtains encrypted array of pixels for identical encryption information to be added in the grid array;
Configuration module, for configuring encrypted picture according to encrypted array of pixels.
15. encryption system according to claim 14, it is characterised in that: the encryption system further includes,
Presetting module is used for predetermined encryption information and encryption rule.
16. a kind of decryption system, it is characterised in that: the decryption system includes,
Array of pixels establishes module, for establishing the array of pixels to be decrypted of picture to be decrypted;
Module is obtained, for identification the head position and/or tail position in array of pixels to be decrypted, and according to head position And/or tail position, determine unit grids array;
Extraction module, for extracting encryption key in the unit grids array according to head position and/or tail position;
Comparison module, the encryption key for will acquire are compared with predetermined encryption key.
17. a kind of encryption system, it is characterised in that: the system comprises at least one processor and at least one processors;
The memory storage perform claim requires the computer program of any the method for 1-11, and the processor calls storage The computer program in device requires any method of 1-11 with perform claim.
18. a kind of decryption system, it is characterised in that: the system comprises at least one processor and at least one processors;
The memory storage perform claim requires the computer program of any the method for 12-13, and the processor calling is deposited The computer program in reservoir requires any method of 12-13 with perform claim.
CN201810982109.8A 2018-08-27 2018-08-27 Encryption and decryption method and system Active CN109068021B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810982109.8A CN109068021B (en) 2018-08-27 2018-08-27 Encryption and decryption method and system
CN201911102778.2A CN111192187B (en) 2018-08-27 2018-08-27 Decryption method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810982109.8A CN109068021B (en) 2018-08-27 2018-08-27 Encryption and decryption method and system

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN201911102778.2A Division CN111192187B (en) 2018-08-27 2018-08-27 Decryption method and system

Publications (2)

Publication Number Publication Date
CN109068021A true CN109068021A (en) 2018-12-21
CN109068021B CN109068021B (en) 2020-02-14

Family

ID=64756191

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201810982109.8A Active CN109068021B (en) 2018-08-27 2018-08-27 Encryption and decryption method and system
CN201911102778.2A Active CN111192187B (en) 2018-08-27 2018-08-27 Decryption method and system

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN201911102778.2A Active CN111192187B (en) 2018-08-27 2018-08-27 Decryption method and system

Country Status (1)

Country Link
CN (2) CN109068021B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112437205A (en) * 2020-11-18 2021-03-02 光谷技术有限公司 Video encryption method and device
CN113282911A (en) * 2021-05-12 2021-08-20 捷德(中国)科技有限公司 Identity authentication method, device, equipment and computer storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111815723B (en) * 2020-07-08 2024-04-12 北京华云安信息技术有限公司 Data encryption method and device
CN113297613A (en) * 2021-05-12 2021-08-24 捷德(中国)科技有限公司 Key access method, key processing device, key processing equipment and computer storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009232129A (en) * 2008-03-21 2009-10-08 Fujitsu Ltd Image processing apparatus, image processing method, and image processing program
CN101656818A (en) * 2008-08-18 2010-02-24 富士通株式会社 Document data encryption method and document data encryption system
CN105488426A (en) * 2015-11-30 2016-04-13 西安闻泰电子科技有限公司 Mobile platform image encryption method
JP2017135530A (en) * 2016-01-27 2017-08-03 セイコーエプソン株式会社 Image scanner and image scanning system
CN107154851A (en) * 2017-06-30 2017-09-12 上海众人网络安全技术有限公司 A kind of method and device of data encryption and decryption

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2404487A (en) * 2003-07-31 2005-02-02 Sony Uk Ltd Access control for digital storage medium content
JP5321217B2 (en) * 2009-04-21 2013-10-23 大日本印刷株式会社 File encryption system
CN102142074B (en) * 2011-03-31 2013-04-10 东北大学 Chaos based universal electronic file encryption and decryption method
CN107483193A (en) * 2017-08-31 2017-12-15 郑州云海信息技术有限公司 An encryption method, a decryption method, an encryption device and a decryption device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009232129A (en) * 2008-03-21 2009-10-08 Fujitsu Ltd Image processing apparatus, image processing method, and image processing program
CN101656818A (en) * 2008-08-18 2010-02-24 富士通株式会社 Document data encryption method and document data encryption system
CN105488426A (en) * 2015-11-30 2016-04-13 西安闻泰电子科技有限公司 Mobile platform image encryption method
JP2017135530A (en) * 2016-01-27 2017-08-03 セイコーエプソン株式会社 Image scanner and image scanning system
CN107154851A (en) * 2017-06-30 2017-09-12 上海众人网络安全技术有限公司 A kind of method and device of data encryption and decryption

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112437205A (en) * 2020-11-18 2021-03-02 光谷技术有限公司 Video encryption method and device
CN112437205B (en) * 2020-11-18 2022-03-15 光谷技术有限公司 Video encryption method and device
CN113282911A (en) * 2021-05-12 2021-08-20 捷德(中国)科技有限公司 Identity authentication method, device, equipment and computer storage medium

Also Published As

Publication number Publication date
CN111192187B (en) 2023-10-24
CN109068021B (en) 2020-02-14
CN111192187A (en) 2020-05-22

Similar Documents

Publication Publication Date Title
CN109068021A (en) A kind of encryption and decryption method and system
Shankar et al. Optimal key based homomorphic encryption for color image security aid of ant lion optimization algorithm
CN109767375A (en) Method and system for image watermark embedding and tracing
US20090046856A1 (en) Methods and apparatus for encrypting, obfuscating and reconstructing datasets or objects
CN104851070B (en) A kind of image encryption and decryption method based on foreground and background separation
CN103475463B (en) Encryption implementation method and device
WO2018006576A1 (en) Method for protecting pdf document page-by-page
AU2006303085A1 (en) Methods and apparatus for encrypting, obfuscating and reconstructing datasets or objects
US11455757B2 (en) Method and apparatus for reconstruction of original images from modified images
US20110307952A1 (en) Electronic device with password generating function and method thereof
CN106295403A (en) A kind of data safety processing method based on hbase and system
CN106875323B (en) Information hiding method and device based on image encryption
CN105872305B (en) A kind of completely separable encryption area image reversible data concealing method
CN107169911A (en) A kind of image encryption method converted based on Arnold transformation
Zaini Image segmentation to secure lsb2 data steganography
CN108174053A (en) A Decrypted Region-Defined Image Encryption Method Based on Directed Area and Playing Card Mapping
CN104700348B (en) A kind of color image-adaptive encryption method based on high-order chaos system
CN112508764B (en) Encryption method for balancing image privacy and usability based on information embedding
CN115001666A (en) Image local encryption algorithm based on bit plane template XOR
CN114465779A (en) A reversible and separable ciphertext domain information hiding method and system
Bhase et al. An access control system using visual cryptography and steganography
CN114329555A (en) Video file encryption processing method and device, storage medium and equipment
CN106846233A (en) A kind of photo encryption method and encryption device
WO2017064517A1 (en) Messaging security
CN110690968B (en) An Image Encryption Method Based on Montgomery-RSA Algorithm

Legal Events

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