2
$key = "12345678876543211234567887654321";
$iv = "1234567887654321";
$plaindata = "String to be encrypted.";

$enc = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaindata, MCRYPT_MODE_CBC, $iv));

echo($enc);

Output:

EIZDQJWOIepUeNjFL2wl3RYA5bDmFd05Xu6z4e0aiWQ=

How this could be decrypted in Perl???

user812120
  • 585
  • 1
  • 10
  • 21

2 Answers2

2

Looks like you'll need a combination of MIME::Base64 and MCrypt.

Dave Cross
  • 68,119
  • 3
  • 51
  • 97
  • Many thanks Dave. I am getting this error. Can't locate Mcrypt.pm in @INC (@INC contains: C:/xampp/perl/site/lib/ C:/xampp/perl/lib C:/xampp/perl/site/lib . C:/xampp/apache) at C:/xampp/htdocs/sites/test/hello.pl line 5. BEGIN failed--compilation aborted at C:/xampp/htdocs/sites/test/hello.pl line 5. , – user812120 May 15 '12 at 15:41
  • When I copy Mcrypt.pm file in the these directories and reload the page, I get Can't locate loadable object for module Crypt::Rijndael in @INC (@INC contains: C:/xampp/perl/site/lib/ C:/xampp/perl/lib C:/xampp/perl/site/lib . C:/xampp/apache) at C:/xampp/htdocs/sites/test/hello.pl line 5 Compilation failed in require at C:/xampp/htdocs/sites/test/hello.pl line 5. BEGIN failed--compilation aborted at C:/xampp/htdocs/sites/test/hello.pl line 5. , – user812120 May 15 '12 at 15:52
  • 1
    Yes, you'll need to install it properly (via the "cpan" / "cpanm" commands, usually; Google for 'install cpan module' for details). Don't just try to manually copy the files around it won't work. – David Precious May 15 '12 at 16:31
  • 1
    presh, do not send people off to Google. Instead, put a useful link to a canonical resource. Fitting example: From the [Stack Overflow Perl FAQ](http://stackoverflow.com/questions/tagged/perl?sort=faq): [What's the easiest way to install a missing Perl module?](http://stackoverflow.com/questions/65865/whats-the-easiest-way-to-install-a-missing-perl-module) – daxim May 15 '12 at 21:57
1

There is a package in cpan .. MCrypt

http://search.cpan.org/perldoc?MCrypt

Check this out

mob
  • 117,087
  • 18
  • 149
  • 283
Arfeen
  • 2,553
  • 5
  • 29
  • 48