NAME

Digest::PSHA - Perl implementation of P_SHA-1 and P_SHA256 digests (pseudorandom functions) described in RFC 4346 and RFC 5246.

SYNOPSIS

use Digest::PSHA qw / p_sha1 p_sha256 /;

my $secret = ' 55 aa eb f9 51 b3 ed ef 84 c6 02 c5 f1 72 c1 aa ';
my $salt   = ' 13 e6 db 5d c1 23 5c f6 4f 89 ce 70 41 0c 52 8d ';

$_ = $secret;
s/\s//g;
my $secret_bin = pack ("H*" , $_ );

$_ = $salt;
s/\s//g;
my $salt_bin = pack ("H*" , $_ );


# Get 128 bit key
my $key1 = p_sha1 ($secret_bin, $salt_bin, 128, 0);

# Get 256 bit key
$secret_bin .= $secret_bin;
$salt_bin .= $salt_bin; 
my $key2 = p_sha256 ($secret_bin, $salt_bin, 256, 0);

DESCRIPTION

Digest::PSHA - Perl implementation of P_SHA-1 and P_SHA256 digests (pseudorandom functions) described in RFC 4346 and RFC 5246.

EXPORT

None by default.

SEE ALSO

RFC 4346, RFC 5246

AUTHOR

The Digest::PSHA module was written by Alexey Semenoff, swaj@swaj.net.

COPYRIGHT AND LICENSE

Copyright (c) 2014 by Alexey Semenoff [http://swaj.net].

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