# Usage: cypher KEY, LIST; sub cypher { srand shift; my $string = join '', @_; my $here = 0; while ( 2*$here < length( $string)) { vec( $string, $here, 16) ^= int rand 1<<16; $here++; } $string; } my $encoded = cypher 12345, <<'EOT'; Listen, my children, and you shall hear Of the midnight ride of Paul Revere. EOT print map {sprintf '%x ', $_ } unpack 'C*', $encoded; print $/, cypher 12345, $encoded;