• Article for your preferred language does not exist. Below is international version of the article.

Article ID: 690, created on Oct 6, 2008, last review on May 9, 2014

  • Applies to:
  • Odin Business Automation Standard 3.2


This is a piece of code for checking passwords using HSPC API:

## 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";

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{PASSPORT_HMAC_KEY});
my $res = $hmac->b64digest;
$res =~ s/\+/_/g;
print "Hashing $_[0] -> $res" if $_[1];
return $res;

$CONFIG{PASSPORT_HMAC_KEY}is taken from/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).

4d44b3e6670a56b979b54b33675b2907 400e18f6ede9f8be5575a475d2d6b0a6 95c731ef6bb58e30865e046f2135d4c1 caea8340e2d186a540518d08602aa065

Email subscription for changes to this article
Save as PDF