Crypt::Camellia_PP - Pure Perl Camellia 128-bit block cipher module.


Crypt-Camellia_PP documentation  | view source Contained in the Crypt-Camellia_PP distribution.

Index


NAME

Top

Crypt::Camellia_PP - Pure Perl Camellia 128-bit block cipher module.

SYNOPSIS

Top

  use Crypt::Camellia_PP;

  my $key = pack 'H*', '00000000000000000000000000000000'; 
  my $plain_text = pack 'H*', '00000000000000000000000000000000';
  my $c = Crypt::Camellia->new($key);
  my $cipher_text = $c->encrypt($plain_text);




DESCRIPTION

Top

this module implements the Camellia cipher by Pure Perl.

Methods

new($key)

Create a new "Crypt::Camellia_PP" cipher object with the given key (which must be 128 or 192 or 256 bit long).

encrypt($data)

Encrypt data. The size of $data must be a 16 bytes.

decrypt($data)

Decrypts $data.

EXAMPLE

Top

Encrypt and Decrypt

  use Crypt::Camellia_PP;

  my $key = pack 'H*', '00112233445566778899AABBCCDDEEFF';
  my $src = pack 'H*', 'FFEEDDCCBBAA99887766554433221100';
  my $camellia = Crypt::Camellia_PP->new($key);
  my $cipher_string = $camellia->encrypt($src);

  my $plain_string = $camellia->decrypt($cipher_string);
  $plain_string eq $src;

With Crypt::CBC module

  use Crypt::CBC;

  my $cbc = Crypt::CBC->new({
      cipher => 'Crypt::Camellia_PP',
      key => pack('H*', '00112233445566778899aabbccddeeff'),
      iv  => pack('H*', '00000000000000000000000000000000'),
      literal_key => 1,
      header => 'none',
      padding => 'standard',
  });
  my $cipher_text = $cbc->encrypt('Hello World!');
  my $plain_text = $cbc->decrypt($cipher_text);
  $plain_text eq 'Hello World!';

SEE ALSO

Top

Crypt::Camellia, http://search.cpan.org/dist/Crypt-Camellia/, http://info.isl.ntt.co.jp/crypt/camellia/

AUTHOR

Top

Hiroyuki OYAMA <oyama@module.jp>

COPYRIGHT AND LICENSE

Top


Crypt-Camellia_PP documentation  | view source Contained in the Crypt-Camellia_PP distribution.