From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#58472: [PATCH] Make `message-unique-id' less prone to collisions Date: Fri, 14 Oct 2022 11:22:15 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7280"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58472@debbugs.gnu.org, Matt Armstrong To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 14 11:24:18 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 1ojGvS-0001ff-BX for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Oct 2022 11:24:18 +0200 Original-Received: from localhost ([::1]:57220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ojGvR-0007gD-Ey for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Oct 2022 05:24:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojGuF-0006Ii-B3 for bug-gnu-emacs@gnu.org; Fri, 14 Oct 2022 05:23:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36701) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ojGuF-0005xL-2k for bug-gnu-emacs@gnu.org; Fri, 14 Oct 2022 05:23:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ojGuE-0002Bl-Qz for bug-gnu-emacs@gnu.org; Fri, 14 Oct 2022 05:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Oct 2022 09:23:02 +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.16657393448318 (code B ref 58472); Fri, 14 Oct 2022 09:23:02 +0000 Original-Received: (at 58472) by debbugs.gnu.org; 14 Oct 2022 09:22:24 +0000 Original-Received: from localhost ([127.0.0.1]:35774 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojGtb-0002A5-Nx for submit@debbugs.gnu.org; Fri, 14 Oct 2022 05:22:24 -0400 Original-Received: from mail-oa1-f49.google.com ([209.85.160.49]:34696) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojGtY-00029W-OZ for 58472@debbugs.gnu.org; Fri, 14 Oct 2022 05:22:21 -0400 Original-Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-1321a1e94b3so5221735fac.1 for <58472@debbugs.gnu.org>; Fri, 14 Oct 2022 02:22:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=XP69grA8CU5BIRUEFl88VcvLghceuOuO/35b2i4A33c=; b=W+NGsGQ012nZh83Sg7Uth4pCeiIRdi8zjmRo5BJrvdsQ97x3PRKESiJ9EY/avoO6kq OOov2hyFrZerYnyXa/SdVeLZ9zhH5zcSpVv95a4MC7+YXQgC1FbeeO2p8ZAHjT9OqVZS 1nODf1Bk7Is7uhI9j1FOYTgV3vnBsM6qnOjQr+8+nFK6eKjMDatHTpfzBO9kWrNI1YJU yABPD1xtyw8fT0Oc/6rmZMAFdQky+bGmAZZvT8PyRHh8GFc3xTxjNCyv6fy8/F5GMnqm AXdrA4w6LR6axNxTua75+hwYTGWU3Djv19pzBPYmQjQ9RuSkRfavE5AKQcRPHDxHZWmS WTXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XP69grA8CU5BIRUEFl88VcvLghceuOuO/35b2i4A33c=; b=SreJytpvLarNzJ5UHIMz4Gtns0beQ3yheV+np41Qv3c2fcdAG4uplMsolXwdZ7L3Zo WUzuxq3zCyCwp8h4sedBKfwUakfCDHpJ0oMS7u/JzC5fl5QnVgl5v6xO8InW1DQ1jG7R +qZArykO588KBUk4vpjwJcPJszP6FET9KzBN4SIacaqTBr/XBf1Cz/CYDBKitVADIgvW Zlp+VeL0HqfNzsO9ziqdaYq9LA/LlmT622s0JPqtBdKMxVh6heBmFtWwyCGhdShp9Vnu vkTIGv1YSrFeD5ON3vTjcDdhLunioVH3U7reKS/dSoy+sjPUALCcSZcFGVyiYBF8I5pi cFcA== X-Gm-Message-State: ACrzQf2Actv5F5X9hmPnibs+GYvPXyf1ccV3pfzjBJgM/FdxH2/pCzXk mnyB/WuGaPoCIUVjTKIMx0aoJEnfWYt8CpdoLJuCd7z+ X-Google-Smtp-Source: AMsMyM543XAznGlaixaViTvpa+VfG0YXWO8gLSIfPA35Ta45Wy/7QQltzLnwnMLqmzxrSlM81K8l1/dzvHu/uM1ozaE= X-Received: by 2002:a05:6870:9126:b0:132:b724:e96c with SMTP id o38-20020a056870912600b00132b724e96cmr7957485oae.199.1665739335413; Fri, 14 Oct 2022 02:22:15 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 14 Oct 2022 11:22:15 +0200 In-Reply-To: X-Hashcash: 1:20:221014:matt@rfc20.org::QRB+u2lpf+YGObX5:4JFM 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:245388 Archived-At: Paul Eggert writes: > That info is in the Date: line, along with zillions of other Received: > lines. There should be no need to repeat it in the Message-ID line. OK, let's use only random data. > If that's a concern, we should be using more-random data, e.g., with > > (base64-encode-string > (secure-hash 'md5 'iv-auto 128 nil t)) > > if we want 128 bits of randomness (this yields a string like > "B8a3usyu5QSE/rTLu0nIHg=="). Sounds good to me, but: The only reference I find to `iv-auto' is in (info "(elisp) Format of GnuTLS Cryptography Inputs"). The `secure-hash' OBJECT parameter is documented like this: The argument OBJECT should be a buffer or a string. Is the documentation incomplete? > As an aside, it's weird that there's no easy way to ask Emacs for an > N-bit random integer, where the randomness is taken from system entropy. > Shouldn't we extend Emacs to support that? E.g., (make-string 128 > 'iv-auto) could give you an N-byte entropy-derived random string, or > (random -N) could give you an N-bit entropy-derived random nonnegative > integer, or something like that. Then we could write something like this: > > (base64-encode-string (make-string 16 'iv-auto)) > > to get a Message-ID component with 16 bytes (128 bits) of entropy. Yes, we should find a better interface here. We also have `cl-random', which I think support float values. Perhaps `random' should do the same? (See also Bug#9103.) Oh, and whatever we do, we should probably also document it in `(elisp) Random Numbers'.