Crypt::Blowfish - Perl Blowfish encryption module
use Crypt::Blowfish; my $cipher = new Crypt::Blowfish $key; my $ciphertext = $cipher->encrypt($plaintext); my $plaintext = $cipher->decrypt($ciphertext);
Crypt::Blowfish has the following methods:
blocksize() keysize() encrypt() decrypt()
Crypt::Blowfish doesn't return a key size due to its ability to use variable-length keys. (well, more accurately, it won't as of 2.09 .. for now, it does. expect that to change)
my $cipher = new Crypt::Blowfish $key;
This creates a new Crypt::Blowfish BlockCipher object, using $key, where $key is a key of "keysize()" bytes (minimum of eight bytes).
my $cipher = new Crypt::Blowfish $key; my $ciphertext = $cipher->encrypt($plaintext);
This function encrypts $plaintext and returns the $ciphertext where $plaintext and $ciphertext must be of "blocksize()" bytes. (hint: Blowfish is an 8 byte block cipher)
my $cipher = new Crypt::Blowfish $key; my $plaintext = $cipher->decrypt($ciphertext);
This function decrypts $ciphertext and returns the $plaintext where $plaintext and $ciphertext must be of "blocksize()" bytes. (hint: see previous hint)
my $key = pack("H16", "0123456789ABCDEF"); # min. 8 bytes my $cipher = new Crypt::Blowfish $key; my $ciphertext = $cipher->encrypt("plaintex"); # SEE NOTES print unpack("H16", $ciphertext), "\n";
Please see the README document for platforms and performance tests.
Bruce Schneier, Applied Cryptography, 1995, Second Edition, published by John Wiley & Sons, Inc.
Other parts of the perl extension and module are copyright of Systemics Ltd ( http://www.systemics.com/ ).
Code revisions, updates, and standalone release are copyright 1999-2001 W3Works, LLC.
Current revision and maintainer: Dave Paris <amused@pobox.com>
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |