CryptX

 view release on metacpan or  search on metacpan

lib/Crypt/Mode/CFB.pm  view on Meta::CPAN

"uninitialized value" warning.

   # in encrypt mode
   my $ciphertext = $m->add($plaintext);

   # in decrypt mode
   my $plaintext = $m->add($ciphertext);

=head2 finish

CFB is a streaming mode and does not use padding, so C<finish> returns an empty
string. It exists for API consistency with L<Crypt::Mode::CBC> and
L<Crypt::Mode::ECB> and may be safely called or omitted.

   $m->start_encrypt($key, $iv);
   my $ciphertext = '';
   $ciphertext .= $m->add($chunk1);
   $ciphertext .= $m->add($chunk2);
   $ciphertext .= $m->finish;   # returns ''

=head1 SEE ALSO

lib/Crypt/Mode/CTR.pm  view on Meta::CPAN

"uninitialized value" warning.

   # in encrypt mode
   my $ciphertext = $m->add($plaintext);

   # in decrypt mode
   my $plaintext = $m->add($ciphertext);

=head2 finish

CTR is a streaming mode and does not use padding, so C<finish> returns an empty
string. It exists for API consistency with L<Crypt::Mode::CBC> and
L<Crypt::Mode::ECB> and may be safely called or omitted.

   $m->start_encrypt($key, $iv);
   my $ciphertext = '';
   $ciphertext .= $m->add($chunk1);
   $ciphertext .= $m->add($chunk2);
   $ciphertext .= $m->finish;   # returns ''

=head1 SEE ALSO

lib/Crypt/Mode/OFB.pm  view on Meta::CPAN

"uninitialized value" warning.

   # in encrypt mode
   my $ciphertext = $m->add($plaintext);

   # in decrypt mode
   my $plaintext = $m->add($ciphertext);

=head2 finish

OFB is a streaming mode and does not use padding, so C<finish> returns an empty
string. It exists for API consistency with L<Crypt::Mode::CBC> and
L<Crypt::Mode::ECB> and may be safely called or omitted.

   $m->start_encrypt($key, $iv);
   my $ciphertext = '';
   $ciphertext .= $m->add($chunk1);
   $ciphertext .= $m->add($chunk2);
   $ciphertext .= $m->finish;   # returns ''

=head1 SEE ALSO

t/digest_kangarootwelve.t  view on Meta::CPAN

     '0d005a194085360217128cf17f91e1f71314efa5564539d444912e3437efa17f' .
     '82db6f6ffe76e781eaa068bce01f2bbf81eacb983d7230f2fb02834a21b1ddd0',
     'K12-256 ptn(1) input, no customization, 64 bytes');

  is(unpack('H*', Crypt::Digest::KangarooTwelve->new(256)->customization(ptn(1))->done(64)),
     '9280f5cc39b54a5a594ec63de0bb99371e4609d44bf845c2f5b8c316d72b1598' .
     '11f748f23e3fabbe5c3226ec96c62186df2d33e9df74c5069ceecbb4dd10eff6',
     'K12-256 empty input, ptn(1) customization, 64 bytes');
}

{ ### streaming done() and clone
  my $d1 = Crypt::Digest::KangarooTwelve->new(128);
  my $out1 = $d1->done(16) . $d1->done(16);
  my $out2 = Crypt::Digest::KangarooTwelve->new(128)->done(32);
  is($out1, $out2, 'K12-128 streaming done');

  my $d2 = Crypt::Digest::KangarooTwelve->new(128)->add(ptn(17));
  my $d3 = $d2->clone;
  is($d2->done(32), $d3->done(32), 'K12-128 clone');

  eval { $d2->add("x"); 1 };
  like($@, qr/^FATAL: cannot add after done; call reset first\b/, 'K12 add after done croaks');
  eval { $d3->customization("ctx"); 1 };
  like($@, qr/^FATAL: cannot add after done; call reset first\b/, 'K12 customization after done croaks');

t/digest_turboshake.t  view on Meta::CPAN

     '367a329dafea871c7802ec67f905ae13c57695dc2c6663c61035f59a18f8e7db' .
     '11edc0e12e91ea60eb6b32df06dd7f002fbafabb6e13ec1cc20d995547600db0',
     'TS256 empty 64');

  is(unpack('H*', Crypt::Digest::TurboSHAKE->new(256)->add(ptn(1))->done(64)),
     '3e1712f928f8eaf1054632b2aa0a246ed8b0c378728f60bc970410155c28820e' .
     '90cc90d8a3006aa2372c5c5ea176b0682bf22bae7467ac94f74d43d39b0482e2',
     'TS256 ptn(1) 64');
}

{ ### streaming done() and clone
  my $d1 = Crypt::Digest::TurboSHAKE->new(128);
  my $out1 = $d1->done(16) . $d1->done(16);
  my $out2 = Crypt::Digest::TurboSHAKE->new(128)->done(32);
  is($out1, $out2, 'TS128 streaming done');

  my $d2 = Crypt::Digest::TurboSHAKE->new(128)->add(ptn(17));
  my $d3 = $d2->clone;
  is($d2->done(32), $d3->done(32), 'TS128 clone');

  my $d4 = Crypt::Digest::TurboSHAKE->new(128)->add(ptn(17));
  $d4->reset;
  is(unpack('H*', $d4->done(32)),
     '1e415f1c5983aff2169217277d17bb538cd945a397ddec541f1ce41af2c1b74c',
     'TS128 reset');



( run in 1.033 second using v1.01-cache-2.11-cpan-140bd7fdf52 )