Download as pdf
Download as pdf
You are on page 1of 5
‘25/10/2021 16:09 09) CODE PROJECT NoisyCrypt a ADMGNS 25.0ct2021 850 Very simple, noise-based colar visual cryptography for images NoisyCrypt- CodeProject Randomize, noise-based and very simple method for visual cryptography to encrypt B/W and color images Download demo - 265.9 KB Download source code - 25.7 KB endioatnaye |X cndonytaptCh | emiNsigCyeBey F anrtopa enaione | T ctisunatlone | tas, 127 = R966 05,255, 2591296 FORO CREE OM cnetone flee Ct ll ooo T_T a] Fiehowace arto Leva hitps:iwwn.codeproject.com/Tips'5316017/NosyCrypt?display=Print 18 25/10/2021 16:00 NoisyCrypt- CodeProject Introduction Inthe last decade, visual cryptography, again, has become a popular interest topic in security (encryption) and data hiding areas. For the first time, it was introduced at EUROCRYPT'94 by M.Naor and Shamir. It is based on sharing secrets atleast by two separated/split (and also encrypted) image components. For decryption, all image components are required; elsewhere, it is not possible to get accessing the eriginal materials, Also, the difference between normal cryptography and visual cryptography is that the stacked/olended (and also decrypted) image must be seen and approved visually by a human or humanoid The Method In this ti, Il present a simple visual cryptic method for color and black-white images using random colors (ie, 2D noise}, me named it NoisyCrypt. It's clear that there are well-known methods for implementing visual cryptography and data hiding in pictures, The most famous one is secret sharing, Ni syCrypt is conceptually based on secret sharing, butts ciferent as technically, very simple and also "too" funny for me.) ‘As a summary, here is some well-known methods: + Secret sharing by split components ‘© Using LSBs (least significant bits) + Using selected bit plane(s) + Bit/block shifting = Rubies Cube rules = Watermarking techniques using wavelets or fractals ‘Inserting into picture's non-used alpha (or auxiliary) channels + Inserting into picture's metadata areas. The Steps ‘The steps are... hold a coin, toss it for heads or tals. Then, set a threshold, T, and pick a pixel from input image. If pixel value is less then T, and coin is on tal, the output pixel is the same as the picked pixel for Share 1 and inverted for Share 2, and otherwise, the output pixel is a random color. As you predict, there are four probable situations according to threshold and tossing. For color images, random colors red, green, and blue component values are thresholded to 0 or 255 before decision. While deciding for output pixels value, its applied for only one component but not for the other two components, That's all. Easy? Of course! Please examine the code snippet below. ‘The following pictures are explaining the procedure roughly. Input image Noise Share 1 Share 2 hitps:lww.codeproject.com/Tips!5316017/No'syCrypt?dlsplay=Print 215 25/10/2021 16:00 NoisyCrypt- CodeProject Stacked/Blended image (Color) ‘Stacked/Blended image (Black/White) NOTE that the noise itself, share 1 & 2, and stacked/blended images consist of only RG.B + CIM + BM, ie, only 8 essential colors located at RGB cube's vertices ‘To get back the original input picture from Shares 1 and Share 2 images, in Photoshop or similar apps that support layers, you must Use the “Difference” or "Exclusion* blend mades for upper layer. Maybe, you can use some other blend modes, but, you'll get a rnonclear image as a result. The Code Here is the principal code: Delphi Ws H we imginput.Height; imginput Width; nSize = abs(H * W); Randonize; 128; // threshold for yi=@ to H-1 do begin for xi=0 to W-1 do begin // ¢1: input color cl i= imgInput Picture. Bitmap.Canvas.Pixels[x, y]3 PL i= 255 - GetRValue(c1); gl i= 255 - GetGvalue(c1); bi i= 255 - GetBValue(ci); // thresholded random colors (ie 20 noise) 55 * (random(256) mod 2)3 255 * (random(256) mod 2); 255 * (random(256) mod 2)3 pndNum := random(nSize) ; // sandy noise or normal noise if chkSandyNoise.Checked then flag := ( rndNum < (nSize div 2) ) else flag = True; // ¢@: output color if (flag = True) then begin // tossing: heads or tails if (rndNum mod 2 = @) then begin hitps:lwwu.codeproject.com/Tips!5316017/No'syCrypt?alsplay=Print 35 ‘26/10/2021 16:09 NoisyCrypt- CodeProject 255 - 5 255 - g 255 - b; end else begin & b5 ends end; // ar, 09, ab for Share 1 (ie Layer A); br, bg, bb for Share 2 (te Layer B) Af (1

You might also like