473,792 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Compare between MD5 hash and Regular File

Hi All,

This is what I want to do.
Support I have two file name abc.txt, xyz.txt
I did created md5 hash for abc.txt and store it some directory

Here is how I create md5 for the abc.txt

FileStream file1 = new FileStream(abc. txt, FileMode.Open, FileAccess.Read );
MD5CryptoServic eProvider md5 = new MD5CryptoServic eProvider();
md5.ComputeHash (file1);

byte[] hash = md5.Hash;
StringBuilder buff = new StringBuilder() ;
foreach (byte hashByte in hash)
{
buff.Append(Str ing.Format("{0: X1}", hashByte));
}

Now I want to open the abc.txt file and do the binary compare with xyz.txt file.
Would someone show me how can I do it.

Thanks in advance
Nov 15 '05 #1
1 8615
TOI DAY wrote:
Hi All,

This is what I want to do.
Support I have two file name abc.txt, xyz.txt
I did created md5 hash for abc.txt and store it some directory

Here is how I create md5 for the abc.txt

FileStream file1 = new FileStream(abc. txt, FileMode.Open, FileAccess.Read );
MD5CryptoServic eProvider md5 = new MD5CryptoServic eProvider();
md5.ComputeHash (file1);

byte[] hash = md5.Hash;
StringBuilder buff = new StringBuilder() ;
foreach (byte hashByte in hash)
{
buff.Append(Str ing.Format("{0: X1}", hashByte));
}

Now I want to open the abc.txt file and do the binary compare with xyz.txt file.
Would someone show me how can I do it.

Thanks in advance


What does the MD5 hash have to do with the binary compare?

You got an answer about binary compares in this thread:
http://groups.google.com/groups?thre...ing.google.com

Was it not good enough?
--
mikeb
Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1578
by: Uri | last post by:
I have a file that looks like this: (but longer, no wordwrap) Name: Date: Time: Company: Employee Number: Jim 2.03.04 12:00 JimEnt 4 Steve 3.04.32 03:00 SteveEnt 5 I want to load 'Jim' and '12:00' and those types of answers into variables in my program, the only delimiter in the file is whitespace. How do I do this?
47
5093
by: VK | last post by:
Or why I just did myArray = "Computers" but myArray.length is showing 0. What a hey? There is a new trend to treat arrays and hashes as they were some variations of the same thing. But they are not at all. If you are doing *array", then you have to use only integer values for array index, as it was since ALGOL.
3
1468
by: wschaub | last post by:
We need to inject information (i.e. server details from where a signed file was downloaded) into a signed file, without breaking the signature or integrity of a signed file. Apparently there are areas and ways to inject custom information into signed files, however, we cannot find the "how to". It is needed to inject server source when customer downloads signed files from a site, allowing the downloaded file to query the information and...
11
3621
by: hoopsho | last post by:
Hi Everyone, I am trying to write a program that does a few things very fast and with efficient use of memory... a) I need to parse a space-delimited file that is really large, upwards fo a million lines. b) I need to store the contents into a unique hash. c) I need to then sort the data on a specific field. d) I need to pull out certain fields and report them to the user.
1
10140
by: sympatico | last post by:
Hi, I am trying to compare 2 images to check if they are exactly identical (in terms of data), I thought this would be quicker than analysing pixels of the images. I have found lots of examples for encrypting text strings using MD5 hash, but I cannot find a way to get this to work with images that exist in picture boxes. I am trying to get a hash for the image file, but not from the file but from the picture box as there is some editing...
1
8127
by: John Wright | last post by:
I want to create a file hash on my exe files and store the hash signature in a database so I can retrieve the value to compare the file hash to ensure I have an untampered file. How can this be done in VB.NET 2005 john
1
7177
by: giftson.john | last post by:
Hi, Anybody knows how to check the file integrity? I need to check the file integrity whether it is corrupt or not. Can anyone please advice?
4
2649
by: giftson.john | last post by:
Hi, I am creating an application which migrates all documents from one repository to another repository. Before migration i have to verify all the documents are unique. No duplicates has to be uploaded. Event the document created date, modified date, filename can be different. How to find the document is duplidate. What i did is, i created a file and did save as and saved into another location. I am not able to find that the document...
15
3189
by: =?ISO-8859-15?Q?L=E9na=EFc?= Huard | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all, For some reasons, somewhere in a program, I'd like, if possible, to quickly parse a whole file before rewinding it and letting the full analysis start. My problem is that the FILE* I want do parse has been fopen'ed far away from where I am and I don't know in which MODE my FILE* has been opened. And additionally, my FILE* may not be a regular file, but a continuous
0
9670
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
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
10430
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
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9033
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
6776
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
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
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
3
2917
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.