From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.bugs Subject: bug#58472: [PATCH] Make `message-unique-id' less prone to collisions Date: Wed, 12 Oct 2022 21:53:44 -0700 Message-ID: <87k054qq7b.fsf@rfc20.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40709"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 58472@debbugs.gnu.org, Paul Eggert To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 13 06:54:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiqEU-000AO5-K1 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Oct 2022 06:54:10 +0200 Original-Received: from localhost ([::1]:51872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiqET-0003vN-74 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Oct 2022 00:54:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiqEM-0003vF-Ji for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 00:54:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiqEM-0005xf-3i for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 00:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oiqEL-0006bs-OF for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 00:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Matt Armstrong Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Oct 2022 04:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58472 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58472-submit@debbugs.gnu.org id=B58472.166563683925395 (code B ref 58472); Thu, 13 Oct 2022 04:54:01 +0000 Original-Received: (at 58472) by debbugs.gnu.org; 13 Oct 2022 04:53:59 +0000 Original-Received: from localhost ([127.0.0.1]:58892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiqEI-0006bX-QD for submit@debbugs.gnu.org; Thu, 13 Oct 2022 00:53:59 -0400 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:37521) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiqEF-0006bG-9A for 58472@debbugs.gnu.org; Thu, 13 Oct 2022 00:53:56 -0400 Original-Received: (Authenticated sender: matt@rfc20.org) by mail.gandi.net (Postfix) with ESMTPSA id 029A1C0004; Thu, 13 Oct 2022 04:53:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rfc20.org; s=gm1; t=1665636828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/cJKUb9ee+F5o+n9fwqt4dxMAxOx/3mF6yf3mwSK9JU=; b=km74a00vSKuqDARoHF49tVn+2f7woQprV7hPCIoD3/P6lDYq3G+B5A6AWC7CkP76clDOFk 5PNdKaIWxiD1wab9JGan23JFfQb1r8pWoOFxKtwFF2mO85n76aJnWZlkNR/YMnSbmsD02L PDsIP7AtBhmM6h6o7ymF3CrCIIN6OBJ3YBLOUbzeof7tbJAo3EO12fdvk4l7b9wuEn2MID +/PP47hrBcdM3i5p/hQl0NMYv53bGoq9Ci3IzT+s1zjESma2BBAh+183Zlsi8U/5V1jc3i 5PKt/OkjQQQPv40aiGy6CcNmIkVOq+XpZ7yoEYKjD9YKtUPOmt611m1RfKh+qw== Original-Received: from matt by naz with local (Exim 4.96) (envelope-from ) id 1oiqE4-000972-2W; Wed, 12 Oct 2022 21:53:44 -0700 In-Reply-To: (Stefan Kangas's message of "Wed, 12 Oct 2022 19:46:14 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:245265 Archived-At: Stefan Kangas writes: > Paul Eggert writes: > >> If the goal is to avoid collisions, though, wouldn't it be better to >> avoid the time entirely? time is not very random in the high order bits. > > The main goal is to avoid collisions, but using the time also gives an > idea of when the message was sent, which is kind of nice. Time also > guarantees a somewhat unique value even if the user has happened to set > the random seed. Most email I get today to use a UUID or UUID-like Message-ID, like this: Message-ID: <736d10a6-001f-4a29-a1d4-554f58733b69@dfw1s10mta1086.xt.local> Message-ID: <1815053947.8446619.1665544925708@lor1-app45123.prod.linkedin.c= om> Message-ID: <01000183b9eaa6f8-411d1f4c-b573-472d-b45f-47b0c4eb6ace-000000@e= mail.amazonses.com> Message-ID: > If we limit the length of the time string to 12 characters, and the > total length to 25 characters (including the ".gnu" part), we still have > a guaranteed 9 characters of random data, or 46 bits of entropy. > > =E2=8C=8Alog=E2=82=82 36=E2=81=B9=E2=8C=8B =3D 46 > > If we want to guarantee 62 bits of entropy, we could do a total length > of 28 characters instead, but that might be overkill. I suspect that most mailers use more randomness than that. Some of the SHA hash algorithms are in the public domain. Could they be added to Emacs and used for UUID generation here? --=20 matt (sent from an Emacs running the feature/noverlay branch)