{"id":115,"date":"2018-07-11T11:26:14","date_gmt":"2018-07-11T11:26:14","guid":{"rendered":"http:\/\/itp4.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=115"},"modified":"2019-05-13T12:28:04","modified_gmt":"2019-05-13T12:28:04","slug":"hash-functions","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/chapter\/hash-functions\/","title":{"rendered":"Hash functions"},"content":{"raw":"<div><span style=\"float: right;\"><a href=\"https:\/\/youtu.be\/f0xkc19XcZ4\" target=\"_blank\" rel=\"noopener\"><img src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a>\r\n<\/span><\/div>\r\n\r\nCryptographic Hash functions:\r\n<ul>\r\n \t<li>\u00a8 A hash function H accepts a variable length block of data M as input and produces a fixed size hash value h=H(M).<\/li>\r\n \t<li>\u00a8 For security applications cryptographic hash functions are required.<\/li>\r\n \t<li style=\"text-align: justify\">\u00a8 A cryptographic hash function is an algorithm for which it is computationally infeasible to find either (a) data object that maps to pre specified hash result (b) two data object that map to same hash result.<\/li>\r\n<\/ul>\r\nRequirements and Security :\r\n<ul>\r\n \t<li>\u00a8 Preimage \u2013 for a hash value h=H(x), x is called preimage.<\/li>\r\n \t<li>\u00a8 A collision occurs if x\u2260y and H(x)=H(y)<\/li>\r\n \t<li>\u00a8 Preimage resistant \u2013 one way property. It is easy to generate a code given a message, but virtually impossible to generate a message given code.<\/li>\r\n \t<li>\u00a8 Second preimage resistant \u2013 It is impossible to find an alternative message with same hash value<\/li>\r\n<\/ul>\r\nTwo categories of attack:\r\n<ul>\r\n \t<li>\u00a8 Brute force attack<\/li>\r\n \t<li>\u00a8 cryptanalysis<\/li>\r\n<\/ul>\r\nSecure Hash Algorithm \u2013 SHA 512:\r\n\r\n<img class=\"size-full wp-image-116 aligncenter\" src=\"http:\/\/itp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-69.png\" alt=\"\" width=\"722\" height=\"469\" \/>\r\n<ul>\r\n \t<li>\u00a8 Input : a message with maximum length of less than 2128<\/li>\r\n \t<li>\u00a8 Output : 512 bit message digest.<\/li>\r\n \t<li>\u00a8 Input processing is done in 1024 bit blocks.<\/li>\r\n<\/ul>\r\nStep 1: Append padding bits\r\n<ul>\r\n \t<li>\u00a8 The message is padded so that its length is congruent to 896 modulo 1024.<\/li>\r\n \t<li>\u00a8 Even if message is of desired length, padding is always done.<\/li>\r\n \t<li>\u00a8 The padding bits can be between 1 to 1024.<\/li>\r\n \t<li>\u00a8 The padding consist of a single 1 bit followed by necessary number of 0 bits. Step 2: Append length<\/li>\r\n \t<li>\u00a8 A block of 128 bits is appended to the message.<\/li>\r\n \t<li>\u00a8 This contains the length of the original message.<\/li>\r\n<\/ul>\r\nStep 3 : Initialize hash buffer\r\n<ul>\r\n \t<li>\u00a8 A 512 bit buffer is used to hold intermediate and final results of the hash function.<\/li>\r\n \t<li>\u00a8 The buffer is eight 64 bit registers(a,b,c,d,e,f,g,h)<\/li>\r\n \t<li>\u00a8 These registers are initialized as follows<\/li>\r\n \t<li>a 6A09E667F3BCC908<\/li>\r\n \t<li>b BB67AE8584CAA73B<\/li>\r\n \t<li>c 3C6EF372FE94F82B<\/li>\r\n \t<li>d A54FF53A5F1D36F1<\/li>\r\n \t<li>e 510E527FADE682D1<\/li>\r\n \t<li>f 9B05688C2B3E6C1F<\/li>\r\n \t<li>g 1F83D9ABFB41BD6B<\/li>\r\n \t<li>h 5BE0CD19137E2179<\/li>\r\n<\/ul>\r\nStep 4: Process message in 1024 bit (128 word) blocks.\r\n<ul>\r\n \t<li>\u00a8 80 rounds are performed<\/li>\r\n \t<li>\u00a8 Each round works as follows : input : 512 bit buffer value abcdefgh updates the contents of buffer.<\/li>\r\n \t<li>At input of the first round, the buffer has the value of the intermediate hash value, Hi-1<\/li>\r\n \t<li>Each round t makes use of Wt(64 bit value) derived from current 1024 bit block being processed(Mi)<\/li>\r\n \t<li>Each round uses additive constant Kt where 0&lt;=t&lt;=79. Process message in 1024 bit (128 word) blocks.<\/li>\r\n \t<li>\u00a8 The output of the eightieth round is added to the input to the first round(Hi-1) to produce H<\/li>\r\n<\/ul>\r\n\u00a8 The addition is done for each eight words in buffer with each corresponding words in Hi-1 using additional modulo 264.\r\n\r\n&nbsp;\r\n\r\n<strong>SHA 512 Round Function :<\/strong>\r\n\r\n<img class=\"size-full wp-image-117 aligncenter\" src=\"http:\/\/itp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-70.png\" alt=\"\" width=\"781\" height=\"523\" \/>\r\n\r\n<img class=\"size-full wp-image-118 aligncenter\" src=\"http:\/\/itp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-71.png\" alt=\"\" width=\"787\" height=\"473\" \/>\r\n\r\n<strong>Behavior of SHA-512 :<\/strong>\r\n<ul>\r\n \t<li>\u00a8 H0 = IV<\/li>\r\n \t<li>\u00a8 Hi = SUM64(Hi-1,abcdefghi)<\/li>\r\n \t<li>\u00a8 MD = HN<\/li>\r\n \t<li>\u00a8 IV = initial value of abcdefgh buffer<\/li>\r\n \t<li>\u00a8 abcdefghi = the output of the last round of processing of the ith message block.<\/li>\r\n \t<li>\u00a8 N = the number of blocks in the message (includes padding and length field.)<\/li>\r\n \t<li>\u00a8 SUM64 = addition modulo 264 performed separately on each word of the pair of inputs.<\/li>\r\n \t<li>\u00a8 MD = final message digest<\/li>\r\n<\/ul>\r\nApplications of hash functions:\r\n<ul>\r\n \t<li>\u00a8 Message authentication<\/li>\r\n \t<li>\u00a8 Digital signature<\/li>\r\n<\/ul>\r\n\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><strong>you can view video on Hash functions<\/strong><\/td>\r\n<td><a href=\"https:\/\/youtu.be\/f0xkc19XcZ4\" target=\"_blank\" rel=\"noopener\"><img class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n<strong>Suggested Reading:<\/strong>\r\n<ol>\r\n \t<li>Cryptography and Network Security Principles and Practice by William Stallings, sixth Edition, PEARSON.<\/li>\r\n \t<li>Security in Computing by Charles Pfleeger &amp; Shari Lawrence Pfleeger, fourth Edition, PEARSON.<\/li>\r\n \t<li>Network Security by Charlie Kaufman, Radia Perlman, Mike Speciner, second Edition, PHI.<\/li>\r\n \t<li>The Complete Reference \u2013 Network Security by Roberta Bragg, Mark Rhodes-Ousley &amp; Keith Strassberg, Tata McGraw Hill<\/li>\r\n \t<li>Network Security Bible by Eric Cole, Ronald Krutz, James Conley, Wiley<\/li>\r\n \t<li>Hacking 6 Exposed by Stuart McClure, Joel Scambray &amp; George Kurtz , Tata McGraw Hill .<\/li>\r\n \t<li><a href=\"http:\/\/www.snort.org\/\">www.snort.org<\/a><\/li>\r\n \t<li><a style=\"text-align: initial;font-size: 1em\" href=\"https:\/\/nmap.org\/\">https:\/\/nmap.org<\/a><\/li>\r\n<\/ol>","rendered":"<div><span style=\"float: right;\"><a href=\"https:\/\/youtu.be\/f0xkc19XcZ4\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a><br \/>\n<\/span><\/div>\n<p>Cryptographic Hash functions:<\/p>\n<ul>\n<li>\u00a8 A hash function H accepts a variable length block of data M as input and produces a fixed size hash value h=H(M).<\/li>\n<li>\u00a8 For security applications cryptographic hash functions are required.<\/li>\n<li style=\"text-align: justify\">\u00a8 A cryptographic hash function is an algorithm for which it is computationally infeasible to find either (a) data object that maps to pre specified hash result (b) two data object that map to same hash result.<\/li>\n<\/ul>\n<p>Requirements and Security :<\/p>\n<ul>\n<li>\u00a8 Preimage \u2013 for a hash value h=H(x), x is called preimage.<\/li>\n<li>\u00a8 A collision occurs if x\u2260y and H(x)=H(y)<\/li>\n<li>\u00a8 Preimage resistant \u2013 one way property. It is easy to generate a code given a message, but virtually impossible to generate a message given code.<\/li>\n<li>\u00a8 Second preimage resistant \u2013 It is impossible to find an alternative message with same hash value<\/li>\n<\/ul>\n<p>Two categories of attack:<\/p>\n<ul>\n<li>\u00a8 Brute force attack<\/li>\n<li>\u00a8 cryptanalysis<\/li>\n<\/ul>\n<p>Secure Hash Algorithm \u2013 SHA 512:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-116 aligncenter\" src=\"http:\/\/itp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-69.png\" alt=\"\" width=\"722\" height=\"469\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-69.png 722w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-69-300x195.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-69-65x42.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-69-225x146.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-69-350x227.png 350w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/p>\n<ul>\n<li>\u00a8 Input : a message with maximum length of less than 2128<\/li>\n<li>\u00a8 Output : 512 bit message digest.<\/li>\n<li>\u00a8 Input processing is done in 1024 bit blocks.<\/li>\n<\/ul>\n<p>Step 1: Append padding bits<\/p>\n<ul>\n<li>\u00a8 The message is padded so that its length is congruent to 896 modulo 1024.<\/li>\n<li>\u00a8 Even if message is of desired length, padding is always done.<\/li>\n<li>\u00a8 The padding bits can be between 1 to 1024.<\/li>\n<li>\u00a8 The padding consist of a single 1 bit followed by necessary number of 0 bits. Step 2: Append length<\/li>\n<li>\u00a8 A block of 128 bits is appended to the message.<\/li>\n<li>\u00a8 This contains the length of the original message.<\/li>\n<\/ul>\n<p>Step 3 : Initialize hash buffer<\/p>\n<ul>\n<li>\u00a8 A 512 bit buffer is used to hold intermediate and final results of the hash function.<\/li>\n<li>\u00a8 The buffer is eight 64 bit registers(a,b,c,d,e,f,g,h)<\/li>\n<li>\u00a8 These registers are initialized as follows<\/li>\n<li>a 6A09E667F3BCC908<\/li>\n<li>b BB67AE8584CAA73B<\/li>\n<li>c 3C6EF372FE94F82B<\/li>\n<li>d A54FF53A5F1D36F1<\/li>\n<li>e 510E527FADE682D1<\/li>\n<li>f 9B05688C2B3E6C1F<\/li>\n<li>g 1F83D9ABFB41BD6B<\/li>\n<li>h 5BE0CD19137E2179<\/li>\n<\/ul>\n<p>Step 4: Process message in 1024 bit (128 word) blocks.<\/p>\n<ul>\n<li>\u00a8 80 rounds are performed<\/li>\n<li>\u00a8 Each round works as follows : input : 512 bit buffer value abcdefgh updates the contents of buffer.<\/li>\n<li>At input of the first round, the buffer has the value of the intermediate hash value, Hi-1<\/li>\n<li>Each round t makes use of Wt(64 bit value) derived from current 1024 bit block being processed(Mi)<\/li>\n<li>Each round uses additive constant Kt where 0&lt;=t&lt;=79. Process message in 1024 bit (128 word) blocks.<\/li>\n<li>\u00a8 The output of the eightieth round is added to the input to the first round(Hi-1) to produce H<\/li>\n<\/ul>\n<p>\u00a8 The addition is done for each eight words in buffer with each corresponding words in Hi-1 using additional modulo 264.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>SHA 512 Round Function :<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-117 aligncenter\" src=\"http:\/\/itp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-70.png\" alt=\"\" width=\"781\" height=\"523\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-70.png 781w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-70-300x201.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-70-768x514.png 768w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-70-65x44.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-70-225x151.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-70-350x234.png 350w\" sizes=\"auto, (max-width: 781px) 100vw, 781px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-118 aligncenter\" src=\"http:\/\/itp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-71.png\" alt=\"\" width=\"787\" height=\"473\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-71.png 787w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-71-300x180.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-71-768x462.png 768w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-71-65x39.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-71-225x135.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-content\/uploads\/sites\/25\/2018\/07\/Untitled-71-350x210.png 350w\" sizes=\"auto, (max-width: 787px) 100vw, 787px\" \/><\/p>\n<p><strong>Behavior of SHA-512 :<\/strong><\/p>\n<ul>\n<li>\u00a8 H0 = IV<\/li>\n<li>\u00a8 Hi = SUM64(Hi-1,abcdefghi)<\/li>\n<li>\u00a8 MD = HN<\/li>\n<li>\u00a8 IV = initial value of abcdefgh buffer<\/li>\n<li>\u00a8 abcdefghi = the output of the last round of processing of the ith message block.<\/li>\n<li>\u00a8 N = the number of blocks in the message (includes padding and length field.)<\/li>\n<li>\u00a8 SUM64 = addition modulo 264 performed separately on each word of the pair of inputs.<\/li>\n<li>\u00a8 MD = final message digest<\/li>\n<\/ul>\n<p>Applications of hash functions:<\/p>\n<ul>\n<li>\u00a8 Message authentication<\/li>\n<li>\u00a8 Digital signature<\/li>\n<\/ul>\n<table>\n<tbody>\n<tr>\n<td><strong>you can view video on Hash functions<\/strong><\/td>\n<td><a href=\"https:\/\/youtu.be\/f0xkc19XcZ4\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Suggested Reading:<\/strong><\/p>\n<ol>\n<li>Cryptography and Network Security Principles and Practice by William Stallings, sixth Edition, PEARSON.<\/li>\n<li>Security in Computing by Charles Pfleeger &amp; Shari Lawrence Pfleeger, fourth Edition, PEARSON.<\/li>\n<li>Network Security by Charlie Kaufman, Radia Perlman, Mike Speciner, second Edition, PHI.<\/li>\n<li>The Complete Reference \u2013 Network Security by Roberta Bragg, Mark Rhodes-Ousley &amp; Keith Strassberg, Tata McGraw Hill<\/li>\n<li>Network Security Bible by Eric Cole, Ronald Krutz, James Conley, Wiley<\/li>\n<li>Hacking 6 Exposed by Stuart McClure, Joel Scambray &amp; George Kurtz , Tata McGraw Hill .<\/li>\n<li><a href=\"http:\/\/www.snort.org\/\">www.snort.org<\/a><\/li>\n<li><a style=\"text-align: initial;font-size: 1em\" href=\"https:\/\/nmap.org\/\">https:\/\/nmap.org<\/a><\/li>\n<\/ol>\n","protected":false},"author":4,"menu_order":11,"template":"","meta":{"_acf_changed":false,"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":["miss-hiteishi-diwanji"],"pb_section_license":""},"chapter-type":[],"contributor":[58],"license":[],"class_list":["post-115","chapter","type-chapter","status-publish","hentry","contributor-miss-hiteishi-diwanji"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/pressbooks\/v2\/chapters\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/wp\/v2\/users\/4"}],"version-history":[{"count":8,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/pressbooks\/v2\/chapters\/115\/revisions"}],"predecessor-version":[{"id":444,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/pressbooks\/v2\/chapters\/115\/revisions\/444"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/pressbooks\/v2\/chapters\/115\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/wp\/v2\/media?parent=115"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/pressbooks\/v2\/chapter-type?post=115"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/wp\/v2\/contributor?post=115"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp4\/wp-json\/wp\/v2\/license?post=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}