File tree Expand file tree Collapse file tree
main/java/com/maxmind/minfraud/request
test/java/com/maxmind/minfraud/request Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ CHANGELOG
2929 used. For example, ` gmali.com ` will become ` gmail.com ` .
3030* When ` hashAddress ` is used, all trailing periods are now removed from an
3131 email address domain. Previously only a single period was removed.
32+ * When ` hashAddress ` is used, the local part of an email address is now
33+ normalized to NFC.
3234
33353.3.0 (2023-12-05)
3436------------------
Original file line number Diff line number Diff line change 77import java .nio .charset .StandardCharsets ;
88import java .security .MessageDigest ;
99import java .security .NoSuchAlgorithmException ;
10+ import java .text .Normalizer ;
1011import java .util .Arrays ;
1112import java .util .Collections ;
1213import java .util .HashMap ;
@@ -422,6 +423,7 @@ private String cleanAddress(String address) {
422423 String localPart = address .substring (0 , domainIndex );
423424 String domain = address .substring (domainIndex + 1 );
424425
426+ localPart = Normalizer .normalize (localPart , Normalizer .Form .NFC );
425427 domain = cleanDomain (domain );
426428
427429 int stopChar ;
Original file line number Diff line number Diff line change @@ -228,6 +228,11 @@ public void testNormalizing() throws NoSuchAlgorithmException {
228228 assertEquals ("2b21bc76dab3c8b1622837c1d698936c" , e .getAddress (), "MD5" );
229229 e = new Builder ().address ("example@b\u00FC cher.com" ).hashAddress ().build ();
230230 assertEquals ("2b21bc76dab3c8b1622837c1d698936c" , e .getAddress (), "MD5" );
231+
232+ e = new Builder ().address ("bu\u0308 cher@example.com" ).hashAddress ().build ();
233+ assertEquals ("53550c712b146287a2d0dd30e5ed6f4b" , e .getAddress (), "MD5" );
234+ e = new Builder ().address ("b\u00FC cher@example.com" ).hashAddress ().build ();
235+ assertEquals ("53550c712b146287a2d0dd30e5ed6f4b" , e .getAddress (), "MD5" );
231236 }
232237
233238 private String toMD5 (String s ) throws NoSuchAlgorithmException {
You can’t perform that action at this time.
0 commit comments