SA Bugzilla – Bug 7993
Plugin HashBL.pm: allow usage of HBL from Spamhaus
Last modified: 2022-05-17 05:44:37 UTC
Currently, if you want to use Spamhaus's HBL, you need to use Spamhaus's SH.pm plugin. Since this plugin is implemented extremely inefficiently, it has no caching implemented, it would be good if you could use the plugin HashBL.pm for this. HashBL.pm has implemented only md5 and sha1 as hash functions, SH.pm on the other hand uses sha256. Therefore the line use Digest::SHA qw(sha1_hex); should be extended to use Digest::SHA qw(sha1_hex sha256); In addition, encode_base32 from MIME::Base32 is required. SH.pm simply copied this function into the plugin. In sub _hash another branch is needed with return encode_base32(sha256($value)); Of course the options have to be adjusted as well.
Is there Perl/Apache conflict for directly copying a single function from CPAN? I'd hate to require one more obscure module, so we should make our own Util/encode_base32 from scratch if required.. ;-)
^ I mean license conflict
I would make it optional and only complain if sha256 is used and module MIME::Base32 is not available. I'm not sure if you can reprogram the function. I definitely do not understand how this function works.
Henrik, copying anything from anywhere with a non-ASLv2 license could cause issues, yes. Often times I ask the author and have many times over the years gotten quick permission for stuff like this.
The base-family encoding is really simple when you understand it. I committed a super simple unoptimized Util/base32_encode (Revision 1900976). sha256 option added: Committed revision 1900977.