110 Methods of Crypto Protection of Color Image Pixels in Different Code Systems Nataliia Vozna1, Yaroslav Nykolaichuk1, Orest Volynskyi2, Petro Humennyi1, Andrij Sydor1 1. Department of Specialized Computer Systems, Ternopil National Economic University, UKRAINE, Ternopil, 8 Chekhova str., email: nvozna@ukr.net 2. Department of Cyber Security, Ternopil National Economic University, UKRAINE, Ternopil, 8 Chekhova str., email: orestsks@ukr.net Abstract: The relevance of the development of recognition was carried out by segmentation methods on the theoretical foundations, methods and algorithms for basis of histogram thresholding and cumulative histograms. It encoding color image pixels by the problem-oriented is analysis of the statistic estimates of the mean value, multifunctional data structuring and the representation dispersion, asymmetry and the degree of contrast of the of color image code pixels in Rademacher (R), Krestenson intensity histograms homogeneity taking into account the (K), Rademacher-Krestenson (RK), Haar-Krestenson dispersion of pixels coordinates of image fragments and (HK) and Galois (G) Systems is substantiated in this silhouettes, as well as image clustering methods [1-5]. article. The purpose of the research is to increase the As a result, it was found that the main components of the efficiency of the algorithms for digital image transforms, algorithms of the above-mentioned methods for image processing and recognition using modular arithmetic of processing are the following arithmetic operations: extended Galois fields on the basis of mathematics of arithmetic operations of a non-positional residue number summarizing ( ∑ xi ), division ( P(i ) = ni / n0 ), absolute system. difference ( xi − x j ), square ( xi2 ), multiplication ( xi × x j ), [ ] Keywords: crypto protection, color image pixels, Rademacher and Krestenson Systems, Residue Number square difference ( xi − x j 2 ), sum of multiplication System. ( ∑ x x ), which are commonly performed due to the low- i j I. INTRODUCTION speed arithmetic of the binary number system. Successful development of modern computer technology, III. THE METHOD FOR ENCODING RGB PIXELS microelectronics and telecommunication systems promotes IN THE RADEMACHER AND KRESTENSON SYSTEMS designing and mass production of color TV displays as well as personal computers, mobile devices, camcorders, tablet PC According to the international RGB color model, colors screens, industrial and large format color displays. are presented as a combination of three main colors: red (R), The large-scale application of various types of video green (G) and blue (B) [4]. equipment in all branches of industry and their wide-spread In this case in the computer RGB system, the main color personal use determines a high level of importance of the has 256 gradations. Thus, the color code of the RGB system solutions to theoretical and applied problems of increasing is made up of three bytes, that is, 24 bits in the Rademacher and optimizing the efficiency of video image structuring system. during the processes of creation, encoding, transformation, The colors of the Hamming distance pixels on a monitor, crypto protection, transmission, archiving and access given in Cartesian coordinates, can be coded in the Residue receiving to color images as well as their use. Number System (K). This is implemented by introducing The examples of setting and successful solving the three relatively simple modules ( P1 , P2 , P3 ), which allow problems referring to this issue on the basis of the encoding each pixel of the RGB system in the binary system mathematical foundations development, the implementation by forward integer transform of the residue number system of the algorithms and hardware and software tools for image (RNS) according to the expression [6]: processing and recognition were thoroughly highlighted in 3 the works of scientific researches [1-5]. N k = res ∑ b ⋅ B (mod P ) i =1 i i 0 (1) Considerable attention is paid to solving research problems in this field and creating algorithms of the image where B i - the orthogonal bases of RNS, which are structural properties and features. calculated according to diophantine equations: II. METHODS OF MULTIFUNCTIONAL B1 = P2 ⋅ P3 ⋅ m1 ≡ 1(mod P1 ) ; (2) STRUCTURING OF COLOR IMAGE PIXELS IN THE B2 = P1 ⋅ P3 ⋅ m2 ≡ 1(mod P2 ) ; (3) SYSTEM OF EXTENDED GALOIS FIELDS B3 = P1 ⋅ P2 ⋅ m3 ≡ 1(mod P3 ) , (4) The analysis of the mathematical foundations of the where m1 , m 2 , m3 - inverse elements of the RNS [8]; existing algorithms for color image processing and ACIT 2018, June 1-3, 2018, Ceske Budejovice, Czech Republic 111 P0 = P1 ⋅ P2 ⋅ P3 - color image pixel encoding range with IV. THE METHOD FOR COLOR IMAGE PIXELS color depth K = Eˆ [log P ] , Eˆ [•] - integer function with 0 2 0 ENCODING IN THE RADEMACHER-KRESTENSON AND rounding to a larger integer. THE HAAR-KRESTENSON SYSTEMS RGB pixels encoding in the Rademacher-Krestenson The encoding of color image pixels according to the RGB system is provided by selecting the following values of the color model is carried out by the 24-bit binary code, when the encoding range of bi remainders in the Rademacher system: intensity of each of the colors is represented by the 8-bit b1 = bR ; 0 ≤ bR ≤ 255 ; ( 00000000 ÷ 11111111 ); binary code of the Rademacher System: b2 = bG ; 0 ≤ bG ≤ 255 ; ( 00000000 ÷ 11111111 ); r8−1  g 8−1 b8−1    b3 = bB ; 0 ≤ bB ≤ 255 ; ( 00000000 ÷ 11111111 ). ... ... ... In addition, taking into account the coefficients m = 1.0 , R ri ; Gg i ; B bi n = 4.5907 , p = 0.0601 , in order to achieve the most ... ... ...    r0  g 0 b0 saturated green color, the range of its change can be set as 0 ≤ bG ≤ 254 that provides relevant simplicity of the 0 ≤ ri ≤ 255 ; 0 ≤ g i ≤ 255 0 ≤ bi ≤ 255 . following modules: P1 = 256 , P2 = 255 , P3 = 257 . Encoding of the color image RGB pixels in the To verify the relevant simplicity of the selected modules Rademacher-Krestenson (RK) and Haar-Krestenson (HK) system, they are factorized into Systems is carried out by selecting relatively simple modules multipliers: 256 = 2 , 255 = 5 * 51 , 257 - a prime number, 8 system ( P1 , P2 , P3 ), whose product exceeds the range of i.e. P0 = 16776960 , where P0 < 2 24 = 16777216 . That is, the quantization of the brightness values ( ri , g i , bi ). condition for creating a 24-bit pixel code in the Rademacher- Such a condition can be satisfied by a different set of the Krestenson System is satisfied. RNS discrete transformer modules, for In binary system module codes are represented as: example, P1 = 5, P2 = 7, P3 = 8 , which provide encoding of ri , P1 = 100000000 ( 2) , P2 = 11111111( 2) , P3 = 100000001( 2) . g i and bi brightness in P0 = 5 * 7 * 8 = 280 > 255 range. The Then: P0 = 111111111111111100000001( 2) . following code structure is created in the R-K System, which As a module P1 = 28 is among the modules P1 , P2 , P3 , unambiguously represents the corresponding RGB-pixel then, according to the inverse RNS transform, the remainder code: of N k (G – color features) will be presented without a 2 c 2 d 2    decoding it by eight low orders of N k , which is in the R ∨ G ∨ B a1 ; c1 d 1 a c d Rademacher system.  0  0  0 According to the Diophantine equations solution (2-4), the P1 = 5 P2 = 7 ; P3 = 8 , following values of the inverse elements mi and basic where ai ∈ 0,1 ; ci ∈ 0,1 ; d i ∈ 0,1 ; i ∈ 0,2 . numbers Bi are received: In this case, each value ai , ci , d i is calculated as the m1 = 255 , B1 = 16711425 ; m 2 = 128 , B 2 = 8421376 ; remainder according to the expressions: ai = res(ri mod P1 ) ; m3 = 129 , B3 = 8421120 ci = res( g i mod P2 ) , d i = res(bi mod P3 ) . The verification of the calculation accuracy of the RNS transform is performed according to the equation: For a given set of modules, the inverse elements mi and N k = (bR ⋅ B1 + bG ⋅ B2 + bB ⋅ B3 ) ⋅ (mod P0 ) = 1 when the basic numbers Bi are determined according to the bR = 1 , bG = 1 , bB = 1 . Diophantine equations solutions (2-4): That is, m1 = 1 , B1 = 56 , m2 = 3 , B2 = 120 , m3 = 3 , N k = (1 ⋅16711425 + 1 ⋅ 8421376 + 1 ⋅ 8421120) ⋅ (mod P0 ) = 1 . B3 = 105 . For example, R = 10 , G = 200 , B = 100 . Accuracy of the obtained mi and Bi values is verified Then according to the expression (1): N k = (10 ⋅16711425 + 200 ⋅ 8421376 + 100 ⋅ 8421120) ⋅ N1 = (1 ⋅ 56 + 1 ⋅ 120 + 1 ⋅ 105) mod 280 = 1 , ⋅ (mod 16776960) = 9187850 For example, the following values of color intensity of the which corresponds to the binary representation of the RGB-pixel are set as: ri = 10 , g i = 100 , bi = 37 . RGB pixel in the Krestenson System Then, RGB-pixel codes are received in the Rademacher (100011000011001000001010 2 ). System: Decoding of such representation is as follows: ri = 00001010 ( 2) ; g i = 01100100 ( 2) ; bi = 00100101( 2) ; ri = resN k (mod P1 ) ; g i = resN k (mod P2 ) ; in the Rademacher-Krestenson system: bi = resN k (mod P3 ) . ACIT 2018, June 1-3, 2018, Ceske Budejovice, Czech Republic 112   P1 P2 P3   P1 P2 P3 The representation of ri , g i and bi color brightness ri = (000011101) (5,7,8) ; g i = (000010010) (5,7,8) ; digital values in different systems leads, correspondingly, to   P1 P2 P3 different code length according to the expressions: bi = (010010101) (5,7,8) . 1. K R = log 2 2 8 = 8 bits in the Rademacher System (R). Representation of the RGB pixel code for each ri , g i and 3 bi intensity value in the Haar-Krestenson System is made 2. K R −C = ∑ [ Eˆ (log P − 1)] = 3 + 3 + 3 = 9 bits in i −1 2 i according to the structure: the Rademacher-Krestenson system (R-K). a P1 −1 c P2 −1 d P3 −1 n  ....  ...  ... 3. K H −C = ∑ P = 5 + 7 + 8 = 20 bits in the Haar- i    i =1 R ∨ G ∨ B a i ;  i c d i Krestenson System (H-K). .... ... ...    V. STRUCTURE DEVELOPMENT AND a 0 c 0 d 0 EXPERIMENTAL STUDIES OF STRUCTURAL, TIME P1 = 5 P2 = 7 ; P3 = 8 , AND HARDWARE COMPLEXITY OF ADC WITH THE where i ∈ 0, Pi − 1 R AND H-K OUTPUT CODES. For the specified color intensity values of the RGB pixel It is expedient to make multifunctional encoding of RGB ri = 10 , g i = 100 , bi = 37 , the following code structure in pixels in the R-K and H-K systems at the level of analog-to- the H-K system is obtained: digital conversion of the analog signals intensity of the RGB ri = (10000..0001000..00000100) ; sensors. Such a principle of multifunctional data structuring in color formation is implemented by parallel ADC, the g i = (10000..0010000..00100000) ; structure of which is shown in Fig 1. bi = (00100..0010000..00000100) . Fig.1. The structure of a multi-purpose parallel ADC with output codes in the Haar-Krestenson System. ADC consists of 1 – input analogue bus; 2 – paraphase τ ADC 2 = τ k 2 + τ LE2 + τ LE3 , comparators; 3 – input reference bus; 4– exemplary resistors; 5 – the first logic elements "AND-NOT"; 6 – the where τ k 2 = 2υ - switching time for paraphase second logic elements "AND-NOT", 7 – output ADC bus. comparator; ADC efficiency is determined according to the τ LE2 = 1υ - switching time for two-input logic element expression: "AND-NOT"; ACIT 2018, June 1-3, 2018, Ceske Budejovice, Czech Republic 113 τ LE3 = 1υ - switching time for multi-input logic substantiated. This allows to increase the efficiency of algorithms for digital image transform, processing and element (LE) "AND-NOT"; recognition on the basis of the mathematics of arithmetic That is, the efficiency of ADC is determined by the total operations of the non-positional Residue Number System. delay of signals: The analysis of the mathematical foundations of τ ADC2 = (2 + 1 + 1)υ = 4 micro cycles. existing algorithms for color image processing and When calculating the time complexity of the ADC recognition was carried out by segmentation methods on components, it is taken into account that the switching the basis of histogram thresholding and cumulative time of the paraphase comparator is 2.5 times less in histograms, statistic estimates of the mean value, comparison with the single-phase comparator due to dispersion, asymmetry and the degree of contrast of the positive trigger feedback between the direct and inverse intensity of histograms. This is exemple homogeneity outputs. taking into account the dispersion of pixels coordinates of image fragments and silhouettes, as well as image VI. THE METHOD OF CRYPTO PROTECTION OF clustering methods. COLOR IMAGE RGB PIXELS. It is proposed to carry out structured encoding of color Crypto protection of the RGB image pixels is image pixels by the codes of non-positional number performed in order to restrict unauthorized access to color systems of R-K, H-K and G. This allows to increase the images that are generated in real time. It's encoded in efficiency of algorithms for image processing by 2-3 different number systems, transmitted via communication orders. channels, recorded in database storage, and displayed on REFERENCES the user monitors. There are different methods for encrypting files containing color image data and data [1] Otsu N., A threshold selection method from grey level arrays, which include a certain amount of color images. In histograms, IEEE Trans. Systems Man Cybernet, this case, information systems use standard algorithms for No.9, pp.62-66, 1979.. data arrays protection from unauthorized access on the [2] Zhang Yudong and Wu Lenan., Fast Document Image basis of hashing, symmetric and asymmetric RSA Binarization Based on an Improved Adaptive Otsu`s algorithms, elliptic curves, etc. [7, 8]. Method and Destination Word Accumulation, Jornal The method for encryption of color images RGB pixels, of Computational Information Systems, No.6, which are represented by R, R-K and H-K codes of the pp.1886-1892, 2011. described methods, is proposed. In this case, structured R- [3] U. Ramer, “An Iterative Procedure for the Polygonal K and H-K codes are problem-oriented to increasing the Approximation of Plane Curves,” Computer Graphics efficiency of the image transform, processing and Image Processing, Vol. 1, No. 3, pp. 244-256, 1972. recognition in accordance with the modular arithmetic of [4] R. Melnyk Algorithms and methods for image the Residue Number System. processing: Teaching manual., Lviv: Lviv It is expedient to apply an effective method based on Politechnika Publishing House, 220 pp., 2017. hashing of certain code positions and logic combination of [5] N. Lotoshynska. Theory of color and color formation: bits of generated Galois sequences [9] according to the Teaching manual, Lviv: Lviv Politechnika Publishing following graphs as the main method of crypto protection House, 204p., 2014. of RGB pixel codes: [6] N. Vozna., Y. Nykolaichuk and N. Shyrmovska, “Method of formation of structured data of quasi- stationary objects on the basis of the Residue Number System of the Krestenson basis”, Scientific and Technical Journal "Exploration and Development of Oil and Gas Fields, No. 3 (40), pp.62-65,2011. [7] Ya. Nykolaychuk, M. Kasianchuk and I.Yakymenko, “Theoretical Foundations for the Analytical Computation of Coefficients of Basic Numbers of , Krestenson’s Transformation”, Cybernetics and where ai - bits of R-K or H-K pixel codes; 1 – hashing Systems Analysis, Volume 50, Issue 5, pp. 649-654, procedure ( bi := b j , i ≠ j , i ∈ 0, n ), Pi , i ∈ 0, n - created September, 2014. [8] Ya. Nykolaychuk, M. Kasianchuk and I.Yakymenko, code of crypto protected pixel PX . “Theoretical Foundations of the Modified Perfect Bits of Galois {Gi }codes are generated according to form of Residue Number System”, Cybernetics and secret keys. Systems Analysis, Volume 52, Issue 2, pp. 219-223, March, 2016. VII. CONCLUSIONS [9] Y. Nykolaichuk, Galois Field Codes: Theory and The relevance of the development of the theory, Application, Ternopil: Ltd.: Terno-graf, 576 pp., methods and algorithms for encoding color image pixels 2012. and their representation in different systems has been ACIT 2018, June 1-3, 2018, Ceske Budejovice, Czech Republic