From e6aa13bccb7ea5d5b3246b3a944621515905e360 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 29 Jan 2023 10:30:41 +0000 Subject: use Net::SSLeay (OpenSSL) for SHA-(1|256) if installed On my x86-64 machine, OpenSSL SHA-256 is nearly twice as fast as the Digest::SHA implementation from Perl, most likely due to an optimized assembly implementation. SHA-1 is a few percent faster, too. --- lib/PublicInbox/MID.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/MID.pm') diff --git a/lib/PublicInbox/MID.pm b/lib/PublicInbox/MID.pm index 35b517e0..4819cc25 100644 --- a/lib/PublicInbox/MID.pm +++ b/lib/PublicInbox/MID.pm @@ -1,15 +1,15 @@ -# Copyright (C) 2015-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # # Various Message-ID-related functions. package PublicInbox::MID; use strict; -use warnings; -use base qw/Exporter/; +use v5.10.1; # TODO: check unicode_strings compat for v5.12 +use parent qw(Exporter); our @EXPORT_OK = qw(mid_clean id_compress mid2path mid_escape MID_ESC mids references mids_for_index mids_in $MID_EXTRACT); use URI::Escape qw(uri_escape_utf8); -use Digest::SHA qw/sha1_hex/; +use PublicInbox::SHA qw(sha1_hex); require PublicInbox::Address; use constant { ID_MAX => 40, # SHA-1 hex length for HTML id anchors -- cgit v1.2.3-24-ge0c7