Need Help: MD5


 
Thread Tools Search this Thread
Operating Systems Linux Need Help: MD5
# 1  
Old 10-25-2009
Need Help: MD5

I am trying to compare two identical files by using md5 command, but cant get the right command parameters Please help me with any examples. All I want is to know how to compare two identical files which are residing on two different machines in my local network, for example:

Host_A - test01.tar.gz
Host_B - test01.tar.gz

Which command parameters should I use?

Smilie
# 2  
Old 10-25-2009
The md5sum command doesn't work across the network. You'll have to use other commands to pipe into it, eg:
Code:
ssh -l user Host_A 'cat /path/to/test01.tar.gz' | md5sum

or, to save bandwith:
Code:
ssh -l user Host_A 'md5sum /path/to/test01.tar.gz'

Analog use for Host_B
# 3  
Old 10-25-2009
Pludi
Thank you!!! Ok, so now I know MD5 cant compare two identical files over the local network.Lets say: I will get the MD5 sum of two files, in this case what will be my next step? To use diff command?? I am a little bit confused here, it looks like its a simple problem, but it's not. I am Linux newbie Smilie
# 4  
Old 10-25-2009
The md5sum utility isn't meant to check if 2 files are the same, but if a file has been changed (small change in the file leads to big change in the hash). But that doesn't mean it can't be used for that, you'll just have to trick a bit.

The output of a typical md5sum run looks something like this
Code:
51e3f4849cf415dbc9abdb46412df72e  -

Capture the first part in a variable (either through cut or awk). Do that for both files, and compare (eg with if)
Code:
if [ "$SUM1" = "$SUM2" ]

# 5  
Old 10-25-2009
thank you again! I will try to do that.
# 6  
Old 10-25-2009
Code:
md5sum test01.tar.gz |ssh remote md5sum -c

If they are located in different directories, do
Code:
(cd /path/to/local/file;md5sum test01.tar.gz) |ssh remote 'cd /path/to/remote/file;md5sum -c'

# 7  
Old 10-26-2009
binlib
Thank you!

md5sum test01.tar.gz |ssh remote md5sum -c
worked, finally! Now I can compare two identical files, right after the transfer!!! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to reverse the b64 format(encoded b64(b64(md5($pass)))) into md5 hash format?

I have about 1500 rows (encoded b64(b64(md5($pass))) algorythm) in a file. I would like reverse the b64 into md5 hash format. How could I do that from command line? So I need only the correct md5 hash formats. These row format: 4G5qc2WQzGES6QkWAUgl5w P9tKxonBOg3ymr8vOBLnDA... (1 Reply)
Discussion started by: freeroute
1 Replies

2. Solaris

MD5 checksum

Hi Guys, I have about MD5 checksum so many times but I can't figure out how to use it. Can someone please show me how to perform an MD5 checksum? Thanks a lot guys. (1 Reply)
Discussion started by: cjashu
1 Replies

3. Solaris

md5 checksum what does it do

Hello good people, I came across md5 checksum. Can anyone please explain to me what it does and if possible an example of how to use it? Thank you very much (1 Reply)
Discussion started by: cjashu
1 Replies

4. Shell Programming and Scripting

Help with MD5 script

Hi, I tried to write script, which would be able to generate MD5 sums into txt file.. But It won't work.. (I've been trying to fix that over 4 hours, but nothing helps) Here it is #!/bin/bash FILE="nothing1" POST="nothing2" I=1 while do FILE=`ls -ltR | grep "^-" | tr -s "... (1 Reply)
Discussion started by: TheBarnacle
1 Replies

5. Shell Programming and Scripting

Create md5 sums and archive the resulting md5 files

Hello everyone, I am looking to basically creating md5sum files for all iso files in a directory and archive the resulting md5 files into a single archive in that very same directory. I worked out a clumsy solution such as: #find files for which md5sum are to be created and store the... (1 Reply)
Discussion started by: SurfTranquille
1 Replies

6. Shell Programming and Scripting

Help with md5 in PERL

I am a newbie in programming in Perl. My problem is that this unix command is embedded in Perl but it gives an empty output. Here's the code: $temp = `md5 "../Directory String/..." | awk {'print $NF'} > "../Directory/file.txt"`; The output file should contain the md5 hash value of the... (2 Replies)
Discussion started by: ianebaj
2 Replies

7. UNIX for Dummies Questions & Answers

MD5 missmatch

I think it's a problem of gtar, but i'm note sure... I use gtar to create an archive from a directory then i use md5 to get an md5 string for the archive bzip2 to compress the archive and md5 again for the compressed archive. I send the file to my backup machine. When i download the... (1 Reply)
Discussion started by: noratx
1 Replies

8. UNIX for Dummies Questions & Answers

Hashing or MD5

Hi, how can one find that which encryption algorithm the system is using for keeping the user password in the /etc/passwd or /etc/shadow file. Is it 1: Hashing ( which considers only first 5 letters of password) 2: MD5 (Which allows arbitry length passwords) Thanks, ~amit (0 Replies)
Discussion started by: amit4g
0 Replies

9. UNIX for Advanced & Expert Users

Digest MD5

Dear Guys , Am sorry i ask alot , but i do not know that much about perl , cgi , MD5 ! now i installed MD5 and Digest MD5 to my solaries 7 sparc machine . when i execute the command : $perl Makefile.PL i get the follwoing error message ,, please tell me how to fix it , i need... (11 Replies)
Discussion started by: tamemi
11 Replies

10. Shell Programming and Scripting

Md5

Does anyone know a scipt that includes MD5. I need to run a script that includes MD5 encryption. Thanks (1 Reply)
Discussion started by: duncang3
1 Replies
Login or Register to Ask a Question