| 1 | package Crypt::Passphrase::SHA1::Base64; | ||
| 2 | 2 | $Crypt::Passphrase::SHA1::Base64::VERSION = '0.024'; | |
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | use parent 'Crypt::Passphrase::Validator'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 2 | ▶ | use Digest::SHA 'sha1'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 2 | ▶ | use MIME::Base64 'decode_base64'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 2 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 12 | 2 | my $class = shift; | |
| 13 | 2 | return bless {}, $class; | |
| 14 | } | ||
| 15 | |||
| 16 | 2 | ▶ | sub accepts_hash { |
|
Subroutine
accepts_hash: called CC=1 SCAR=0.0
Pod
documented
| |||
| 17 | 2 | my ($self, $hash) = @_; | |
| 18 | 2 | return $hash =~ m{ ^ [A-Za-z0-9+/]{27} =? \z }x; | |
| 19 | } | ||
| 20 | |||
| 21 | 2 | ▶ | sub verify_password { |
|
Subroutine
verify_password: called CC=1 SCAR=0.0
Pod
documented
| |||
| 22 | 2 | my ($self, $password, $hash) = @_; | |
| 23 | 2 | my $new_hash = sha1($password); | |
| 24 | 2 | return $self->secure_compare($new_hash, decode_base64($hash)); | |
| 25 | } | ||
| 26 | |||
| 27 | 2 | 1; | |
| 28 | |||
| 29 | # ABSTRACT: Validate against base64ed SHA1 hashes with Crypt::Passphrase | ||
| 30 | |||
| 31 | __END__ | ||