473,406 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

md5 differences

Hi there!

I'm trying to match the results of an md5 checksum done in a tcsh shell.
I keep getting different results and can't find anything on google...

here's an example:

Arno@Computer:~% echo "hello" | md5
b1946ac92492d2347c6235b4d2611184

Arno@Computer:~% python
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>import md5
md5.new("hello").hexdigest()
'5d41402abc4b2a76b9719d911017c592'
How do I get the same results?

thanks
Arno
Sep 10 '08 #1
10 1619

"Python" <py****@rgbaz.euwrote in message
news:ma*************************************@pytho n.org...
here's an example:
Arno@Computer:~% echo "hello" | md5
b1946ac92492d2347c6235b4d2611184
How do I get the same results?
Checksum the same string.
>>md5.new("hello\n").hexdigest()
'b1946ac92492d2347c6235b4d2611184'
Sep 10 '08 #2

On 10 sep 2008, at 18:30, Richard Brodie wrote:
>
"Python" <py****@rgbaz.euwrote in message
news:ma*************************************@pytho n.org...
>here's an example:
Arno@Computer:~% echo "hello" | md5
b1946ac92492d2347c6235b4d2611184
How do I get the same results?

Checksum the same string.
>>>md5.new("hello\n").hexdigest()
'b1946ac92492d2347c6235b4d2611184'

hmm and this then:

Arno@Computer:~% echo "test" test.txt

Arno@Computer:~% md5 test.txt
MD5 (test.txt) = d8e8fca2dc0f896fd7cb4cb0031ba249

Arno@Computer:~% python
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>import md5
md5.new("/Volumes/data/Arno/test.txt").hexdigest()
'90364ed45b452d43378629c20543a81d'
even
echo -n "hello" | md5
doesn't return the same number
gr
Arno
Sep 10 '08 #3
On Wed, 10 Sep 2008 19:12:28 +0200
Python <py****@rgbaz.euwrote:
hmm and this then:

Arno@Computer:~% echo "test" test.txt

Arno@Computer:~% md5 test.txt
MD5 (test.txt) = d8e8fca2dc0f896fd7cb4cb0031ba249

Arno@Computer:~% python
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>import md5
>>md5.new("/Volumes/data/Arno/test.txt").hexdigest()
'90364ed45b452d43378629c20543a81d'
You're going to smack yourself on the head over this one. :-)
>>md5.new(open("/Volumes/data/Arno/test.txt").read()).hexdigest()
--
D'Arcy J.M. Cain <da***@druid.net | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
Sep 10 '08 #4
On Wed, 10 Sep 2008 19:12:28 +0200, Python wrote:
Arno@Computer:~% echo "test" test.txt

Arno@Computer:~% md5 test.txt
MD5 (test.txt) = d8e8fca2dc0f896fd7cb4cb0031ba249
>import md5
md5.new("/Volumes/data/Arno/test.txt").hexdigest()
'90364ed45b452d43378629c20543a81d'

Works for me:
>>import md5
f = open('test.txt').read()
md5.new(f).hexdigest()
'd8e8fca2dc0f896fd7cb4cb0031ba249'
>>>
IOW, don't pass the path to the file to md5.new, but the contents
of this file.

The strange thing is that
>>md5.new("/Volumes/data/Arno/test.txt").hexdigest()
returns '8dd66a1592e2a8c3ab160822fb237f4d' on my machine.

--
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/
Sep 10 '08 #5
On 2008-09-10, Python <py****@rgbaz.euwrote:
>
On 10 sep 2008, at 18:30, Richard Brodie wrote:
>>
"Python" <py****@rgbaz.euwrote in message
news:ma*************************************@pyth on.org...
>>here's an example:
Arno@Computer:~% echo "hello" | md5
b1946ac92492d2347c6235b4d2611184
How do I get the same results?

Checksum the same string.
>>>>md5.new("hello\n").hexdigest()
'b1946ac92492d2347c6235b4d2611184'


hmm and this then:

Arno@Computer:~% echo "test" test.txt

Arno@Computer:~% md5 test.txt
MD5 (test.txt) = d8e8fca2dc0f896fd7cb4cb0031ba249

Arno@Computer:~% python
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>import md5
md5.new("/Volumes/data/Arno/test.txt").hexdigest()
'90364ed45b452d43378629c20543a81d'
That's the digest of the string "/Volumes/data/Arno/test.txt".
It's not supposed to match the digest of the string "test\n".
>>md5.new(open("test.txt").read()).hexdigest()
'd8e8fca2dc0f896fd7cb4cb0031ba249'

$ md5sum test.txt
d8e8fca2dc0f896fd7cb4cb0031ba249 test.txt

$ echo "test" | md5sum
d8e8fca2dc0f896fd7cb4cb0031ba249 -
>>md5.new("test\n").hexdigest()
'd8e8fca2dc0f896fd7cb4cb0031ba249'
even
echo -n "hello" | md5
doesn't return the same number
Not the same as _what_?
>>md5.new("test").hexdigest()
'098f6bcd4621d373cade4e832627b4f6'

$ echo -n test | md5sum
098f6bcd4621d373cade4e832627b4f6 -
--
Grant Edwards grante Yow! One FISHWICH coming
at up!!
visi.com
Sep 10 '08 #6
On 2008-09-10, Wojtek Walczak <gm*****@bzt.bztwrote:
On Wed, 10 Sep 2008 19:12:28 +0200, Python wrote:
>Arno@Computer:~% echo "test" test.txt

Arno@Computer:~% md5 test.txt
MD5 (test.txt) = d8e8fca2dc0f896fd7cb4cb0031ba249
>>import md5
md5.new("/Volumes/data/Arno/test.txt").hexdigest()
'90364ed45b452d43378629c20543a81d'


Works for me:
>>>import md5
f = open('test.txt').read()
md5.new(f).hexdigest()
'd8e8fca2dc0f896fd7cb4cb0031ba249'
>>>>

IOW, don't pass the path to the file to md5.new, but the contents
of this file.

The strange thing is that
>>>md5.new("/Volumes/data/Arno/test.txt").hexdigest()
returns '8dd66a1592e2a8c3ab160822fb237f4d' on my machine.
Same here.

--
Grant Edwards grante Yow! What PROGRAM are they
at watching?
visi.com
Sep 10 '08 #7
On Wed, 10 Sep 2008 12:39:24 -0500, Grant Edwards wrote:
>The strange thing is that
>>>>md5.new("/Volumes/data/Arno/test.txt").hexdigest()
returns '8dd66a1592e2a8c3ab160822fb237f4d' on my machine.

Same here.
I guess it will be the same for vast majority of us ;-)
The question is why is it '90364ed45b452d43378629c20543a81d'
for the OP? :-)

--
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/
Sep 10 '08 #8
On 2008-09-10, Wojtek Walczak <gm*****@bzt.bztwrote:
On Wed, 10 Sep 2008 12:39:24 -0500, Grant Edwards wrote:
>>The strange thing is that
>md5.new("/Volumes/data/Arno/test.txt").hexdigest()
returns '8dd66a1592e2a8c3ab160822fb237f4d' on my machine.

Same here.

I guess it will be the same for vast majority of us ;-)
The question is why is it '90364ed45b452d43378629c20543a81d'
for the OP? :-)
The smart money is betting on "because the OP goofed when he
was cutting/pasting stuff from his terminal window into his
posting."

--
Grant Edwards grante Yow! Were these parsnips
at CORRECTLY MARINATED in
visi.com TACO SAUCE?
Sep 10 '08 #9

On 10 sep 2008, at 19:39, Grant Edwards wrote:
On 2008-09-10, Wojtek Walczak <gm*****@bzt.bztwrote:
>On Wed, 10 Sep 2008 19:12:28 +0200, Python wrote:
>>Arno@Computer:~% echo "test" test.txt

Arno@Computer:~% md5 test.txt
MD5 (test.txt) = d8e8fca2dc0f896fd7cb4cb0031ba249
>>>>>import md5
>md5.new("/Volumes/data/Arno/test.txt").hexdigest()
'90364ed45b452d43378629c20543a81d'


Works for me:
>>>>import md5
f = open('test.txt').read()
md5.new(f).hexdigest()
'd8e8fca2dc0f896fd7cb4cb0031ba249'
>>>>>

IOW, don't pass the path to the file to md5.new, but the contents
of this file.

The strange thing is that
>>>>md5.new("/Volumes/data/Arno/test.txt").hexdigest()
returns '8dd66a1592e2a8c3ab160822fb237f4d' on my machine.

Same here.

--
Grant Edwards grante Yow! What PROGRAM
are they
thanks everyone for helping me out!

cheers
Arno

Sep 10 '08 #10

On 10 sep 2008, at 19:48, Grant Edwards wrote:
On 2008-09-10, Wojtek Walczak <gm*****@bzt.bztwrote:
>On Wed, 10 Sep 2008 12:39:24 -0500, Grant Edwards wrote:
>>>The strange thing is that
>>md5.new("/Volumes/data/Arno/test.txt").hexdigest()
returns '8dd66a1592e2a8c3ab160822fb237f4d' on my machine.

Same here.

I guess it will be the same for vast majority of us ;-)
The question is why is it '90364ed45b452d43378629c20543a81d'
for the OP? :-)

The smart money is betting on "because the OP goofed when he
was cutting/pasting stuff from his terminal window into his
posting."
I did! I did!

my bad... i cut some crap from the path to make it a bit easier to read
but that was before the time i knew it was checksumming the
actual path in stead of the contents of the file.
So I figured it didn't matter...

;)
Sep 10 '08 #11

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

Similar topics

0
by: Dan Gass | last post by:
The difflib.py module and the diff.py tools script in Python 2.4 alpha 3 now support generating side by side (with intra line differences) in HTML format. I have found this useful for performing...
6
by: Martin Meyer im Hagen | last post by:
Hello, I've got installed Win 2003 SBS Premium with the SQL Server 2000 on a server machine. It works almost fine, except the application which uses the SQL Server. The main part of the...
2
by: Daniel | last post by:
Hi, Are there any differences between C# and VB.Net besides syntax? Performance-wise, how do they compare? Thanks, Dan
14
by: Bern | last post by:
what are all the diferences between the two?
4
by: effendi | last post by:
How can I extract differences between two arrays using Javascript? I hv for example, apple, orange, pear and another array with apple, orange and I would like to get pear. Thanks.
2
by: Patrick | last post by:
Are the differences between a search engine, a subject directory and a meta search engine significant for an ebusiness web site owner? A meta search engine merely uses ordinary existing search...
13
by: Kieran | last post by:
I am designing a content management system and I want to make sure all pages entered into it's database by users are using valid HTML. I have designed the system to use HTML 4.01 Transitional...
3
by: Daniel | last post by:
Are the differences between MSXML and .Net XSL transformation documented online anywhere? Many of my XSL's work in MSXML but transform differently in ..Net XSL transformation.
4
by: MS | last post by:
Just a general question here re VBA. Can anyone explain the differences between "!" and "." when refering to a control? eg Me!TxtBox and Me.TxtBox. What is difference between "+" and "&"...
4
by: Matt F | last post by:
Hey all, I'm a hobbyist programmer who usually codes in C++ or Java. I don't claim to be experts at either, and I'm not familiar with different types of variables, inheritance systems, etc. I've...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.