| 1 | package Net::OAuth::SignatureMethod; | ||
| 2 | |||
| 3 | 10 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 10 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | # SPDX-SnippetBegin | ||
| 7 | # SPDX-SnippetCopyrightText: 2021 by Leon Timmermans. | ||
| 8 | # SPDX-License-Identifier: The Artistic License 2.0 (GPL Compatible) | ||
| 9 | |||
| 10 | 24 | ▶ | sub secure_compare { |
|
Subroutine
secure_compare: called CC=2 SCAR=6.9
Pod
undocumented
| |||
| 11 | 24 | my ( $self, $up, $down ) = @_; | |
| 12 | 24 | my $r = length $up != length $down; | |
| 13 | 24 | my $left = $up . $down; | |
| 14 | 24 | my $right = $down . $up; | |
| 15 | 24 | $r |= ord( substr $left, $_, 1 ) ^ ord( substr $right, $_, 1 ) for 0 .. length($left) - 1; | |
| 16 | 24 | return $r == 0; | |
| 17 | } | ||
| 18 | |||
| 19 | # SPDX-SnippetEnd | ||
| 20 | |||
| 21 | =head1 NAME | ||
| 22 | |||
| 23 | Net::OAuth::SignatureMethod - a base class for signature methods | ||
| 24 | |||
| 25 | =head1 SEE ALSO | ||
| 26 | |||
| 27 | L<Net::OAuth> | ||
| 28 | |||
| 29 | =head1 AUTHOR | ||
| 30 | |||
| 31 | This uses the C<secure_compare> function from L<Crypt::Passphrase::Validator> by Leon Timmermans. | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | 10 | 1; | |