From 80461f24c903330e05634f842c27e3065b63112c Mon Sep 17 00:00:00 2001 From: millert Date: Tue, 31 Oct 2023 20:42:14 +0000 Subject: [PATCH] cksum: better describe the -c (checklist) option The -c option can handle entries in normal (BSD) and reverse (GNU) format. Both hex and base64 entries are supported. OK jmc@ --- bin/md5/cksum.1 | 26 ++++++++++++++++++-------- bin/md5/md5.1 | 24 ++++++++++++++++-------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/bin/md5/cksum.1 b/bin/md5/cksum.1 index 75fc56cb261..3b8a8cdd9a0 100644 --- a/bin/md5/cksum.1 +++ b/bin/md5/cksum.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cksum.1,v 1.41 2023/08/18 14:10:33 kn Exp $ +.\" $OpenBSD: cksum.1,v 1.42 2023/10/31 20:42:14 millert Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)cksum.1 8.2 (Berkeley) 4/28/95 .\" -.Dd $Mdocdate: August 18 2023 $ +.Dd $Mdocdate: October 31 2023 $ .Dt CKSUM 1 .Os .Sh NAME @@ -61,7 +61,10 @@ and name of the file or string. If no file name is specified, the standard input is used and no file name is written. .It all others -The output line consists of four whitespace separated fields: +Unless the +.Fl r +option is specified (see below), +output lines consist of four whitespace separated fields: the name of the algorithm used, the name of the file or string in parentheses, an equals sign, and the cryptographic hash of the input. If no file name is specified, the standard input is used and only @@ -115,11 +118,15 @@ will generate an error. If this option is specified, the .Ar file options become checklists. -Each checklist should contain hash results in the normal format, -which will be verified against the specified paths. +Each checklist should contain hash results, which will be verified +against the specified paths. +Both normal (BSD) and reverse (GNU) forms are supported in either +hexadecimal or base64 format. Output consists of the digest used, the file name, and an OK, FAILED, or MISSING for the result of the comparison. -This will validate any of the supported checksums. +Entries in normal format can be validated using any of the supported checksums. +Entries in reverse format are validated using the specified algorithm +(or the default algorithm if none is specified). If no file is given, stdin is used. The .Fl c @@ -138,8 +145,11 @@ Only print the checksum (quiet mode) or if used in conjunction with the .Fl c flag, only print the failed cases. .It Fl r -Reverse the format of the hash algorithm output, making -it match the checksum output format. +Reverse the format of the hash algorithm output, similar to +the checksum output format (but without the number of octets). +This is also the format used by the GNU +.Nm cksum +utility. .It Fl s Ar string Print a checksum of the given .Ar string . diff --git a/bin/md5/md5.1 b/bin/md5/md5.1 index e92828c9673..732191f83b7 100644 --- a/bin/md5/md5.1 +++ b/bin/md5/md5.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: md5.1,v 1.49 2023/08/18 14:10:33 kn Exp $ +.\" $OpenBSD: md5.1,v 1.50 2023/10/31 20:42:14 millert Exp $ .\" .\" Copyright (c) 2003, 2004, 2006 Todd C. Miller .\" @@ -18,7 +18,7 @@ .\" Agency (DARPA) and Air Force Research Laboratory, Air Force .\" Materiel Command, USAF, under agreement number F39502-99-1-0512. .\" -.Dd $Mdocdate: August 18 2023 $ +.Dd $Mdocdate: October 31 2023 $ .Dt MD5 1 .Os .Sh NAME @@ -77,12 +77,16 @@ will generate an error. If this option is specified, the .Ar file options become checklists. -Each checklist should contain hash results in the normal format, -which will be verified against the specified paths. +Each checklist should contain hash results, which will be verified +against the specified paths. +Both normal (BSD) and reverse (GNU) forms are supported in either +hexadecimal or base64 format. Output consists of the digest used, the file name, and an OK, FAILED, or MISSING for the result of the comparison. -This will validate any of the supported checksums (see +Entries in normal format can be validated using any of the supported checksums +(see .Xr cksum 1 ) . +Entries in reverse format are validated using the default algorithm. If no file is given, stdin is used. .It Fl h Ar hashfile Place the checksum into @@ -96,9 +100,13 @@ Only print the checksum (quiet mode) or if used in conjunction with the .Fl c flag, only print the failed cases. .It Fl r -Reverse the format of the hash algorithm output, making -it match the output format used by -.Xr cksum 1 . +Reverse the format of the hash algorithm output, similar to +the output format used by +.Xr cksum 1 +(but without the number of octets). +This is also the format used by the GNU +.Xr cksum 1 +utility. .It Fl s Ar string Print a checksum of the given .Ar string . -- 2.20.1