4.2.2. Decryption of QR Codes Using Random Numbers Generated from a Uniform Distribution
Table 3 summarizes the results of decrypting the encrypted seed values as shown in
Table 2 using RC4.
From
Table 3, it is confirmed that the original seed value was decrypted.
Figure 8a shows the mask image generated using the decrypted seed value.
Figure 8b shows the result of decryption by subtracting the mask image in
Figure 8a from the screenshot of the encrypted image, as shown in
Figure 7c.
Figure 8 shows that encryption using a uniform distribution is capable of complete decryption. The recognition rate was 100% for 100 different QR codes used in the experiment.
Table 4 shows the measured processing time required to encrypt an image using random numbers generated by uniform distribution.
Table 4 shows that the processing time required for encryption is not affected by the seed value or QR code to be encrypted and that the processing speed is always sufficient for QR payments.
Table 5 shows the results from measuring the processing time required for decryption.
Table 5 shows that the processing time required for decryption is not affected by the seed value or QR code to be decrypted and that the processing speed is always sufficient for QR settlements.
In the currently proposed method, the fixed values—95, 154, 483, and 75—are added to avoid the same seed value specified when generating the mask image in the encryption process. Randomly determining this fixed value is expected to improve the security strength. However, when introducing this function, the fixed values must be equal, as adding different fixed values on the encryption and decryption sides will make decryption impossible.
4.2.3. Security Analysis for Encryption Using Random Numbers Generated from Uniform Distribution
To measure the encryption strength, a histogram analysis is performed. The histogram of the encrypted image shown in
Figure 7c is shown in
Figure 9.
The closer the histogram of the encrypted image is to uniform, the better it is as an encryption because it indicates that the pixel values are randomly distributed.
Figure 9 shows that the histogram of the encrypted image by the proposed method follows a normal distribution. This is because normalization is performed during the encryption process by the proposed method. If the histogram is not uniform, it is known to be vulnerable to known-plaintext and chosen-plaintext attacks.
Next, a key sensitivity analysis was conducted. A key sensitivity analysis is a method of analyzing the impact of a small change in a cryptographic key on the encrypted image. The images used for the key sensitivity analysis are shown in
Figure 10.
Figure 10a shows the original image,
Figure 10b shows the encrypted image with the seed value set to 41,
Figure 10c shows the encrypted image with the seed value set to 42, and
Figure 10d shows the encrypted image with the seed value set to 43.
Key sensitivity is analyzed by comparing the encrypted images shown in
Figure 10b–d. The correlation coefficient of the corresponding pixel values between each image was used as a method of comparison. The results are summarized in
Table 6.
Correlation coefficients below 0.2 indicate that there is little correlation. The results in
Table 6 show that the proposed method is capable of completely different encryption when the encryption key differs even slightly. The results of decrypting an image encrypted with a seed value of 42 using a different seed value are shown in
Figure 11.
Figure 11a shows the image decrypted with the seed value set to 42.
Figure 11b shows the image decrypted with the seed value set to 41.
Figure 11c shows the image decrypted with the seed value set to 43.
Figure 11d shows the image decrypted with the seed value set to 90.
From
Figure 11, decryption with a value that differs even slightly from the seed value used during encryption is impossible. From the results in
Figure 10 and
Figure 11, it can be said that the proposed method is key-sensitive and an excellent encryption method.
The correlation between two adjacent pixel values in the encrypted image was determined to analyze the resistance to a statistical attack [
22,
23], which is a type of attack method on encrypted images. A statistical attack is an attack method that analyzes the statistical characteristics of an encrypted image to deduce information about the encryption algorithm and key. As part of the analysis procedure, first, 1000 pairs of horizontally adjacent pixels are extracted from the encrypted image. For each pair, one pixel value is denoted as
x and the other as
y, and we use Equation (
8) to obtain the correlation coefficient
r [
24,
25,
26].
In this case,
n is the data number, which in this case is 1000. In addition,
and
are the individual values of
x and
y, respectively,
is the average of
x, and
is the average of
y. The correlation coefficient between two horizontally adjacent pixel values in the encrypted image obtained using Equation (
8) is 0.05367. As an interpretation of correlation coefficients, it is known that the closer the absolute value of the correlation coefficient is to 1, the stronger the correlation and that there is almost no correlation when the value is between 0.0 and 0.2. This indicates that there is almost no correlation between two horizontally adjacent pixels in the encrypted image by the proposed method. From the encryption point of view, the lower the correlation coefficients, the more resistant to statistical attacks. Therefore, in addition to the horizontal direction, the correlation coefficients for two adjacent pixels in the vertical and diagonal directions were determined, respectively. The results are shown in
Table 7, where the correlation coefficients of two adjacent pixel values in the horizontal, vertical, and diagonal directions are shown for comparison.
From
Table 7, the correlation coefficient is reduced by encryption using the proposed method. This shows that the encrypted image has no correlation between each pixel value and is resistant to statistical attacks.
A comparison is made between encryption using the proposed method and existing encrypted QR codes. Existing encrypted QR codes do not encrypt the QR codes themselves, but rather the data before they are converted into QR codes. The process of generating an encrypted QR code first involves encrypting the data using a symmetric key cipher such as AES. Next, the encrypted data are converted into a QR code. When reading the QR code, the encrypted data are obtained by reading the QR code. The data are then decrypted using the previously shared key. When comparing the proposed method with existing encrypted QR codes, the proposed method has the advantage of visual encryption, which makes it resistant to forgery and tampering of the encrypted image. However, as existing encrypted QR codes use AES, the encryption strength of existing encrypted QR codes is superior. However, as QR codes are updated at certain times in QR payments, the encryption strength of the encryption by the proposed method is considered sufficient.
It has been confirmed that the QR code sizes used for QR payments are in the range of 200 px × 200 px~400 px × 400 px. Therefore, experiments were also conducted for QR code sizes of 200 px × 200 px, 300 px × 300 px, and 400 px × 400 px. The processing times required to encrypt QR codes of 200 px × 200 px, 300 px × 300 px, and 400 px × 400 px are shown in
Table 8,
Table 9 and
Table 10, respectively.
Table 8,
Table 9 and
Table 10 show that the processing times required for encryption increase slightly as the image sizes increase. However, for QR codes of the same size, the processing speed is sufficient for QR payments and is not affected by the seed value used for encryption or the type of QR code. Next, the processing times for decryption for each size are shown in
Table 11,
Table 12 and
Table 13.
Table 11,
Table 12 and
Table 13 show that the processing times required for decryption and encryption increase slightly as the image sizes increase. However, for QR codes of the same size, the processing speed is sufficient for QR payments without being affected by the seed value used for encryption or the type of QR code. The correlation coefficients between two neighboring pixels in the horizontal, vertical, and diagonal directions were determined in the encrypted images of 200 px × 200 px, 300 px × 300 px, and 400 px × 400 px QR codes with the seed value set to 42. The results are summarized in
Table 14.
The correlation coefficient is less than 0.2 and hardly correlated, indicating that the proposed method is resistant to statistical attacks regardless of the size of the QR code to be encrypted.