| 1 | # | ||||||||||||||||||||
| 2 | # Copyright (c) 2011-2015 T.v.Dein <tlinden |AT| cpan.org>. | ||||||||||||||||||||
| 3 | # | ||||||||||||||||||||
| 4 | # Licensed under the terms of the Artistic License 2.0 | ||||||||||||||||||||
| 5 | # see: http://www.perlfoundation.org/artistic_license_2_0 | ||||||||||||||||||||
| 6 | # | ||||||||||||||||||||
| 7 | # helper class to provide SHA-256 to HMAC class | ||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | package Crypt::PWSafe3::SHA256; | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 1 | $Crypt::PWSafe3::SHA256::VERSION = '1.03'; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 1 | ▶ | use Digest::SHA; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 4 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||
| 16 | 4 | my($this) = @_; | |||||||||||||||||||
| 17 | 4 | ▶ | my $class = ref($this) || $this; | ||||||||||||||||||
|
Condition33%1/3
ref $this || $this
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table33%1/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||
| 18 | 4 | my $self = { }; | |||||||||||||||||||
| 19 | 4 | bless($self, $class); | |||||||||||||||||||
| 20 | 4 | my $sha = Digest::SHA->new('SHA-256'); | |||||||||||||||||||
| 21 | 4 | return $sha; | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | =head1 NAME | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | Crypt::PWSafe3::SHA256 - HMAC Helper Class | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | =head1 DESCRIPTION | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | This is a small helper class used to work with | ||||||||||||||||||||
| 31 | SHA256 in Digest::HMAC module. This is because the | ||||||||||||||||||||
| 32 | Digest::HMAC module requires a module as parameter | ||||||||||||||||||||
| 33 | for the algorithm but Digest::SHA256 doesn't exist | ||||||||||||||||||||
| 34 | as a module. | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | This module here is just a wrapper, it doesn't return | ||||||||||||||||||||
| 37 | an instance of its own but an instance of Digest::SHA('SHA-256') | ||||||||||||||||||||
| 38 | instead. | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | =head1 AUTHOR | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | T.v.Dein <tlinden@cpan.org> | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | =head1 SEE ALSO | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | L<Crypt::PWSafe3> | ||||||||||||||||||||
| 47 | L<Digest::SHA> | ||||||||||||||||||||
| 48 | L<Digest::HMAC> | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | =head1 COPYRIGHT | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | Copyright (c) 2011-2015 by T.v.Dein <tlinden@cpan.org>. | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | =head1 LICENSE | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | This program is free software; you can redistribute it | ||||||||||||||||||||
| 57 | and/or modify it under the same terms of the Artistic | ||||||||||||||||||||
| 58 | License 2.0, see: L<http://www.perlfoundation.org/artistic_license_2_0> | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | =cut | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 1 | 1; | |||||||||||||||||||