Crypt-NaCl-Sodium

 view release on metacpan or  search on metacpan

lib/Crypt/NaCl/Sodium/auth.pod  view on Meta::CPAN

    unless ( $crypto_auth->verify( $mac, $msg, $key ) ) {
        die "Impostor alert!";
    }

Verifies the integrity and authenticity of the C<$msg> using given C<$mac> and C<$key>.

Method returns true if message has been verified, false otherwise.

=head1 ADVANCED USAGE

Single pass and streaming API keyed message authentication using I<HMAC-SHA-256>,
I<HMAC-SHA-512> and I<HMAC-SHA-512/256> are described below.

=head2 HMAC-SHA-256

=head3 hmacsha256_keygen

    my $key256 = $crypto_auth->hmacsha256_keygen();

Helper method to generate a random key to be used by C<$crypto_auth>.

lib/Crypt/NaCl/Sodium/hash.pod  view on Meta::CPAN

    }

=head1 DESCRIPTION

The I<SHA-256> and I<SHA-512> functions are provided for interoperability with
other applications.

These functions are not keyed and are thus deterministic. In
addition, they are vulnerable to length extension attacks.

A message can be hashed in a single pass, but a streaming API is
also available to process a message as a sequence of
multiple chunks.

If you are looking for a generic hash function and not specifically
I<SHA-2>, using L<Crypt::NaCl::Sodium::generichash> might be a
better choice.

=head1 METHODS

=head2 sha256



( run in 0.235 second using v1.01-cache-2.11-cpan-4d50c553e7e )