Text::Cipher::KeywordAlphabet

Substitution cipher based on a keyword alphabet
Download

Text::Cipher::KeywordAlphabet Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • John Alden
  • Publisher web site:
  • http://search.cpan.org/~bbc/

Text::Cipher::KeywordAlphabet Tags


Text::Cipher::KeywordAlphabet Description

Substitution cipher based on a keyword alphabet Text::Cipher::KeywordAlphabet is a Perl module that generates a monoalphabetic substitution cipher from a set of words, resulting in what's sometimes referred to as a "keyword (generated) alphabet". Here's a good definition, plagiarised from an anonymous source:"A keyword alphabet is formed by taking a word or phrase, deleting the second and subsequent occurrence of each letter and then writing the remaining letters of the alphabet in order. Encipherment is achieved by replacing each plaintext letter by the letter that appears N letters later in the (cyclic) keyword alphabet."The keyword alphabet is case-insensitive - both uppercase and lowercase characters will be transformed with the same mapping. The offset (N in the definition above) can be a positive or negative integer.http://www.trincoll.edu/depts/cpsc/cryptography/substitution.html is an introductory tutorial on how substitution ciphers can be broken. http://www-math.cudenver.edu/~wcherowi/courses/m5410/exsubcip.html contains a full worked example. http://www.muth.org/Robert/Cipher/query_scb.html provides an online substitution cipher breaker.At the risk of stating the obvious, since substitution ciphers are easy to break, it's advisable not to use them for protecting important data. Look at some of the more heavy-duty ciphers in the Crypt:: namespace which plug into Crypt::CBC if you want to protect data.SYNOPSIS #Create a keyword alphabet with a left shift of 5 $cipher = new Text::Cipher::KeywordAlphabet("the quick brown fox", -5); #Fetch the generated alphabet $keyword_alphabet = $cipher->alphabet(); #Encipher a string $ciphered = $cipher->encipher($message); #Decipher an enciphered message $message = $cipher->decipher($ciphered); #Some convenience methods $cipher->encipher_scalar($some_scalar); $cipher->decipher_scalar($some_scalar); @ciphered = $cipher->encipher_list(@list); @list = $cipher->decipher_list(@ciphered); $cipher->encipher_array(@some_array); $cipher->decipher_array(@some_array); #Other uses $null_cipher = new Text::Cipher::KeywordAlphabet(); #no-op cipher $rot13_cipher = new Text::Cipher::KeywordAlphabet(undef, 13); #Caesar cipher Requirements: · Perl


Text::Cipher::KeywordAlphabet Related Software