| 1 | package OpenSSH::Fingerprint; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Digest::MD5; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use MIME::Base64; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Crypt::Digest::SHA256; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | our @ISA = qw(Exporter); | |||||||||
| 11 | 1 | our @EXPORT = qw(unbase64 md5_sum sub sha256); | |||||||||
| 12 | |||||||||||
| 13 | =head1 NAME | ||||||||||
| 14 | |||||||||||
| 15 | OpenSSH::Fingerprint - The great new OpenSSH::Fingerprint! | ||||||||||
| 16 | |||||||||||
| 17 | =head1 VERSION | ||||||||||
| 18 | |||||||||||
| 19 | Version 0.01 | ||||||||||
| 20 | |||||||||||
| 21 | =cut | ||||||||||
| 22 | |||||||||||
| 23 | 1 | our $VERSION = '0.01'; | |||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | =head1 SYNOPSIS | ||||||||||
| 27 | |||||||||||
| 28 | Quick summary of what the module does. | ||||||||||
| 29 | |||||||||||
| 30 | Perhaps a little code snippet. | ||||||||||
| 31 | |||||||||||
| 32 | use OpenSSH::Fingerprint; | ||||||||||
| 33 | |||||||||||
| 34 | my $foo = OpenSSH::Fingerprint->new(); | ||||||||||
| 35 | ... | ||||||||||
| 36 | |||||||||||
| 37 | =head1 EXPORT | ||||||||||
| 38 | |||||||||||
| 39 | A list of functions that can be exported. You can delete this section | ||||||||||
| 40 | if you don't export anything, such as for a purely object-oriented module. | ||||||||||
| 41 | |||||||||||
| 42 | =head1 SUBROUTINES/METHODS | ||||||||||
| 43 | |||||||||||
| 44 | =cut | ||||||||||
| 45 | sub unbase64 { | ||||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | my ( $file_name) = @_; | ||||||||
|
Subroutine
unbase64: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||
| 48 | 0 | my ( $FD, $mydstr, $md5 ); | |||||||||
| 49 | 0 | ▶ | open( $FD, $file_name ) or warn "Can't open $file_name !"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | |||||||||||
| 51 | 0 | ▶ | while(<$FD>) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 0 | ▶ | next if /#^/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | 0 | ▶ | next unless (split)[1]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | push @{$mydstr},decode_base64((split)[1]); | |||||||||
| 55 | |||||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 0 | return $mydstr; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | |||||||||||
| 62 | sub md5_sum { | ||||||||||
| 63 | |||||||||||
| 64 | 0 | ▶ | my $key = shift; | ||||||||
|
Subroutine
md5_sum: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 65 | 0 | my $ctx = Digest::MD5->new; | |||||||||
| 66 | 0 | $ctx->add($key); | |||||||||
| 67 | 0 | my $md5 = $ctx->hexdigest; | |||||||||
| 68 | 0 | $md5=~s/(..)/$1:/g; | |||||||||
| 69 | 0 | $md5=~s/:$//; | |||||||||
| 70 | 0 | return $md5; | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | sub sha256 { | ||||||||||
| 74 | |||||||||||
| 75 | 0 | ▶ | my $key = shift; | ||||||||
|
Subroutine
sha256: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 76 | 0 | my $ctx = Crypt::Digest::SHA256->new; | |||||||||
| 77 | 0 | $ctx->add($key); | |||||||||
| 78 | 0 | my $md5 = $ctx->digest; | |||||||||
| 79 | 0 | return $md5; | |||||||||
| 80 | } | ||||||||||
| 81 | |||||||||||
| 82 | |||||||||||
| 83 | =head1 AUTHOR | ||||||||||
| 84 | |||||||||||
| 85 | ORANGE, C<< <bollwarm at ijz.me> >> | ||||||||||
| 86 | |||||||||||
| 87 | =head1 BUGS | ||||||||||
| 88 | |||||||||||
| 89 | Please report any bugs or feature requests to C<bug-openssh-fingerprint at rt.cpan.org>, or through | ||||||||||
| 90 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=OpenSSH-Fingerprint>. I will be notified, and then you'll | ||||||||||
| 91 | automatically be notified of progress on your bug as I make changes. | ||||||||||
| 92 | |||||||||||
| 93 | |||||||||||
| 94 | |||||||||||
| 95 | |||||||||||
| 96 | =head1 SUPPORT | ||||||||||
| 97 | |||||||||||
| 98 | You can find documentation for this module with the perldoc command. | ||||||||||
| 99 | |||||||||||
| 100 | perldoc OpenSSH::Fingerprint | ||||||||||
| 101 | |||||||||||
| 102 | |||||||||||
| 103 | You can also look for information at: | ||||||||||
| 104 | |||||||||||
| 105 | =over 4 | ||||||||||
| 106 | |||||||||||
| 107 | =item * RT: CPAN's request tracker (report bugs here) | ||||||||||
| 108 | |||||||||||
| 109 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=OpenSSH-Fingerprint> | ||||||||||
| 110 | |||||||||||
| 111 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||
| 112 | |||||||||||
| 113 | L<http://annocpan.org/dist/OpenSSH-Fingerprint> | ||||||||||
| 114 | |||||||||||
| 115 | =item * CPAN Ratings | ||||||||||
| 116 | |||||||||||
| 117 | L<http://cpanratings.perl.org/d/OpenSSH-Fingerprint> | ||||||||||
| 118 | |||||||||||
| 119 | =item * Search CPAN | ||||||||||
| 120 | |||||||||||
| 121 | L<http://search.cpan.org/dist/OpenSSH-Fingerprint/> | ||||||||||
| 122 | |||||||||||
| 123 | =back | ||||||||||
| 124 | |||||||||||
| 125 | |||||||||||
| 126 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 127 | |||||||||||
| 128 | |||||||||||
| 129 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 130 | |||||||||||
| 131 | Copyright 2017 ORANGE. | ||||||||||
| 132 | |||||||||||
| 133 | This program is released under the following license: Perl | ||||||||||
| 134 | |||||||||||
| 135 | |||||||||||
| 136 | =cut | ||||||||||
| 137 | |||||||||||
| 138 | 1 | 1; # End of OpenSSH::Fingerprint | |||||||||