Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Caesar Cipher

by kcott (Abbot)
on Aug 05, 2013 at 07:01 UTC ( #1047870=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl -l
    
    ...
        print "Ciphertext: $input";
        print "Plaintext:  $plaintext";
    }
    
  2. or download this
    $ pm_caesar_cipher.pl def 1 1 3
    Transform: encrypt  --  Shift: right  --  Positions: 3
    Plaintext:  def
    Ciphertext: ghi
    
  3. or download this
    $ pm_caesar_cipher.pl ghi 0 1 3
    Transform: decrypt  --  Shift: right  --  Positions: 3
    Ciphertext: ghi
    Plaintext:  def
    
  4. or download this
    $ pm_caesar_cipher.pl def 1 0 3
    Transform: encrypt  --  Shift: left  --  Positions: 3
    Plaintext:  def
    Ciphertext: abc
    
  5. or download this
    $ pm_caesar_cipher.pl abc 0 0 3
    Transform: decrypt  --  Shift: left  --  Positions: 3
    Ciphertext: abc
    Plaintext:  def
    
  6. or download this
    $ pm_caesar_cipher.pl 'The quick brown fox jumped over the lazy dog.' 
    +1 1 145
    Transform: encrypt  --  Shift: right  --  Positions: 50
    Plaintext:  The quick brown fox jumped over the lazy dog.
    Ciphertext: ';8RDH<6>R5EBJAR9BKR=H@C87RBI8ERG;8R?4MLR7B:`
    
  7. or download this
    $ pm_caesar_cipher.pl "';8RDH<6>R5EBJAR9BKR=H@C87RBI8ERG;8R?4MLR7B:\`"
    + 0 1 145
    Transform: decrypt  --  Shift: right  --  Positions: 50
    Ciphertext: ';8RDH<6>R5EBJAR9BKR=H@C87RBI8ERG;8R?4MLR7B:`
    Plaintext:  The quick brown fox jumped over the lazy dog.
    
  8. or download this
    $ pm_caesar_cipher.pl
    Usage: ./pm_caesar_cipher.pl text encrypt/decrypt(1|0) right_shift/lef
    +t_shift(1|0) positions_to_shift
    (Note: when decrypting, '*_shift' and 'positions_to_shift' is what was
    + used for the original encryption!)
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2015-07-04 21:33 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 (60 votes), past polls