Saturday, September 26, 2009
Thursday, September 17, 2009
Thursday, September 03, 2009
OpenSocialX::Shindig::Crypter long story
The long story is
we (Zorpia) were developing OpenSocial in last days. The first choice to build a opensocial container is Shindig.
unlucky, it ONLY has PHP and Java version. yeah, I do all my code in Perl, I know nothing about PHP or Java. (well, I know a little PHP now because I was writing Service package with PHP in last days, and I must say, PHP sucks.)
lucky, the Shindig author points me to an URL: Using Shindig in a non PHP or Java environment
that I can write the 'Application' section in Perl. It IS great, really very great.
so at last, I google around and wrote my last solution: OpenSocialX::Shindig::Crypter and the php lib BasicBlobCrypter.php
and now I'm happy to share it with your guys. if you have the same situation with me, you can try that module and tell me your feeling. :)
Thanks. (OK, it's not so long.)
we (Zorpia) were developing OpenSocial in last days. The first choice to build a opensocial container is Shindig.
unlucky, it ONLY has PHP and Java version. yeah, I do all my code in Perl, I know nothing about PHP or Java. (well, I know a little PHP now because I was writing Service package with PHP in last days, and I must say, PHP sucks.)
lucky, the Shindig author points me to an URL: Using Shindig in a non PHP or Java environment
that I can write the 'Application' section in Perl. It IS great, really very great.
so at last, I google around and wrote my last solution: OpenSocialX::Shindig::Crypter and the php lib BasicBlobCrypter.php
and now I'm happy to share it with your guys. if you have the same situation with me, you can try that module and tell me your feeling. :)
Thanks. (OK, it's not so long.)
Labels: CPAN, OpenSocial, Shindig
OpenSocialX::Shindig::Crypter short story
the short story is that I released the OpenSocialX::Shindig::Crypter yesterday.
the short story is if you want to find a way that encrypt data by Perl and decrypt the encrypted data by PHP, you come to the right place.
Perl: crypt.pl
both of them show the same output:
I'll post a long story later today.
Thanks.
the short story is if you want to find a way that encrypt data by Perl and decrypt the encrypted data by PHP, you come to the right place.
Perl: crypt.pl
my $str = 'o=1&v=3&p=5';
my $cipher = Crypt::CBC->new( {
'key' => 'length16length16',
'cipher'=> 'Rijndael',
'iv' => '1234567890abcdef',
'literal_key' => 1,
'padding' => 'null',
'header' => 'none',
keysize => 128/8
} );
my $encrypted = $cipher->encrypt($str);
print "encrypted: ".encode_base64($encrypted)."\n";
print "decrypted: ".$cipher->decrypt($encrypted)."\n";
my $hmac = Digest::SHA::hmac_sha1($encrypted, 'hmackey');
print "hmac: " . encode_base64($hmac) . "\n";
print "total: " . encode_base64($encrypted . $hmac) . "\n";PHP: crypt.php$str = 'o=1&v=3&p=5';
$encrypted = mcrypt_cbc(MCRYPT_RIJNDAEL_128, 'length16length16', $str, MCRYPT_ENCRYPT, '1234567890abcdef');
$decrypted = mcrypt_cbc(MCRYPT_RIJNDAEL_128, 'length16length16', $encrypted, MCRYPT_DECRYPT, '1234567890abcdef');
echo "encrypted: ".base64_encode($encrypted)."\n";
echo "decrypted: ".$decrypted."\n";
$blabla = hash_hmac('sha1', $encrypted, 'hmackey', 1);
echo "hmac: " . base64_encode($blabla) . "\n";
echo "total: " . base64_encode($encrypted . $blabla) . "\n";both of them show the same output:
# perl crypt.pl
encrypted: rgPZe6swWb3t3yIoIZFQaQ==
decrypted: o=1&v=3&p=5
hmac: WLTGeyesYTUhwg6fjVqDudrKRz0=
total: rgPZe6swWb3t3yIoIZFQaVi0xnsnrGE1IcIOn41ag7naykc9
# php crypt.php
encrypted: rgPZe6swWb3t3yIoIZFQaQ==
decrypted: o=1&v=3&p=5
hmac: WLTGeyesYTUhwg6fjVqDudrKRz0=
total: rgPZe6swWb3t3yIoIZFQaVi0xnsnrGE1IcIOn41ag7naykc9I'll post a long story later today.
Thanks.
Labels: CPAN, OpenSocial, Shindig
use Moose; or no Moose;
recently "Moose or no Moose" is spreading to the Perl world.
Moose or No Moose
Command Line Moose or Knowing what You Don't know.
Re: Moose Or No Moose
Take arms against a sea of troubles
Re: Re: Moose Or No Moose
Moose Startup Time over Time
basically I agree with Adam Kennedy that Array::Compare shouldn't based on Moose. Test::Warn is a popular module and Array::Compare without Moose can totally ease the install of the Test::Warn.
in the meantime, I would agree with Stevan Little that we shouldn't hold the usage of the Moose. it's a great module with great idea and great contributors. I use it in my daily life and it works great. once more and more people/module use Moose, the problem wouldn't become a problem.
I think Padre should use Moose, I know Adam would reject that, but I insist on that Padre will benefit from Moose even Class::XSAccessor is the fastest accessor module now. Padre will be in a better structure and much more easy to read if it's coded with Moose. Plugin/Document/Highlighter would be easily written and plugged.
another thing is that I met the problem before. Long time ago people rate down WWW::Contact because it uses Moose. but I think it's not true. Moose helps me to build the module.
at last and in short, I think simple module (like only use the accessor of Moose) shouldn't use Moose but large software/module like Padre should use Moose.
Thanks. just personal thoughts.
Moose or No Moose
Command Line Moose or Knowing what You Don't know.
Re: Moose Or No Moose
Take arms against a sea of troubles
Re: Re: Moose Or No Moose
Moose Startup Time over Time
basically I agree with Adam Kennedy that Array::Compare shouldn't based on Moose. Test::Warn is a popular module and Array::Compare without Moose can totally ease the install of the Test::Warn.
in the meantime, I would agree with Stevan Little that we shouldn't hold the usage of the Moose. it's a great module with great idea and great contributors. I use it in my daily life and it works great. once more and more people/module use Moose, the problem wouldn't become a problem.
I think Padre should use Moose, I know Adam would reject that, but I insist on that Padre will benefit from Moose even Class::XSAccessor is the fastest accessor module now. Padre will be in a better structure and much more easy to read if it's coded with Moose. Plugin/Document/Highlighter would be easily written and plugged.
another thing is that I met the problem before. Long time ago people rate down WWW::Contact because it uses Moose. but I think it's not true. Moose helps me to build the module.
at last and in short, I think simple module (like only use the accessor of Moose) shouldn't use Moose but large software/module like Padre should use Moose.
Thanks. just personal thoughts.
Labels: Moose
