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:
+--+ +--+ |AB| |th| |CD| |is| +--+--+--+--+ +--+--+--+--+ |EF|IJ|MN|QR| __\ | g|s |dd|.~| |GH|KL|OP|ST| ~~/ |et|pa|ed|~~| +--+--+--+--+ +--+--+--+--+ |UV| |~~| |WX| |~~| +--+ +--+
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):
+--+ +--+ |BD| |hs| |AC| |ti| +--+--+--+--+ +--+--+--+--+ |QR|EF|IJ|MN| __\ |.~| g|s |dd| |GH|KL|OP|ST| ~~/ |et|pa|ed|~~| +--+--+--+--+ +--+--+--+--+ |UV| |~~| |WX| |~~| +--+ +--+
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.
+--+ +--+ |TD| |~s| |NC| |di| +--+--+--+--+ +--+--+--+--+ |GQ|BF|IJ|MW| __\ |e.|hg|s |d~| |HR|AL|OP|SU| ~~/ |t~|ta|ed|~~| +--+--+--+--+ +--+--+--+--+ |EV| | ~| |KX| |p~| +--+ +--+
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!).

$_="goto+F.print+chop;\n=yhpaj";F1:eval

In reply to Rubix by japhy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.