Image secret sharing method based on random grid and polynomial
By combining random grids and polynomial algorithms, grayscale secret images are encrypted and decoded, and the problems of low image contrast and pixel expansion in the prior art are solved, and an efficient and applicable image secret sharing method is realized.
Patent Information
- Application Number
- CN202210464513.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-04-29
AI Technical Summary
The existing two-in-one image secret sharing algorithm (TIOISSS) has low contrast when recovering images, has problems with pixel expansion, and is unable to be used for encryption and decoding of grayscale secret images.
Using the image secret sharing method based on random mesh and polynomials, the grayscale secret image is encrypted through the grayscale random mesh method and the polynomial algorithm, combining the distance formula and threshold selection mechanism to generate the final shared image, and the image is realized through MATLAB. overlay and Lagrangian interpolation decoding.
It solves the problem of pixel expansion and grayscale image encryption applicability, realizes high-quality image encryption and decoding, reduces the workload and complexity of the algorithm, and supports dual decoding of images.
Smart Images

Figure CN114826583B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of secret sharing and relates to an image secret sharing method based on random grids and polynomials. Background Art
[0002] Since the secret sharing technology was proposed, it has been applied to various fields. In recent years, people have paid more and more attention to the field of image secret sharing (ISSS). The most common image secret sharing is visual password VCS. Since the visual password was proposed, the basis matrix is still the core of most schemes. On this basis, Shamir used the interpolation method to implement a (k,n) threshold scheme polynomial image secret sharing algorithm. At the same time, in 1987, Kafri and Keren first proposed an image secret sharing method based on random grids. Then, the characteristics of the two image secret sharing methods were combined, and the advantages of each method were taken to obtain a two-in-one image secret sharing algorithm (TIOISSS).
[0003] Two-in-one image secret sharing algorithm (TIOISSS) is a new image secret sharing method. Generally, the decoding is divided into two stages. The first stage is to simply superimpose the shared images, and a relatively blurred reconstructed image can be obtained after superposition. In the second decoding stage, a complete and clear secret image is reconstructed by calculation. The main purpose of this encryption and decryption mechanism is to achieve double decryption. On the one hand, this method can realize the preview of the secret image. On the other hand, when the decryptor does not have a computing device, the complete secret image cannot be obtained, thereby ensuring the security of the encrypted image. However, the image restored by the existing two-in-one image secret sharing algorithm (TIOISSS) has low contrast and there is a problem of pixel expansion. In addition, the existing two-in-one image secret sharing algorithm (TIOISSS) is not applicable to the encryption and decoding of grayscale secret images. Summary of the invention
[0004] The purpose of the present invention is to provide an image secret sharing method based on random grids and polynomials, which solves the problems of pixel expansion and inapplicability to grayscale secret images in the prior art.
[0005] The technical solution adopted by the present invention is a method for sharing image secrets based on random grids and polynomials, including an image encryption method based on random grids and polynomials, which is specifically implemented according to the following steps:
[0006] Step 1: Collect two original grayscale images as grayscale secret image S1 and grayscale secret image S2 respectively; encrypt the grayscale secret image S1 using the grayscale random grid method, and generate n shared images R1, R2, ..., R n , where n is not less than 2;
[0007] Step 2: Use the polynomial algorithm to encrypt the grayscale secret image S2, and generate n shared images P1, P2, ..., P n , where n is not less than 2;
[0008] Step 3: Calculate the shared images R1, R2, ..., R by using the distance formula n and share images P1, P2, ..., P n The pixel distance D;
[0009] Step 4: select a threshold value d through experiments, compare the threshold value d with the pixel distance D, and repeat the steps from step 2 to step 4 when the pixel distance D is greater than the threshold value d. When the pixel distance D is not greater than the threshold value d, output the shared images P1, P2, ..., P n And let the shared images P1, P2, ..., P n For the final shared images G1, G2, ..., G n .
[0010] A method for sharing secret images based on random grids and polynomials, and also includes a method for decoding image encryption methods based on random grids and polynomials, which is specifically implemented according to the following steps:
[0011] Step 1: In the first decoding stage of the image, use MATLAB to decode the shared images G1, G2, ..., G n Superposition, to obtain the reconstructed grayscale secret image S1;
[0012] Step 2: In the second decoding phase of the image, use MATLAB to decode the secret shared images G1, G2, ..., G n The reconstructed image of the grayscale secret image S2 is obtained by calculating through the Lagrange interpolation algorithm.
[0013] The present invention is also characterized in that:
[0014] The specific steps of encrypting S1 using the grayscale random grid method in step 1 are:
[0015] Step 1.1: Generate an integer pixel value between 0 and 255 randomly by using the random number generation function round(rand(1)*255) in MATLAB. Generate a random grayscale image A1, A2, ..., A1 with the same size as the integer pixel value according to each randomly generated integer pixel value. K-1 , k is an integer greater than 1;
[0016] Step 1.2: When k = 2, according to the random grayscale image A K-1The pixel values of the random grayscale image A and the pixel values of the grayscale secret image S1 generate a grid image B1 in MATLAB. When k is greater than 3, K-1 The pixel values and grid image B K-2 The pixel values of the grid image B are generated in MATLAB K-2 ;
[0017] Step 1.3: Repeat steps 1.1 to 1.2 to generate grid images B1, B2, ... B K-1 ;
[0018] Step 1.4: Calculate the generated grid images B1, B2...B K-1 The corresponding pixel values are b1, b2, ... b n , calculate the random grayscale images A1, A2, ..., A K-1 The corresponding pixel values are a1, a2, ..., a n ;
[0019] Step 1.5: According to the grid images B1, B2, ... B in step 1.4 K-1 The pixel values b1, b2, ..., b k-1 and random grayscale images A1, A2, ..., A K-1 The pixel values a1, a2, ..., a k-1 ,make:
[0020] r1=a1,r2=a2,...,r k-1 =a k-1 ,r k =b k-1 ,r k+1 =a1,r k+2 =a2,...,r n =a n-k ,according to
[0021] Pixel values r1, r2, ... r n Generate corresponding sharing images R1, R2...R n , n is greater than k;
[0022] Step 1.6: Output the shared images R1, R2...R n ;
[0023] Among them, the specific implementation steps in step 1.2 are:
[0024] Step 1.2.1, when K = 2, random grayscale image A K-1 For a random grayscale image A1, we have:
[0025] When the pixel value of the grayscale secret image S1 is greater than 128, the pixel value of the grid image B1 is equal to the pixel value of the random grayscale image A1. When the pixel value of S1 is not greater than 128, the pixel value corresponding to the grid image B1 is complementary to the pixel value of the random grayscale image A1 in the range of [0, 255]. The pixel value of the grid image B1 is obtained by the above method, and the grid image B1 is generated according to the pixel value of the grid image B1.
[0026] Step 1.2.2, when K = 3, random grayscale image A K-1 For a random grayscale image A2, we have:
[0027] When the pixel value of the grid image B1 is greater than 128, the pixel value of the grid image B2 is equal to the pixel value of the random grayscale image A2; when the pixel value of the grid image B1 is not greater than 128, the pixel value corresponding to the grid image B2 is complementary to the pixel value of the random grayscale image A2 in the range of [0, 255]. The pixel value of the grid image B2 is obtained by the above method, and the grid image B2 is generated according to the pixel value of the grid image B1;
[0028] Step 1.2.3, keep changing the value of K, and then according to the process described in step 1.2.2, finally generate a random grayscale image A3...A K-1 and grid image B3......B K-1 .
[0029] The specific steps of encrypting S2 using the polynomial algorithm in step 2 are:
[0030] Step 2.1, construct a (K-1) degree polynomial using MATLAB:
[0031] f(x)=a0+a1x+a2x 2 +...+a k-1 x k-1 (modp) (1)
[0032] Where: p is a public prime number that is not greater than 255 and close to 255, K is a threshold value, and X is a random value that is different from each other;
[0033] Step 2.2: Encode the pixel value of a pixel in the grayscale secret image S2 as a constant term a0, where a1, a2, ..., a k-1 The random number generation function a=round(rand(1)*255) in MATLAB is used to generate integer random values between 0 and 255, and the integer random values are used as random coefficients a1, a2, ..., a k-1 The value of .
[0034] Step 2.3: Repeat the process of step 2.2, encode each pixel of S2, and bring it into the polynomial of step 2.1 above to calculate and output the corresponding values p1, p2, ..., p n , according to the values p1,p2,......,p n Generate the corresponding pixel values of the shared images P1, P2, ..., P n , and output.
[0035] The formula for calculating the distance D in step 3 is:
[0036]
[0037] Among them, p i To share images P1, P2, ..., P n The corresponding pixel value, r i To share images R1, R2, ..., R n The corresponding pixel value, i is not less than 1, z is the number of shared images used when reconstructing the image, 2≤z≤n.
[0038] In step 1, images G1, G2, ..., G will be shared. n The specific method of superposition is as follows:
[0039] Step 1-1, share images G1, G2, ..., G n The corresponding grayscale pixel values are g1, g2, ..., g n Perform pixel blending and define the blended pixel value as g n+1 ;
[0040] Step 1-2, mixed pixel value g n+1 Specifically:
[0041]
[0042] Where n is an integer not less than 2, and int(...) means rounding down to the nearest integer;
[0043] Step 1-3, according to the mixed pixel value g n+1 The reconstructed image of the secret image S1 is obtained.
[0044] Step 2 is implemented as follows:
[0045] Step 2-1, take the shared images G1, G2, ..., G n The pixel value of each corresponding position of each image in is calculated according to the following Lagrange interpolation formula:
[0046]
[0047] Step 2-2: The calculation result is the pixel value of the corresponding position of the reconstructed image. After all the pixel values of the shared image are calculated using the above formula, a complete reconstructed grayscale secret image S2 is obtained.
[0048] The beneficial effects of the present invention are:
[0049] The random grid-based grayscale image secret sharing algorithm is used for encryption, which retains the advantages of the random grid algorithm, has no pixel expansion, and does not require complex calculations during decoding, only simple superposition is required; a new image secret sharing algorithm is formed by combining the polynomial-based image secret sharing method with the random grid-based grayscale image method, which can encrypt grayscale images. There is no need to halftone the image before encryption, reducing the workload and complexity of the algorithm; the dot distance calculation method is used to combine the random grid-based image secret sharing algorithm with the polynomial-based image secret sharing to achieve multi-image encryption and double decryption. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a flow chart of a random grid and polynomial based image secret sharing method of the present invention;
[0051] Figure 2 It is a flow chart of a grayscale random grid method in a random grid and polynomial-based image secret sharing method of the present invention;
[0052] Figure 3 , Figure 4 , Figure 5 This is an experimental diagram of the present invention for generating a shared image using a random grid and polynomial based image secret sharing method;
[0053] Figure 6 This is an experimental diagram of the reconstructed image generated by superimposing two shared images in the first decoding stage of the image secret sharing method based on random grids and polynomials of the present invention;
[0054] Figure 7 In the image secret sharing method based on random grid and polynomial of the present invention, two shared images are superimposed to generate a pixel histogram of a reconstructed image;
[0055] Figure 8 This is an experimental diagram of the reconstructed image generated by superimposing three shared images in the first decoding stage of the image secret sharing method based on random grids and polynomials of the present invention;
[0056] Fig. 9 It is a pixel histogram of a reconstructed image generated by superimposing three shared images in an image secret sharing method based on random grid and polynomial of the present invention;
[0057] Fig.10 This is an experimental diagram of an image reconstructed in the second decoding stage of an image secret sharing method based on random grids and polynomials of the present invention;
[0058] Fig.11 , Fig.12 This is an experimental diagram of the present invention using a random grid and polynomial based image secret sharing method to generate a shared image;
[0059] Fig.13 , Fig.14 The present invention is a random grid and polynomial based image secret sharing method to generate a pixel histogram of a shared image;
[0060] Fig.15 This is an experimental diagram of the present invention's method for secret image sharing based on random grids and polynomials for superimposing and generating a reconstructed image. DETAILED DESCRIPTION
[0061] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0062] The present invention discloses a random grid and polynomial-based image secret sharing method, comprising an image encryption method based on a random grid and polynomial and an image encryption method decoding method based on a random grid and polynomial. Figure 1 As shown, a random grid and polynomial-based image encryption method is implemented in the following steps:
[0063] Step 1: Collect two original grayscale images and use them as grayscale secret image S1 and grayscale secret image S2 respectively; encrypt the grayscale secret image S1 using the grayscale random grid method, and generate n shared images R1, R2, ..., R n , where n is not less than 2; the specific steps are as follows;
[0064] Step 1.1: Generate an integer pixel value between 0 and 255 randomly by using the random number generation function round(rand(1)*255) in MATLAB. Generate a random grayscale image A1, A2, ..., A1 with the same size as the integer pixel value according to each randomly generated integer pixel value. K-1 , k is an integer greater than 1;
[0065] Step 1.2: When k=2, according to the random grayscale image A K-1 The pixel values of the random grayscale image A and the pixel values of the grayscale secret image S1 generate a grid image B1 in MATLAB. When k is greater than 3, K-1 The pixel values and grid image B K-2The pixel values of the grid image B are generated in MATLAB K-2 , the specific implementation steps in step 1.2 are:
[0066] Step 1.2.1, when K = 2, random grayscale image A K-1 For a random grayscale image A1, we have:
[0067] When the pixel value of the grayscale secret image S1 is greater than 128, the pixel value of the grid image B1 is equal to the pixel value of the random grayscale image A1. When the pixel value of S1 is not greater than 128, the pixel value corresponding to the grid image B1 is complementary to the pixel value of the random grayscale image A1 in the range of [0, 255]. The pixel value of the grid image B1 is obtained by the above method, and the grid image B1 is generated according to the pixel value of the grid image B1.
[0068] Step 1.2.2, when K = 3, random grayscale image A K-1 For a random grayscale image A2, we have:
[0069] When the pixel value of the grid image B1 is greater than 128, the pixel value of the grid image B2 is equal to the pixel value of the random grayscale image A2; when the pixel value of the grid image B1 is not greater than 128, the pixel value corresponding to the grid image B2 is complementary to the pixel value of the random grayscale image A2 in the range of [0, 255]. The pixel value of the grid image B2 is obtained by the above method, and the grid image B2 is generated according to the pixel value of the grid image B1;
[0070] Step 1.2.3, keep changing the value of K, and then according to the process described in step 1.2.2, finally generate a random grayscale image A3...A K-1 and grid image B3......B K-1 .
[0071] Step 1.3: Repeat steps 1.1 to 1.2 to generate grid images B1, B2, ... B K-1 ;
[0072] Step 1.4: Calculate the generated grid images B1, B2...B K-1 The pixel values b1, b2, ... b n , calculate the random grayscale images A1, A2, ..., A K-1 The pixel values a1, a2, ..., a n ;
[0073] Step 1.5: According to the grid images B1, B2, ... B in step 1.4 K-1 The pixel values b1, b2, ..., b k-1and random grayscale images A1, A2, ..., A K-1 The pixel values a1, a2, ..., a k-1 ,make:
[0074] r1=a1,r2=a2,...,r k-1 =a k-1 ,r k =b k-1 ,r k+1 =a1,r k+2 =a2,...,r n =a n-k ,according to
[0075] Pixel values r1, r2, ... r n Generate secret images R1, R2, ... R n , n is not less than k;
[0076] Step 1.6: Output secret images R1, R2, ... R n ;
[0077] Step 2: Use the polynomial algorithm to encrypt the grayscale secret image S2, and generate n shared images P1, P2, ..., P n , where n is not less than 2;
[0078] The specific steps of using the polynomial algorithm for encryption in step 2 are:
[0079] Step 2.1, construct a (K-1) degree polynomial using MATLAB:
[0080] f(x)=a0+a1x+a2x 2 +...+a k-1 x k-1 (modp) (1)
[0081] Where: p is a public prime number that is not greater than 255 and close to 255, K is a threshold value, and X is a random value that is different from each other;
[0082] Step 2.2: Encode the pixel value of a pixel in the grayscale secret image S2 as a constant term a0, where a1, a2, ..., a k-1 The random number generation function a=round(rand(1)*255) in MATLAB is used to generate integer random values between 0 and 255, and the integer random values are used as random coefficients a1, a2, ..., a k-1 The value of .
[0083] Step 2.3: Repeat the process of step 2.2, encode each pixel of S2, and bring it into the polynomial of step 2.1 above to calculate and output the corresponding values p1, p2, ..., p n , according to the values p1,p2,......,p n Generate the corresponding pixel values of the shared images P1, P2, ..., P n , and output.
[0084] Step 3: Calculate the shared images R1, R2, ..., R by using the distance formula n and share images P1, P2, ..., P n The pixel distance D;
[0085] The formula for calculating the distance D in step 3 is:
[0086]
[0087] Among them, p i To share images P1, P2, ..., P n The corresponding pixel value, r i To share images R1, R2, ..., R n The corresponding pixel value, i is not less than 1, z is the number of shared images used when reconstructing the image, 2≤z≤n.
[0088] Step 4: Select a suitable threshold d through experiments, compare the threshold d with the distance D, and repeat the steps 2 to 4 when the distance D is greater than the threshold d. When the distance D is not greater than the threshold d, output the shared images P1, P2, ..., P n And let the shared images P1, P2, ..., P n For the final shared images G1, G2, ..., G n ;
[0089] A decoding method for an image encryption method based on a random grid and a polynomial is specifically implemented according to the following steps:
[0090] Step 1: In the first decoding stage of the image, use MATLAB to decode the shared images G1, G2, ..., G n The reconstructed image S1 is obtained by superposition. The specific method is as follows:
[0091] Step 1-1, share images G1, G2, ..., G n The corresponding grayscale pixel values are g1, g2, ..., g n Perform pixel blending and define the blended pixel value as g n+1 ;
[0092] Step 1-2: Mixed pixel value g n+1 Specifically:
[0093]
[0094] Where n is an integer not less than 2, and int(...) means rounding down to the nearest integer;
[0095] Step 1-3, according to the mixed pixel value g n+1 The reconstructed image of the secret image S1 is obtained.
[0096] Step 2: In the second decoding phase of the image, use MATLAB to decode the secret shared images G1, G2, ..., G n The reconstructed image of the secret image S2 is obtained by calculating through the Lagrange interpolation algorithm, as follows:
[0097] Step 2-1, take the shared images G1, G2, ..., G n The pixel value of each corresponding position of each image in is calculated according to the following Lagrange interpolation formula:
[0098]
[0099] Step 2-2: The calculation result is the pixel value of the corresponding position of the reconstructed image. After all the pixel values of the shared image are calculated using the above formula, a complete reconstructed grayscale secret image S2 is obtained.
[0100] In the present invention, a random grid and polynomial based image secret sharing method.
[0101] The purpose of step 1 is:
[0102] The grayscale random grid method is used for encryption;
[0103] The principle is as follows: the algorithm obtains the second shared image based on the pixel values of the original binary image and the first shared image. In the pixel range of [0,255], a random grayscale image A1 is randomly generated, and a grid image B1 is generated based on the random grayscale image A1 and the grayscale secret image S1. When the pixel value of the original image S1 is greater than 128, the pixel value corresponding to A1 is equal to the pixel value of B1. When the pixel value of the original image S1 is not greater than 128, the pixel value corresponding to A1 is complementary to the pixel value of B1.
[0104] Its advantages are: the algorithm retains the advantages of the random grid algorithm, there is no pixel expansion, and no complex calculation is required during decoding, only simple superposition is required.
[0105] The purpose of step 2 is:
[0106] Use polynomial algorithm for encryption.
[0107] The principle is as follows: construct a (k-1)th degree polynomial (1), which is the basis of the algorithm, where p is a public prime number not greater than 255 and close to 255, k is a threshold value, and the pixels of the secret image are encoded as constant terms a0, and a1, a2, ..., a k-1 is a random value between [0,255], x is a different random value, the number of x determines the number of shared images, and each secret pixel of the grayscale secret image S2 is encrypted using a polynomial.
[0108] The advantages are: since each pixel of the secret image is encrypted as secret information, the encrypted shared image is the same size as the original image without pixel expansion, and the decrypted secret image has a higher degree of restoration.
[0109] The purpose of steps 3-4 is:
[0110] The image encryption method based on polynomial algorithm is combined with the grayscale image encryption method based on random grid algorithm. A new image secret sharing algorithm is formed on the basis of these two algorithms to realize image encryption.
[0111] The principle is as follows: This algorithm first uses a grayscale secret image S1 to generate n shared images R1, R2, ..., R n In the second step, the grayscale secret image S2 is encrypted using a polynomial algorithm, and the pixel value of a pixel in the grayscale secret image S2 is encoded as a constant term a0, where a1, a2, ..., a k-1 The random number generation function a=round(rand(1)*255) in MATLAB is used to generate an integer random value between 0 and 255, and the secret pixel value and the random coefficient are put into the polynomial to calculate and obtain the pixel values p1, p2, ..., p of n shared images. n , generate sharing images P1, P2, ..., P n ,The third step is to compare the secret images R1,R2,......,R n and share images P1, P2, ..., P n The distance D is calculated using the distance formula (2). When D is less than the threshold d, the final shared image is [G1, G2...G n ,P1,P2...P n ], when D is greater than d, random coefficients a0, a1, a2, ..., a are generated again k-1 Repeat the above steps until D is no greater than d, and make G1, G2, ... Gn =P1,P2,......,P n .
[0112] Its advantages are: this algorithm can encrypt grayscale images, and there is no need to perform halftone processing on the image before encryption, which reduces the workload and complexity of the algorithm and can achieve dual decoding of the image.
[0113] The role of step one is:
[0114] The shared images G1, G2, ..., G n decoding.
[0115] The principle is: in order to stack the grayscale secret images R1, R2, ..., R n , use a grayscale blending operation to blend the shared images G1, G2, ..., G n The grayscale pixel values g1, g2, ..., g n , define the mixed pixel as g n , calculated using formula (3).
[0116] The advantage is that this equation can prove that the pixel value g n Less than pixel value g1,g2,......,g n-1 , which shows that the stacked image is darker than other grayscale images due to the pixel values g1,g2,......,g n-1 The pixel range is 0-255, and the pixel value g n It should also be within this range.
[0117] The purpose of step 6 is:
[0118] Decoding is based on Lagrange interpolation algorithm.
[0119] The principle is: any k shared images can be used to restore the secret image information through the Lagrange interpolation formula. A set with less than k members cannot calculate any information about the secret pixel. The pixel value at the corresponding position of each shared image is calculated using formula (4), and the calculation result is the pixel value at the corresponding position of the reconstructed image.
[0120] The advantage is that all pixel values of the shared image are calculated using the Lagrange interpolation method to obtain a complete reconstructed image, and the reconstructed image contains all the information of the original secret image, so a clear secret image can be obtained.
[0121] from Figure 3-10 It can be seen from the experimental results of the image secret sharing method based on polynomial and random grid fusion proposed in this invention, Figure 3-5Three shared images are shown. These three shared images do not contain the original image information. Figure 6 and Figure 8 These are the results of superimposing two and three shared images in the first decoding stage. It can be seen that the more shared images are superimposed, the closer the superimposed result is to the original secret image. Fig.10 The reconstructed image of the second decoding stage is shown. It can be seen that the overlapping decoding stage can obtain a reconstructed image that is the same as the original secret image. Figure 7 and Fig. 9 The reconstructed images are shown respectively Figure 6 and reconstruct the image Figure 8 From the pixel histogram, we can see that as the number of superimposed shared images increases, the pixel value of the reconstructed image gradually decreases, the brightness gradually darkens, and it becomes closer to the original image to the naked eye.
[0122] from Figure 11-15 It can be seen from the figure that the shared image generated by the random grid-based grayscale image secret sharing method proposed in the present invention is as follows: Fig.11 and Fig.12 As shown, it can be seen that this shared image is a noise-like image, so it will not leak any information of the original secret image. Fig.11 and Fig.12 The histograms of Fig.13 and Fig.14 As shown, it shows that the pixels of the shared image are evenly distributed, which ensures the security of the shared image and is not vulnerable to attacks; Fig.15 Yes will share the image Fig.11 and Fig.12 The result of superposition can be used to obtain the information of the secret image.
[0123] The specific embodiments are as follows:
[0124] Step 1:
[0125] Input: an M×N grayscale secret image S;
[0126] Output: n grayscale shared images, R1, R2, ..., R n ;
[0127] 1.1 Generate a random grayscale image A1 in the range of 0-255;
[0128] 1.2 Generate a grid image B1 based on the random grayscale image A1 and the grayscale secret image S1;
[0129] 1.2.1 If S(i, j)>128, B1(i, j)=A1(i, j);
[0130] 1.2.2 If S(i, j) ≤ 128, B1(i, j) = 255 - A1(i, j);
[0131] 1.3 Generate a random grayscale image A2 in the range of 0-255;
[0132] 1.4 Generate a grid image B2 according to the random grayscale image A2 and the grid image B1;
[0133] 1.4.1 If B1(i, j)>128, B2(i, j)=A2(i, j);
[0134] 1.4.2 If B1(i, j) ≤ 128, B2(i, j) = 255 - A2(i, j);
[0135] 1.5 Repeat steps 1.3 to 1.4 to generate grid images B3...B K-1 and random grayscale image A3......A K-1 ;
[0136] 1.6 Let R1=A1, R2=A2, ..., R K-1 =A K-1 ,R K =B K ,R K+1 =A1,R K+2 =A2,......,R n =A n-k ;
[0137] 1.7 Output shared images R1, R2, ..., R n .
[0138] Step 2:
[0139] Input: two secret grayscale images S1 and S2, threshold d;
[0140] Output: n shared images G1, G2, ..., G n ;
[0141] 1. Generate n shared images R1, R2, ..., R n ;
[0142] 2. Generate n shared images P1, P2, ..., P n .
[0143] 3. Calculate the shared images R1, R2, ..., R n and share images P1, P2, ..., P n The pixel distance D between them.
[0144] 4. If D≤d, then share images G1, G2, ... G n =P1,P2,......,P n ;
[0145] 5. If D>d, regenerate the shared images P1, P2, ..., P n and pixel distance D, and compare pixel distance D with threshold d;
[0146] 6. Repeat the above steps until D≤d, and get the final shared images G1, G2, ..., G n .
[0147] Experimental results: The algorithm can encrypt grayscale images without half-toning the images before encryption, which reduces the workload and complexity of the algorithm.
Claims
1. A method for sharing image secrets based on random grids and polynomials, characterized in that: The invention comprises an image encryption method based on random grid and polynomial, which is implemented in the following steps: Step 1: Collect two original grayscale images as grayscale secret image S1 and grayscale secret image S2 respectively; encrypt the grayscale secret image S1 using the grayscale random grid method, and generate n shared images R1, R2, ..., R n , where n is not less than 2; Step 2: Use the polynomial algorithm to encrypt the grayscale secret image S2, and generate n shared images P1, P2, ..., P n , where n is not less than 2; Step 3: Calculate the shared images R1, R2, ..., R by using the distance formula n and share images P1, P2, ..., P n The pixel distance D; Step 4: select a threshold value d through experiments, compare the threshold value d with the pixel distance D, and repeat the steps from step 2 to step 4 when the pixel distance D is greater than the threshold value d. When the pixel distance D is not greater than the threshold value d, output the shared images P1, P2, ..., P n And let the shared images P1, P2, ..., P n For the final shared images G1, G2, ..., G n .
2. The image secret sharing method based on random grid and polynomial according to claim 1, characterized in that: The specific steps of encrypting S1 using the grayscale random grid method in step 1 are: Step 1.1: Generate an integer pixel value between 0 and 255 randomly by using the random number generation function round(rand(1)*255) in MATLAB. Generate a random grayscale image A1, A2, ..., A1 with the same size as the integer pixel value according to each randomly generated integer pixel value. K-1 , k is an integer greater than 1; Step 1.2: When k=2, according to the random grayscale image A K-1 The pixel values of the random grayscale image A and the pixel values of the grayscale secret image S1 generate a grid image B1 in MATLAB. When k is greater than 3, K-1 The pixel values and grid image B K-2 The pixel values of the grid image B are generated in MATLAB K-2 ; Step 1.3: Repeat steps 1.1 to 1.2 to generate grid images B1, B2, ... B K-1 ; Step 1.4: Calculate the generated grid images B1, B2...B K-1 The corresponding pixel values are b1, b2, ... b n , calculate the random grayscale images A1, A2, ..., A K-1 The corresponding pixel values are a1, a2, ..., a n ; Step 1.5: According to the grid images B1, B2, ... B in step 1.4 K-1 The pixel values b1, b2, ..., b k-1 and random grayscale images A1, A2, ..., A K-1 The pixel values a1, a2, ..., a k-1 ,make: r1=a1,r2=a2,...,r k-1 =a k-1 ,r k =b k-1 ,r k+1 =a1,r k+2 =a2,...,r n =a n-k , According to the pixel values r1, r2, ... r n Generate corresponding sharing images R1, R2...R n , n is greater than k; Step 1.6: Output the shared images R1, R2...R n .
3. The image secret sharing method based on random grid and polynomial according to claim 2, characterized in that: The specific implementation steps in step 1.2 are: Step 1.2.1, when K = 2, random grayscale image A K-1 For a random grayscale image A1, we have: When the pixel value of the grayscale secret image S1 is greater than 128, the pixel value of the grid image B1 is equal to the pixel value of the random grayscale image A1. When the pixel value of S1 is not greater than 128, the pixel value corresponding to the grid image B1 is complementary to the pixel value of the random grayscale image A1 in the range of [0, 255]. The pixel value of the grid image B1 is obtained by the above method, and the grid image B1 is generated according to the pixel value of the grid image B1. Step 1.2.2, when K = 3, random grayscale image A K-1 For a random grayscale image A2, we have: When the pixel value of the grid image B1 is greater than 128, the pixel value of the grid image B2 is equal to the pixel value of the random grayscale image A2; when the pixel value of the grid image B1 is not greater than 128, the pixel value corresponding to the grid image B2 is complementary to the pixel value of the random grayscale image A2 in the range of [0, 255]. The pixel value of the grid image B2 is obtained by the above method, and the grid image B2 is generated according to the pixel value of the grid image B1; Step 1.2.3, keep changing the value of K, and then follow the process of step 1.2.2 to finally generate a random grayscale image A3...A K-1 and grid image B3......B K-1 .
4. The image secret sharing method based on random grid and polynomial according to claim 1, characterized in that: The specific steps of encrypting S2 using the polynomial algorithm in step 2 are: Step 2.1, construct a (K-1) degree polynomial using MATLAB: f(x)=a0+a1x+a2x 2 +...+a k-1 x k-1 (modp) (1) Where: p is a public prime number that is not greater than 255 and close to 255, K is a threshold value, and X is a random value that is different from each other; Step 2.2: Encode the pixel value of a pixel in the grayscale secret image S2 as a constant term a0, where a1, a2, ..., a k-1 The random number generation function a=round(rand(1)*255) in MATLAB is used to generate integer random values between 0 and 255, and the integer random values are used as random coefficients a1, a2, ..., a k-1 The value of Step 2.3: Repeat the process of step 2.2, encode each pixel of S2, and bring it into the polynomial of step 2.1 above to calculate and output the corresponding values p1, p2, ..., p n , according to the values p1,p2,......,p n Generate the corresponding pixel values of the shared images P1, P2, ..., P n , and output the shared images P1, P2, ..., P n .
5. The image secret sharing method based on random grid and polynomial according to claim 1, characterized in that: The formula for calculating the distance D in step 3 is specifically: Among them, p i To share images P1, P2, ..., P n The corresponding pixel value, r i To share images R1, R2, ..., R n The corresponding pixel value, i is not less than 1, z is the number of shared images used when reconstructing the image, 2≤z≤n.
6. A method for sharing image secrets based on random grids and polynomials, characterized in that: A method for decoding an image encryption method based on a random grid and a polynomial is included, which is characterized by being implemented in the following steps: Step 1: In the first decoding stage of the image, use MATLAB to decode the shared images G1, G2, ..., G n Superposition, to obtain the reconstructed grayscale secret image S1; Step 2: In the second decoding phase of the image, use MATLAB to decode the secret shared images G1, G2, ..., G n The reconstructed image of the grayscale secret image S2 is obtained by calculating through the Lagrange interpolation algorithm; In step 1, the shared images G1, G2, ..., G n The specific method of superposition is as follows: Step 1-1, share images G1, G2, ..., G n The corresponding grayscale pixel values are g1, g2, ..., g n Perform pixel blending and define the blended pixel value as g n+1 ; Step 1-2, mixed pixel value g n+1 Specifically: Where n is an integer not less than 2, and int(...) means rounding down to the nearest integer; Step 1-3, according to the mixed pixel value g n+1 Obtain a reconstructed image of the secret image S1; The step 2 is specifically implemented according to the following steps: Step 2-1, take the shared images G1, G2, ..., G n The pixel value of each corresponding position of each image in is calculated according to the following Lagrange interpolation formula: Step 2-2: The calculation result is the pixel value of the corresponding position of the reconstructed image. After all the pixel values of the shared image are calculated using formula (4), the complete reconstructed grayscale secret image S2 is obtained.
Citation Information
Patent Citations
(k,n) threshold based user-friendly visual secret sharing method
CN105404817A
A secret image sharing method based on a multi-phase iteration algorithm
CN109698891A