The importance of cybersecurity in modern life cannot be overstated. The generation of pseudorandom sequences of numbers is the basis of modern cryptographic algorithms, so optimising their components has a significant impact on security in general [1]. Among the numerous methods for generating pseudorandom sequences based on various sources of entropy, the methods based on webcam images are particularly interesting for research. They allow for achieving high sequence generation speeds due to the large amount of input data obtained from the webcam sensor. However, for practical use, it is important to optimise the speed of the algorithm. Although many of the proposed methods have good cryptographic characteristics, they have insufficient speed [2,3,4].
A simple algorithm for constructing a sequence of pseudo-random numbers based on a webcam was used. It is based on obtaining two consecutive images A and B from a webcam sensor in the form of a three-dimensional array of bytes representing individual color components of each pixel.
The next step is to calculate the change in the image using a subtraction operation:
with the subsequent formation of a one-dimensional vector:
where m and n are the width and height of the resulting images, and p = 3 corresponds to the number of bytes that encode different colour components.
This paper proposes to consider a random sequence generator implementation based on the .NET framework and the Emgu CV library, which can potentially reduce the computational resources required to obtain an image from a matrix and perform operations on matrices, making higher pseudorandom sequence generation rates practically available. At the same time, the software solution remains cross-platform.The necessary initialisation before starting to work with the webcam is as follows, setting the image capture parameters supported by the webcam:
using var capture = new VideoCapture();
capture.Set(CapProp.FrameWidth, 1920);
capture.Set(CapProp.FrameHeight, 1080);
capture.Set(CapProp.Fps, 30);
After that, a matrix of two images is obtained with a minimum delay between them:
using var frame1 = new Mat();
using var frame2 = new Mat();
capture.Read(frame1);
capture.Read(frame2);
After these operations, the frame1 and frame2 objects will contain the three-dimensional matrix of the corresponding image. The matrix subtraction operation can be performed using the following operations:
using var diffFrame = new Mat();
CvInvoke.AbsDiff(frame1, frame2, diffFrame);
With the subsequent formation of a one-dimensional vector:
diffFrame.GetRawData();
Table 1. Achieved generation speed per image resolution.
This approach allows to achieve an average pseudorandom sequence generation rate of 1395 Mbps or 174 Mbps when using a 1920 x 1080 FHD image from an image sensor without significant use of computing resources, which is close to the theoretical maximum and makes it promising for further research.
References
1. Asia Othman Aljahdal, “Random Number Generators Survey” International Journal of Computer Science and Information Security (IJCSIS),Vol. 18, No. 10, October 2020 https://zenodo.org/records/4249407
2. Barannik, V., Sidchenko, S., Barannik, N., & Khimenko, A. (2021). The method of masking overhead compaction in video compression systems. Radioelectronic and Computer Systems, (2), 51-63. https://doi.org/10.32620/reks.2021.2.05
3. Yevseiev, S., Milov, O., Zviertseva, N., Lezik, O., Komisarenko, O., Nalyvaiko, A., Pogorelov, V., Katsalap, V., Pribyliev, Y., & Husarova, I. (2023). Development of the concept for determining the level of critical business processes security. Eastern-European Journal of Enterprise Technologies, 1(9 (121), 21–40. https://doi.org/10.15587/1729-4061.2023.274301
4. R. Li, "A True Random Number Generator algorithm from digital camera image noise for varying lighting conditions," SoutheastCon 2015, Fort Lauderdale, FL, USA, 2015, pp. 1-8, doi: 10.1109/SECON.2015.7132901. https://ieeexplore.ieee.org/document/7132901
|