File Coverage

blib/lib/Crypt/Passphrase/Validator.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Crypt::Passphrase::Validator;
2             $Crypt::Passphrase::Validator::VERSION = '0.023';
3 13     13   146731 use strict;
  13         33  
  13         537  
4 13     13   225 use warnings;
  13         29  
  13         2992  
5              
6             our @CARP_NOT = 'Crypt::Passphrase';
7              
8             sub secure_compare {
9 33     33 1 514 my ($self, $up, $down) = @_;
10 33         104 my $r = length $up != length $down;
11 33         72 my $left = $up . $down;
12 33         73 my $right = $down . $up;
13 33         1667 $r |= ord(substr $left, $_, 1) ^ ord(substr $right, $_, 1) for 0 .. length($left) - 1;
14 33         448 return $r == 0;
15             }
16              
17             1;
18              
19             #ABSTRACT: Base class for Crypt::Passphrase validators
20              
21             __END__