From: Eric Wong Date: Sat, 11 Mar 2023 17:36:00 +0000 (+0000) Subject: lei_dedupe: simplify smsg_hash sub X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36f8d51742b04c951e8bdacf70b5413d9c418287;p=thirdparty%2Fpublic-inbox.git lei_dedupe: simplify smsg_hash sub We can just use the sha256() sub instead of dealing with the OO interface for a small string. --- diff --git a/lib/PublicInbox/LeiDedupe.pm b/lib/PublicInbox/LeiDedupe.pm index 22864508b..86cd8490d 100644 --- a/lib/PublicInbox/LeiDedupe.pm +++ b/lib/PublicInbox/LeiDedupe.pm @@ -1,10 +1,9 @@ # Copyright (C) all contributors # License: AGPL-3.0+ package PublicInbox::LeiDedupe; -use strict; -use v5.10.1; +use v5.12; use PublicInbox::ContentHash qw(content_hash git_sha); -use PublicInbox::SHA (); +use PublicInbox::SHA qw(sha256); # n.b. mutt sets most of these headers not sure about Bytes our @OID_IGNORE = qw(Status X-Status Content-Length Lines Bytes); @@ -30,11 +29,9 @@ sub _oidbin ($) { defined($_[0]) ? pack('H*', $_[0]) : undef } sub smsg_hash ($) { my ($smsg) = @_; - my $dig = PublicInbox::SHA->new(256); my $x = join("\0", @$smsg{qw(from to cc ds subject references mid)}); utf8::encode($x); - $dig->add($x); - $dig->digest; + sha256($x); } # the paranoid option