NAME
Crypt::Mode::ECB - Block cipher mode ECB [Electronic codebook]
SYNOPSIS
my $m = Crypt::Mode::ECB->new( 'AES' );
my $ciphertext = $m ->encrypt( $plaintext , $key );
my $plaintext = $m ->decrypt( $ciphertext , $key );
$m ->start_encrypt( $key );
my $ciphertext = $m ->add( 'some data' );
$ciphertext .= $m ->add( 'more data' );
$ciphertext .= $m ->finish;
$m ->start_decrypt( $key );
my $plaintext = $m ->add( $some_ciphertext );
$plaintext .= $m ->add( $more_ciphertext );
$plaintext .= $m ->finish;
|
DESCRIPTION
This module implements ECB cipher mode. NOTE: it works only with ciphers from CryptX (Crypt::Cipher::NNNN). BEWARE: ECB is inherently insecure, if you are not sure go for Crypt::Mode::CBC!
METHODS
new
my $m = Crypt::Mode::ECB->new( $name );
my $m = Crypt::Mode::ECB->new( $name , $padding );
my $m = Crypt::Mode::ECB->new( $name , $padding , $cipher_rounds );
|
encrypt
my $ciphertext = $m ->encrypt( $plaintext , $key );
|
decrypt
my $plaintext = $m ->decrypt( $ciphertext , $key );
|
start_encrypt
start_decrypt
add
my $plaintext = $m ->add( $ciphertext );
my $ciphertext = $m ->add( $plaintext );
|
finish
$m ->start_encrypt( $key );
my $ciphertext = '' ;
$ciphertext .= $m ->add( 'some data' );
$ciphertext .= $m ->add( 'more data' );
$ciphertext .= $m ->finish;
$m ->start_decrypt( $key );
my $plaintext = '' ;
$plaintext .= $m ->add( $some_ciphertext );
$plaintext .= $m ->add( $more_ciphertext );
$plaintext .= $m ->finish;
|
SEE ALSO