Crypt-Present

 view release on metacpan or  search on metacpan

t/Crypt-Present.t  view on Meta::CPAN

              { KEY => ("\xFF" x 16), PLAIN => ("\x00" x 8), CRYPT => pack('H*','13238c710272a5d8') },
              { KEY => ("\xFF" x 16), PLAIN => ("\xFF" x 8), CRYPT => pack('H*','628d9fbd4218e5b4') },
            );
for my $known ( @known ) {
  my $cipher = new Crypt::Present( $known->{KEY} );
  my $plaintext  = $known->{PLAIN};
  my $crypttext  = $cipher->encrypt( $plaintext );
  my $plaintext2 = $cipher->decrypt( $crypttext );
  my $KEY_Hex   = unpack('H*',$known->{KEY});
  my $PLAIN_Hex = unpack('H*',$plaintext);
  my $CRYPT_Hex = unpack('H*',$known->{CRYPT});
  ok $plaintext eq $plaintext2, "KEY $KEY_Hex: decrypt( encrypt( $PLAIN_Hex} ) ) is ".unpack('H*',$plaintext2);
  ok $known->{CRYPT} eq $crypttext, "KEY $KEY_Hex: $PLAIN_Hex should -> $CRYPT_Hex and not ".unpack('H*',$crypttext);
}


#done_testing( 16 );

1;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.263 second using v1.00-cache-2.02-grep-82fe00e-cpan-48ebf85a1963 )