Crypt::Sodium - Perl bindings for libsodium https://github.com/jedisct1/libsodium |
Crypt::Sodium - Perl bindings for libsodium (NaCL) https://github.com/jedisct1/libsodium
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);
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.
box_keypair()
Usage: my ($public_key, $secret_key) = box_keypair();
sign_keypair()
Usage: my ($public_key, $secret_key) = sign_keypair();
Usage: my $signed_message = crypto_sign($m, $sk);
Usage: my $message = crypto_sign_open($sm, $pk);
Usage: my $ciphertext = crypto_box($m, $n, $pk, $sk); Note: $nonce must be at least crypto_box_NONCEBYTES long.
Usage: my $cleartext = crypto_box_open($c, $n, $pk, $sk);
Usage: my $ciphertext = crypto_secretbox($m, $n, $k); Note: $nonce must be at least crypto_box_NONCEBYTES long, $key must be at least crypto_box_SECRETKEYBYTES long.
Usage: my $message = crypto_secretbox($c, $n, $k);
crypto_hash($to_hash)
Usage: my $hash = crypto_hash($to_hash);
Usage: my $stream = crypto_stream($length, $nonce, $key); Note: $nonce must be at least crypto_stream_NONCEBYTES long, $key must be at least crypto_stream_KEYBYTES long.
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, $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();
crypto_pwhash_salt()
Usage: my $salt = crypto_pwhash_salt();
Usage: my $derivedkey = crypto_pwhash_scrypt($password, $salt, $keylen, $opslimit, $memlimit); Note: $salt must be crypto_pwhash_SALTBYTES long, use crypto_pwhash_salt() to generate $keylen maybe omitted, the default is crypto_box_SEEDBYTES $opslimit maybe omitted, the default is crypto_pwhash_OPSLIMIT $memlimit maybe omitted, the default is crypto_pwhash_MEMLIMIT See L<http://doc.libsodium.org/password_hashing/README.html> for details>.
crypto_stream_KEYBYTES crypto_stream_NONCEBYTES crypto_box_NONCEBYTES crypto_box_PUBLICKEYBYTES crypto_box_SECRETKEYBYTES crypto_box_MACBYTES crypto_box_SEEDBYTES crypto_secretbox_MACBYTES crypto_sign_PUBLICKEYBYTES crypto_sign_SECRETKEYBYTES crypto_pwhash_SALTBYTES crypto_pwhash_OPSLIMIT crypto_pwhash_MEMLIMIT crypto_pwhash_STRBYTES
https://github.com/jedisct1/libsodium http://nacl.cr.yp.to/
libsodium 1.0.0 or higher
Michael Gregorowicz, <mike@mg2.org>
Copyright (C) 2015 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.
Crypt::Sodium - Perl bindings for libsodium https://github.com/jedisct1/libsodium |