- SEE ALSO
- REQUESTS AND BUGS
- COPYRIGHT AND LICENSE
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);
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.
$scrypt = Crypt::Scrypt->new( key => $key, max_mem => $bytes, max_mem_frac => $fraction, max_time => $seconds );
The key used to encrypt the plaintext. This parameter is required.
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.
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.
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.
REQUESTS AND BUGS
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.
You can also look for information at:
GitHub Source Repository
AnnoCPAN: Annotated CPAN documentation
RT: CPAN's request tracker
COPYRIGHT AND LICENSE
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>