Skip to content

Commit

Permalink
[perl] add SHA3 digest algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
mrash committed Oct 5, 2016
1 parent f5509bc commit d287d14
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions perl/FKO/lib/FKO_Constants.pl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
FKO_DIGEST_SHA256
FKO_DIGEST_SHA384
FKO_DIGEST_SHA512
FKO_DIGEST_SHA3_256
FKO_DIGEST_SHA3_512
);

# HMAC digest types tag list.
Expand All @@ -43,6 +45,8 @@
FKO_HMAC_SHA256
FKO_HMAC_SHA384
FKO_HMAC_SHA512
FKO_HMAC_SHA3_256
FKO_HMAC_SHA3_512
);

# Encryption types tag list.
Expand Down Expand Up @@ -233,6 +237,8 @@
FKO_DIGEST_SHA256 => 3,
FKO_DIGEST_SHA384 => 4,
FKO_DIGEST_SHA512 => 5,
FKO_DIGEST_SHA3_256 => 6,
FKO_DIGEST_SHA3_512 => 7,

# HMAC digest types
FKO_HMAC_INVALID_DATA => -1,
Expand All @@ -242,6 +248,8 @@
FKO_HMAC_SHA256 => 3,
FKO_HMAC_SHA384 => 4,
FKO_HMAC_SHA512 => 5,
FKO_HMAC_SHA3_256 => 6,
FKO_HMAC_SHA3_512 => 7,

# Encryption types
FKO_ENCRYPTION_INVALID_DATA => -1,
Expand Down
12 changes: 10 additions & 2 deletions perl/FKO/t/02_functions.t
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
use FKO;

use Test::More tests => 533;
use Test::More tests => 537;

# Test spa data support vars
#
Expand Down Expand Up @@ -151,8 +151,16 @@ $err = $f1->digest_type(FKO::FKO_DIGEST_MD5);
ok($err == FKO::FKO_SUCCESS, 'f1 set digest to md5');
is($f1->digest_type(), FKO::FKO_DIGEST_MD5, 'verify set digest md5');

$err = $f1->digest_type(FKO::FKO_DIGEST_SHA3_256);
ok($err == FKO::FKO_SUCCESS, 'f1 set digest to sha3_256');
is($f1->digest_type(), FKO::FKO_DIGEST_SHA3_256, 'verify set digest sha3_256');

$err = $f1->hmac_type(FKO::FKO_HMAC_SHA3_512);
ok($err == FKO::FKO_SUCCESS, 'f1 set HMAC digest to sha3_512');
is($f1->hmac_type(), FKO::FKO_HMAC_SHA3_512, 'verify set HMAC digest sha3_512');

$err = $f1->hmac_type($tsd_hmac_digest_type);
ok($err == FKO::FKO_SUCCESS, 'f1 set set HMAC digest to sha512');
ok($err == FKO::FKO_SUCCESS, 'f1 set HMAC digest to sha512');
is($f1->hmac_type(), $tsd_hmac_digest_type, 'verify set HMAC digest sha512');

my $tts = $f1->timestamp();
Expand Down

0 comments on commit d287d14

Please sign in to comment.