Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171270237
D25278.id73242.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D25278.id73242.diff
View Options
Index: sbin/md5/md5.1
===================================================================
--- sbin/md5/md5.1
+++ sbin/md5/md5.1
@@ -95,6 +95,42 @@
and 2 if at least one file does not have the same hash as the
.Fl c
option.
+.Sh EXAMPLES
+Calculate the md5 checksum of the string Hello.
+.Bd -literal -offset indent
+$ md5 -s Hello
+MD5 ("Hello") = 8b1a9953c4611296a827abf8c47804d7
+.Ed
+.Pp
+Same as above.
+Note the absence of \\n in the input string:
+.Bd -literal -offset indent
+$ echo -n Hello | md5
+8b1a9953c4611296a827abf8c47804d7
+.Ed
+.Pp
+Calculate the checksum of multiple files reversing the output:
+.Bd -literal -offset indent
+$ md5 -r /boot/loader.conf /etc/rc.conf
+ada5f60f23af88ff95b8091d6d67bef6 /boot/loader.conf
+d80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf
+.Ed
+.Pp
+Write digest for file /boot/loader.conf in a file named digest.
+Then calculate the checksum again and validate against the checksum string
+extracted from the digest file:
+.Bd -literal -offset indent
+$ md5 /boot/loader.conf > digest && md5 -c $(cut -f2 -d= digest)
+/boot/loader.conf
+MD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6
+.Ed
+.Pp
+Same as above but using randomstring to compare with to make it fail:
+.Bd -literal -offset indent
+$ md5 /boot/loader.conf > digest && md5 -c randomstring
+/boot/loader.conf
+MD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6 [ Failed ]
+.Ed
.Sh SEE ALSO
.Xr cksum 1 ,
.Xr md5 3 ,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Sep 11, 12:28 AM (6 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38675123
Default Alt Text
D25278.id73242.diff (1 KB)
Attached To
Mode
D25278: md5(1): Add EXAMPLES section
Attached
Detach File
Event Timeline
Log In to Comment