Crypt-Camellia

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

Changes
MANIFEST
Makefile.PL
README
camellia-GPL-1.2.0/COPYING
camellia-GPL-1.2.0/README
camellia-GPL-1.2.0/camellia.c
camellia-GPL-1.2.0/camellia.h
lib/Crypt/Camellia.pm
t/00-basic.t
t/01-CBC.t
t/02-test-vectors-simple.t
t/03-test-vectors-full.t
META.yml                                 Module meta-data (added by MakeMaker)

README  view on Meta::CPAN

NAME
    Crypt::Camellia - Perl Camellia encryption module

SYNOPSIS
      use Crypt::Camellia;
      my $cipher     = Crypt::Camellia->new($key); 
      my $ciphertext = $cipher->encrypt($plaintext);
      my $plaintext  = $cipher->decrypt($ciphertext);

      # more likely
      use Crypt::CBC;
      $cipher = Crypt::CBC->new( -key    => 'my secret key',
                                 -cipher => 'Camellia'
                                );

DESCRIPTION
    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

README  view on Meta::CPAN

      IETF standard ciphers (Proposed Standard RFC) .

    Crypt::Camellia has the following methods:

       blocksize()
       keysize()
       encrypt()
       decrypt()

    Like many Crypt:: modules like Crypt::Blowfish and Crypt::DES, this
    module works as a backend of Crypt::CBC.

FUNCTIONS
    blocksize
      Returns the size (in bytes) of the block cipher. Currently this is a
      fixed value of 16.

    new
        my $cipher = Crypt::Camellia->new($key);

      This creates a new Crypt::Camellia BlockCipher object, using $key,

README  view on Meta::CPAN

      $plaintext and $ciphertext must be of "blocksize()" bytes. (hint: see
      previous hint)

EXAMPLE
      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";

NOTES
    For practical uses use this module via Crypt::CBC rather than directly.

SEE ALSO
    Crypt::CBC, Crypt::Rijndael, Crypt::DES, Crypt::IDEA

AUTHOR
    Dan Kogai, <dankogai@dan.co.jp>

    Current maintainer is Hiroyuki OYAMA <oyama@module.jp>.

    And

    NTT <http://info.isl.ntt.co.jp/crypt/camellia/index.html>

lib/Crypt/Camellia.pm  view on Meta::CPAN

Crypt::Camellia - Perl Camellia encryption module

=head1 SYNOPSIS

  use Crypt::Camellia;
  my $cipher     = Crypt::Camellia->new($key); 
  my $ciphertext = $cipher->encrypt($plaintext);
  my $plaintext  = $cipher->decrypt($ciphertext);

  # more likely
  use Crypt::CBC;
  $cipher = Crypt::CBC->new( -key    => 'my secret key',
                             -cipher => 'Camellia'
                            );

=head1 DESCRIPTION

This module implements Camelia 128-bit Block Cipher for perl.
For Camellia.  Check L<https://info.isl.ntt.co.jp/crypt/eng/camellia/index_s.html>.  Here is an exerpt of that page.

=over 2

lib/Crypt/Camellia.pm  view on Meta::CPAN

=over 2

 blocksize()
 keysize()
 encrypt()
 decrypt()

=back

Like many Crypt:: modules like L<Crypt::Blowfish> and L<Crypt::DES>,
this module works as a backend of L<Crypt::CBC>.

=head1 FUNCTIONS

=over 2

=item blocksize

Returns the size (in bytes) of the block cipher.  Currently this is a
fixed value of 16.

lib/Crypt/Camellia.pm  view on Meta::CPAN


=head1 EXAMPLE

  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";

=head1 NOTES

For practical uses use this module via L<Crypt::CBC> rather than directly. 

=head1 SEE ALSO

L<Crypt::CBC>,
L<Crypt::Rijndael>,
L<Crypt::DES>,
L<Crypt::IDEA>

=head1 AUTHOR

Dan Kogai, E<lt>dankogai@dan.co.jpE<gt>

Current maintainer is Hiroyuki OYAMA E<lt>oyama@module.jpE<gt>.

t/01-CBC.t  view on Meta::CPAN

#!/usr/local/bin/perl
#
# $Id: 01-CBC.t,v 0.1 2006/07/21 06:50:53 oyama Exp oyama $
#
# Shamelessly Stolen from Crypt::CBC t/Blowfish.t -- dankogai
#

use lib '..','../blib/lib','.','./blib/lib';

eval "use Crypt::CBC";
if ($@) {
    print "1..0 # Skipped: Crypt::CBC not installed\n";
    exit;
}

print "1..33\n";

sub test {
    local($^W) = 0;
    my($num, $true,$msg) = @_;
    print($true ? "ok $num\n" : "not ok $num $msg\n");
}

$test_data = <<END;
Mary had a little lamb,
Its fleece was black as coal,
And everywere that Mary went,
That lamb would dig a hole.
END
    ;

eval "use Crypt::CBC";

test(1,!$@,"Couldn't load module");
if ($Crypt::CBC::VERSION <= 2.13) {
    $i = Crypt::CBC->new({key=>'secret', cipher=>'Camellia'});
}
else {
    $i = Crypt::CBC->new(-key=>'secret',-cipher=>'Camellia');

}
test(2,$i,"Couldn't create new object");
test(3,$c = $i->encrypt($test_data),"Couldn't encrypt");
test(4,$p = $i->decrypt($c),"Couldn't decrypt");
test(5,$p eq $test_data,"Decrypted ciphertext doesn't match plaintext");

# now try various truncations of the whole
for (my $c=1;$c<=7;$c++) {
  substr($test_data,-$c) = '';  # truncate



( run in 0.817 second using v1.01-cache-2.11-cpan-e1769b4cff6 )