# man > Crypt::Cipher::Camellia(3pm)

---
type: CommandReference
command: Crypt::Cipher::Camellia
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference
- `use Crypt::Mode::CBC; my $cbc = Crypt::Mode::CBC->new('Camellia'); $ciphertext = $cbc->encrypt("data", $key, $iv);` — Encrypt using CBC mode (fast)
- `use Crypt::CBC; use Crypt::Cipher::Camellia; my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Camellia', -key=>$key, -iv=>$iv ); $ciphertext = $cbc->encrypt("data");` — Encrypt via Crypt::CBC (slower but flexible)
- `my $c = Crypt::Cipher::Camellia->new($key);` — Create cipher object for key lengths 128/192/256 bits
- `$ciphertext = $c->encrypt($plaintext);` — Encrypt a single 16-byte block
- `$plaintext = $c->decrypt($ciphertext);` — Decrypt a single block
- `$c->keysize();` — Get current key size in bytes (16, 24, or 32)
- `$c->blocksize();` — Block size (always 16 bytes)
- `$c->default_rounds();` — Default number of rounds (18 for 128-bit keys, 24 for 192/256-bit keys)

## Name
Symmetric cipher Camellia, key sizes: 128/192/256 bits

## Synopsis
perl
### Fast: use Crypt::Mode::CBC
use Crypt::Mode::CBC;

my $key = '...';   # 16, 24, or 32 bytes
my $iv  = '...';   # 16 bytes
my $cbc = Crypt::Mode::CBC->new('Camellia');
my $ciphertext = $cbc->encrypt("secret data", $key, $iv);
perl
### Slower: use Crypt::CBC
use Crypt::CBC;
use Crypt::Cipher::Camellia;

my $cbc = Crypt::CBC->new(
    -cipher => 'Cipher::Camellia',
    -key    => $key,
    -iv     => $iv
);
my $ciphertext = $cbc->encrypt("secret data");
## Methods
- `new($key)` — Create cipher object with given key (16, 24, or 32 bytes); optional second argument `$rounds`
- `encrypt($plaintext)` — Encrypt a single 16-byte block
- `decrypt($ciphertext)` — Decrypt a single 16-byte block
- `keysize()` — Return key size in bytes; can be called as instance or class method (`Crypt::Cipher::Camellia->keysize` or `Crypt::Cipher::Camellia::keysize`)
- `blocksize()` — Return block size (always 16); class-method variants also available
- `max_keysize()` — Return maximum key size in bytes (32)
- `min_keysize()` — Return minimum key size in bytes (16)
- `default_rounds()` — Return default number of rounds (18 for 128-bit keys, 24 for 192/256-bit keys)

## Examples
Basic one-block encryption and decryption:
perl
use Crypt::Cipher::Camellia;
my $key = "1234567890123456";  # 16 bytes (128 bits)
my $cipher = Crypt::Cipher::Camellia->new($key);
my $ciphertext = $cipher->encrypt("data block 16byt");
my $plaintext  = $cipher->decrypt($ciphertext);
Encrypt arbitrary-length data using CBC mode:
perl
use Crypt::Mode::CBC;
my $cbc = Crypt::Mode::CBC->new('Camellia');
my $ciphertext = $cbc->encrypt("any length data", $key, $iv);
my $decrypted = $cbc->decrypt($ciphertext, $key, $iv);
## See Also
- [CryptX](http://localhost/phpMan.php/perldoc/CryptX)
- [Crypt::Cipher](http://localhost/phpMan.php/perldoc/Crypt%3A%3ACipher)
- [Crypt::Mode::CBC](http://localhost/phpMan.php/perldoc/Crypt%3A%3AMode%3A%3ACBC)
- [Crypt::Mode::CTR](http://localhost/phpMan.php/perldoc/Crypt%3A%3AMode%3A%3ACTR)
- [Crypt::CBC](http://localhost/phpMan.php/perldoc/Crypt%3A%3ACBC)
- [Camellia cipher on Wikipedia](https://en.wikipedia.org/wiki/Camellia_(cipher))