It does not need to be secure,
If it really doesn't need to be secure, merely a little obscure to discourage the curious and minimally motivated, you can get a quick and easy result in the same number of charactes, using just a little scrambling. Transform each character to a different character using tr///, and scramble the characters using an array slice. It should be fairly fast as well.

Update: Here's a very simple code implementation if that's helpful.

use warnings; use strict; my $in = 'Simpletestxy'; my $tr_ed = $in; $tr_ed =~ tr/A-Za-z1-9/1-9a-zA-Z/; #complicate and add chars to the tr/// as you wish # 0 1 2 3 4 5 6 7 8 9 10 11 my $out = join '',(split '',$tr_ed)[qw(5 6 4 2 9 10 3 7 11 1 8 0)]; my $back = join '',(split '',$out )[qw(11 9 3 6 2 0 1 7 10 4 5 8)]; $back =~ tr/1-9a-zA-Z/A-Za-z1-9/; print "in=$in, tr_ed=$tr_ed, out=$out, back=$back\n";

2nd Update: Xor with a pass phrase as syphilis uses can be used instead of the tr/// step in the code above, it's another way of doing and expressing the translation. Use of tr/// has an advantage if you want the $output confined to printable characters, otherwise, just decide which is easier for you to read.


In reply to Re: Short & Sweet Encryption? by rodion
in thread Short & Sweet Encryption? by inblosam

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.