1*f3343fe4SGordon Bergling.Dd March 12, 2024 2f22592e7SJohn-Mark Gurney.Dt MD5 1 3f22592e7SJohn-Mark Gurney.Os 4f22592e7SJohn-Mark Gurney.Sh NAME 52768d705SDag-Erling Smørgrav.Nm md5 , sha1 , sha224 , sha256 , sha384 , 62768d705SDag-Erling Smørgrav.Nm sha512 , sha512t224 , sha512t256 , 72768d705SDag-Erling Smørgrav.Nm rmd160 , skein256 , skein512 , skein1024 , 82768d705SDag-Erling Smørgrav.Nm md5sum , sha1sum , sha224sum , sha256sum , sha384sum , 92768d705SDag-Erling Smørgrav.Nm sha512sum , sha512t224sum , sha512t256sum , 104849767cSDag-Erling Smørgrav.Nm rmd160sum , skein256sum , skein512sum , skein1024sum , 114849767cSDag-Erling Smørgrav.Nm shasum 12f22592e7SJohn-Mark Gurney.Nd calculate a message-digest fingerprint (checksum) for a file 13f22592e7SJohn-Mark Gurney.Sh SYNOPSIS 148ff3cdd1SConrad Meyer.Nm 15cb49d42bSOliver Eikemeier.Op Fl pqrtx 1674525359SEitan Adler.Op Fl c Ar string 17cb49d42bSOliver Eikemeier.Op Fl s Ar string 18cb49d42bSOliver Eikemeier.Op Ar 19c2870e57SStefan Eßer.Pp 2084f35b6fSStefan Eßer.Nm md5sum 214849767cSDag-Erling Smørgrav.Op Fl bctwz 224849767cSDag-Erling Smørgrav.Op Fl -binary 234849767cSDag-Erling Smørgrav.Op Fl -check 244849767cSDag-Erling Smørgrav.Op Fl -help 254849767cSDag-Erling Smørgrav.Op Fl -ignore-missing 264849767cSDag-Erling Smørgrav.Op Fl -quiet 274849767cSDag-Erling Smørgrav.Op Fl -status 284849767cSDag-Erling Smørgrav.Op Fl -strict 294849767cSDag-Erling Smørgrav.Op Fl -tag 304849767cSDag-Erling Smørgrav.Op Fl -text 314849767cSDag-Erling Smørgrav.Op Fl -version 324849767cSDag-Erling Smørgrav.Op Fl -warn 334849767cSDag-Erling Smørgrav.Op Fl -zero 3484f35b6fSStefan Eßer.Op Ar 358ff3cdd1SConrad Meyer.Pp 368ff3cdd1SConrad Meyer(All other hashes have the same options and usage.) 374849767cSDag-Erling Smørgrav.Pp 384849767cSDag-Erling Smørgrav.Nm shasum 394849767cSDag-Erling Smørgrav.Op Fl 0bchqstUvw 404849767cSDag-Erling Smørgrav.Op Fl -01 414849767cSDag-Erling Smørgrav.Op Fl a | -algorithm Ar alg 424849767cSDag-Erling Smørgrav.Op Fl -binary 434849767cSDag-Erling Smørgrav.Op Fl -check 444849767cSDag-Erling Smørgrav.Op Fl -help 454849767cSDag-Erling Smørgrav.Op Fl -ignore-missing 464849767cSDag-Erling Smørgrav.Op Fl -quiet 474849767cSDag-Erling Smørgrav.Op Fl -status 484849767cSDag-Erling Smørgrav.Op Fl -strict 494849767cSDag-Erling Smørgrav.Op Fl -tag 504849767cSDag-Erling Smørgrav.Op Fl -text 514849767cSDag-Erling Smørgrav.Op Fl -UNIVERSAL 524849767cSDag-Erling Smørgrav.Op Fl -version 534849767cSDag-Erling Smørgrav.Op Fl -warn 544849767cSDag-Erling Smørgrav.Op Ar 55f22592e7SJohn-Mark Gurney.Sh DESCRIPTION 5692b425d0SPhilippe CharnierThe 572768d705SDag-Erling Smørgrav.Nm md5 , sha1 , sha224 , sha256 , sha384 , sha512 , sha512t224 , sha512t256 , 582768d705SDag-Erling Smørgrav.Nm rmd160 , skein256 , skein512 , 59cb49d42bSOliver Eikemeierand 6040d3e536SAllan Jude.Nm skein1024 61cb49d42bSOliver Eikemeierutilities take as input a message of arbitrary length and produce as 62cb49d42bSOliver Eikemeieroutput a 63f22592e7SJohn-Mark Gurney.Dq fingerprint 64f22592e7SJohn-Mark Gurneyor 65f22592e7SJohn-Mark Gurney.Dq message digest 66ee355dcbSRuslan Ermilovof the input. 674849767cSDag-Erling Smørgrav.Pp 68086feed8SWarner LoshThe 69086feed8SWarner Losh.Nm md5sum , sha1sum , sha224sum , sha256sum , sha384sum , sha512sum , 702768d705SDag-Erling Smørgrav.Nm sha512t224sum , sha512t256sum , rmd160sum , skein256sum , skein512sum , 71086feed8SWarner Loshand 72086feed8SWarner Losh.Nm skein1024sum 734849767cSDag-Erling Smørgravutilities do the same, but with command-line options and an output 744849767cSDag-Erling Smørgravformat that match those of their similary named GNU utilities. 754849767cSDag-Erling Smørgrav.Pp 764849767cSDag-Erling SmørgravThe 774849767cSDag-Erling Smørgrav.Nm shasum 784849767cSDag-Erling Smørgravutility does the same, but with command-line options and an output 794849767cSDag-Erling Smørgravformat that match those of the similarly named utility that ships with 804849767cSDag-Erling SmørgravPerl. 814849767cSDag-Erling Smørgrav.Pp 8272ee91feSDag-Erling SmørgravIn all cases, each file listed on the command line is processed separately. 8372ee91feSDag-Erling SmørgravIf no files are listed on the command line, or a file name is given as 8472ee91feSDag-Erling Smørgrav.Pa - , 8572ee91feSDag-Erling Smørgravinput is taken from stdin instead. 8672ee91feSDag-Erling Smørgrav.Pp 87ee355dcbSRuslan ErmilovIt is conjectured that it is computationally infeasible to 88f22592e7SJohn-Mark Gurneyproduce two messages having the same message digest, or to produce any 89e1645093SPaul Trainamessage having a given prespecified target message digest. 907d40dd24SFernando ApesteguíaThe SHA-224 , SHA-256 , SHA-384 , SHA-512, RIPEMD-160, 917d40dd24SFernando Apesteguíaand SKEIN 92cb49d42bSOliver Eikemeieralgorithms are intended for digital signature applications, where a 93f22592e7SJohn-Mark Gurneylarge file must be 94f22592e7SJohn-Mark Gurney.Dq compressed 95f22592e7SJohn-Mark Gurneyin a secure manner before being encrypted with a private 96c4d9468eSRuslan Ermilov(secret) 977d40dd24SFernando Apesteguíakey under a public-key cryptosystem such as RSA. 98f22592e7SJohn-Mark Gurney.Pp 997d40dd24SFernando ApesteguíaThe MD5 and SHA-1 algorithms have been proven to be vulnerable to practical 1007d40dd24SFernando Apesteguíacollision attacks and should not be relied upon to produce unique outputs, 1018ff3cdd1SConrad Meyer.Em nor should they be used as part of a cryptographic signature scheme. 1028d26f08eSDag-Erling SmørgravAs of 2017-03-02, there is no publicly known method to 103c74cccf0SDag-Erling Smørgrav.Em reverse 1047d40dd24SFernando Apesteguíaeither algorithm, i.e., to find an input that produces a specific 105c74cccf0SDag-Erling Smørgravoutput. 1064c55b9e0SColin Percival.Pp 1077d40dd24SFernando ApesteguíaSHA-512t256 is a version of SHA-512 truncated to only 256 bits. 1087d40dd24SFernando ApesteguíaOn 64-bit hardware, this algorithm is approximately 50% faster than SHA-256 but 1097d40dd24SFernando Apesteguíawith the same level of security. 1101780e407SAllan JudeThe hashes are not interchangeable. 1111780e407SAllan Jude.Pp 1122768d705SDag-Erling SmørgravSHA-512t224 is identical to SHA-512t256, but with the digest truncated 1132768d705SDag-Erling Smørgravto 224 bits. 1142768d705SDag-Erling Smørgrav.Pp 1157d40dd24SFernando ApesteguíaIt is recommended that all new applications use SHA-512 or SKEIN-512 1164c55b9e0SColin Percivalinstead of one of the other hash functions. 1174849767cSDag-Erling Smørgrav.Ss BSD OPTIONS 1184849767cSDag-Erling SmørgravThe following options are available in BSD mode, i.e. when the program 1194849767cSDag-Erling Smørgravis invoked with a name that does not end in 1204849767cSDag-Erling Smørgrav.Dq sum : 12123b5892fSPhilippe Charnier.Bl -tag -width indent 1224849767cSDag-Erling Smørgrav.It Fl c Ar string , Fl -check= Ns Ar string 1234849767cSDag-Erling SmørgravCompare the digest of the file against this string. 1249f3aa538SStefan EßerIf combined with the 1259f3aa538SStefan Eßer.Fl q 1264849767cSDag-Erling Smørgravor 1274849767cSDag-Erling Smørgrav.Fl -quiet 1289f3aa538SStefan Eßeroption, the calculated digest is printed in addition to the exit status being set. 1290e2e260eSBenjamin Kaduk.Pq Note that this option is not yet useful if multiple files are specified. 1304849767cSDag-Erling Smørgrav.It Fl p , -passthrough 131cb49d42bSOliver EikemeierEcho stdin to stdout and append the checksum to stdout. 1325b44edb4SDag-Erling SmørgravIn this mode, any files specified on the command line are silently ignored. 1334849767cSDag-Erling Smørgrav.It Fl q , -quiet 1340e2e260eSBenjamin KadukQuiet mode \(em only the checksum is printed out. 135ee355dcbSRuslan ErmilovOverrides the 1362963da13SDavid E. O'Brien.Fl r 1374849767cSDag-Erling Smørgravor 1384849767cSDag-Erling Smørgrav.Fl -reverse 1392963da13SDavid E. O'Brienoption. 1404849767cSDag-Erling Smørgrav.It Fl r , -reverse 141ee355dcbSRuslan ErmilovReverses the format of the output. 142ee355dcbSRuslan ErmilovThis helps with visual diffs. 143ee355dcbSRuslan ErmilovDoes nothing 1449e18a3bdSDavid E. O'Brienwhen combined with the 14573fd2717SDavid E. O'Brien.Fl ptx 1469e18a3bdSDavid E. O'Brienoptions. 1474849767cSDag-Erling Smørgrav.It Fl s Ar string , Fl -string= Ns Ar string 1484849767cSDag-Erling SmørgravPrint a checksum of the given 1494849767cSDag-Erling Smørgrav.Ar string . 1505b44edb4SDag-Erling SmørgravIn this mode, any files specified on the command line are silently ignored. 1514849767cSDag-Erling Smørgrav.It Fl t , Fl -time-trial 15223b5892fSPhilippe CharnierRun a built-in time trial. 153086feed8SWarner LoshFor the 154086feed8SWarner Losh.Nm -sum 155086feed8SWarner Loshversions, this is a nop for compatibility with coreutils. 1564849767cSDag-Erling Smørgrav.It Fl x , Fl -self-test 15723b5892fSPhilippe CharnierRun a built-in test script. 158f22592e7SJohn-Mark Gurney.El 1594849767cSDag-Erling Smørgrav.Ss GNU OPTIONS 1604849767cSDag-Erling SmørgravThe following options are available in GNU mode, i.e. when the program 1614849767cSDag-Erling Smørgravis invoked with a name that ends in 1624849767cSDag-Erling Smørgrav.Dq sum : 1634849767cSDag-Erling Smørgrav.Bl -tag -width indent 1644849767cSDag-Erling Smørgrav.It Fl b , Fl -binary 1654849767cSDag-Erling SmørgravRead files in binary mode. 1664849767cSDag-Erling Smørgrav.It Fl c , Fl -check 1674849767cSDag-Erling SmørgravThe file passed as arguments must contain digest lines generated by the same 1684849767cSDag-Erling Smørgravdigest algorithm in either classical BSD format or in GNU coreutils format. 1694849767cSDag-Erling SmørgravA line with the file name followed by a colon 1704849767cSDag-Erling Smørgrav.Dq ":" 1714849767cSDag-Erling Smørgravand either OK or FAILED is written for each well-formed line in the digest file. 1724849767cSDag-Erling SmørgravIf applicable, the number of failed comparisons and the number of lines that were 1734849767cSDag-Erling Smørgravskipped since they were not well-formed are printed at the end. 1744849767cSDag-Erling SmørgravThe 1754849767cSDag-Erling Smørgrav.Fl -quiet 1764849767cSDag-Erling Smørgravoption can be used to quiesce the output unless there are mismatched entries in 1774849767cSDag-Erling Smørgravthe digest. 1784849767cSDag-Erling Smørgrav.It Fl -help 1794849767cSDag-Erling SmørgravPrint a usage message and exit. 1804849767cSDag-Erling Smørgrav.It Fl -ignore-missing 1814849767cSDag-Erling SmørgravWhen verifying checksums, ignore files for which checksums are given 1824849767cSDag-Erling Smørgravbut which aren't found on disk. 1834849767cSDag-Erling Smørgrav.It Fl -quiet 1844849767cSDag-Erling SmørgravWhen verifying checksums, do not print anything unless the 1854849767cSDag-Erling Smørgravverification fails. 1864849767cSDag-Erling Smørgrav.It Fl -status 1874849767cSDag-Erling SmørgravWhen verifying checksums, do not print anything at all. 1884849767cSDag-Erling SmørgravThe exit code will reflect whether verification succeeded. 1894849767cSDag-Erling Smørgrav.It Fl -strict 1904849767cSDag-Erling SmørgravWhen verifying checksums, fail if the input is malformed. 1914849767cSDag-Erling Smørgrav.It Fl -tag 1924849767cSDag-Erling SmørgravProduce BSD-style output. 1934849767cSDag-Erling Smørgrav.It Fl t , Fl -text 1944849767cSDag-Erling SmørgravRead files in text mode. 1954849767cSDag-Erling SmørgravThis is the default. 1964849767cSDag-Erling SmørgravNote that this implementation does not differentiate between binary 1974849767cSDag-Erling Smørgravand text mode. 1984849767cSDag-Erling Smørgrav.It Fl -version 1994849767cSDag-Erling SmørgravPrint version information and exit. 2004849767cSDag-Erling Smørgrav.It Fl w , Fl -warn 2014849767cSDag-Erling SmørgravWhen verifying checksums, warn about malformed input. 2024849767cSDag-Erling Smørgrav.It Fl z , Fl -zero 2034849767cSDag-Erling SmørgravTerminate output lines with NUL rather than with newline. 2044849767cSDag-Erling Smørgrav.El 2054849767cSDag-Erling Smørgrav.Ss PERL OPTIONS 2064849767cSDag-Erling SmørgravThe following options are available in Perl mode, i.e. when the program 2074849767cSDag-Erling Smørgravis invoked with the name 2084849767cSDag-Erling Smørgrav.Dq shasum : 2094849767cSDag-Erling Smørgrav.Bl -tag -width indent 2104849767cSDag-Erling Smørgrav.It Fl 0 , Fl -01 2114849767cSDag-Erling SmørgravRead files in bits mode: ASCII 2124849767cSDag-Erling Smørgrav.Sq 0 2134849767cSDag-Erling Smørgravand 2144849767cSDag-Erling Smørgrav.Sq 1 2154849767cSDag-Erling Smørgravcharacters correspond to 0 and 1 bits, respectively, and all other 2164849767cSDag-Erling Smørgravcharacters are ignored. 2174849767cSDag-Erling SmørgravSee 2184849767cSDag-Erling Smørgrav.Sx BUGS . 2194849767cSDag-Erling Smørgrav.It Fl a Ar alg , Fl -algorithm Ar alg 2204849767cSDag-Erling SmørgravUse the specified algorithm: 2214849767cSDag-Erling Smørgrav.Dq 1 2224849767cSDag-Erling Smørgravfor SHA-1 (default), 2234849767cSDag-Erling Smørgrav.Dq xxx 2244849767cSDag-Erling Smørgravfor 2254849767cSDag-Erling Smørgrav.Va xxx Ns -bit 2264849767cSDag-Erling SmørgravSHA-2 (e.g. 2274849767cSDag-Erling Smørgrav.Dq 256 2284849767cSDag-Erling Smørgravfor SHA-256) 2294849767cSDag-Erling Smørgravor 2304849767cSDag-Erling Smørgrav.Dq xxxyyy 2314849767cSDag-Erling Smørgravfor 2324849767cSDag-Erling Smørgrav.Va xxx Ns -bit 2334849767cSDag-Erling SmørgravSHA-2 truncated to 2344849767cSDag-Erling Smørgrav.Va yyy 2354849767cSDag-Erling Smørgravbits (e.g. 2364849767cSDag-Erling Smørgrav.Dq 512224 2374849767cSDag-Erling Smørgravfor SHA-512/224). 2384849767cSDag-Erling Smørgrav.It Fl b , Fl -binary 2394849767cSDag-Erling SmørgravRead files in binary mode. 2404849767cSDag-Erling Smørgrav.It Fl c , Fl -check 2414849767cSDag-Erling SmørgravThe file passed as arguments must contain digest lines generated by the same 2424849767cSDag-Erling Smørgravdigest algorithm in either classical BSD format or in GNU coreutils format. 2434849767cSDag-Erling SmørgravA line with the file name followed by a colon 2444849767cSDag-Erling Smørgrav.Dq ":" 2454849767cSDag-Erling Smørgravand either OK or FAILED is written for each well-formed line in the digest file. 2464849767cSDag-Erling SmørgravIf applicable, the number of failed comparisons and the number of lines that were 2474849767cSDag-Erling Smørgravskipped since they were not well-formed are printed at the end. 2484849767cSDag-Erling SmørgravThe 2494849767cSDag-Erling Smørgrav.Fl -quiet 2504849767cSDag-Erling Smørgravoption can be used to quiesce the output unless there are mismatched entries in 2514849767cSDag-Erling Smørgravthe digest. 2524849767cSDag-Erling Smørgrav.It Fl -help 2534849767cSDag-Erling SmørgravPrint a usage message and exit. 2544849767cSDag-Erling Smørgrav.It Fl -ignore-missing 2554849767cSDag-Erling SmørgravWhen verifying checksums, ignore files for which checksums are given 2564849767cSDag-Erling Smørgravbut which aren't found on disk. 2574849767cSDag-Erling Smørgrav.It Fl -quiet 2584849767cSDag-Erling SmørgravWhen verifying checksums, do not print anything unless the 2594849767cSDag-Erling Smørgravverification fails. 2604849767cSDag-Erling Smørgrav.It Fl -status 2614849767cSDag-Erling SmørgravWhen verifying checksums, do not print anything at all. 2624849767cSDag-Erling SmørgravThe exit code will reflect whether verification succeeded. 2634849767cSDag-Erling Smørgrav.It Fl -strict 2644849767cSDag-Erling SmørgravWhen verifying checksums, fail if the input is malformed. 2654849767cSDag-Erling Smørgrav.It Fl -tag 2664849767cSDag-Erling SmørgravProduce BSD-style output. 2674849767cSDag-Erling Smørgrav.It Fl t , Fl -text 2684849767cSDag-Erling SmørgravRead files in text mode. 2694849767cSDag-Erling SmørgravThis is the default. 2704849767cSDag-Erling SmørgravNote that this implementation does not differentiate between binary 2714849767cSDag-Erling Smørgravand text mode. 2724849767cSDag-Erling Smørgrav.It Fl U , Fl -UNIVERSAL 2734849767cSDag-Erling SmørgravRead files in universal mode: any CR-LF pair, as well as any CR not 2744849767cSDag-Erling Smørgravfollowed by LF, is translated to LF before the digest is computed. 2754849767cSDag-Erling Smørgrav.It Fl -version 2764849767cSDag-Erling SmørgravPrint version information and exit. 2774849767cSDag-Erling Smørgrav.It Fl w , Fl -warn 2784849767cSDag-Erling SmørgravWhen verifying checksums, warn about malformed input. 2794849767cSDag-Erling Smørgrav.El 280a866e170SRuslan Ermilov.Sh EXIT STATUS 2815758d949SStefan EßerThe 28200de65aaSDag-Erling Smørgrav.Nm md5 , sha1 , sha224 , sha256 , sha384 , sha512 , 28300de65aaSDag-Erling Smørgrav.Nm sha512t224 , sha512t256 , 2844849767cSDag-Erling Smørgrav.Nm rmd160 , skein256 , skein512 , 285cb49d42bSOliver Eikemeierand 28640d3e536SAllan Jude.Nm skein1024 287cb49d42bSOliver Eikemeierutilities exit 0 on success, 28874525359SEitan Adler1 if at least one of the input files could not be read, 2890e2e260eSBenjamin Kadukand 2 if at least one file does not have the same hash as the 2900e2e260eSBenjamin Kaduk.Fl c 2910e2e260eSBenjamin Kadukoption. 2924849767cSDag-Erling Smørgrav.Pp 2934849767cSDag-Erling SmørgravThe 29400de65aaSDag-Erling Smørgrav.Nm md5sum , sha1sum , sha224sum , sha256sum , sha384sum , sha512sum , 2954849767cSDag-Erling Smørgrav.Nm sha512t224sum , sha512t256sum , 2964849767cSDag-Erling Smørgrav.Nm rmd160 , skein256 , skein512 , skein1024 2974849767cSDag-Erling Smørgravand 2984849767cSDag-Erling Smørgrav.Nm shasum 2994849767cSDag-Erling Smørgravutilities exit 0 on success and 1 if at least one of the input files 3004849767cSDag-Erling Smørgravcould not be read or, when verifying checksums, does not have the 3014849767cSDag-Erling Smørgravexpected checksum. 30283d742d6SFernando Apesteguía.Sh EXAMPLES 30383d742d6SFernando ApesteguíaCalculate the MD5 checksum of the string 30483d742d6SFernando Apesteguía.Dq Hello . 30583d742d6SFernando Apesteguía.Bd -literal -offset indent 30683d742d6SFernando Apesteguía$ md5 -s Hello 30783d742d6SFernando ApesteguíaMD5 ("Hello") = 8b1a9953c4611296a827abf8c47804d7 30883d742d6SFernando Apesteguía.Ed 30983d742d6SFernando Apesteguía.Pp 31083d742d6SFernando ApesteguíaSame as above, but note the absence of the newline character in the input 31183d742d6SFernando Apesteguíastring: 31283d742d6SFernando Apesteguía.Bd -literal -offset indent 31383d742d6SFernando Apesteguía$ echo -n Hello | md5 31483d742d6SFernando Apesteguía8b1a9953c4611296a827abf8c47804d7 31583d742d6SFernando Apesteguía.Ed 31683d742d6SFernando Apesteguía.Pp 31783d742d6SFernando ApesteguíaCalculate the checksum of multiple files reversing the output: 31883d742d6SFernando Apesteguía.Bd -literal -offset indent 31983d742d6SFernando Apesteguía$ md5 -r /boot/loader.conf /etc/rc.conf 32083d742d6SFernando Apesteguíaada5f60f23af88ff95b8091d6d67bef6 /boot/loader.conf 32183d742d6SFernando Apesteguíad80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf 3224849767cSDag-Erling Smørgrav.Ed 3234849767cSDag-Erling Smørgrav.Pp 3244849767cSDag-Erling SmørgravThis is almost but not quite identical to the output from GNU mode: 3254849767cSDag-Erling Smørgrav.Bd -literal -offset indent 3264849767cSDag-Erling Smørgrav$ md5sum /boot/loader.conf /etc/rc.conf 3274849767cSDag-Erling Smørgravada5f60f23af88ff95b8091d6d67bef6 /boot/loader.conf 3284849767cSDag-Erling Smørgravd80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf 3294849767cSDag-Erling Smørgrav.Ed 3304849767cSDag-Erling Smørgrav.Pp 3314849767cSDag-Erling SmørgravNote the two spaces between hash and file name. 3324849767cSDag-Erling SmørgravIf binary mode is requested, they are instead separated by a space and 3334849767cSDag-Erling Smørgravan asterisk: 3344849767cSDag-Erling Smørgrav.Bd -literal -offset indent 3354849767cSDag-Erling Smørgrav$ md5sum -b /boot/loader.conf /etc/rc.conf 3364849767cSDag-Erling Smørgravada5f60f23af88ff95b8091d6d67bef6 */boot/loader.conf 3374849767cSDag-Erling Smørgravd80bf36c332dc0fdc479366ec3fa44cd */etc/rc.conf 33883d742d6SFernando Apesteguía.Ed 33983d742d6SFernando Apesteguía.Pp 34083d742d6SFernando ApesteguíaWrite the digest for 34183d742d6SFernando Apesteguía.Pa /boot/loader.conf 34283d742d6SFernando Apesteguíain a file named 34383d742d6SFernando Apesteguía.Pa digest . 34483d742d6SFernando ApesteguíaThen calculate the checksum again and validate it against the checksum string 34583d742d6SFernando Apesteguíaextracted from the 34683d742d6SFernando Apesteguía.Pa digest 34783d742d6SFernando Apesteguíafile: 34883d742d6SFernando Apesteguía.Bd -literal -offset indent 34983d742d6SFernando Apesteguía$ md5 /boot/loader.conf > digest && md5 -c $(cut -f2 -d= digest) /boot/loader.conf 35083d742d6SFernando ApesteguíaMD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6 35183d742d6SFernando Apesteguía.Ed 35283d742d6SFernando Apesteguía.Pp 35383d742d6SFernando ApesteguíaSame as above but comparing the digest against an invalid string 35483d742d6SFernando Apesteguía.Pq Dq randomstring , 35583d742d6SFernando Apesteguíawhich results in a failure. 35683d742d6SFernando Apesteguía.Bd -literal -offset indent 35783d742d6SFernando Apesteguía$ md5 -c randomstring /boot/loader.conf 35883d742d6SFernando ApesteguíaMD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6 [ Failed ] 35983d742d6SFernando Apesteguía.Ed 360c2870e57SStefan Eßer.Pp 3614849767cSDag-Erling SmørgravIn GNU mode, the 362c2870e57SStefan Eßer.Fl c 363c2870e57SStefan Eßeroption does not compare against a hash string passed as parameter. 364c2870e57SStefan EßerInstead, it expects a digest file, as created under the name 365c2870e57SStefan Eßer.Pa digest 366c2870e57SStefan Eßerfor 367c2870e57SStefan Eßer.Pa /boot/loader.conf 368c2870e57SStefan Eßerin the example above. 369c2870e57SStefan Eßer.Bd -literal -offset indent 370*f3343fe4SGordon Bergling$ md5sum -c digest 371c2870e57SStefan Eßer/boot/loader.conf: OK 372c2870e57SStefan Eßer.Ed 373c2870e57SStefan Eßer.Pp 3744849767cSDag-Erling SmørgravThe digest file may contain any number of lines in the format 3754849767cSDag-Erling Smørgravgenerated in either BSD or GNU mode. 3764849767cSDag-Erling SmørgravIf a hash value does not match the file, 3774849767cSDag-Erling Smørgrav.Dq FAILED 3784849767cSDag-Erling Smørgravis printed instead of 3794849767cSDag-Erling Smørgrav.Dq OK . 380f22592e7SJohn-Mark Gurney.Sh SEE ALSO 381cb49d42bSOliver Eikemeier.Xr cksum 1 , 382cb49d42bSOliver Eikemeier.Xr md5 3 , 383cb49d42bSOliver Eikemeier.Xr ripemd 3 , 3842fc230e2SColin Percival.Xr sha 3 , 385edd4c16fSXin LI.Xr sha256 3 , 3867a3f5d11SAllan Jude.Xr sha384 3 , 38740d3e536SAllan Jude.Xr sha512 3 , 38840d3e536SAllan Jude.Xr skein 3 389f22592e7SJohn-Mark Gurney.Rs 390f22592e7SJohn-Mark Gurney.%A R. Rivest 391f22592e7SJohn-Mark Gurney.%T The MD5 Message-Digest Algorithm 392f22592e7SJohn-Mark Gurney.%O RFC1321 393f22592e7SJohn-Mark Gurney.Re 394cb49d42bSOliver Eikemeier.Rs 395cb49d42bSOliver Eikemeier.%A J. Burrows 396cb49d42bSOliver Eikemeier.%T The Secure Hash Standard 3972fc230e2SColin Percival.%O FIPS PUB 180-2 398cb49d42bSOliver Eikemeier.Re 399cb49d42bSOliver Eikemeier.Rs 400cb49d42bSOliver Eikemeier.%A D. Eastlake and P. Jones 401cb49d42bSOliver Eikemeier.%T US Secure Hash Algorithm 1 402cb49d42bSOliver Eikemeier.%O RFC 3174 403cb49d42bSOliver Eikemeier.Re 404cb49d42bSOliver Eikemeier.Pp 405cb49d42bSOliver EikemeierRIPEMD-160 is part of the ISO draft standard 406cb49d42bSOliver Eikemeier.Qq ISO/IEC DIS 10118-3 407cb49d42bSOliver Eikemeieron dedicated hash functions. 408cb49d42bSOliver Eikemeier.Pp 409cb49d42bSOliver EikemeierSecure Hash Standard (SHS): 4106981ec8bSWolfram Schneider.Pa https://www.nist.gov/publications/secure-hash-standard-shs 411cb49d42bSOliver Eikemeier.Pp 412cb49d42bSOliver EikemeierThe RIPEMD-160 page: 4136981ec8bSWolfram Schneider.Pa https://homes.esat.kuleuven.be/~bosselae/ripemd160.html 414086feed8SWarner Losh.Sh BUGS 4154849767cSDag-Erling SmørgravIn bits mode, the original 4164849767cSDag-Erling Smørgrav.Nm shasum 4174849767cSDag-Erling Smørgravscript is capable of processing inputs of arbitrary length. 4184849767cSDag-Erling SmørgravThis implementation is not, and will issue an error if the input 4194849767cSDag-Erling Smørgravlength is not a multiple of eight bits. 42023b5892fSPhilippe Charnier.Sh ACKNOWLEDGMENTS 4214849767cSDag-Erling Smørgrav.An -nosplit 4224849767cSDag-Erling SmørgravThis utility was originally derived from a program which was placed in 4234849767cSDag-Erling Smørgravthe public domain for free general use by RSA Data Security. 424cb49d42bSOliver Eikemeier.Pp 4254849767cSDag-Erling SmørgravSupport for SHA-1 and RIPEMD-160 was added by 426bd0891ceSBaptiste Daroussin.An Oliver Eikemeier Aq Mt eik@FreeBSD.org . 4274849767cSDag-Erling Smørgrav.Pp 4284849767cSDag-Erling SmørgravSupport for SHA-2 was added by 4294849767cSDag-Erling Smørgrav.An Colin Percival Aq Mt cperciva@FreeBSD.org 4304849767cSDag-Erling Smørgravand 4314849767cSDag-Erling Smørgrav.An Allan Jude Aq Mt allanjude@FreeBSD.org . 4324849767cSDag-Erling Smørgrav.Pp 4334849767cSDag-Erling SmørgravSupport for SKEIN was added by 4344849767cSDag-Erling Smørgrav.An Allan Jude Aq Mt allanjude@FreeBSD.org . 4354849767cSDag-Erling Smørgrav.Pp 4364849767cSDag-Erling SmørgravCompatibility with GNU coreutils was added by 4374849767cSDag-Erling Smørgrav.An Warner Losh Aq Mt imp@FreeBSD.org 4384849767cSDag-Erling Smørgravand much expanded by 4394849767cSDag-Erling Smørgrav.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org , 4404849767cSDag-Erling Smørgravwho also added Perl compatibility. 441