| 1 | package Crypt::Passphrase::Pepper::Simple; | ||||||||||||||||||||||||||||||||||||||
| 2 | 2 | $Crypt::Passphrase::Pepper::Simple::VERSION = '0.024'; | |||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use parent 'Crypt::Passphrase::Pepper::Base'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Carp 'croak'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Digest::SHA; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||
| 11 | 2 | my %algorithms = ( | |||||||||||||||||||||||||||||||||||||
| 12 | 'sha1-hmac' => \&Digest::SHA::hmac_sha1, | ||||||||||||||||||||||||||||||||||||||
| 13 | 'sha224-hmac' => \&Digest::SHA::hmac_sha224, | ||||||||||||||||||||||||||||||||||||||
| 14 | 'sha256-hmac' => \&Digest::SHA::hmac_sha256, | ||||||||||||||||||||||||||||||||||||||
| 15 | 'sha384-hmac' => \&Digest::SHA::hmac_sha384, | ||||||||||||||||||||||||||||||||||||||
| 16 | 'sha512-hmac' => \&Digest::SHA::hmac_sha512, | ||||||||||||||||||||||||||||||||||||||
| 17 | ); | ||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=18.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 20 | 1 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | my $peppers = $args{peppers} or croak('No peppers given'); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | $args{active} //= (sort {; no warnings 'numeric'; $b <=> $a || $b cmp $a } keys %{ $peppers })[0]; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Condition16%1/6
$args{"active"} //= (sort {BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
$b <=> $a or $b cmp $a;} keys %{$peppers;})[0]
$b <=> $a || $b cmp $a
MC/DC0%0/2
$args{"active"} //= (sort {BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
$b <=> $a or $b cmp $a;} keys %{$peppers;})[0]
$args{"active"}
(sort {BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
$b <=> $a or $b cmp $a;} keys %{$peppers;})[0]
MC/DC0%0/2
$b <=> $a || $b cmp $a
$b <=> $a
$b cmp $a
Truth table33%1/3
A //= B
A= $args{"active"}B= (sort {BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
$b <=> $a or $b cmp $a;} keys %{$peppers;})[0]
Truth table0%0/3
A || B
A= $b <=> $aB= $b cmp $a
| |||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | $args{algorithm} //= 'sha512-hmac'; | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"algorithm"} //= "sha512-hmac"
MC/DC0%0/1
$args{"algorithm"} //= "sha512-hmac"
$args{"algorithm"}
Truth table50%1/2
A
A= $args{"algorithm"}
| |||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||
| 26 | 1 | return $class->SUPER::new(%args); | |||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||
| 29 | 2 | ▶ | sub prehash_password { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
prehash_password: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 30 | 2 | my ($self, $password, $algorithm, $id) = @_; | |||||||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | my $secret = $self->{peppers}{$id} or croak "No such pepper $id"; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 32 | 2 | ▶ | my $func = $algorithms{$algorithm} or croak "No such algorithm $algorithm"; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 33 | 2 | return $func->($password, $secret); | |||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||
| 36 | 1 | ▶ | sub supported_hashes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
supported_hashes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 37 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 38 | 1 | return keys %algorithms; | |||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||
| 41 | 2 | 1; | |||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||
| 43 | #ABSTRACT: A pepper-wrapper for Crypt::Passphrase | ||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||||||||||||||||||||