Karel Miko > Crypt-ScryptKDF-0.008 > Crypt::ScryptKDF

Download:
Crypt-ScryptKDF-0.008.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.008   Source  

NAME ^

Crypt::ScryptKDF - Scrypt password based key derivation function

SYNOPSIS ^

 ###### creating raw scrypt-based derived key
 use Crypt::ScryptKDF qw(scrypt_raw scrypt_hex scrypt_b64);
 my $binary_buffer = scrypt_raw($password, $salt, $N, $r, $p, $len);
 my $hexadecimal_string = scrypt_hex($password, $salt, $N, $r, $p, $len);
 my $base64_string = scrypt_b64($password, $salt, $N, $r, $p, $len);

 #or
 $key_binary = scrypt_raw($password);
 $key_binary = scrypt_raw($password, $salt);
 $key_binary = scrypt_raw($password, $N, $r, $p, $len);

 #the same applies for
 $key_hex = scrypt_hex($password);
 $key_hex = scrypt_hex($password, $salt);
 $key_hex = scrypt_hex($password, $N, $r, $p, $len);
 $key_base64 = scrypt_b64($password);
 $key_base64 = scrypt_b64($password, $salt);
 $key_base64 = scrypt_b64($password, $N, $r, $p, $len);

 ###### creating / verifying scrypt-based password hash
 use Crypt::ScryptKDF qw(scrypt_hash scrypt_hash_verify random_bytes);

 my $hash = scrypt_hash("secret password");
 # .. later
 die "Invalid password" unless scrypt_hash_verify("secret password", $hash);

 #or by specifying Scrypt parameters
 my $salt = random_bytes(32);
 my $hash = scrypt_hash($password, $salt, $N, $r, $p, $len);
 my $hash = scrypt_hash($password, $N, $r, $p, $len);
 my $hash = scrypt_hash($password, $salt);

DESCRIPTION ^

Scrypt is a password-based key derivation function (like for example PBKDF2). Scrypt was designed to be "memory-hard" algorithm in order to make it expensive to perform large scale custom hardware attacks.

It can be used for:

More details about Scrypt: http://www.tarsnap.com/scrypt/scrypt.pdf and https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-00

IMPORTANT: This module needs a cryptographically strong random number generator. It tries to use one of the following:

FUNCTIONS ^

LICENSE ^

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

COPYRIGHT ^

Copyright (c) 2013 DCIT, a.s. http://www.dcit.cz / Karel Miko

syntax highlighting: