Gossamer Forum
Home : General : Perl Programming :

Encryption in nph-prxy.cgi script.

Quote Reply
Encryption in nph-prxy.cgi script.
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!

Last edited by:

Mr_Green.com: Aug 22, 2003, 9:27 AM
Quote Reply
Re: [Mr_Green.com] Encryption in nph-prxy.cgi script. In reply to
HI!



Wish i could help you on that matter. I am to trying to configure nph-proxy and i getting confuse about this security thing.

What do we need those functions encode and decode? I now it encrypts urls right? but who is going to decrypt them?



headon