I am trying to make the proxy script (nph-proxy.cgi) more secure and would like to add MD5 encryption. I have the following code example, but am a perl newbie and haven't been able to get it to work.
use Digest::MD5 qw( md5_base64 );
my $base64_digest = md5_base64( @data );
This is a snippet from the proxy CGI script (nph-proxy.cgi):
sub proxy_encode {
my($URL)= @_ ;
$URL=~ s#^([\w+.-]+)://#$1/# ; # http://xxx -> http/xxx
$URL=~ s/(.)/ sprintf('%02x',ord($1)) /ge ; # each char -> 2-hex
$URL=~ tr/a-zA-Z/n-za-mN-ZA-M/ ; # rot-13
return $URL ;
}
sub proxy_decode {
my($enc_URL)= @_ ;
$enc_URL=~ tr/a-zA-Z/n-za-mN-ZA-M/ ; # rot-13
$enc_URL=~ s/([0-9A-Fa-f]{2})/ sprintf("%c",hex($1)) /ge ;
$enc_URL=~ s#^([\w+.-]+)/#$1://# ; # http/xxx -> http://xxx
return $enc_URL ;
}
Any help would be appreciated!
use Digest::MD5 qw( md5_base64 );
my $base64_digest = md5_base64( @data );
This is a snippet from the proxy CGI script (nph-proxy.cgi):
sub proxy_encode {
my($URL)= @_ ;
$URL=~ s#^([\w+.-]+)://#$1/# ; # http://xxx -> http/xxx
$URL=~ s/(.)/ sprintf('%02x',ord($1)) /ge ; # each char -> 2-hex
$URL=~ tr/a-zA-Z/n-za-mN-ZA-M/ ; # rot-13
return $URL ;
}
sub proxy_decode {
my($enc_URL)= @_ ;
$enc_URL=~ tr/a-zA-Z/n-za-mN-ZA-M/ ; # rot-13
$enc_URL=~ s/([0-9A-Fa-f]{2})/ sprintf("%c",hex($1)) /ge ;
$enc_URL=~ s#^([\w+.-]+)/#$1://# ; # http/xxx -> http://xxx
return $enc_URL ;
}
Any help would be appreciated!