DBIx-Oracle-Unwrap
view release on metacpan or search on metacpan
lib/DBIx/Oracle/Unwrap.pm view on Meta::CPAN
/;
my $source = join("",@{$dbh->selectcol_arrayref($source_sql)});
my $unwrapper = DBIx::Oracle::Unwrap->new();
my $unwrapped_text = $unwrapper->unwrap($source);
=head1 METHODS
=cut
# this is the substituion table. All the characters in the base64 decoded text
# must be replaced with its lookup
Readonly::Array my @sub_table => (
0x3d, 0x65, 0x85, 0xb3, 0x18, 0xdb, 0xe2, 0x87, 0xf1, 0x52, 0xab, 0x63,
0x4b, 0xb5, 0xa0, 0x5f, 0x7d, 0x68, 0x7b, 0x9b, 0x24, 0xc2, 0x28, 0x67,
0x8a, 0xde, 0xa4, 0x26, 0x1e, 0x03, 0xeb, 0x17, 0x6f, 0x34, 0x3e, 0x7a,
0x3f, 0xd2, 0xa9, 0x6a, 0x0f, 0xe9, 0x35, 0x56, 0x1f, 0xb1, 0x4d, 0x10,
0x78, 0xd9, 0x75, 0xf6, 0xbc, 0x41, 0x04, 0x81, 0x61, 0x06, 0xf9, 0xad,
0xd6, 0xd5, 0x29, 0x7e, 0x86, 0x9e, 0x79, 0xe5, 0x05, 0xba, 0x84, 0xcc,
0x6e, 0x27, 0x8e, 0xb0, 0x5d, 0xa8, 0xf3, 0x9f, 0xd0, 0xa2, 0x71, 0xb8,
lib/DBIx/Oracle/Unwrap.pm view on Meta::CPAN
0xea, 0x1b, 0xf7, 0xce
);
sub _decode {
my $self = shift;
my $text = shift;
return unless $text;
# Decode text and ignore the SHA1 hash (first 20 characters)
my $decoded = substr(decode_base64($text), 20, length($text) - 1);
return unless $decoded;
my ($zipped, $source);
#Translate each character
foreach my $byte (split //, $decoded) {
$zipped .= chr($sub_table[ord($byte)]);
}
# Uncompress (inflate) the data
my $status = inflate \$zipped => \$source
or die "Can't decompress requested data: $InflateError\n";
return $source;
}
=head2 new
( run in 0.354 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )