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.016';
3 3     3   1280 use strict;
  3         6  
  3         91  
4 3     3   15 use warnings;
  3         5  
  3         402  
5              
6             sub secure_compare {
7 3     3 1 15 my ($self, $left, $right) = @_;
8 3 50       19 return if length $left != length $right;
9 3         41 my $r = 0;
10 3         119 $r |= ord(substr $left, $_, 1) ^ ord(substr $right, $_, 1) for 0 .. length($left) - 1;
11 3 50       44 return $r == 0 ? 1 : undef;
12             }
13              
14             1;
15              
16             #ABSTRACT: Base class for Crypt::Passphrase validators
17              
18             __END__