Crypt::Camellia - Perl Camellia encryption module
my $cipher = Crypt::Camellia->new($key);
my $ciphertext = $cipher->encrypt($plaintext);
my $plaintext = $cipher->decrypt($ciphertext);
# more likely
$cipher = Crypt::CBC->new( -key => 'my secret key',
-cipher => 'Camellia'
This module implements Camelia 128-bit Block Cipher for perl. For Camellia. Check https://info.isl.ntt.co.jp/crypt/eng/camellia/index_s.html. Here is an exerpt of that page.
Camellia is a symmetric key block cipher developed jointly in 2000 by world top class encryption researchers at NTT and Mitsubishi Electric Corporation. Technologically speaking, Camellia naturally has not only a high level of security, but also excellent efficiency and practical characteristics. It can be implemented at high performance by software on various platforms. In regard to hardware implementation, compact and low-power consumption type implementation as well as high-speed implementation is possible.
Based on these technological advantages, Camellia has been internationally recognized, for example the selection project on the European recommendation of strong cryptographic primitives, NESSIE, evaluated Camellia to have "many similarities to the AES, so much of the analysis for the AES is also applicable to Camellia." Currently, Camellia is the only cipher internationally recognized which has the same level of security and performance as AES, and is selected for many international standard/recommended ciphers. In particular, as Japanese domestic ciphers, this is the first case to be approved as IETF standard ciphers (Proposed Standard RFC) .
Crypt::Camellia has the following methods:
Like many Crypt:: modules like Crypt::Blowfish and Crypt::DES, this module works as a backend of Crypt::CBC.
Returns the size (in bytes) of the block cipher. Currently this is a fixed value of 16.
my $cipher = Crypt::Camellia-E<gt>new($key);
This creates a new Crypt::Camellia BlockCipher object, using $key, where $key is a key of keysize() bytes (minimum of eight bytes).
my $ciphertext = $cipher-E<gt>encrypt($plaintext);
This function encrypts $plaintext and returns the $ciphertext where $plaintext and $ciphertext must be of blocksize() bytes. (hint: Camellia is an 16 byte block cipher)
my $plaintext = $cipher-E<gt>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 = Crypt::Camellia->new($key);
my $ciphertext = $cipher->encrypt("plaintex");# SEE NOTES
print unpack("H16", $ciphertext), "\n";
For practical uses use this module via Crypt::CBC rather than directly.
Crypt::CBC, Crypt::Rijndael, Crypt::DES, Crypt::IDEA
Dan Kogai, <firstname.lastname@example.org>
Current maintainer is Hiroyuki OYAMA <email@example.com>.
Copyright (C) 2006 by Dan Kogai
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.
Except for anything under camellia/ directory which is licensed as follows:
Copyright (c) 2006
NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer as
the first lines of this file unmodified.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY NTT ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL NTT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
To install Crypt::Camellia, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.