Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
It is Possible Encrypt and Decrypt a image Using Rubik's Cube Principle in c#.I can't understand the concept .please anybody give me some idea about this concept.how can i use this rubik's cube algorithm in Image encryption and decryption.

thanks in advance
Posted
Comments
Dave Kreskowiak 26-Feb-14 12:20pm    
Are you asking us to do all the research on this and give you the "Cliff Notes" version of how to make it work?
Hannah Magi 3-Apr-14 0:57am    
if u have done with this can u help me... this is my project im doing right now.. im clueless

Basically it's:

1. Permute your pixels by first rotating each row and column by some steps
2. Encrypt each pixel using XOR (probably this step is meant to obfuscate the permutation from step 1)
3. Repeat a couple of times

The algorithm uses a "seed" of (number of columns + number of rows + 1) numbers to define individual rotations for each row and column, and individual XOR values for each pixel.

The "Rubiks Cube" part of this algorithm doesn't introduce anything conceptionally new (defining a permutation), but it helps by providing a non-trivial scheme that can be defined with a relatively low number of key values.

I'd like to add, that while this algorithm is supposed to be applied on images only, nothing stops you from interpreting any kind of data as an image, or sequence of images: e. g. you could split up a big file into 64KB blocks, and then interpret each block as a 256x256 greyscale image with 256 grey scales per 'pixel' (stored as one byte each).
 
Share this answer
 
Comments
Hannah Magi 3-Apr-14 1:00am    
how to rotate the pixels.. can u tell me clearly?
Stefan_Lang 3-Apr-14 2:39am    
By rotate I meant moving each Pixel value N cells to the right or left, with positions treated as a circular buffer. E. g. if you had a row of 8 pixels with pixel grey scale values like this:
+---+---+---+---+---+---+---+---+
|017|196|234|098|192|175|249|065|
+---+---+---+---+---+---+---+---+

then a shift 2 positions to the right would move the value of the first position (17) to the third position, 196 to the fourth position, etc.. The value at the second-to-last position, 249, would then be "rotated" to the first position, and the last value, 65, would be at second position. The end result would be like this:
+---+---+---+---+---+---+---+---+
|249|065|017|196|234|098|192|175|
+---+---+---+---+---+---+---+---+

When you implement this, you must be mindful of the fact that you shouldn't do it literally the way I described it, as you would be overwriting the original values. You'd better copy the pixels to an entirely new image to prevent that.
 
Share this answer
 
Comments
Dave Kreskowiak 26-Feb-14 12:22pm    
Something tells me he found it too, but can't understand all the math in it.
Oh really !!! :doh:
So, what to do now? :)
Sergey Alexandrovich Kryukov 26-Feb-14 16:06pm    
From the first glance, it looks like the algorithm is 100% described, and if you set the proofs aside (it looks like no proof is shown), there is nothing unknown it it, the description is self-sufficient. It is nothing but matrices, loops, XOR(^) and modulo operations (%)... just some day(s?) of boring work requiring very close attention. Of course, if there are no mistakes in the article and if this is not a joke. :-)
—SA
Stefan_Lang 27-Feb-14 3:39am    
"if there are no mistakes in the article"

Actually I think there are: Kc and Kr are supposed to be initialized with values in the range of 0..2^a-1, i. e. the range of greyscale values. However, these numbers are used to determine by how much each row and column of pixels is rotated, which is logically limited by the number of rows and columns respectively! Doesn't make sense...
Sergey Alexandrovich Kryukov 26-Feb-14 16:08pm    
So, I voted 5.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900