# Cryptography Tutorials - Tutorial Addendum - Bulletin Abstract - SHA1 Algorithm

games appcolt utilitiesappsios mac appcolt
31 December 18:00

(Continued from antecedent part...)

Task 3. Advancing processing Functions. SHA1 requires 80 processing functions authentic as:

`        f(t;B,C,D) = (B AND C) OR ((NOT B) AND D)         ( 0 <= t <= 19)        f(t;B,C,D) = B XOR C XOR D                        (20 <= t <= 39)        f(t;B,C,D) = (B AND C) OR (B AND D) OR (C AND D)  (40 <= t <= 59)        f(t;B,C,D) = B XOR C XOR D                        (60 <= t <= 79)     `

Task 4. Advancing Processing Constants. SHA1 requires 80 processing connected words authentic as:

`        K(t) = 0x5A827999         ( 0 <= t <= 19)        K(t) = 0x6ED9EBA1         (20 <= t <= 39)        K(t) = 0x8F1BBCDC         (40 <= t <= 59)        K(t) = 0xCA62C1D6         (60 <= t <= 79)     `

Task 5. Initializing Buffers. SHA1 algorithm requires 5 chat buffers with the afterward antecedent values:

`        H0 = 0x67452301       H1 = 0xEFCDAB89       H2 = 0x98BADCFE       H3 = 0x10325476       H4 = 0xC3D2E1F0    `

Task 6. Processing Bulletin in 512-bit Blocks.

This is the capital assignment of SHA1 algorithm, which

loops through the bedlam and added bulletin in blocks of 512 \$.25 each. For anniversary ascribe block,

a amount of operations are performed. This assignment can be

described in the afterward bogus cipher hardly adapted from the RFC 3174 s adjustment 1:

`     Input and predefined functions:        M[1, 2, ..., N]: Blocks of the bedlam and added message       f(0;B,C,D), f(1,B,C,D), ..., f(79,B,C,D): Authentic as above       K(0), K(1), ..., K(79): Authentic as above       H0, H1, H2, H3, H4, H5: Chat buffers with antecedent values    Algorithm:       For bend on k = 1 to N         (W(0),W(1),...,W(15)) = M[k] /* Bisect M[k] into 16 words */         For t = 16 to 79 do:             W(t) = (W(t-3) XOR W(t-8) XOR W(t-14) XOR W(t-16)) <<< 1         A = H0, B = H1, C = H2, D = H3, E = H4         For t = 0 to 79 do:             Acting = A<<<5 + f(t;B,C,D) + E + W(t) + K(t)             E = D, D = C, C = B<<<30, B = A, A = TEMP         End of for loop         H0 = H0 + A, H1 = H1 + B, H2 = H2 + C, H3 = H3 + D, H4 = H4 + E       End of for loop           Output:        H0, H1, H2, H3, H4, H5: Chat buffers with final bulletin digest    `

Step 5. Output. The capacity in H0, H1, H2, H3, H4, H5 are alternate in arrangement

the bulletin digest.

SHA1 Accomplishing in Java

Sun provides SHA1 algorithm in Java beneath their JCE (Java Cryptography Extension) package,

which is included in JDK 1.5.

Sun s accomplishing of SHA1 can be accessed through a all-encompassing chic alleged MessageDigest.

Here are the capital methods of MessageDigest class:

• getInstance("SHA1") - Allotment a bulletin abstract item represents a specific accomplishing

of SHA1 algorithm from the absence provider, Sun.

•

• getProvider() - Allotment the provider name of the accepted object.

•

• update(bytes) - Updates the ascribe bulletin by appending a byte arrangement at the end.

•

• digest() - Performs SHA1 algorithm on the accepted ascribe bulletin and allotment the bulletin digest

as a byte array. This adjustment aswell resets the ascribe bulletin to an abandoned byte string.

•

• reset() - Resets the ascribe bulletin to an abandoned byte string.

•

(Continued on next part...)

 Tags: functions, requires, processing, message, blocks, defined, notes, string, tutorial, tutorials  message, algorithm, input, processing, digest, buffers, defined, implementation, returns, requires, functions, cryptography, blocks, , sha1 algorithm, message digest, input message, < <, word buffers, digest sha1, buffers with, word buffers with, message digest sha1, digest sha1 algorithm, empty byte string, notes message digest, tutorials tutorial notes, tutorial notes message, cryptography tutorials tutorial,

Share Cryptography Tutorials - Tutorial Addendum - Bulletin Abstract - SHA1 Algorithm: