Re: openssl Vs perl encode
Bhasker C V wrote:
> Hi all,
>
> I am sure that this is more of a security question and does not
> pertain to 'debian', please advice me to re-route this mail to
> appropriate list if you are offended.
>
> I am trying to encode using base64 to get data for SMTP
> authentication which i am experimenting upon. I stumbled upon this
> issue. I am not sure why this is happening.
>
>
> Say the text to be encoded is "help@base.com"
>
> $ perl
> use MIME::Base64;
> print encode_base64("help@base.com");
The @ is special in strings inside " " in Perl, so you need to escape it
writing \@ or use single quotes.
> $ echo "help@base.com" | openssl base64
And here you're adding a newline character after the address.
These two give the same result (which is neither of the ones you got
before :- ) ) :
$ perl -MMIME::Base64 -e 'print encode_base64("help\@base.com"); '
aGVscEBiYXNlLmNvbQ==
$ echo -n "help@base.com" |openssl base64
aGVscEBiYXNlLmNvbQ==
--
I love you, not only for what you are, but for what I am when I am with you.
-- Roy Croft
Eduardo M KALINOWSKI
eduardo@kalinowski.com.br
http://move.to/hpkb
Reply to: