Zachary Blair > Crypt-Rot47-0.03 > Crypt::Rot47

Download:
Crypt-Rot47-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.03   Source  

NAME ^

Crypt::Rot47 - Perl extension for encrypting and decrypting ASCII text using the Rot47 substitution cipher.

SYNOPSIS ^

  # Object-oriented interface
  use Crypt::Rot47; 

  my $cipher = new Crypt::Rot47();
  my $ciphertext = $cipher->encrypt('Shhh... this is a secret message');

  print "$ciphertext\n";     # Prints "$999]]] E9:D :D 2 D64C6E >6DD286"

  my $plaintext = $cipher->decrypt($ciphertext);

  print "$plaintext\n";        # Prints "Shhh... this is a secret message"

  # Simpler non-OOP interface
  use Crypt::Rot47 qw(rot47);

  my $ciphertext = rot47('Shhh... this is a secret message');
  my $plaintext  = rot47($ciphertext);

DESCRIPTION ^

A module that applies the Rot47 substitution cipher to text to encrypt or decrypt it.

Methods

PACKAGE->new()
  use Crypt::Rot47;
  my $cipher = new Crypt::Rot47();

Returns a newly created Crypt::Rot47 object.

$OBJ->encrypt(SCALAR)
  my $cipherText = $cipher->encrypt('Hello, world!');

Returns the ciphertext of the provided plaintext.

$OBJ->decrypt(ARRAY)
  my $plainText  = $cipher->decrypt($cipherText);

Returns the plaintext of the provided ciphertext. Note that because encrypting and decrypting using Rot47 are exactly the same operation, you could technically just call encrypt() to decrypt the ciphertext, but I provided both methods to be consistent with the API of other Crypt:: modules.

Exportable Subroutines

rot47(SCALAR)
  use Crypt::Rot47 qw(rot47);

  my $cipherText = rot47('Hello, world!'); 
  my $plainText = rot47($cipherText);

Encrypts or decrypts the provided text. For Rot47, encryption and decryption are the same operation, so calling rot47 on text twice has no effect.

SEE ALSO ^

Crypt::Rot13 - A similar module that applies the Rot13 substitution cipher to text.

Crypt::Blowfish Crypt::IDEA

AUTHOR ^

Zachary Blair, <zack_blair@hotmail.com>

COPYRIGHT AND LICENSE ^

Copyright (C) 2008 by Zachary Blair

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.