/[pdpsoft]/nl.nikhef.pdp.fetchcrl/tags/fetch-crl-3.0.10-1/base64.pm
ViewVC logotype

Diff of /nl.nikhef.pdp.fetchcrl/tags/fetch-crl-3.0.10-1/base64.pm

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

revision 1771 by davidg, Fri Jun 11 20:31:18 2010 UTC revision 1776 by davidg, Fri Jun 11 21:05:01 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;      length($str) % 4 and
21      $str =~ tr|A-Za-z0-9+/| -_|; # collapse base64 unto continuous set of chars        die "Internal error in state: length of base64 data not a multiple of 4";
22                                   # (by convention the uuencode set, for unpack)      $str =~ s/=+$//;                        # remove padding
23      my $result;      $str =~ tr|A-Za-z0-9+/| -_|;            # convert to uuencoded format
24      $result = "" unless $str;      return "" unless length $str;
25      $result = unpack("u", join('', map( chr(32 + length($_)*3/4) . $_,  
26                                     $str =~ /(.{1,60})/gs) ) );      unpack("u", join('', map( chr(32 + length($_)*3/4) . $_,
27      $result;                          $str =~ /(.{1,60})/gs) ) );
28  }  }
29    
30  sub b64encode  sub b64encode

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

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