加密算法sha
sha加密算法The 256 bytes mmessage (represented asa sequence of bytes byte o is first,byte 255 is last):000102030405060708090a0b0c0d0e0f101112231415161718191a1bc1d1e1f202122232425262728292a2b2c2d2e2f03132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4fEven when comparing“best” against“ worst505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b77d7e7f808132838485868788898a3b8c8d8e8f09192939495969798999a9b9c9d9e9f10a⊥a2a3a4a5a6a7a8b ac adko b1 b2 b3 b4 bs b6 b7 b8 b9 ba bb3 c4 c5 c6 C7 c8 c9do d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de dfeel e2 e3e4e5 ebe7e8eg ea eb ec ed ee effo f1 f2 f3 f4 f5 f6 f7 f8f9 fa ib fc fd fe ffThe SHA-512/256 hash value (beforetruncation)ho=4ff7ecb3e7c23b55h1=9974eba17a3d1a62h2-0504f18be2e472eh3=c5c5cbf75b37550h4=27a8af7dc7dc9845h5= 8cfc76997dc50cfdh6=f4f500cc1830f561h上12abd3732dt66aThe ShA512/256 hash value (256 bits)h0= 4ff7ecb3e7c23b55h1=9974eba17a3a1a62h2=0504f18be2e472ea5c5cbf75b3b7550The first 64bits ofPrime Prime the fractional partFor comparison, the sHA-512 hash valueNumber Value of the square rootsof the same message is:of the primesho=1e7b80bc8edc552cae5f91567b6d99bh161c6c85a39d1a1e15h 18feeb2780e111477h2672三73477a6a4563cah2=e5bc70465facla77h320716d1826cafd82c1cdh 48b43d4570a51b936h3=129135980c3f0ce4h579e360b596ac380c3fh4=aC36a6c9462036821c455032ce13e9f8h5=4kd56801e62af7e9h724896-19533143a0af0h6- feba5c22ed8a5af8h 777b17de117dcac 6d(note that completely different valuesare obtained)SHA-512 constantsOutput: The SHA-512 constantsPrototype:void calculate SIlA-512 constants (uint16tdeltas:80, uint8 t offsets[40], uint64tK[80])ConstantsoffsetsCx01,0x22,0×42,0x42,CX46,0x26,0×42,Cx46,0×62,0x64,0x26,C×46,0x84,0×24X24,0xe4,0x62,0xa20x46,0x62Cxa2,0x42,0xc,0×42,Cx46,0x2a,0x66Cx62,0x64,0x2a,0xe4,Cx24,0xe6,0xa2Cx46,0x86,0x64,0x68,C48DeltasCxfe22 0x05cd Oxfb2f, Cxfbbc, 0xf533b,0x0118,Cx0242,0x0:Cxf28C, 0xf4c2 0x096f, Cxf6b1 0xf235Cx0694,0×0ad2,0x05c3,Cx15b5,0x1c55,0275,0xe48DxEbd4, Cx13b5, 0xdfabCxf210, 0xel3f, 0x0ee4, Cx0fc2, 0xe725Cx026f, Oxee70, Oxeffc, Cx0926, OxeaedCxf3df, Oxe3de, Oxf2Cxeee6, 0xf53bCx0364,0xf001,0x1791,Cxfe30,0x12Cx2910, 0xe02a, Oxdlb8, Cxl0c8, 0xeb53Cxeb99,0×08a,0x1a63,Cx0acb,0×e373Cxf8a3, 0xI2fc, Oxet60, Cx2b72, Oxgec,Cxle28, 0xfde9, Oxf915, Cx132b, 0xel9cCx0207, Oxeble, 0xl178, Cxefba, 0xl8a6CxOdae, 0x071b, Oxfd84, Cx2493 0xfebcCx0d4c, 0x02b6, Oxfe2a Cxfaec, 0x1817Flowdouble p= 2//the first prinefor i=o to 79f(i82=1)//offset is in the second nibblep=p+ (offsets[i/2]&0x0fe⊥se/offset in the first n-bble(offsets [i/21endouble n=p/3for i=0 to 13(n3-p)/3n2correction to 64 bitsacyK[-:= fraction(n)* 2+ deltas[iInput: Pointers to three arrays∈ nd forArray 1 holds the differences between theOutputfirst 80 primes (two differences per byteThe constants are now ir the k arrayArray 2 holds the difference betrresult of the Newton-Raphson iterations andthe desired constantArray 3 a place to store the computed 80The 256 bytes message (represented assequence of bytes byte o is firstbyte 255 is last):000102030405060708090a0b0c0a0e0f10111231415161718191a1bc1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3csd3e3f404142434445464748494a4b4c4d4e4f2737475767778797a7b7c7d7e808182838485868788898a8b8c8d8e8f909192939495969798999a3b9c9d9e9fo al a2 a3 24 a5 a6 a7 a8 agbo b1 b2 b3 b4 b5 bo b7 b8 b9 ba bb bc bd be bfo c1 c2 c3 c4 c5 c6 C7 c8 c9 ca cb cc cddo d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de dfo el e2 eo e7e8eg ea eb ec ed ee effo fl f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ffThe SHA-512/256 hash value (beforetruncation)0=5Ca201aC449a0617h1=43e22f5c∠8eff125h2=3ef8380C02ae5655h3= 2b8c57b60cce2f2e4=4e2280f2ad1c4d8ah5=688eb8bC73694f88h6= ad4d5b4cbe93c8f4h 712d3a450787b415The ShA512/256 hash value (256 bits):h0=5Ca201aC∠49a061000100000000000000000000h1=43e22f5c∠8eff125000000000000000000000000h2=3ef8380002ae5655000000000000000000000000000000000000000000000000h3 2b8c57b60cce2f2e000000000000000000000000000000000000000000000000000000000000000000000000SHA-512 of the same message000000000000000000000000h0 =1e7b80bc8edc552c000000000000000000000000000000000000000000000000h1=8feeb2780e1114770000000000000000h2=e5bc70465facla77h0=2b2b0a74439fba29h3=29b35980c3f0ce4h1=b0395e75cf517538h2=2d56e63211d68a9ah4=aC36a6c946203682h3= cd2e4f0e7f903a4bh5=41d56801e62af7e9h 41fa53c41cf466fe4h6- feba5c22ed8a5af8h5=60119e4~4bc5e6c6h6=b895a38a334ca3h7=77b57de117dcac 6dh7=68b7beb95a22e694(different values are obtained)NIST, "NIST Brief Comments on Recent Cryptanalyticabove, "II"denotes string concatenation, and M is3."SECURE IIASII STANDARD'512’ s collisionThe Skcin Hash Function Familybeing Wang's512s performance on 64 bil
下载地址
用户评论