Home > bash, security > md5sum, sha1sum

md5sum, sha1sum

Problem
You always forget how to use the commands md5sum and sha1sum.

Reminder

bash$ ls -al
-rw-r--r--  1 jabba users 351 Nov 29 14:55 file.iso
=====================================================
bash$ md5sum file.iso
ca9779174955bbaaa6652bb0844ed64f  file.iso 
=====================================================
bash$ md5sum file.iso >na.md5
=====================================================
bash$ md5sum -c na.md5
file.iso: OK
=====================================================
bash$ sha1sum file.iso
76004a25fc2ba41cb805f010a0f66f41e023692d  file.iso
=====================================================
bash$ sha1sum file.iso >na.sha1
=====================================================
bash$ sha1sum -c na.sha1
file.iso: OK
=====================================================
bash$ python2
>>> len("ca9779174955bbaaa6652bb0844ed64f")
32
>>> len("ca9779174955bbaaa6652bb0844ed64f")*4
128 
>>> len("76004a25fc2ba41cb805f010a0f66f41e023692d")
40
>>> len("76004a25fc2ba41cb805f010a0f66f41e023692d")*4
160

MD5 is 128-bit, SHA1 is 160-bit. sha1sum has some stronger variations: sha224sum, sha256sum, sha384sum and sha512sum.

Categories: bash, security Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: