/[pdpsoft]/tags/fetchcrl/fetch-crl-3.0.0-0.RC1/base64.pm
ViewVC logotype

Diff of /tags/fetchcrl/fetch-crl-3.0.0-0.RC1/base64.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/fetchcrl/base64.pm revision 1771 by davidg, Fri Jun 11 20:31:18 2010 UTC tags/fetchcrl/fetch-crl-3.0.0-0.RC1/base64.pm revision 1775 by davidg, Fri Jun 11 21:00:30 2010 UTC
# Line 12  sub b64decode Line 12  sub b64decode
12  {  {
13      return &MIME::Base64::decode_base64 if $use_MIMEBase64;      return &MIME::Base64::decode_base64 if $use_MIMEBase64;
14    
15      local($^W) = 0;      local($^W) = 0; # unpack("u",...) gives bogus warning in 5.00[123]
16      use integer; # should be faster and more accurate      use integer;
17    
18      ( my $str = shift ) =~ tr|A-Za-z0-9+=/||cd;      my $str = shift;
19      $str =~ s/=+$//;      $str =~ tr|A-Za-z0-9+=/||cd;            # remove non-base64 chars
20      $str =~ s/[\n\s+]//s;      if (length($str) % 4) {
21      $str =~ tr|A-Za-z0-9+/| -_|; # collapse base64 unto continuous set of chars          require Carp;
22                                   # (by convention the uuencode set, for unpack)          Carp::carp("Length of base64 data not a multiple of 4")
23      my $result;      }
24      $result = "" unless $str;      $str =~ s/=+$//;                        # remove padding
25      $result = unpack("u", join('', map( chr(32 + length($_)*3/4) . $_,      $str =~ tr|A-Za-z0-9+/| -_|;            # convert to uuencoded format
26                                     $str =~ /(.{1,60})/gs) ) );      return "" unless length $str;
27      $result;  
28        unpack("u", join('', map( chr(32 + length($_)*3/4) . $_,
29                            $str =~ /(.{1,60})/gs) ) );
30  }  }
31    
32  sub b64encode  sub b64encode

Legend:
Removed from v.1771  
changed lines
  Added in v.1775

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28