Pages

Thursday, July 11, 2013

Checksum

Checksums are used for integrity check of contents.

2. Multiple types are there
a. md5 - 128 bit 
b. sha1 - 160 bit 
c. sha256 - 256 bit 

Locations of Checksum Binaries in BSD.
# which md5
 /sbin/md5
# which sha1
 
 /sbin/sha1
# which sha256
 /sbin/sha256
md5 waits on STDIN for input (use CTRL-D to terminate STDIn stream) - Generates a unique finger print.
Example.
vasanth aa8adc7e1fb2c83161357130a4281c1a
Checksum do not garantee that a man in the middle has not viewed your content. It simply means the content is intact.
Checksum strings do not vary with time. They are solely content-dependent.
b. sha1 - vasanth-  6a04ed4f77798a2e8661e44cc9746f329af953af
c. sha256 - vasanth - b932a819680211a67c15707c88ca2070c55093139c12dbacb34597f2d3c0467f

To generates unique fingerprint for the strings
# md5|sha1|sha256 -s "STRING"
Generating Fingerprint for the files.


# md5 filename
Create a file called check.txt and create finger print for the file.


# cat check.txt
This is fingerprint check file.
Run the following command to get the fingerprint using md5,sha1,sha256


# CFILE=check.txt ; md5 $CFILE && sha1 $CFILE && sha256 $CFILE
 MD5 (check.txt) = 1da283e6addeca541faff8d2c617dea4
 SHA1 (check.txt) = ab5a2ea17198ac8f17225bbfa4d7135e70deb744
 SHA256 (check.txt) = 3f6309880627d03d8941774456f865058f19db449f67f5165ec7a76f73a1375e
Checksums are only as goo as the security behind the provider of the content Generating the checksums and saving in file


# CFILE=check.txt ; md5 $CFILE >> $CFILE.sums && sha1 $CFILE >> $CFILE.sums && sha256 $CFILE >> $CFILE.sums


[root@basd1 ~]# cat check.txt.sums
MD5 (check.txt) = 1da283e6addeca541faff8d2c617dea4
SHA1 (check.txt) = ab5a2ea17198ac8f17225bbfa4d7135e70deb744
SHA256 (check.txt) = 3f6309880627d03d8941774456f865058f19db449f67f5165ec7a76f73a1375e


Publish sums file with source so that receiver can check the integrity of the source by checking the fingerprint.

Enjoy !!!

No comments:

Post a Comment