Archive for May, 2012

Before i start, i want to thank Coursera.org for their courses that helped and inspired me to create this project … Thank you Coursera :) .

So, some of you may think, what is visual encryption, and how does it work ?

Actually, it exists many techniques that can do the job, but the most known is the “Share+Share” technique (2 images) .

If you want to know more about it you can check Wikipedia : http://en.wikipedia.org/wiki/Visual_cryptography .

Today, i’m going to explain to you a technique that i used to encrypt my images visually by using the puzzle switching and division .

The idea is to split the image to small or large puzzles (it can go to 1 pixel/block) and place them randomly .

After encryption you can generate a key that will help you to decode the image .

The complexity of the encryption is defined by the number of puzzle blocks and the random block switching .

So if the random access increases ==> more security + larger key file .

as long as the number of slices increases, you must define a larger random access too, so the probability to switch all blocks tends to ~1.

If you didn’t get the trick check those examples :

This is the original image created by Oubahman Ibrahim :

Blocks = 100 (10 x 10) :

With color reversing :

Normal encryption :

Blocks = 1600(40 x 40) :

With color reversing :

Normal encryption :

Decoding :

Here is an example of the encryption written in PHP :

<?php
 
////////////////////////////////////////////////////////////////////////////////
///
///Coded By : Ayoub DARDORY (Apolikamixitos)
///Email : AYOUBUTO@Gmail.com
///Description : Visual encryption for image files
///Follow me : http://www.twitter.com/Apolikamixitos
///GitHub: http://github.com/apolikamixitos
//
//////////////////////////////////////////////////////////////////////////////// 
 
require 'Pixelizator.class.php';
 
$KeyFile = 'key';
$EncryptedImgFile = 'EncryptedImg.jpg';
 
$ImageFile = 'flowers.jpg';
$Slices = 10;
$MaxRandSwitch = 300;
 
 
/*
 * Encryption part
 */
$VisualEn = new Pixelizator($ImageFile, $Slices,true);
$VisualEn->Encrypt($MaxRandSwitch); //As long as the $MaxRandSwitch increases, the key file size will become bigger
$VisualEn->GenerateKey($KeyFile);
$VisualEn->SaveImage($EncryptedImgFile);
$VisualEn->Show();
exit;
?>

 

And this for decryption :

<?php
 
////////////////////////////////////////////////////////////////////////////////
///
///Coded By : Ayoub DARDORY (Apolikamixitos)
///Email : AYOUBUTO@Gmail.com
///Description : Visual encryption for image files
///Follow me : http://www.twitter.com/Apolikamixitos
///GitHub: http://github.com/apolikamixitos
//
////////////////////////////////////////////////////////////////////////////////
 
require 'Pixelizator.class.php';
 
/*
 * Decryption part
 */
 
$EncryptedImgFile = 'EncryptedImg.jpg';
 
$KeyFile = 'key';
$DecryptedImgFile = 'DecryptedImg.jpg';
 
$VisualDe = new Pixelizator($EncryptedImgFile);
$VisualDe->LoadKey($KeyFile);
$VisualDe->Decrypt();
$VisualDe->SaveImage($DecryptedImgFile);
$VisualDe->Show();
?>

As usual you can download this project from GitHub :

All your suggestions and collaborations are welcomed !

Currently evolving ...

Yeah ...

Discovering and learning new things about the world ! ... and how they should be done ...

About Me

ABOUT

Can you spell "Apolikamixitos" ?