LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-11-2009, 03:33 PM   #1
curtisa
Member
 
Registered: Oct 2005
Location: Switzerland
Distribution: Ubuntu
Posts: 33

Rep: Reputation: 16
MD5 confusion / giving conflicting results...


Hi,
When I do ...
Code:
echo 'HelloWorld' | md5
I get..

6df4d50a41a5d20bc4faad8a6f09aa8f

Where as when I do (what I think is) the same via an online website (eg http://www.yellowpipe.com/yis/tools/encrypter/index.php ) I get ...

68e109f0f40ca72a15e05cc22786f8e6

Can someone help explain why they are different please because I would have thought they should give the same result.

Many thanks,
Alex
 
Old 05-11-2009, 03:42 PM   #2
frnk
LQ Newbie
 
Registered: Dec 2006
Posts: 3

Rep: Reputation: 0
echo outputs a trailing newline.

$ echo -n 'HelloWorld' | md5sum
68e109f0f40ca72a15e05cc22786f8e6 -

$ echo 'HelloWorld' | md5sum
6df4d50a41a5d20bc4faad8a6f09aa8f -
 
Old 05-11-2009, 03:45 PM   #3
harry edwards
Member
 
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
Also, consider that some md5 algorithms only read a section of the file; let's say the first 2k; others may read the entire file. This can obviously lead to discrepancy and I think will explain what you are seeing.

The reason is related to efficiency; for, example if you had ten 2GB files on a network share the md5 program that reads the first 2k would be faster than than the program that requires the entire file.

Last edited by harry edwards; 05-11-2009 at 03:47 PM.
 
Old 05-11-2009, 04:03 PM   #4
curtisa
Member
 
Registered: Oct 2005
Location: Switzerland
Distribution: Ubuntu
Posts: 33

Original Poster
Rep: Reputation: 16
Ahhhh ha !
Ok thanks very much (was beginning to worry that I've got some different 'version' of md5 !
Thanks vm
 
Old 08-01-2009, 07:04 PM   #5
maddes.b
LQ Newbie
 
Registered: Aug 2009
Location: Germany
Distribution: Debian, OpenWrt
Posts: 23

Rep: Reputation: 1
Other reasons:

#1 Where do you invoke md5sum?
On Linux: binary and text files are the same.
On Windows: binary and text files are different.

#2 How do you invoke md5sum?
With --text (default on Linux) or --binary (default on Windows).

Always use the correct parameter depending on the file format (binary or text) to create a cross-platform compatible checksum.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ethtool giving conflicting answers!! kamalsivadas Linux - Networking 1 04-23-2009 08:51 AM
hostname -f giving no results cafeelgood Linux - Networking 1 08-20-2007 08:14 PM
df and du giving contradictory results ? wearetheborg Linux - General 7 02-03-2006 05:49 PM
Conflicting results with usb memory sticks Taliesin Linux - Hardware 4 03-31-2005 01:43 AM
MonoDevelop gives conflicting results nagromo Linux - Software 0 12-11-2004 02:00 PM


All times are GMT -5. The time now is 02:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration