| 1 | package WWW::Live::Auth::SecretKey; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 1 | require Digest::SHA; | |||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | sub new { | ||||||||||||||||||||
| 9 | 0 | ▶ | my ( $proto, $raw ) = @_; | ||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 10 | 0 | ▶ | my $class = ref $proto || $proto; | ||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 0 | my $self = bless { | |||||||||||||||||||
| 13 | 'string' => $raw, | ||||||||||||||||||||
| 14 | }, $class; | ||||||||||||||||||||
| 15 | 0 | $self->_process( $raw ); | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 0 | return $self; | |||||||||||||||||||
| 18 | } | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | sub as_string { | ||||||||||||||||||||
| 21 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
as_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 22 | 0 | return $self->{'string'}; | |||||||||||||||||||
| 23 | } | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | sub encryption_key { | ||||||||||||||||||||
| 26 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
encryption_key: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 27 | 0 | return $self->{'encryption_key'}; | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | sub signature_key { | ||||||||||||||||||||
| 31 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
signature_key: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 32 | 0 | return $self->{'signature_key'}; | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | sub _process { | ||||||||||||||||||||
| 36 | 0 | ▶ | my ( $self, $secret_key ) = @_; | ||||||||||||||||||
|
Subroutine
_process: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 37 | 0 | my $encryption_key = Digest::SHA::sha256( "ENCRYPTION$secret_key" ); | |||||||||||||||||||
| 38 | 0 | my $signature_key = Digest::SHA::sha256( "SIGNATURE$secret_key" ); | |||||||||||||||||||
| 39 | 0 | $encryption_key = substr( $encryption_key, 0, 16); | |||||||||||||||||||
| 40 | 0 | $signature_key = substr( $signature_key, 0, 16); | |||||||||||||||||||
| 41 | 0 | $self->{'encryption_key'} = $encryption_key; | |||||||||||||||||||
| 42 | 0 | $self->{'signature_key'} = $signature_key; | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 1 | 1; | |||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||