| 1 | package Crypt::OpenBSD::Blowfish; | ||||||||||
| 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 | 1 | ▶ | use Carp qw( croak ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | require Exporter; | |||||||||
| 8 | |||||||||||
| 9 | 1 | our @ISA = qw(Exporter); | |||||||||
| 10 | |||||||||||
| 11 | # Items to export into callers namespace by default. Note: do not export | ||||||||||
| 12 | # names by default without a very good reason. Use EXPORT_OK instead. | ||||||||||
| 13 | # Do not simply export all your public functions/methods/constants. | ||||||||||
| 14 | |||||||||||
| 15 | # This allows declaration use Crypt::OpenBSD::Blowfish ':all'; | ||||||||||
| 16 | # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK | ||||||||||
| 17 | # will save memory. | ||||||||||
| 18 | 1 | our %EXPORT_TAGS = ( 'all' => [ qw( | |||||||||
| 19 | |||||||||||
| 20 | ) ] ); | ||||||||||
| 21 | |||||||||||
| 22 | 1 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||
| 23 | |||||||||||
| 24 | 1 | our @EXPORT = qw( | |||||||||
| 25 | |||||||||||
| 26 | ); | ||||||||||
| 27 | |||||||||||
| 28 | 1 | our $VERSION = '0.01'; | |||||||||
| 29 | |||||||||||
| 30 | 1 | require XSLoader; | |||||||||
| 31 | 1 | XSLoader::load('Crypt::OpenBSD::Blowfish', $VERSION); | |||||||||
| 32 | |||||||||||
| 33 | # Preloaded methods go here. | ||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | sub blocksize { 8 } | ||||||||
|
Subroutine
blocksize: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 36 | 0 | ▶ | sub keysize { 0 } | ||||||||
|
Subroutine
keysize: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 37 | 2 | ▶ | sub minkeysize { 4 } | ||||||||
|
Subroutine
minkeysize: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 38 | 2 | ▶ | sub maxkeysize { 56 } | ||||||||
|
Subroutine
maxkeysize: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 39 | |||||||||||
| 40 | 3 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||
| 41 | 3 | my $class = shift; | |||||||||
| 42 | 3 | my $key = shift; | |||||||||
| 43 | 3 | ▶ | if ($key) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 2 | ▶ | croak "Key must be at least " . $class->minkeysize . " octets" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | if length($key) < $class->minkeysize; | ||||||||||
| 46 | 2 | ▶ | $key = substr($key,0,$class->keymaxsize) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | if length($key) > $class->maxkeysize; | ||||||||||
| 48 | } | ||||||||||
| 49 | 3 | ▶ | $key ? Crypt::OpenBSD::Blowfish::init_key($key) : | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | Crypt::OpenBSD::Blowfish::init(); | ||||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 1 | 1; | |||||||||
| 54 | __END__ | ||||||||||