473,799 Members | 3,822 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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
0 1556

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

Similar topics

1
2342
by: Marco Herrn | last post by:
Hi, I don't know wether this is really the best place for asking this question. If you know a better, please tell me. The problem is an understanding of the 3 modules for hash algorithms. I need a script to create hashed passwords (the user enters his password and gets back the hash for it). I need this for password verification in the mailserver exim, since it supports hashed passwords. The user then sends his password in clear (but...
28
3711
by: Paul Rubin | last post by:
http://www.nightsong.com/phr/python/sharandom.c This is intended to be less predicable/have fewer correlations than the default Mersenne Twister or Wichmann-Hill generators. Comments are appreciated.
4
1947
by: Florian Lindner | last post by:
Hello, I try to compute SHA hashes for different files: for root, dirs, files in os.walk(sys.argv): for file in files: path = os.path.join(root, file) print path f = open(path) sha = sha.new(f.read())
4
6778
by: Ravi Singh (UCSD) | last post by:
Hello all I am trying to compare the SHA 256 algorithm as implemented by Christophe Devine and on using the .NET "SHA256Managed" but they do not give me similar hashes. Here is the Christophes implementation .
0
3094
by: rene.rugerio | last post by:
I am developing an application using dot net fw 2.0 I am using the signedcms for the digital signature. I certainly do not understand why this generates long string as a result of the signing, because it is supposed to generate a string after SHA-1 hashing. Is this implemented as a part of the method for signedcms? I am asking because, lets say you want to sign the word "google" the output is 150 based 64 characters. If you wanted to sign...
3
4317
by: mirandacascade | last post by:
Operating system: Win XP Vsn of Python: 2.4 Situation is this: Required to calcluate a message digest. The process for calcluating the digest must use an SHA-256 algorithm. Questions: 1) Is it correct that the sha module comes with python 2.4? 2) Is it correct that the sha module that ships with python 2.4 does NOT have the SHA-256 capability as part of the module?
1
1931
by: David Rees | last post by:
The Forms-encryption module includes a handy (if long-winded) hash function: FormsAuthentication.HashPasswordForStoringInConfigFile It only supports MD5 and SHA1, but ages ago MD5 was torn apart, and more recently (http://it.slashdot.org/article.pl?sid=07/01/20/1936257&threshold=2) they've broken SHA-1, so obviously we're going to need something a little stronger. I was thinking SHA-256, but that's too similar to SHA-1. Fortunately I...
0
2607
by: Antony Clements | last post by:
I can't find one anywhere on the net and my skills are lacking in that particular area of coding. The closest I can find is a truncated version of SHA-384 that someone is trying to pass off as SHA-1. The official SHA-1 standard has an output string of 160 bits, or 20 characters, the module that I have has an output string of 320 bits or 40 characters. Is anyone here a classy enough coder to write a properly working module of SHA-1 that...
18
2434
by: Tomás Ó hÉilidhe | last post by:
(SHA-1 is a cryptographic hash function. For info on what SHA-1 is: http://en.wikipedia.org/wiki/SHA-1) I'm writing fullportable C89 code that needs to make use of the SHA-1 algorithm. Does anyone know if there's been a fully-portable C89 implementation of the SHA-1 algorithm? If not, could someone please point me to a very good implementation of the algorithm, an implementation which is very portable (perhaps portable to machines...
12
4212
by: gulyan | last post by:
Hi, I'm trying to make the sha-1 algorithm based on the wikipedia pseudocode. For the 'The quick brown fox jumps over the lazy dog" string I should get 2fd4e1c6 7a2d28fc ed849ee1 bb76e739 1b93eb12 but what I get is 1D8B8841 A544939A 98BB54FE 4C325476 C44AE1F0 (after I convert from dec to hex) I have no idea what the problem is :( Thx in advance #define ROTL ( a , b ) ( ( ( b ) << a ) | ( ( b ) >> ( 32 - a ) ) )
0
9543
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10488
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9077
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6808
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4144
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.