Skip Menu |

This queue is for tickets about the Captcha-reCAPTCHA-Mailhide CPAN distribution.

Report information
The Basics
Id: 31740
Status: rejected
Priority: 0/
Queue: Captcha-reCAPTCHA-Mailhide

People
Owner: andy [...] hexten.net
Requestors: me [...] justinsimoni.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Support for Crypt::Rijndael_PP
It would be really wonderful to have support for Crypt::Rijndael_PP, so someone could install Captcha-reCAPTCHA-Mailhide without needing access to a compiler - Crypt::Rijndael is currently an XS module. I'll be happy to raise my hand in hacking it together, if you'd be interested in taking my diffs. My interest is in including the Mailhide functionality in Dada Mail, "out of the box", since a great majority of my users aren't familiar with cpan. It may be as easy as using: http://search.cpan.org/~gaal/Best-0.11/ or just wrapping a, "require" in an eval statement and switching to the PP version if it fails. Again - willing to try it out, run the tests and give you some diffs. Lemme know ;)
On Wed Dec 19 23:38:26 2007, JJSIMONI wrote: Show quoted text
> It would be really wonderful to have support for Crypt::Rijndael_PP, so > someone could install Captcha-reCAPTCHA-Mailhide without needing access > to a compiler - Crypt::Rijndael is currently an XS module. > > I'll be happy to raise my hand in hacking it together, if you'd be > interested in taking my diffs. My interest is in including the Mailhide > functionality in Dada Mail, "out of the box", since a great majority of > my users aren't familiar with cpan. > > It may be as easy as using: > > http://search.cpan.org/~gaal/Best-0.11/ > > or just wrapping a, "require" in an eval statement and switching to the > PP version if it fails. > > Again - willing to try it out, run the tests and give you some diffs. > > Lemme know ;)
That sounds like a good plan :) Makefile.PL would have to handle the optional deps too. If you have time to look at it that'd be most helpful - my head's going to be full until after christmas now.
From: me [...] justinsimoni.com
Here's the basic changes - I'm taking advantage of the, "Best" module - this module will allow Mailhide.pm to only need a one line change and the Makefile to just need one more (Pure Perl) dependency: [snip] diff -ru Captcha-reCAPTCHA-Mailhide-0.93/Makefile.PL Captcha-reCAPTCHA-Mailhide-0.93-new/Makefile.PL --- Captcha-reCAPTCHA-Mailhide-0.93/Makefile.PL 2007-11-19 06:54:46.000000000 -0700 +++ Captcha-reCAPTCHA-Mailhide-0.93-new/Makefile.PL 2007-12-27 11:09:39.000000000 -0700 @@ -17,6 +17,7 @@ 'Crypt::Rijndael' => 0, 'MIME::Base64' => 0, 'HTML::Tiny' => '0.904', + 'Best' => '0.11', }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Captcha-reCAPTCHA-Mailhide-*' }, Only in Captcha-reCAPTCHA-Mailhide-0.93-new/lib: .DS_Store Only in Captcha-reCAPTCHA-Mailhide-0.93-new/lib/Captcha: .DS_Store diff -ru Captcha-reCAPTCHA-Mailhide-0.93/lib/Captcha/reCAPTCHA/Mailhide.pm Captcha-reCAPTCHA-Mailhide-0.93-new/lib/Captcha/reCAPTCHA/Mailhide.pm --- Captcha-reCAPTCHA-Mailhide-0.93/lib/Captcha/reCAPTCHA/Mailhide.pm 2007-11-19 07:06:51.000000000 -0700 +++ Captcha-reCAPTCHA-Mailhide-0.93-new/lib/Captcha/reCAPTCHA/Mailhide.pm 2007-12-27 10:41:42.000000000 -0700 @@ -3,7 +3,7 @@ use warnings; use strict; use Carp; -use Crypt::Rijndael; +use Best qw/Crypt::Rijndael Crypt::Rijndael_PP/; use MIME::Base64; use HTML::Tiny; @@ -229,9 +229,10 @@ =head1 DEPENDENCIES -Crypt::Rijndael, +Crypt::Rijndael or Crypt::Rijndael_PP (Crypt::Rijndael being preferable), MIME::Base64, -HTML::Tiny +HTML::Tiny, +Best =head1 INCOMPATIBILITIES [/snip] I'm kind of wondering *what* exactly else to put in the Makefile.PL - The idea of falling back on Crypt::Rijndael_PP is to be able to install Mailhide without CPAN, or support for a c compiler. We can do something like version.pm: http://search.cpan.org/src/JPEACOCK/version-0.74/Makefile.PL where a --pure_perl flag can be set to Makefile.pm to explicitly install the Pure Perl stuff, and then have the PREREQ_PM look something like this: PREREQ_PM => { 'Test::More' => 0, 'MIME::Base64' => 0, 'HTML::Tiny' => '0.904', 'Best' => '0.11', ( ($no_xs == 1) ? ('Crypt::Rijndael_PP' => 0,) : ('Crypt::Rijndael' => 0,) ) }, which I guess is a personal decision. If you're into that idea, I can give it a test and make sure it works. On Thu Dec 20 07:39:29 2007, ANDYA wrote: Show quoted text
> On Wed Dec 19 23:38:26 2007, JJSIMONI wrote:
> > It would be really wonderful to have support for Crypt::Rijndael_PP,
> so
> > someone could install Captcha-reCAPTCHA-Mailhide without needing
> access
> > to a compiler - Crypt::Rijndael is currently an XS module. > > > > I'll be happy to raise my hand in hacking it together, if you'd be > > interested in taking my diffs. My interest is in including the
> Mailhide
> > functionality in Dada Mail, "out of the box", since a great majority
> of
> > my users aren't familiar with cpan. > > > > It may be as easy as using: > > > > http://search.cpan.org/~gaal/Best-0.11/ > > > > or just wrapping a, "require" in an eval statement and switching to
> the
> > PP version if it fails. > > > > Again - willing to try it out, run the tests and give you some
> diffs.
> > > > Lemme know ;)
> > That sounds like a good plan :) > > Makefile.PL would have to handle the optional deps too. > > If you have time to look at it that'd be most helpful - my head's > going to be full until after > christmas now. > > >
On Thu Dec 27 13:32:39 2007, JJSIMONI wrote: Show quoted text
> Here's the basic changes - I'm taking advantage of the, "Best" module - > this module will allow Mailhide.pm to only need a one line change and > the Makefile to just need one more (Pure Perl) dependency:
Unfortunately it seems that Crypt::Rijndael_PP is not a drop-in replacement for Crypt::Rijndael - so it doesn't quite work as hoped. I guess it might be possible to provide our own compatibility layer around PP - but I haven't had a chance to check that PP supports everything we need. I've checked a branch into the repo (svn checkout http://recaptcha.googlecode.com/svn/trunk/recaptcha-plugins/perl/Captcha-reCAPTCHA- Mailhide/branches/pure_perl/) which is your patch plus a bit of code to auto-detect which Crypt::Rijndael is installed. I've renamed Crypt::Rijndael as Crypt::Rijndael2 in the code so that it attempts to use Crypt::Rijndael_PP instead. As you'll see the tests fail :)
It also turns out that Crypt::Rijndael_PP's CBC mode isn't compatible with Crypt::Rijndael - so it doesn't look like Crypt::Rijndael_PP will do what we want. Fancy doing another pure-Perl port of Crypt::Rijndael? :)
From: me [...] justinsimoni.com
On Sat Dec 29 20:02:45 2007, ANDYA wrote: Show quoted text
> It also turns out that Crypt::Rijndael_PP's CBC mode isn't compatible > with Crypt::Rijndael - so it > doesn't look like Crypt::Rijndael_PP will do what we want. > > Fancy doing another pure-Perl port of Crypt::Rijndael? :)
I'll play around with some stuff. I will say that Best.pm does seem to have some Magic to it, so saying something like (and not having Crypt::Rijndael available): use Best qw/Crypt::Rijndael2 Crypt::Rijndael_PP); my $cipher = Crypt::Rijndael->new(...); Won't work, but: use Best qw/Crypt::Rijndael Crypt::Rijndael_PP); my $cipher = Crypt::Rijndael->new(...); # Will use Crypt::Rijndael_PP should Do What You Mean. But! If Crypt::Rijndael and Crypt::Rijndael_PP don't have API parity, well, that is a problem. I'll play with some stuff. Sadly, Crypto stuff isn't my forté, but mucking with stuff is ;) Thanks for your interest - it's very refreshing. -js
On Sun Dec 30 21:03:52 2007, JJSIMONI wrote: Show quoted text
> On Sat Dec 29 20:02:45 2007, ANDYA wrote:
> > It also turns out that Crypt::Rijndael_PP's CBC mode isn't compatible > > with Crypt::Rijndael - so it > > doesn't look like Crypt::Rijndael_PP will do what we want. > > > > Fancy doing another pure-Perl port of Crypt::Rijndael? :)
> > > I'll play around with some stuff. > > I will say that Best.pm does seem to have some Magic to it, so saying > something like (and not having Crypt::Rijndael available): > > use Best qw/Crypt::Rijndael2 Crypt::Rijndael_PP); > my $cipher = Crypt::Rijndael->new(...); > > Won't work, but: > > use Best qw/Crypt::Rijndael Crypt::Rijndael_PP); > my $cipher = Crypt::Rijndael->new(...); # Will use Crypt::Rijndael_PP > > > should Do What You Mean.
Ah - I missed the magic - sorry Justin. Show quoted text
> But! If Crypt::Rijndael and Crypt::Rijndael_PP don't have API parity, > well, that is a problem. I'll play with some stuff. Sadly, Crypto stuff > isn't my forté, but mucking with stuff is ;)
Yeah, that's the real problem. I haven't contacted Christian Lackas to ask if he plans to fix Crypt::Rijndael_PP but since he hasn't updated it since 2001 I'd guess the answer might be "no". Show quoted text
> Thanks for your interest - it's very refreshing.
You're welcome. Sorry we haven't got anywhere yet...
Yeesh :) I don't *quite* understand how Crypt::Rijndael_PP could be both correct and not work similar to Crypt::Rijndael - I'm suspecting it's just plain broken. It may be an interesting exercise to rewrite that module - there is a pure-ruby implementation of Rijndael that looks similar and is very cleanly written: http://crypt.rubyforge.org/rijndael.html Could use that as inspiration (I don't know Ruby! :) ) and use the same API as Crypt::Rijndael and use the test suite from Crypt::Rijndael as well to see if it's working ;) On the very odd chance I do that, I'll let you and perhaps the CPAN folks know and maybe we can get an at least unofficial Crypt::Rijndael_PP release out. Cheers, -js On Mon Dec 31 07:18:17 2007, ANDYA wrote: Show quoted text
> On Sun Dec 30 21:03:52 2007, JJSIMONI wrote:
> > On Sat Dec 29 20:02:45 2007, ANDYA wrote:
> > > It also turns out that Crypt::Rijndael_PP's CBC mode isn't
> compatible
> > > with Crypt::Rijndael - so it > > > doesn't look like Crypt::Rijndael_PP will do what we want. > > > > > > Fancy doing another pure-Perl port of Crypt::Rijndael? :)
> > > > > > I'll play around with some stuff. > > > > I will say that Best.pm does seem to have some Magic to it, so
> saying
> > something like (and not having Crypt::Rijndael available): > > > > use Best qw/Crypt::Rijndael2 Crypt::Rijndael_PP); > > my $cipher = Crypt::Rijndael->new(...); > > > > Won't work, but: > > > > use Best qw/Crypt::Rijndael Crypt::Rijndael_PP); > > my $cipher = Crypt::Rijndael->new(...); # Will use
> Crypt::Rijndael_PP
> > > > > > should Do What You Mean.
> > Ah - I missed the magic - sorry Justin. >
> > But! If Crypt::Rijndael and Crypt::Rijndael_PP don't have API
> parity,
> > well, that is a problem. I'll play with some stuff. Sadly, Crypto
> stuff
> > isn't my forté, but mucking with stuff is ;)
> > Yeah, that's the real problem. I haven't contacted Christian Lackas to > ask if he plans to fix Crypt::Rijndael_PP but since he hasn't updated > it since 2001 I'd guess the answer might be > "no". >
> > Thanks for your interest - it's very refreshing.
> > You're welcome. Sorry we haven't got anywhere yet...
I'm going to reject this ticket. It's a good idea but I don't think anything's going to happen about it unless someone adopts Crypt::Rijndael_PP. Sorry.