Crypt-Sodium-XS
view release on metacpan or search on metacpan
lib/Crypt/Sodium/XS/Base64.pm view on Meta::CPAN
L</FUNCTIONS>. The tag C<:all> imports everything.
=head2 sodium_base642bin
my $bytes = sodium_base642bin($string);
No real advantage over L<MIME::Base64>. Stops parsing at any invalid base64
bytes. C<$bytes> will be empty if C<$string> could not be validly interpreted
as base64 (i.e., if the output would not be a multiple of 8 bits).
Returns the base64 decoded bytes.
=head2 sodium_bin2base64
my $string = sodium_bin2base64($bytes);
my $string = sodium_bin2base64($bytes, $variant);
C<$variant> is optional. See L</BASE64 CONSTANTS>. If not provided, the default
is L</BASE64_VARIANT_URLSAFE_NO_PADDING>.
Returns the base64 encoded string.
lib/Crypt/Sodium/XS/MemVault.pm view on Meta::CPAN
=head2 new_from_hex
my $mv = Crypt::Sodium::XS::MemVault->new_from_hex($hex_string, $flags);
C<$hex_string> is an arbitrary length string. Decoding of C<$hex_string> will
stop at the first non-hex character.
C<$flags> is optional. If not provided, the default is
L<Crypt::Sodium::XS::ProtMem/protmem_flags_memvault_default>.
Returns a L<Crypt::Sodium::XS::MemVault>: the decoded content of
C<$hex_string>.
=head2 new_from_base64
my $mv
= Crypt::Sodium::XS::MemVault->new_from_base64($base64, $variant, $flags);
C<$base64> is an arbitrary length string. Decoding of C<$base64> will stop at
the first non-base64 character.
C<$variant> is optional. If not provided, the default is
L<Crypt::Sodium::XS::Base64/BASE64_VARIANT_URLSAFE_NO_PADDING>. See
L<Crypt::Sodium::XS::Base64/CONSTANTS>.
C<$flags> is optional. If not provided, the default is
L<Crypt::Sodium::XS::ProtMem/protmem_flags_memvault_default>.
Returns a L<Crypt::Sodium::XS::MemVault>: the decoded content of C<$base64>.
=head2 new_from_file
my $mv = Crypt::Sodium::XS::MemVault->new_from_file($path, $size, $flags);
C<$path> is a filesystem path.
C<$size> is optional. It is the B<maximum> number of bytes to read from C<$fd>.
If not provided or it numifies to 0, C<$fd> will be read until end-of-file.
lib/Crypt/Sodium/XS/OO/secretstream.pm view on Meta::CPAN
=item L</TAG_FINAL>
Indicates that the message marks the end of the stream, and erases the secret
key used to encrypt the previous sequence.
=item L</TAG_PUSH>
Indicates that the message marks the end of a set of messages, but not the end
of the stream. For example, a huge JSON string sent as multiple chunks can use
this tag to indicate to the application that the string is complete and that it
can be decoded. But the stream itself is not closed, and more data may follow.
=item L</TAG_REKEY>
âForgetâ the key used to encrypt this message and the previous ones, and derive
a new secret key.
=back
A typical encrypted stream simply attaches 0 as a tag to all messages, except
the last one which is tagged as TAG_FINAL.
lib/Crypt/Sodium/XS/secretstream.pm view on Meta::CPAN
=item L</secretstream_xchacha20poly1305_TAG_FINAL>
Indicates that the message marks the end of the stream, and erases the secret
key used to encrypt the previous sequence.
=item L</secretstream_xchacha20poly1305_TAG_PUSH>
Indicates that the message marks the end of a set of messages, but not the end
of the stream. For example, a huge JSON string sent as multiple chunks can use
this tag to indicate to the application that the string is complete and that it
can be decoded. But the stream itself is not closed, and more data may follow.
=item L</secretstream_xchacha20poly1305_TAG_REKEY>
âForgetâ the key used to encrypt this message and the previous ones, and derive
a new secret key.
=back
A typical encrypted stream simply attaches 0 as a tag to all messages, except
the last one which is tagged as TAG_FINAL.
( run in 1.423 second using v1.01-cache-2.11-cpan-211d0254c34 )