summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgregor herrmann <gregoa@debian.org>2024-03-09 14:42:04 +0100
committergregor herrmann <gregoa@debian.org>2024-03-09 14:42:04 +0100
commit91f09c2454e2af96a85ccd3c21779f2b4a75f8b7 (patch)
tree2cf3bcc5a543205a1809b796a3f031a7d90df329
parent65d836031b85eec6909b6d7c7f2c43703d7e6dbb (diff)
parent517328950b3f92afacc6cd3927c23b1ece61b2e4 (diff)
Update upstream source from tag 'upstream/1.7'
Update to upstream version '1.7' with Debian dir 8bfc96f781768e429c533d385d81ade41e389ee8
-rw-r--r--Changes3
-rw-r--r--META.json2
-rw-r--r--META.yml2
-rw-r--r--README2
-rw-r--r--README.pod2
-rw-r--r--lib/Pass/OTP.pm4
-rw-r--r--lib/Pass/OTP/URI.pm2
-rw-r--r--t/totp-test-vectors.t6
8 files changed, 14 insertions, 9 deletions
diff --git a/Changes b/Changes
index 8415131..974edd2 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+1.7 2024/03/02
+- fix algorithm case matching
+
1.6 2023/09/13
- fix SHA384 and SHA512 blocksize (#1)
diff --git a/META.json b/META.json
index b81717d..7af1ab1 100644
--- a/META.json
+++ b/META.json
@@ -46,6 +46,6 @@
}
},
"release_status" : "stable",
- "version" : "1.6",
+ "version" : "1.7",
"x_serialization_backend" : "JSON::PP version 4.16"
}
diff --git a/META.yml b/META.yml
index 21b698a..118c9bd 100644
--- a/META.yml
+++ b/META.yml
@@ -24,5 +24,5 @@ requires:
Digest::SHA: '0'
Math::BigInt: '1.999806'
perl: '5.014'
-version: '1.6'
+version: '1.7'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff --git a/README b/README
index 97fa84b..98d204d 100644
--- a/README
+++ b/README
@@ -50,7 +50,7 @@ SEE ALSO
<https://github.com/google/google-authenticator/wiki/Key-Uri-Format>
COPYRIGHT AND LICENSE
- Copyright (C) 2020 Jan Baier
+ Copyright (C) 2024 Jan Baier
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
diff --git a/README.pod b/README.pod
index afbe6f9..e7a7107 100644
--- a/README.pod
+++ b/README.pod
@@ -65,7 +65,7 @@ L<https://github.com/google/google-authenticator/wiki/Key-Uri-Format>
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2020 Jan Baier
+Copyright (C) 2024 Jan Baier
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
diff --git a/lib/Pass/OTP.pm b/lib/Pass/OTP.pm
index 7a2d888..6f921a4 100644
--- a/lib/Pass/OTP.pm
+++ b/lib/Pass/OTP.pm
@@ -29,7 +29,7 @@ require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(otp hotp totp);
-our $VERSION = '1.6';
+our $VERSION = '1.7';
=head1 DESCRIPTION
@@ -73,7 +73,7 @@ sub hotp {
my ($hex) = $C->as_hex =~ /^0x(.*)/;
$hex = "0" x (16 - length($hex)) . $hex;
- my ($algorithm) = $options{algorithm} =~ /sha(\d+)/;
+ my ($algorithm) = $options{algorithm} =~ /sha(\d+)/i;
my $digest = Digest::SHA->new($algorithm);
my $hmac = Digest::HMAC->new(
$options{base32} ? decode_base32($options{secret} =~ s/ //gr) : pack('H*', $options{secret}),
diff --git a/lib/Pass/OTP/URI.pm b/lib/Pass/OTP/URI.pm
index 25f6002..1c762bc 100644
--- a/lib/Pass/OTP/URI.pm
+++ b/lib/Pass/OTP/URI.pm
@@ -57,7 +57,7 @@ L<https://github.com/google/google-authenticator/wiki/Key-Uri-Format>
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2020 Jan Baier
+Copyright (C) 2024 Jan Baier
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
diff --git a/t/totp-test-vectors.t b/t/totp-test-vectors.t
index 13d165d..beeb118 100644
--- a/t/totp-test-vectors.t
+++ b/t/totp-test-vectors.t
@@ -23,7 +23,7 @@ sub is_totp {
is(
Pass::OTP::otp(
- secret => $seeds{$opts{algorithm}},
+ secret => $seeds{lc $opts{algorithm}},
algorithm => $opts{algorithm},
now => $opts{now},
digits => 8,
@@ -63,4 +63,6 @@ is_totp(now => 20000000000, algorithm => 'sha256', totp => '77737706');
is_totp(now => 20000000000, algorithm => 'sha512', totp => '47863826');
-done_testing(19);
+is_totp(now => 59, algorithm => 'SHA512', totp => '90693936');
+
+done_testing(20);