473,657 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
b1946ac92492d23 47c6235b4d26111 84

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("hell o").hexdiges t()
'5d41402abc4b2a 76b9719d911017c 592'
How do I get the same results?

thanks
Arno
Sep 10 '08 #1
10 1634

"Python" <py****@rgbaz.e uwrote in message
news:ma******** *************** **************@ python.org...
here's an example:
Arno@Computer:~ % echo "hello" | md5
b1946ac92492d23 47c6235b4d26111 84
How do I get the same results?
Checksum the same string.
>>md5.new("hell o\n").hexdigest ()
'b1946ac92492d2 347c6235b4d2611 184'
Sep 10 '08 #2

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

Checksum the same string.
>>>md5.new("hel lo\n").hexdiges t()
'b1946ac92492d2 347c6235b4d2611 184'

hmm and this then:

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

Arno@Computer:~ % md5 test.txt
MD5 (test.txt) = d8e8fca2dc0f896 fd7cb4cb0031ba2 49

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").hexd igest()
'90364ed45b452d 43378629c20543a 81d'
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.e uwrote:
hmm and this then:

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

Arno@Computer:~ % md5 test.txt
MD5 (test.txt) = d8e8fca2dc0f896 fd7cb4cb0031ba2 49

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").hexd igest()
'90364ed45b452d 43378629c20543a 81d'
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.ne t | 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) = d8e8fca2dc0f896 fd7cb4cb0031ba2 49
>import md5
md5.new("/Volumes/data/Arno/test.txt").hexd igest()
'90364ed45b452d 43378629c20543a 81d'

Works for me:
>>import md5
f = open('test.txt' ).read()
md5.new(f).he xdigest()
'd8e8fca2dc0f89 6fd7cb4cb0031ba 249'
>>>
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").hexd igest()
returns '8dd66a1592e2a8 c3ab160822fb237 f4d' on my machine.

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

Checksum the same string.
>>>>md5.new("he llo\n").hexdige st()
'b1946ac92492d 2347c6235b4d261 1184'


hmm and this then:

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

Arno@Computer:~ % md5 test.txt
MD5 (test.txt) = d8e8fca2dc0f896 fd7cb4cb0031ba2 49

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").hexd igest()
'90364ed45b452d 43378629c20543a 81d'
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").rea d()).hexdigest( )
'd8e8fca2dc0f89 6fd7cb4cb0031ba 249'

$ md5sum test.txt
d8e8fca2dc0f896 fd7cb4cb0031ba2 49 test.txt

$ echo "test" | md5sum
d8e8fca2dc0f896 fd7cb4cb0031ba2 49 -
>>md5.new("test \n").hexdigest( )
'd8e8fca2dc0f89 6fd7cb4cb0031ba 249'
even
echo -n "hello" | md5
doesn't return the same number
Not the same as _what_?
>>md5.new("test ").hexdiges t()
'098f6bcd4621d3 73cade4e832627b 4f6'

$ echo -n test | md5sum
098f6bcd4621d37 3cade4e832627b4 f6 -
--
Grant Edwards grante Yow! One FISHWICH coming
at up!!
visi.com
Sep 10 '08 #6
On 2008-09-10, Wojtek Walczak <gm*****@bzt.bz twrote:
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) = d8e8fca2dc0f896 fd7cb4cb0031ba2 49
>>import md5
md5.new("/Volumes/data/Arno/test.txt").hexd igest()
'90364ed45b452 d43378629c20543 a81d'


Works for me:
>>>import md5
f = open('test.txt' ).read()
md5.new(f).h exdigest()
'd8e8fca2dc0f89 6fd7cb4cb0031ba 249'
>>>>

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").hexd igest()
returns '8dd66a1592e2a8 c3ab160822fb237 f4d' 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").hexd igest()
returns '8dd66a1592e2a8 c3ab160822fb237 f4d' on my machine.

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

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

Same here.

I guess it will be the same for vast majority of us ;-)
The question is why is it '90364ed45b452d 43378629c20543a 81d'
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.bz twrote:
>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) = d8e8fca2dc0f896 fd7cb4cb0031ba2 49
>>>>>import md5
>md5.new( "/Volumes/data/Arno/test.txt").hexd igest()
'90364ed45b45 2d43378629c2054 3a81d'


Works for me:
>>>>import md5
f = open('test.txt' ).read()
md5.new(f). hexdigest()
'd8e8fca2dc0f8 96fd7cb4cb0031b a249'
>>>>>

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").hexd igest()
returns '8dd66a1592e2a8 c3ab160822fb237 f4d' 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

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

Similar topics

0
1901
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 build release comparisons (I use a script to generate a main page showing all the files that were changed in a build with hyperlinks to side by side differences for each of those files). I also find it useful for generating HTML test reports to...
6
3114
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 application runs (since the last update) fine, but other tools of that application (database import and the database manager for check and rebuild) doesn't. They hang up or kill the database. Our software developer says that these problems are in...
2
8269
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
2061
by: Bern | last post by:
what are all the diferences between the two?
4
3873
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
11837
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 engines. A subject directory classifies websites into some category. Could anyone point me towards the differences between these three that are significant for an ebusiness web site owner?
13
9622
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 throughout, however the php powered html checker I have only caters for HTML 4.01 Strict. If possible I need to know the complete differences between Strict and Transitional so I can go through the php script and correctly set it up to properly...
3
3069
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
3703
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 "&" when working with strings. eg MyStr = "I have " & MyNumber & " apples." and MyStr = "I have " + MyNumber + " apples."
4
4836
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 decided to play around with C# and .NET 2.0 a little bit, but I'm still not completely certain about the differences between C++ and C#. All I know is that there are some limitations that aren't on C++ (which is probably a good thing... I think...
0
8315
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
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8508
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7341
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...
1
6172
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4164
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
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
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
1627
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.