By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,096 Members | 1,264 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,096 IT Pros & Developers. It's quick & easy.

SHA-1 in microsoft visual basics for 160bit message digest

P: 2
can any one of youll write a code in microsoft Visual basics for secure Hash algorithm please see additional information below (this is for my final year project)

ALGORITHM
 Append padding bits : The message length should be congruent to 448 mod 512.Padding is always added even if the msg is already of the desired length.Padding consists of a single 1-bit followed by the necessary number of 0-bits.
 Append length : A block of 64-bits is appended to the message. This block is an unsigned 64-bit integer (most significant byte first) and contains the length of the original message before padding.
 Initialize MD buffer : A 160-bit buffer is used to hold intermediate and final results of the hash function.The buffer is represented as five 32-bit registers(A,B,C,D,E).These registers are initialized to the following 32-bit hexadecimal values.
A=67452301
B=EFCDAB8
C=98BADCFE
D=10325476
E=C3D2E1F0
In SHA-1 these values are stored in big endian format which is the most significant byte of the word in the low address byte position.
 Process message in 512-bit blocks : The heart of the algorithm is a module that consists of 4 rounds of processing of 20 steps each,i.e. a total of 80 steps.The 4 rounds have similar structure but use different logical functions(f1,f2,f3,f4).Each round takes as input the current 512-bit block being processed (Yq) and 160-bit buffer value (A,B,C,D,E) and updates the contents of the buffer.Each round also makes use of an additive constant Kt, where 0<=t<=79.
kt =5A827999
kt =6ED9EBA1
kt =8F1BBCDC
kt =CA62C1D6

Processing of a single 512-bit block



SHA-1 Compression Function
 ft =>takes 3words(B,C,D) of 32-bit each and performs bitwise logical operations. The output is a 32-bit word.
Step function name function value
0<=t<=19 f1 =f(t,B,C,D) (B/\C)\/(Bí/\D)
20<=t<=39 f2=f(t,B,C,D) B xor C xor D
40<=t<=59 f3 =f(t,B,C,D) (B/\C)\/(B/\D)\/(C/\D)
60<=t<=79 f4 =f(t,B,C,D) B xor C xor D


 Output : After all 512-bit blocks have been processed ,the output from the last stage is the 160-bit message digest.
Mar 30 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.