RESOLUTION
This is a piece of code for checking passwords using HSPC API:
#!/usr/bin/perl
## initialize environment in console script
use HSPC::Console;
## get authentication module
my $auth_module = $ENV{security_obj}->{_auth_obj};
## check password
my $err = $auth_module->check_pwd(email=>'john@smith.com',pwd=>'123');
## reset password if check failed
if($err) {
print "Got error - $err, reseting password\n";
$auth_module->change_pwd(email=>'john@smith.com',pwd=>'123');
} Please, note that check_pwd method returns undef if email/password pair is valid.
If you need to create a new person, please, check HSPC integration guide.
The code snipped that does a 'real work':
sub _digest{
my $hmac = Digest::HMAC_SHA1->new($CONFIG);
$hmac->add($_[0]);
my $res = $hmac->b64digest;
$res =~ s/\+/_/g;
print "Hashing $_[0] -> $res" if $_[1];
return $res;
} $CONFIG /etc/hspc/hspc.conf perhaps it is more suitable for you - you can write something similar in different language or for example can encrypt passwords somewhere else and authenticate against a remote mysql database (HSPC) - but it is not recommended, there's no guarantee that encryption format won't be changed (I myself hope it will and 'regular' crypt() will be used with md5 or blowfish hash).