This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: Non-Formula based Text Encoding - with Compression
by jeffa (Bishop) on Apr 15, 2015 at 15:43 UTC

    Aside from my failure to understand what value the output of this code offers, the quality of the code is very poor.

    1. use POD instead of single line comments for blocks of comments
    2. use strict and warnings (and declare your variables!)
    3. use Getopt::Long to allow your client to specify arguments you have instead hard coded or just use STDOUT
    4. don't use 3 arrays when 1 will suffice
    5. consider your solution is O(N^3) and that can be improved
    6. in fact ... there might be a mathematical formula that can derive these combinations in O(N) instead

    In other words, something more like this:

    #!/usr/bin/env perl use strict; use warnings; my @base = ( 'a'..'z', 'A'..'Z', 0..9 ); for my $i (@base) { print "$i\n"; for my $j (@base) { print "$i$j\n"; for my $k (@base) { print "$i$j$k\n"; } } } __END__ =head1 NAME non-forumla-based-text-encoder-with-compression.pl =head1 DESCRIPTION =over 4 =item * Create 242,234 unique codes, 1-3 characters in length, from the characters {a-zA-Z0-9}. =item * 62 (1 char codes) + 3844 (2 char codes) + 238,328 (3 char codes) = 242,234 unique codes. =item * (Somewhat like MIMEbase64 encoding, but my encoding is non-formula based.) =item * ... =back =cut
    And then the client can redirect STDOUT to their own file of choice.

    Now then ... i'd really like to see if someone can get this down to O(N). :)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Non-Formula based Text Encoding - with Compression
by GotToBTru (Prior) on Apr 16, 2015 at 00:41 UTC

    Undecipherable? This kind of one-to-one encoding is exactly the sort of thing decryption software eats for breakfast. Since you require sender and receiver to exchange databases, why not have them exchange random pads instead and have truly unbreakable encryption?

    Dum Spiro Spero
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Non-Formula based Text Encoding - with Compression
by Anonymous Monk on Apr 17, 2015 at 22:02 UTC

    A fair warning to would-be cryptographers. This sort of encryption is called a substitution cipher, and it succumbs to most trivial word frequency analysis.

    For a quick jab at the gibberish, my recommendation is to start with Crypt::Rot13. Home assignment: implement triple-rot13.

      ++for the warning to future hobby crypologists.

      However, I would point out the OP was careful to say "encoded", not "encrypted", and emphasized "compression".

      I'll withhold comments on the sophomoric quality of the comments within, and suggested uses of, the originally-presented code.

      But the childish response on the thread definitely received its appropriate downvote. Childlike behavior can be tolerated and gentle guidance given; childish behavior neither requires nor begets tolerance.

    A reply falls below the community's threshold of quality. You may see it by logging in.