++ed by:
PRAVUS
Author image Michael Gregorowicz

NAME

Crypt::Sodium - Perl bindings for libsodium (NaCL) https://github.com/jedisct1/libsodium

SYNOPSIS

  use Crypt::Sodium;

  my $k = crypto_stream_key();
  my $n = crypto_stream_nonce();

  my $ciphertext = crypto_stream_xor("Hello World!", $n, $k);
  my $cleartext = crypto_stream_xor($ciphertext, $n, $k);

DESCRIPTION

  Simple wrapper around NaCL functions as provided by libsodium.  crypto_box, crypto_stream, crypto_hash,
  and crypto_sign are all present and accounted for.  None of the specific implementations are exposed, 
  only the default implementations are.

  I'm releasing this, though I don't feel I have any business writing a Crypt:: namespace'd module.  SO, 
  if you use it, please use it with caution, and supply me with patches when you notice any security holes.  I
  will do my best to apply them and release new versions promptly.

EXPORT

 box_keypair()
   Usage: my ($public_key, $secret_key) = box_keypair();

 sign_keypair()
   Usage: my ($public_key, $secret_key) = sign_keypair();

 crypto_sign($message, $secret_key)
   Usage: my $signed_message = crypto_sign($m, $sk);

 crypto_sign_open($signed_message, $public_key)
   Usage: my $message = crypto_sign_open($sm, $pk);

 crypto_box($message, $nonce, $public_key, $secret_key)
   Usage: my $ciphertext = crypto_box($m, $n, $pk, $sk);
   Note: $nonce must be at least crypto_box_NONCEBYTES long.

 crypto_box_open($ciphertext, $nonce, $public_key, $secret_key)
   Usage: my $cleartext = crypto_box_open($c, $n, $pk, $sk);

 crypto_hash($to_hash)
   Usage: my $hash = crypto_hash($to_hash);

 crypto_stream($length, $nonce, $key)
   Usage: my $stream = crypto_stream($length, $nonce, $key);
   Note: $nonce must be at least crypto_stream_NONCEBYTES long, and $key must be at least crypto_stream_KEYBYTES long.

 crypto_stream_xor($message, $nonce, $key)
   Usage: my $ciphertext = crypto_stream_xor($message, $nonce, $key);
          my $cleartext = crypto_stream_xor($ciphertext, $nonce, $key);

   Note: $nonce must be at least crypto_stream_NONCEBYTES long, and $key must be at least crypto_stream_KEYBYTES long.

 randombytes_buf($length)
   Usage: my $bytes = randombytes(24);

 crypto_box_nonce()
   Usage: my $nonce = crypto_box_nonce()

 crypto_stream_nonce()
   Usage: my $nonce = crypto_stream_nonce()

 crypto_stream_key()
   Usage: my $key = crypto_stream_key()

SEE ALSO

 https://github.com/jedisct1/libsodium
 http://nacl.cr.yp.to/

AUTHOR

Michael Gregorowicz, <mike@mg2.org>

COPYRIGHT AND LICENSE

Copyright (C) 2014 Michael Gregorowicz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18 or, at your option, any later version of Perl 5 you may have available.