blib/lib/Kelp/Module/Bcrypt.pm

filter: Statementstmt 93.3% 14 / 15 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 84.0% 21 / 25 CC 3 SCAR 5.3
CC
3
Cov
84%
build
2.1
__ANON__
2.0
BEGIN
1.0
CRAP 1.7
↑ Summary
1 package Kelp::Module::Bcrypt;
2  
3 1 ▶use Kelp::Base 'Kelp::Module';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Crypt::Eksblowfish::Bcrypt qw(bcrypt_hash en_base64);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = 0.2;
7  
8 1 ▶sub build {
Subroutine build: called CC=2 SCAR=7.3
Pod documented
9 1 my ( $self, %args ) = @_;
10  
11 1 ▶ if ( !$args{salt} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($args{"salt"}) 0 1 1
12 0 die "Must define salt for bcrypt";
13 }
14  
15 $self->register(
16 2 ▶ bcrypt => sub {
Subroutine __ANON__: called CC=2 SCAR=7.1
17 2 my ( $app, $password ) = @_;
18 my $hash = bcrypt_hash(
19 {
20 key_nul => 1,
21 cost => $args{cost} // 8,
22 salt => $args{salt},
23 },
24 2 ▶ $password
Condition50%1/2
$args{"cost"} // 8
l!l
20
MC/DC0%0/1
$args{"cost"} // 8
$args{"cost"}
Truth table50%1/2
A
A= $args{"cost"}
Aresult
11
00
25 );
26 2 return en_base64($hash);
27 }
28 1 );
29 }
30  
31 1 1;
32  
33 __END__
↑ Summary