/usr/share/perl5/MIME/Base32.pm is in libmime-base32-perl 1.02a-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | package MIME::Base32;
require 5.005_62;
use strict;
use warnings;
use vars qw( $VERSION );
$VERSION = '1.02'; # minor changes : added COPYRIGHT according to community request; test.pl - extended test string
sub import
{
my( $pkg, $arg )=@_;
if( defined($arg) && $arg =~ /rfc|3548/i )
{
*encode = \&encode_rfc3548;
*decode = \&decode_rfc3548;
}
else
{
*encode = \&encode_09AV;
*decode = \&decode_09AV;
}
}
sub encode_rfc3548{
# base32:
#
# modified base64 algorithm with
# 32 characters set: A - Z 2 - 7 compliant with: RFC-3548
#
$_ = shift @_;
my( $buffer, $l, $e );
$_=unpack('B*', $_);
s/(.....)/000$1/g;
$l=length;
if ($l & 7)
{
$e = substr($_, $l & ~7);
$_ = substr($_, 0, $l & ~7);
$_ .= "000$e" . '0' x (5 - length $e);
}
$_=pack('B*', $_);
tr|\0-\37|A-Z2-7|;
$_;
}
sub decode_rfc3548{
$_ = shift;
my( $l );
tr|A-Z2-7|\0-\37|;
$_=unpack('B*', $_);
s/000(.....)/$1/g;
$l=length;
# pouzije pouze platnou delku retezce
$_=substr($_, 0, $l & ~7) if $l & 7;
$_=pack('B*', $_);
}
sub encode_09AV{
# base32:
#
# modified base64 algorithm with
# 32 characters set: [0-9A-V] pre 1.00 backward compatibility
#
$_ = shift @_;
my( $buffer, $l, $e );
$_=unpack('B*', $_);
s/(.....)/000$1/g;
$l=length;
if ($l & 7)
{
$e = substr($_, $l & ~7);
$_ = substr($_, 0, $l & ~7);
$_ .= "000$e" . '0' x (5 - length $e);
}
$_=pack('B*', $_);
tr|\0-\37|0-9A-V|;
$_;
}
sub decode_09AV{
$_ = shift;
my( $l );
tr|0-9A-V|\0-\37|;
$_=unpack('B*', $_);
s/000(.....)/$1/g;
$l=length;
# pouzije pouze platnou delku retezce
$_=substr($_, 0, $l & ~7) if $l & 7;
$_=pack('B*', $_);
}
1;
__END__
=head1 NAME
MIME::Base32 - Base32 encoder / decoder
=head1 SYNOPSIS
# RFC forces the [A-Z2-7] RFC-3548 compliant encoding
# default encoding [0-9A-V] is for backward compatibility with pre v1.0
use MIME::Base32 qw( RFC );
$encoded = MIME::Base32::encode($text_or_binary_data);
$decoded = MIME::Base32::decode($encoded);
=head1 DESCRIPTION
Encode data similar way like MIME::Base64 does.
Main purpose is to create encrypted text used as id or key entry typed-or-submitted by user. It is upper/lowercase safe (not sensitive).
=head1 EXPORT
ALLWAYS NOTHING
=head1 AUTHOR
Daniel Peder, sponsored by Infoset s.r.o., Czech Republic
<Daniel.Peder@InfoSet.COM> http://www.infoset.com
=head1 COPYRIGHT
Copyright (c) 2003-2010 Daniel Peder. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=head1 NOTE
Version 1.02 provides minor changes only:
- added COPYRIGHT according to FEDORA & DEBIAN community requests
- test.pl - extended test string (just for sure ;)
=head1 SEE ALSO
perl(1), MIME::Base64(3pm).
=cut
|