blib/lib/Crypt/Passwd/XS.pm

filter: Statementstmt 93.7% 15 / 16 Branchbran 92.8% 13 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod 0.0% 0 / 1 totaltotal 90.6% 29 / 32 CC 8 SCAR 20.8
CC
8
Cov
93%
crypt
8.0
CRAP 8.0
↑ Summary yescrypt-common.c »
1 package Crypt::Passwd::XS;
2  
3 11 our $VERSION = '0.701';
4  
5 11 require XSLoader;
6 11 XSLoader::load( 'Crypt::Passwd::XS', $VERSION );
7  
8 31 ▶sub crypt {
Subroutine crypt: called CC=8 SCAR=20.8
Pod undocumented
9 31 my $password = shift;
10 31 my $salt = shift;
11 31 ▶ return unless $salt;
Branch: 1 branch
BranchTrueFalseTotal
unless $salt 2 29 31
12 29 my $crypt_type = substr( $salt, 0, 3 );
13 29 ▶ if ( $crypt_type eq '$1$' ) {
Branch: 6 branches
BranchTrueFalseTotal
if ($crypt_type eq '$1$') { } 2 27 29
elsif ($crypt_type eq '$6$') { } 7 20 27
elsif ($crypt_type eq '$5$') { } 7 13 20
elsif ($crypt_type eq '$y$') { } 5 8 13
elsif (substr($salt, 0, 1) ne '$') { } 7 1 8
elsif (substr($salt, 0, 6) eq '$apr1$') { } 1 0 1
14 2 return unix_md5_crypt( $password, $salt );
15 }
16 elsif ( $crypt_type eq '$6$' ) {
17 7 return unix_sha512_crypt( $password, $salt );
18 }
19 elsif ( $crypt_type eq '$5$' ) {
20 7 return unix_sha256_crypt( $password, $salt );
21 }
22 elsif ( $crypt_type eq '$y$' ) {
23 5 return unix_yescrypt_crypt( $password, $salt );
24 }
25 elsif ( substr( $salt, 0, 1 ) ne '$' ) {
26 7 return unix_des_crypt( $password, $salt );
27 }
28 elsif ( substr( $salt, 0, 6 ) eq '$apr1$' ) {
29 1 return apache_md5_crypt( $password, $salt );
30 }
31 else {
32  
33 # Unimplemented hashing scheme
34 0 return;
35 }
36 }
37  
38 11 1;
39  
40 __END__
↑ Summary yescrypt-common.c »