Hi,

I've attached a proposed patch to have 'announce-gen' produce SHA3-256
checksums instead of SHA-1.

I don't think there is much benefit in keeping SHA-1 around, since you
can generate hash collisions. I assume the time/cost per GPU is much
lower nowadays than it was in the 2017 estimates [1].

Furthermore, most people are likely using a 'cksum' version from later
than 2007 which supports SHA-256. So I don't think removing SHA-1 will
do any harm.

It would be nice to have SHA3-256 checksums ready in the unlikely case
that SHA-2 is broken in the foreseeable future.

GNU coreutils 'cksum' has supported SHA3 since 9.8, but it couldn't
derive the digest length from the base64 output. So using
'cksum -a sha3 --check' requires coreutils 9.9.

Here is the output with the proposed patch and without --cksum-checksums
in the invocation:

    $ announce-gen --release-type=alpha --package-name=coreutils \
        --previous-version=0.0 --current-version=9.9.35-cf973 \
        --gpg-key-id=8CE6491AE30D7D75 --url=localhost
    [...]
    Here are the SHA256 and SHA3-256 checksums:
    
      File: coreutils-9.9.35-cf973.tar.gz
      SHA256 sum:   
b5662c336a6bcf03e3d69f5cd53d27a03c51293162c525a6657e6dccf67a716f
      SHA3-256 sum: 
16057652e0d2bfe53751df5f75203999644641867d0802b1df06021e24e6dcbb
    
      File: coreutils-9.9.35-cf973.tar.xz
      SHA256 sum:   
06486a09ac5e2884f9d56b4fef77ee8dae5e91961be030e13f387cf2ec76825a
      SHA3-256 sum: 
6c3fe41615ff3b5b90f5c887510ca03daf18ca8b5306b9ac5790e8fb8f72015f
    [...]

Here is the output with the proposed patch and with --cksum-checksums in
the invocation:

    $ announce-gen --cksum-checksums --release-type=alpha \
        --package-name=coreutils --previous-version=0.0 \
        --current-version=9.9.35-cf973 --gpg-key-id=8CE6491AE30D7D75 \
        --url=localhost
    [...]
    Here are the SHA256 and SHA3-256 checksums:
    
      tWYsM2przwPj1p9c1T0noDxRKTFixSWmZX5tzPZ6cW8=  
coreutils-9.9.35-cf973.tar.gz
      FgV2UuDSv+U3Ud9fdSA5mWRGQYZ9CAKx3wYCHiTm3Ls=  
coreutils-9.9.35-cf973.tar.gz
      BkhqCaxeKIT51WtP73fuja5ekZYb4DDhPzh88ux2glo=  
coreutils-9.9.35-cf973.tar.xz
      bD/kFhX/O1uQ9ciHUQygPa8YyotTBrmsV5Do+49yAV8=  
coreutils-9.9.35-cf973.tar.xz
    
    Verify the base64 SHA256 checksum with cksum -a sha256 --check
    from coreutils-9.2 or OpenBSD's cksum since 2007.
    
    Verify the base64 SHA3-256 checksum with cksum -a sha3 --check
    from coreutils-9.9.
    [...]

And we can see the checksums can be checked:

    $ cksum --version | head -n 1
    cksum (GNU coreutils) 9.9
    $ printf 'SHA3-256 (%s) = %s\nSHA3-256 (%s) = %s\n' \
        'coreutils-9.9.35-cf973.tar.gz' \
        '16057652e0d2bfe53751df5f75203999644641867d0802b1df06021e24e6dcbb' \
        'coreutils-9.9.35-cf973.tar.xz' \
        '6c3fe41615ff3b5b90f5c887510ca03daf18ca8b5306b9ac5790e8fb8f72015f' \
        | cksum -a sha3 --check
    coreutils-9.9.35-cf973.tar.gz: OK
    coreutils-9.9.35-cf973.tar.xz: OK
    $ printf '%s\n%s\n' \
        'FgV2UuDSv+U3Ud9fdSA5mWRGQYZ9CAKx3wYCHiTm3Ls=  
coreutils-9.9.35-cf973.tar.gz' \
        'bD/kFhX/O1uQ9ciHUQygPa8YyotTBrmsV5Do+49yAV8=  
coreutils-9.9.35-cf973.tar.xz' \
        | cksum -a sha3 --check
    coreutils-9.9.35-cf973.tar.gz: OK
    coreutils-9.9.35-cf973.tar.xz: OK

Any objections? Or is this change okay?

Collin

[1] https://shattered.io/static/infographic.pdf

>From 1e9ddb4963b05a9813800cf5e032b76f4edd2296 Mon Sep 17 00:00:00 2001
Message-ID: <1e9ddb4963b05a9813800cf5e032b76f4edd2296.1763865436.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Sat, 22 Nov 2025 17:51:45 -0800
Subject: [PATCH] announce-gen: replace SHA1 checksums with SHA3-256.

* build-aux/announce-gen (usage): Mention that SHA256 and SHA3-256
checksums are used.
(digest_file_base64_wrap): Add padding lengths for SHA3.
(print_checksums): Use SHA3-256 instead of SHA1. Emit instructions for
checking them with coreutils-9.9 and later.
---
 ChangeLog              |  9 +++++++++
 build-aux/announce-gen | 25 ++++++++++++++-----------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4eadd88f12..8fe08e7fdc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-11-22  Collin Funk  <[email protected]>
+
+	announce-gen: replace SHA1 checksums with SHA3-256.
+	* build-aux/announce-gen (usage): Mention that SHA256 and SHA3-256
+	checksums are used.
+	(digest_file_base64_wrap): Add padding lengths for SHA3.
+	(print_checksums): Use SHA3-256 instead of SHA1. Emit instructions for
+	checking them with coreutils-9.9 and later.
+
 2025-11-20  Bruno Haible  <[email protected]>
 
 	strnlen: Fix compilation error (regression 2025-11-18).
diff --git a/build-aux/announce-gen b/build-aux/announce-gen
index 8d02f4f5c8..8af14a48ad 100755
--- a/build-aux/announce-gen
+++ b/build-aux/announce-gen
@@ -35,7 +35,7 @@
 eval 'exec perl -wSx "$0" "$@"'
      if 0;
 
-my $VERSION = '2025-11-14 18:29'; # UTC
+my $VERSION = '2025-11-23 01:42'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -95,9 +95,9 @@ The following are optional:
                                 sign the tarballs
    --gpg-keyring-url=URL        URL pointing to keyring containing the key used
                                 to sign the tarballs
-   --no-print-checksums         do not emit SHA1 or SHA256 checksums
-   --cksum-checksums            emit SHA256 checksums in a form that requires
-                                cksum from coreutils or OpenBSD
+   --no-print-checksums         do not emit SHA256 or SHA3-256 checksums
+   --cksum-checksums            emit SHA256 and SHA3-256 checksums in a form
+                                that requires cksum from coreutils or OpenBSD
    --archive-suffix=SUF         add SUF to the list of archive suffixes
    --mail-headers=HEADERS       a space-separated list of mail headers, e.g.,
                                 To: x\@example.com Cc: y-announce\@example.com,...
@@ -166,7 +166,7 @@ sub print_locations ($\@\%@)
 
 =item C<print_checksums (@file)>
 
-Print the SHA1 and SHA256 signature section for each C<@file>.
+Print the SHA256 and SHA3-256 signature section for each C<@file>.
 
 =cut
 
@@ -180,7 +180,8 @@ sub digest_file_base64_wrap ($$)
   my ($file, $alg) = @_;
   my $h = digest_file_base64($file, $alg);
   $alg =~ tr{-}{}d;
-  my %pad = (MD5 => 2, SHA1 => 1, SHA256 => 1, SHA384 => 0, SHA512 => 2);
+  my %pad = (MD5 => 2, SHA1 => 1, SHA256 => 1, SHA384 => 0, SHA512 => 2,
+             SHA3256 => 1, SHA3384 => 0, SHA3512 => 2);
   return $h . '=' x $pad{$alg};
 }
 
@@ -188,7 +189,7 @@ sub print_checksums ($@)
 {
   my ($prefer_cksum, @file) = @_;
 
-  print "Here are the SHA1 and SHA256 checksums:\n";
+  print "Here are the SHA256 and SHA3-256 checksums:\n";
   print "\n";
 
   use Digest::file qw(digest_file_hex digest_file_base64);
@@ -197,19 +198,21 @@ sub print_checksums ($@)
     {
       foreach my $f (@file)
         {
-          print '  ', digest_file_hex ($f, "SHA-1"), "  $f\n";
           print '  ', digest_file_base64_wrap ($f, "SHA-256"), "  $f\n";
+          print '  ', digest_file_base64_wrap ($f, "SHA3-256"), "  $f\n";
         }
       print "\nVerify the base64 SHA256 checksum with cksum -a sha256 --check\n";
-      print "from coreutils-9.2 or OpenBSD's cksum since 2007.\n\n";
+      print "from coreutils-9.2 or OpenBSD's cksum since 2007.\n";
+      print "\nVerify the base64 SHA3-256 checksum with cksum -a sha3 --check\n";
+      print "from coreutils-9.9.\n\n";
     }
   else
     {
       foreach my $f (@file)
         {
           print "  File: $f\n";
-          print '  SHA1 sum:   ', digest_file_hex ($f, "SHA-1"), "\n";
-          print '  SHA256 sum: ', digest_file_hex ($f, "SHA-256"), "\n";
+          print '  SHA256 sum:   ', digest_file_hex ($f, "SHA-256"), "\n";
+          print '  SHA3-256 sum: ', digest_file_hex ($f, "SHA3-256"), "\n";
           print "\n";
         }
     }
-- 
2.51.1

Reply via email to