File Coverage

blib/lib/Crypt/Passphrase/Validator.pm
Criterion Covered Total %
statement 11 11 100.0
branch 2 4 50.0
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 17 19 89.4


line stmt bran cond sub pod time code
1             package Crypt::Passphrase::Validator;
2             $Crypt::Passphrase::Validator::VERSION = '0.014';
3 3     3   1424 use strict;
  3         7  
  3         84  
4 3     3   15 use warnings;
  3         7  
  3         377  
5              
6             sub secure_compare {
7 3     3 1 12 my ($self, $left, $right) = @_;
8 3 50       17 return if length $left != length $right;
9 3         7 my $r = 0;
10 3         109 $r |= ord(substr $left, $_, 1) ^ ord(substr $right, $_, 1) for 0 .. length($left) - 1;
11 3 50       55 return $r == 0 ? 1 : undef;
12             }
13              
14             1;
15              
16             #ABSTRACT: Base class for Crypt::Passphrase validators
17              
18             __END__