Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Rot13 (was Re: Perl Obsfucate Or Encrypter)

by cciulla (Friar)
on May 31, 2003 at 03:17 UTC ( #262025=note: print w/ replies, xml ) Need Help??


in reply to Perl Obsfucate Or Encrypter

Let's see if I got the requirements down:

  • Command line encrypter [sic]
  • Encrypt it with no problem

Given that the OP's requirements did not specify that the resultant output of the command line encrypter must be able to be interpreted, I present...

#!/usr/bin/perl use strict; use warnings; my ($final, $rot); $_ = shift; open (INFILE, $_) || die "Can't open $_: $!"; while (<INFILE>) { foreach (split //) { if (/[a-m]/i) { $rot = 13; } elsif (/[n-z]/i) { $rot = -13; } else { $rot = 0; } $final .= chr(ord() + $rot); } } close(INFILE); print $final;


Comment on Rot13 (was Re: Perl Obsfucate Or Encrypter)
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://262025]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2015-07-08 02:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls