HEX
Server: Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System: Linux ns565604.ip-54-39-133.net 4.18.0-553.50.1.el8_10.x86_64 #1 SMP Tue Apr 15 08:09:22 EDT 2025 x86_64
User: greer489 (1034)
PHP: 8.3.19
Disabled: NONE
Upload Files
File: //lib64/perl5/vendor_perl/Razor2/Preproc/enBase64.pm
package Razor2::Preproc::enBase64;

sub new {
    return bless {}, shift;
}

sub isit {
    my ( $self, $text ) = @_;
    my $is_binary = ( $$text =~ /^Content-Type-Encoding: 8-bit/ )
      || ( $$text =~ /([\x00-\x1f|\x7f-\xff])/ and $1 !~ /[\r\n\t]/ );

    return $is_binary;
}

sub doit {
    my ( $self, $text ) = @_;

    pos($$text) = 0;    # ensure start at the beginning

    my $res = join '', map( pack( 'u', $_ ) =~ /^.(\S*)/, ( $$text =~ /(.{1,45})/gs ) );

    $res =~ tr|` -_|AA-Za-z0-9+/|;    # `# help emacs
                                      # fix padding at the end
    my $padding = ( 3 - length($$text) % 3 ) % 3;
    $res =~ s/.{$padding}$/'=' x $padding/e if $padding;

    # split into lines
    $res =~ s/(.{1,76})/$1\n/g;

    $res = "Content-Transfer-Encoding: base64\n\n$res";

    $$text = $res;
}

1;