|Perl Monk, Perl Meditation|
Rubixby japhy (Canon)
|on Oct 02, 2000 at 18:51 UTC||Need Help??|
I'm working on an encryption algorithm (probably not the best in the world) for the fun (or hell) of it. It's called Rubix, and you probably already have a good idea of what it does. It maps a string onto a cube of given proportion (so string lengths are padded to 6, 24, 54, 96, ...), and then allows for rotations on ANY row or column throughout the cube. These rotations ALSO effect the character value of the character on the cube. Rotating something N times will increase the ASCII values of the characters in that segment by N.
I used to use a square for this. It was a whole lot simpler then. Now I have a LOT of things to deal with. Take the simple cube for "this message gets padded.". The string gets padded to 24 characters with a null character, say, "~". Then I map it onto the cube in the following fashion:
If I want to spin segment EFIJMNQR , to the right one notch, then the top face ABCD would get rotated too, and the cube would be (sans character transliteration):
Now I want to rotate the segment BAEKUWTN -- if you don't see why it's TN, and not NT, draw it out, and you'll see the loop goes UP the block in the back. In doing this, face QRGH will get rotated to. Let's say I spin the vertical segment down one notch.
If I restructure the cube into the string now, I go in the same order of the cells that I placed them in. That makes the result "~sdie.t~hgtas edd~~~ ~p~" -- now, the recipient (or interceptor) of this message knows the original characters, he just has a jumbled order (and perhaps some null characters). That's why the value augmentation is used. You can rotate a segment 4 notches, thus returning each character to where it was, but augmenting their values by 4. This makes it imperative that you know the turning sequence.
Which brings me to the turning sequence. Now, obviously, you can't just send the encrypted text. The recipient has to know how to decode it. And you can't send the "key" with the text, because then ANYONE can decode it if they know the algorithm. So how does one send a message and let the recipient know what to do? I'm thinking something not unlike the one-time pass technique. You both have a file holding generic instructions, and the sender determines how many instructions he wants executed, and sends that number as the first line of his transmission (or something).
The problem is that you'd have to have generic instruction sheets for each sized cube. 1x1x1, 2x2x2, 3x3x3, and so on. To me, this sounds less than practical (but then again, maybe Rubix is less than practical too...). Or perhaps it could be used for just keeping your own data obscured.
I appreciate any comments, insights, criticisms, or suggestions (I might end up making this a Filter:: module!).