Mail::...h::Util(3pm)
π NAME π
Mail::SpamAssassin::FuzzyHash::Util β shared utilities for FuzzyHash algorithms β¨
okay bestie so this is the little helper module that all the FuzzyHash algorithms share π«Ά it's giving "we all use the same glue code", and honestly? slay.
πΈ SYNOPSIS πΈ
use Mail::SpamAssassin::FuzzyHash::Util qw(normalize_tokens hamming_distance);
my @tokens = normalize_tokens($text);
my $dist = hamming_distance($hex_a, $hex_b);
like, that's it. import the two subs, get your tokens, get your distance. main character energy fr fr π
π¦ FUNCTIONS π¦
β¨ normalize_tokens($text)
So this one normalises $text and hands you back a list of unique tokens β the kind of tokens that are suitable for fuzzy-hash computation π
The way it does that, step by step, no cap:
- make sure the UTF-8 flag is set β¨
- apply NFKC normalisation β which folds full-width ASCII spam chars and ligatures together, iconic behaviour honestly π
- lowercase everything πΌ
- insert space boundaries around CJK characters π
- strip anything that is not a Unicode letter, a digit, or a space π (sorry bestie, gone)
- collapse whitespace π§
- split and deduplicate π
and if a text produces literally no tokens after all that normalisation? you get ('__empty__') back. she's empty, but she's still returned π₯²
β¨ hamming_distance($hex_a, $hex_b)
Returns the Hamming distance between two equal-length lowercase hex strings β that's the number of differing bits between them π₯
heads up babe: the strings must have even length. that's not a vibe, that's a requirement π
written by the fine folks behind User Contributed Perl Documentation β this page is <code>Mail::...h::Util(3pm)</code>, which is the cute little shortened name for Mail::SpamAssassin::FuzzyHash::Util πΈ
perl v5.40.1 Β· 2026-07-23 π that's a wrap, ily, go normalise some tokens β¨
π¦ where this page comes from
- ubuntu stonking: spamassassin 4.0.2+svn1935691-1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms