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: Sun, 16 Oct 2022 16:49:45 +0000 Message-ID: References: <871qr794o2.fsf@rfc20.org> 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="22550"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58472@debbugs.gnu.org To: Matt Armstrong , Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 16 18:50:25 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 1ok6qG-0005cU-PH for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 16 Oct 2022 18:50:24 +0200 Original-Received: from localhost ([::1]:50834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ok6qD-0002x2-Pu for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 16 Oct 2022 12:50:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ok6pu-0002ve-W5 for bug-gnu-emacs@gnu.org; Sun, 16 Oct 2022 12:50:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46896) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ok6pu-00067z-D8 for bug-gnu-emacs@gnu.org; Sun, 16 Oct 2022 12:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ok6pu-0001Ni-25 for bug-gnu-emacs@gnu.org; Sun, 16 Oct 2022 12:50: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: Sun, 16 Oct 2022 16:50: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.16659389945292 (code B ref 58472); Sun, 16 Oct 2022 16:50:02 +0000 Original-Received: (at 58472) by debbugs.gnu.org; 16 Oct 2022 16:49:54 +0000 Original-Received: from localhost ([127.0.0.1]:45974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ok6pl-0001NI-R9 for submit@debbugs.gnu.org; Sun, 16 Oct 2022 12:49:54 -0400 Original-Received: from mail-oo1-f46.google.com ([209.85.161.46]:42937) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ok6pj-0001N4-Rw for 58472@debbugs.gnu.org; Sun, 16 Oct 2022 12:49:52 -0400 Original-Received: by mail-oo1-f46.google.com with SMTP id r15-20020a4abf0f000000b004761c7e6be1so2345532oop.9 for <58472@debbugs.gnu.org>; Sun, 16 Oct 2022 09:49:51 -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=X04eCmDiRAyfWBAUxuP8jGwpNcL9q8DcNFwKIPZrWi4=; b=hj5IHRQvHupd8NPENa+8CC6tdRaijzvCFLgxx+1V7VgzyH9AjYbjhhARpNeKF2kVq5 CvGEeq2XLULwnD31ihrEfon48ZhIoPzEOPS4lJ9zh4WbPiCaOMcsk7EkNuc6izbJ4HA4 PGc8glQDi66qHfujeSCc3AmKM27TuZqYQQezAiEMRBpZVO8xAh7C4g6DY30/pHfJprLW vEQ+MeWtkGQNKy/D/hwK4gPmHVhUYobUyjBLjc+xlPcfcJhlUq4+xA0x7NZUt3rME9if nJuJBDE2cZJeq0kN8/9WyPhgufA/SCD+vZUsA9iiSZhJkCdLhVmbfjDlXhqalT2Ue3tn /f6g== 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=X04eCmDiRAyfWBAUxuP8jGwpNcL9q8DcNFwKIPZrWi4=; b=kkSgc0bWAmzBUIgeALcMU+2JM6LNS/3/oar3+ASQ2nGJBEgjS8uE2JEw75/3YO6GFo GeyG5O9/coSNe+yg7M+lCAcN/vYcx3aQBlVnBMp5/cPt6EGbIxG7owrmKVPT9pNSDLAC BKAnCvsap9uZH+FzFqtifkzZKPx2+sbeI53ip1fygluDdQFRZbg5hIt/LYZrgjSpG994 b8mGPwjMbJXypRy2ZtuXF+VpCDfh27eYkoAyIXbvpqK6waCTvvUw1suotYa+lxmC04mZ uZYKSaph8TLDOomCNkAM7Wl02fHMlO4yhkRMLRa67LMoAH5aiWQJoyJ2lh2eezxeV/n8 XE0A== X-Gm-Message-State: ACrzQf3Ds/Nt0TDNDhiUPLCNZFi2WBgApzsPii263AlNt+luWmXmr7Va n7XO/Vz1mZ99Iu1vWNJEg4ibFYzwcZ2tD5EN+Zg= X-Google-Smtp-Source: AMsMyM7K60CPUWO+27C7fnSsdpujllBMpAJMfRr1qbSsL0OzvWEkUre786ytULf7FrPuFTlL/TcTq7Ger4x9dHVuPnE= X-Received: by 2002:a05:6820:1746:b0:47f:926a:286d with SMTP id bf6-20020a056820174600b0047f926a286dmr2790072oob.5.1665938986012; Sun, 16 Oct 2022 09:49:46 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 16 Oct 2022 16:49:45 +0000 In-Reply-To: <871qr794o2.fsf@rfc20.org> X-Hashcash: 1:20:221016:58472@debbugs.gnu.org::b0q0e+jWfcchq76g:74oI 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:245665 Archived-At: Matt Armstrong writes: > Since some tools expect users to work directly with Message-ID at > times (https://notmuchmail.org/) it might be nice to avoid leading > non-alnum chars, I agree that it'd be nice to just use alpha-numeric characters. > Maybe a base 62 encoder could be written just for this, as Emacs' > version of this doesn't need to be fast. A base62 encoder is just `message-number-base36' with the A-Z range added. I think I included that in a previous patch. > Can a string be turned into a non-negative bignum integer in > (simple) elisp? Does this look reasonable? (seq-reduce (lambda (a i) (+ (ash a 8) i)) (secure-hash 'md5 'iv-auto 128 nil t) 0)