Crypt::Scrypt - Perl interface to the scrypt key derivation function
use Crypt::Scrypt; my $scrypt = Crypt::Scrypt->new( key => $key, max_mem => $bytes, max_mem_frac => $fraction, max_time => $seconds ); my $ciphertext = $scrypt->encrypt($plaintext); my $plaintext = $scrypt->decrypt($ciphertext); # or using class methods: my $ciphertext = Crypt::Scrypt->encrypt($plaintext, key => $key, %args); my $plaintext = Crypt::Scrypt->decrypt($ciphertext, key => $key, %args);
The Crypt::Scrypt module provides an interface to the scrypt key derivation function. It is designed to be far more secure against hardware brute-force attacks than alternative functions such as PBKDF2 or bcrypt.
Crypt::Scrypt
$scrypt = Crypt::Scrypt->new( key => $key, max_mem => $bytes, max_mem_frac => $fraction, max_time => $seconds );
key
The key used to encrypt the plaintext. This parameter is required.
max_mem
The maximum number of bytes of memory to use for computation. If set to 0, no maximum will be enforced; any other value less than 1 MiB will be treated as 1 MiB.
Defaults to 0.
max_mem_frac
The maximum fraction of available memory to use for computation. If this value is set to 0 or more than 0.5 it will be treated as 0.5; this value will never cause a limit of less than 1 MiB to be enforced.
Defaults to 0.125.
max_time
The maximum number of seconds of CPU time for computation.
Defaults to 5 seconds.
When encrypting, the key strength is maximized subject to the specified limits; when decrypting, an error is returned if decrypting the data is not possible within the specified limits.
$ciphertext = $scrypt->encrypt($plaintext, %args)
Encrypts the plaintext and returns the ciphertext. The plaintext can be either a scalar or scalar reference. Additional named arguments can override any value provided to the constructor. Croaks on failure.
$plaintext = $scrypt->decrypt($ciphertext, %args)
Decrypts the ciphertext and and returns the plaintext. The ciphertext can be either a scalar or scalar reference. Additional named arguments can override any value provided to the constructor. Croaks on failure.
http://www.tarsnap.com/scrypt.html
http://git.chromium.org/gitweb/?p=chromiumos/third_party/libscrypt.git;a=tree
Please report any bugs or feature requests to http://rt.cpan.org/Public/Bug/Report.html?Queue=Crypt-Scrypt. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Crypt::Scrypt
You can also look for information at:
GitHub Source Repository
http://github.com/gray/crypt-scrypt
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Crypt-Scrypt
CPAN Ratings
http://cpanratings.perl.org/d/Crypt-Scrypt
RT: CPAN's request tracker
http://rt.cpan.org/Public/Dist/Display.html?Name=Crypt-Scrypt
Search CPAN
http://search.cpan.org/dist/Crypt-Scrypt/
Copyright (C) 2011 gray <gray at cpan.org>, all rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
gray, <gray at cpan.org>
To install Crypt::Scrypt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Crypt::Scrypt
CPAN shell
perl -MCPAN -e shell install Crypt::Scrypt
For more information on module installation, please visit the detailed CPAN module installation guide.