* [PATCH] lei_dedupe: simplify smsg_hash sub
@ 2023-03-11 17:36 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-03-11 17:36 UTC (permalink / raw)
To: meta
We can just use the sha256() sub instead of dealing with the
OO interface for a small string.
---
lib/PublicInbox/LeiDedupe.pm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/lib/PublicInbox/LeiDedupe.pm b/lib/PublicInbox/LeiDedupe.pm
index 22864508..86cd8490 100644
--- a/lib/PublicInbox/LeiDedupe.pm
+++ b/lib/PublicInbox/LeiDedupe.pm
@@ -1,10 +1,9 @@
# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-11 17:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-11 17:36 [PATCH] lei_dedupe: simplify smsg_hash sub Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).