Initial Commit
This commit is contained in:
6
database/perl/vendor/lib/auto/Crypt/CAST5_PP/.packlist
vendored
Normal file
6
database/perl/vendor/lib/auto/Crypt/CAST5_PP/.packlist
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
C:\strawberry\perl\vendor\lib\Crypt\CAST5_PP.pm
|
||||
C:\strawberry\perl\vendor\lib\Crypt\CAST5_PP\Tables.pm
|
||||
C:\strawberry\perl\vendor\lib\auto\Crypt\CAST5_PP\autosplit.ix
|
||||
C:\strawberry\perl\vendor\lib\auto\Crypt\CAST5_PP\decrypt.al
|
||||
C:\strawberry\perl\vendor\lib\auto\Crypt\CAST5_PP\encrypt.al
|
||||
C:\strawberry\perl\vendor\lib\auto\Crypt\CAST5_PP\init.al
|
||||
7
database/perl/vendor/lib/auto/Crypt/CAST5_PP/autosplit.ix
vendored
Normal file
7
database/perl/vendor/lib/auto/Crypt/CAST5_PP/autosplit.ix
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# Index created by AutoSplit for blib\lib\Crypt\CAST5_PP.pm
|
||||
# (file acts as timestamp)
|
||||
package Crypt::CAST5_PP;
|
||||
sub init ;
|
||||
sub encrypt ;
|
||||
sub decrypt ;
|
||||
1;
|
||||
47
database/perl/vendor/lib/auto/Crypt/CAST5_PP/decrypt.al
vendored
Normal file
47
database/perl/vendor/lib/auto/Crypt/CAST5_PP/decrypt.al
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# NOTE: Derived from blib\lib\Crypt\CAST5_PP.pm.
|
||||
# Changes made here will be lost when autosplit is run again.
|
||||
# See AutoSplit.pm.
|
||||
package Crypt::CAST5_PP;
|
||||
|
||||
#line 223 "blib\lib\Crypt\CAST5_PP.pm (autosplit into blib\lib\auto\Crypt\CAST5_PP\decrypt.al)"
|
||||
sub decrypt {
|
||||
use strict;
|
||||
use integer;
|
||||
my ($cast5, $block) = @_;
|
||||
croak "Block size must be 8" if length($block) != 8;
|
||||
|
||||
my $decrypt = $cast5->{decrypt};
|
||||
unless ($decrypt) {
|
||||
my $key = $cast5->{key} or croak "Call init() first";
|
||||
my $rounds = $cast5->{rounds};
|
||||
my $f = 'sub{my($r,$l,$i)=unpack"N2",$_[0];';
|
||||
|
||||
my ($l, $r) = qw( $r $l );
|
||||
my ($op1, $op2, $op3) = qw( - + ^ );
|
||||
foreach (1 .. $rounds%3) { ($op1, $op2, $op3) = ($op2, $op3, $op1) }
|
||||
foreach my $round (1 .. $rounds) {
|
||||
my $km = $key->[$rounds-$round];
|
||||
my $kr = $key->[$rounds-$round+16];
|
||||
|
||||
my $rot = "";
|
||||
if ($kr) {
|
||||
my $mask = ~(~0<<$kr) & 0xffffffff;
|
||||
my $kr2 = 32-$kr;
|
||||
$rot = "\$i=\$i<<$kr|\$i>>$kr2&$mask;"
|
||||
}
|
||||
|
||||
$f .= "\$i=$km$op1$r;$rot$l^=((\$s1[\$i>>24&255]$op2\$s2[\$i>>16&255])$op3\$s3[\$i>>8&255])$op1\$s4[\$i&255];";
|
||||
($l, $r) = ($r, $l);
|
||||
($op1, $op2, $op3) = ($op3, $op1, $op2);
|
||||
}
|
||||
|
||||
$f .= 'pack"N2",$l&0xffffffff,$r&0xffffffff}';
|
||||
$cast5->{decrypt} = $decrypt = eval $f;
|
||||
}
|
||||
|
||||
return $decrypt->($block);
|
||||
} # decrypt
|
||||
|
||||
# end CAST5_PP.pm
|
||||
1;
|
||||
# end of Crypt::CAST5_PP::decrypt
|
||||
44
database/perl/vendor/lib/auto/Crypt/CAST5_PP/encrypt.al
vendored
Normal file
44
database/perl/vendor/lib/auto/Crypt/CAST5_PP/encrypt.al
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# NOTE: Derived from blib\lib\Crypt\CAST5_PP.pm.
|
||||
# Changes made here will be lost when autosplit is run again.
|
||||
# See AutoSplit.pm.
|
||||
package Crypt::CAST5_PP;
|
||||
|
||||
#line 187 "blib\lib\Crypt\CAST5_PP.pm (autosplit into blib\lib\auto\Crypt\CAST5_PP\encrypt.al)"
|
||||
sub encrypt {
|
||||
use strict;
|
||||
use integer;
|
||||
my ($cast5, $block) = @_;
|
||||
croak "Block size must be 8" if length($block) != 8;
|
||||
|
||||
my $encrypt = $cast5->{encrypt};
|
||||
unless ($encrypt) {
|
||||
my $key = $cast5->{key} or croak "Call init() first";
|
||||
my $f = 'sub{my($l,$r,$i)=unpack"N2",$_[0];';
|
||||
|
||||
my ($l, $r) = qw( $l $r );
|
||||
my ($op1, $op2, $op3) = qw( + ^ - );
|
||||
foreach my $round (0 .. $cast5->{rounds}-1) {
|
||||
my $km = $key->[$round];
|
||||
my $kr = $key->[$round+16];
|
||||
|
||||
my $rot = "";
|
||||
if ($kr) {
|
||||
my $mask = ~(~0<<$kr) & 0xffffffff;
|
||||
my $kr2 = 32-$kr;
|
||||
$rot = "\$i=\$i<<$kr|\$i>>$kr2&$mask;"
|
||||
}
|
||||
|
||||
$f .= "\$i=$km$op1$r;$rot$l^=((\$s1[\$i>>24&255]$op2\$s2[\$i>>16&255])$op3\$s3[\$i>>8&255])$op1\$s4[\$i&255];";
|
||||
($l, $r) = ($r, $l);
|
||||
($op1, $op2, $op3) = ($op2, $op3, $op1);
|
||||
}
|
||||
|
||||
$f .= 'pack"N2",$r&0xffffffff,$l&0xffffffff}';
|
||||
$cast5->{encrypt} = $encrypt = eval $f;
|
||||
}
|
||||
|
||||
return $encrypt->($block);
|
||||
} # encrypt
|
||||
|
||||
# end of Crypt::CAST5_PP::encrypt
|
||||
1;
|
||||
69
database/perl/vendor/lib/auto/Crypt/CAST5_PP/init.al
vendored
Normal file
69
database/perl/vendor/lib/auto/Crypt/CAST5_PP/init.al
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
# NOTE: Derived from blib\lib\Crypt\CAST5_PP.pm.
|
||||
# Changes made here will be lost when autosplit is run again.
|
||||
# See AutoSplit.pm.
|
||||
package Crypt::CAST5_PP;
|
||||
|
||||
#line 126 "blib\lib\Crypt\CAST5_PP.pm (autosplit into blib\lib\auto\Crypt\CAST5_PP\init.al)"
|
||||
sub init {
|
||||
use strict;
|
||||
use integer;
|
||||
my ($cast5, $key) = @_;
|
||||
croak "Key length must be 40 to 128 bits"
|
||||
if length($key) < 5 || length($key) > 16;
|
||||
require Crypt::CAST5_PP::Tables;
|
||||
|
||||
# untaint the key. this keeps the evals from blowing up later.
|
||||
# arguably, a tainted key should result in tainted output. oh well.
|
||||
$key =~ /^(.*)$/s and $key = $1;
|
||||
|
||||
# null-pad the key to 16 bytes, and then split it into 32-bit chunks
|
||||
my ($s, $t, $u, $v) = unpack "N4", pack "a16", $key;
|
||||
|
||||
# compute the key schedule
|
||||
# don't try to read this -- it's generated by mkschedule
|
||||
my ($w, $x, $y, $z, @k);
|
||||
for (1..2) {
|
||||
$w=$s^$s5[$v>>16&255]^$s6[$v&255]^$s7[$v>>24&255]^$s8[$v>>8&255]^$s7[$u>>24&255];
|
||||
$x=$u^$s5[$w>>24&255]^$s6[$w>>8&255]^$s7[$w>>16&255]^$s8[$w&255]^$s8[$u>>8&255];
|
||||
$y=$v^$s5[$x&255]^$s6[$x>>8&255]^$s7[$x>>16&255]^$s8[$x>>24&255]^$s5[$u>>16&255];
|
||||
$z=$t^$s5[$y>>8&255]^$s6[$y>>16&255]^$s7[$y&255]^$s8[$y>>24&255]^$s6[$u&255];
|
||||
push@k,$s5[$y>>24&255]^$s6[$y>>16&255]^$s7[$x&255]^$s8[$x>>8&255]^$s5[$w>>8&255];
|
||||
push@k,$s5[$y>>8&255]^$s6[$y&255]^$s7[$x>>16&255]^$s8[$x>>24&255]^$s6[$x>>8&255];
|
||||
push@k,$s5[$z>>24&255]^$s6[$z>>16&255]^$s7[$w&255]^$s8[$w>>8&255]^$s7[$y>>16&255];
|
||||
push@k,$s5[$z>>8&255]^$s6[$z&255]^$s7[$w>>16&255]^$s8[$w>>24&255]^$s8[$z>>24&255];
|
||||
$s=$y^$s5[$x>>16&255]^$s6[$x&255]^$s7[$x>>24&255]^$s8[$x>>8&255]^$s7[$w>>24&255];
|
||||
$t=$w^$s5[$s>>24&255]^$s6[$s>>8&255]^$s7[$s>>16&255]^$s8[$s&255]^$s8[$w>>8&255];
|
||||
$u=$x^$s5[$t&255]^$s6[$t>>8&255]^$s7[$t>>16&255]^$s8[$t>>24&255]^$s5[$w>>16&255];
|
||||
$v=$z^$s5[$u>>8&255]^$s6[$u>>16&255]^$s7[$u&255]^$s8[$u>>24&255]^$s6[$w&255];
|
||||
push@k,$s5[$s&255]^$s6[$s>>8&255]^$s7[$v>>24&255]^$s8[$v>>16&255]^$s5[$u>>24&255];
|
||||
push@k,$s5[$s>>16&255]^$s6[$s>>24&255]^$s7[$v>>8&255]^$s8[$v&255]^$s6[$v>>16&255];
|
||||
push@k,$s5[$t&255]^$s6[$t>>8&255]^$s7[$u>>24&255]^$s8[$u>>16&255]^$s7[$s&255];
|
||||
push@k,$s5[$t>>16&255]^$s6[$t>>24&255]^$s7[$u>>8&255]^$s8[$u&255]^$s8[$t&255];
|
||||
$w=$s^$s5[$v>>16&255]^$s6[$v&255]^$s7[$v>>24&255]^$s8[$v>>8&255]^$s7[$u>>24&255];
|
||||
$x=$u^$s5[$w>>24&255]^$s6[$w>>8&255]^$s7[$w>>16&255]^$s8[$w&255]^$s8[$u>>8&255];
|
||||
$y=$v^$s5[$x&255]^$s6[$x>>8&255]^$s7[$x>>16&255]^$s8[$x>>24&255]^$s5[$u>>16&255];
|
||||
$z=$t^$s5[$y>>8&255]^$s6[$y>>16&255]^$s7[$y&255]^$s8[$y>>24&255]^$s6[$u&255];
|
||||
push@k,$s5[$w&255]^$s6[$w>>8&255]^$s7[$z>>24&255]^$s8[$z>>16&255]^$s5[$y>>16&255];
|
||||
push@k,$s5[$w>>16&255]^$s6[$w>>24&255]^$s7[$z>>8&255]^$s8[$z&255]^$s6[$z>>24&255];
|
||||
push@k,$s5[$x&255]^$s6[$x>>8&255]^$s7[$y>>24&255]^$s8[$y>>16&255]^$s7[$w>>8&255];
|
||||
push@k,$s5[$x>>16&255]^$s6[$x>>24&255]^$s7[$y>>8&255]^$s8[$y&255]^$s8[$x>>8&255];
|
||||
$s=$y^$s5[$x>>16&255]^$s6[$x&255]^$s7[$x>>24&255]^$s8[$x>>8&255]^$s7[$w>>24&255];
|
||||
$t=$w^$s5[$s>>24&255]^$s6[$s>>8&255]^$s7[$s>>16&255]^$s8[$s&255]^$s8[$w>>8&255];
|
||||
$u=$x^$s5[$t&255]^$s6[$t>>8&255]^$s7[$t>>16&255]^$s8[$t>>24&255]^$s5[$w>>16&255];
|
||||
$v=$z^$s5[$u>>8&255]^$s6[$u>>16&255]^$s7[$u&255]^$s8[$u>>24&255]^$s6[$w&255];
|
||||
push@k,$s5[$u>>24&255]^$s6[$u>>16&255]^$s7[$t&255]^$s8[$t>>8&255]^$s5[$s&255];
|
||||
push@k,$s5[$u>>8&255]^$s6[$u&255]^$s7[$t>>16&255]^$s8[$t>>24&255]^$s6[$t&255];
|
||||
push@k,$s5[$v>>24&255]^$s6[$v>>16&255]^$s7[$s&255]^$s8[$s>>8&255]^$s7[$u>>24&255];
|
||||
push@k,$s5[$v>>8&255]^$s6[$v&255]^$s7[$s>>16&255]^$s8[$s>>24&255]^$s8[$v>>16&255];
|
||||
}
|
||||
|
||||
for (16..31) { $k[$_] &= 31 }
|
||||
delete $cast5->{encrypt};
|
||||
delete $cast5->{decrypt};
|
||||
$cast5->{rounds} = length($key) <= 10 ? 12 : 16;
|
||||
$cast5->{key} = \@k;
|
||||
return $cast5;
|
||||
} # init
|
||||
|
||||
# end of Crypt::CAST5_PP::init
|
||||
1;
|
||||
Reference in New Issue
Block a user