use Crypt::SaltedHash; use MIME::Base64 qw(decode_base64); my $password = "password"; my $crypt=Crypt::SaltedHash->new(algorithm=>'SHA-512', salt_len => 32, salt => decode_base64("ZD1qsc8PwUXqP9GihP+NHvWQ+FXap4Td0KWCMp8yrDQ=")); $crypt->add($password); my $shash=$crypt->generate(); my $salt=$crypt->salt_hex(); print "Salt= $salt\n"; # to show that it is using the right salt print "hex encoded = " . unpack('H*',substr($shash,9)) . "\n"; # the substr is required as generate prepends {SSHA512}